Update main.dart
AppColors.themeColor
This commit is contained in:
+5
-12
@@ -17,6 +17,7 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|||||||
|
|
||||||
import 'model/UserPreference.dart';
|
import 'model/UserPreference.dart';
|
||||||
import 'model/themeCollection.dart';
|
import 'model/themeCollection.dart';
|
||||||
|
import 'resources/app_theme.dart';
|
||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
@@ -50,24 +51,14 @@ class SailApp extends StatelessWidget {
|
|||||||
// This widget is the root of your application.
|
// This widget is the root of your application.
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
// // var userViewModel = Provider.of<UserModel>(context);
|
// AppModel appModel = Provider.of<AppModel>(context);
|
||||||
// // var onceuse = userViewModel.getOnceUse();
|
// appModel.themeData
|
||||||
// // print("onceuse.toString(): ${onceuse.toString()}");
|
|
||||||
// String onceuse = "0";
|
|
||||||
// if (onceuse == "1") {
|
|
||||||
// } else {
|
|
||||||
|
|
||||||
// }
|
|
||||||
|
|
||||||
AppModel appModel = Provider.of<AppModel>(context);
|
|
||||||
|
|
||||||
services.SystemChrome.setPreferredOrientations([
|
services.SystemChrome.setPreferredOrientations([
|
||||||
services.DeviceOrientation.portraitUp,
|
services.DeviceOrientation.portraitUp,
|
||||||
services.DeviceOrientation.portraitDown
|
services.DeviceOrientation.portraitDown
|
||||||
]);
|
]);
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
// <--- /!\ Add the builder
|
|
||||||
title: AppStrings.appName,
|
title: AppStrings.appName,
|
||||||
navigatorKey: Application.navigatorKey,
|
navigatorKey: Application.navigatorKey,
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
@@ -83,6 +74,8 @@ class SailApp extends StatelessWidget {
|
|||||||
Locale('zh', 'CN'), // 简体中文
|
Locale('zh', 'CN'), // 简体中文
|
||||||
//其它Locales
|
//其它Locales
|
||||||
],
|
],
|
||||||
|
darkTheme: getApplicationTheme(),
|
||||||
|
themeMode: ThemeMode.dark,
|
||||||
// theme: appModel.themeData, //固定主题
|
// theme: appModel.themeData, //固定主题
|
||||||
theme: Provider.of<ThemeCollection>(context).getActiveTheme,
|
theme: Provider.of<ThemeCollection>(context).getActiveTheme,
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user