feat:增加主题色模块
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:food_hub_app/provider/food_provider.dart';
|
||||
import 'package:food_hub_app/provider/theme_provider.dart';
|
||||
import 'package:food_hub_app/utils/sp_util.dart';
|
||||
import 'package:food_hub_app/views/home.dart';
|
||||
import 'package:food_hub_app/views/login.dart';
|
||||
@@ -18,6 +19,7 @@ void main() async {
|
||||
MultiProvider(
|
||||
providers: [
|
||||
ChangeNotifierProvider(create: (context) => FoodProvider()),
|
||||
ChangeNotifierProvider(create: (context) => ThemeProvider()),
|
||||
],
|
||||
child: MyApp(),
|
||||
),
|
||||
@@ -30,9 +32,11 @@ class MyApp extends StatelessWidget {
|
||||
// This widget is the root of your application.
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final themeProvider = context.watch<ThemeProvider>();
|
||||
|
||||
return MaterialApp(
|
||||
debugShowCheckedModeBanner: false,
|
||||
theme: ThemeData(fontFamily: 'CustomFont'),
|
||||
theme: themeProvider.currentThemeData,
|
||||
supportedLocales: const [
|
||||
Locale('en', 'US'), // 英语
|
||||
Locale('zh', 'CN'), // 中文
|
||||
|
||||
Reference in New Issue
Block a user