BBreaking change

This commit is contained in:
LollipopKit
2021-10-26 07:31:42 +08:00
parent 44e9780e5a
commit a725604121
20 changed files with 710 additions and 183 deletions

View File

@@ -1,4 +1,6 @@
import 'package:flutter/material.dart';
import 'package:toolbox/data/store/setting.dart';
import 'package:toolbox/locator.dart';
import 'package:toolbox/view/page/home.dart';
class MyApp extends StatelessWidget {
@@ -7,13 +9,23 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'ToolBox',
theme: ThemeData(
primarySwatch: Colors.blue,
),
darkTheme: ThemeData.dark(),
home: const MyHomePage(title: 'ToolBox'),
);
return ValueListenableBuilder<int>(
valueListenable: locator<SettingStore>().primaryColor.listenable(),
builder: (_, value, __) {
final primaryColor = Color(value);
return MaterialApp(
title: 'ToolBox',
theme: ThemeData(
primaryColor: primaryColor,
appBarTheme: AppBarTheme(backgroundColor: primaryColor),
floatingActionButtonTheme:
FloatingActionButtonThemeData(backgroundColor: primaryColor),
iconTheme: IconThemeData(color: primaryColor),
primaryIconTheme: IconThemeData(color: primaryColor),
),
darkTheme: ThemeData.dark().copyWith(primaryColor: primaryColor),
home: MyHomePage(primaryColor: primaryColor),
);
});
}
}