-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cd6eeda
commit 1c6e236
Showing
21 changed files
with
1,235 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import 'package:shared_preferences/shared_preferences.dart'; | ||
|
||
class Constants { | ||
static SharedPreferences? prefs; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:ice_cream_cart/counter/counter.dart'; | ||
import 'package:ice_cream_cart/app/constants.dart'; | ||
import 'package:ice_cream_cart/l10n/l10n.dart'; | ||
import 'package:ice_cream_cart/product_store/views/home_view.dart'; | ||
import 'package:ice_cream_cart/product_store/views/login_view.dart'; | ||
import 'package:ice_cream_cart/themes/styles.dart'; | ||
import 'package:velocity_x/velocity_x.dart'; | ||
|
||
class App extends StatelessWidget { | ||
const App({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return MaterialApp( | ||
theme: ThemeData( | ||
appBarTheme: AppBarTheme( | ||
backgroundColor: Theme.of(context).colorScheme.inversePrimary, | ||
return VxApp( | ||
store: MyStore(), | ||
builder: (context, vxData) => VxAdaptive( | ||
scaleType: VxAdaptiveScaleType.width, | ||
designWidth: Vx.isMobileOS ? context.screenWidth : 1000, | ||
builder: (context, scaled) => MaterialApp( | ||
debugShowCheckedModeBanner: false, | ||
theme: ThemeData( | ||
useMaterial3: true, | ||
brightness: vxData.isDarkMode ? Brightness.dark : Brightness.light, | ||
colorScheme: vxData.isDarkMode | ||
? Styles.darkColorScheme | ||
: Styles.lightColorScheme, | ||
), | ||
// darkTheme: ThemeData( | ||
// useMaterial3: true, | ||
// colorScheme: Styles.darkColorScheme, | ||
// ), | ||
localizationsDelegates: AppLocalizations.localizationsDelegates, | ||
supportedLocales: AppLocalizations.supportedLocales, | ||
home: Constants.prefs!.getBool('isLoggedIn') == true | ||
? const HomeView() | ||
: const LoginView(), | ||
), | ||
useMaterial3: true, | ||
), | ||
localizationsDelegates: AppLocalizations.localizationsDelegates, | ||
supportedLocales: AppLocalizations.supportedLocales, | ||
home: const CounterPage(), | ||
); | ||
} | ||
} | ||
|
||
class MyStore extends VxStore {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:flutter/services.dart'; | ||
import 'package:ice_cream_cart/product_store/model/icecream.dart'; | ||
|
||
class ProductData { | ||
static Future<List<Icecreams>> loadAllIcecreams() async { | ||
final res = await rootBundle.loadString('assets/icecreams.json'); | ||
final iceCreamData = | ||
IceCreamData.fromJson(jsonDecode(res) as Map<String, dynamic>); | ||
return iceCreamData.icecreams!; | ||
} | ||
} |
Oops, something went wrong.