feat:增加主题颜色和暗黑模式
This commit is contained in:
@@ -11,7 +11,7 @@ import 'layout/main_screen.dart';
|
||||
import 'models/todo.dart';
|
||||
import 'provider/todo_provider.dart';
|
||||
|
||||
void main() async{
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
// 初始化提醒服务
|
||||
final notifyService = NotifyService();
|
||||
@@ -50,22 +50,23 @@ class MyApp extends StatelessWidget {
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (_) => AppProvider()),
|
||||
ChangeNotifierProvider(create: (_) => TodoProvider()),
|
||||
ChangeNotifierProvider(create: (_) => FlispProvider())
|
||||
ChangeNotifierProvider(create: (_) => FlispProvider()),
|
||||
],
|
||||
child: MaterialApp(
|
||||
title: '闪灵',
|
||||
localizationsDelegates: [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate
|
||||
],
|
||||
supportedLocales: [
|
||||
const Locale('zh'),
|
||||
const Locale('zh', 'CN'),
|
||||
],
|
||||
locale: Locale('zh', 'CN'),
|
||||
theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true),
|
||||
home: const MainScreen(),
|
||||
child: Consumer<AppProvider>(
|
||||
builder: (context, appProvider, child) {
|
||||
return MaterialApp(
|
||||
title: '闪灵',
|
||||
localizationsDelegates: [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: [const Locale('zh'), const Locale('zh', 'CN')],
|
||||
locale: Locale('zh', 'CN'),
|
||||
theme: appProvider.currentThemeData,
|
||||
home: const MainScreen(),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user