dynamic theme, basic category settings
This commit is contained in:
58
lib/app.dart
58
lib/app.dart
@@ -1,3 +1,4 @@
|
||||
import 'package:dynamic_color/dynamic_color.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
@@ -6,7 +7,6 @@ import 'package:tunas/pages/home/home_page.dart';
|
||||
import 'package:tunas/repositories/json/json_repository.dart';
|
||||
import 'package:tunas/repositories/metadata/metadata_repository.dart';
|
||||
import 'package:tunas/repositories/transactions/transactions_repository.dart';
|
||||
import 'package:tunas/theme.dart';
|
||||
|
||||
class App extends StatefulWidget {
|
||||
const App({super.key});
|
||||
@@ -56,24 +56,44 @@ class _AppViewState extends State<AppView> {
|
||||
RepositoryProvider.value(value: _transactionsRepository),
|
||||
RepositoryProvider.value(value: _metadataRepository),
|
||||
],
|
||||
child: MaterialApp(
|
||||
title: 'Tunas',
|
||||
theme: ThemeData(useMaterial3: true, colorScheme: lightColorScheme),
|
||||
darkTheme: ThemeData(useMaterial3: true, colorScheme: darkColorScheme),
|
||||
themeMode: ThemeMode.dark,
|
||||
initialRoute: '/home',
|
||||
routes: {
|
||||
'/home':(context) => const HomePage(),
|
||||
},
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate
|
||||
],
|
||||
supportedLocales: const [
|
||||
Locale('fr')
|
||||
],
|
||||
)
|
||||
child: DynamicColorBuilder(
|
||||
builder: ((lightDynamic, darkDynamic) {
|
||||
ColorScheme lightColorScheme;
|
||||
ColorScheme darkColorScheme;
|
||||
|
||||
if (lightDynamic != null && darkDynamic != null) {
|
||||
lightColorScheme = lightDynamic.harmonized();
|
||||
darkColorScheme = darkDynamic.harmonized();
|
||||
} else {
|
||||
lightColorScheme = ColorScheme.fromSeed(
|
||||
seedColor: const Color.fromARGB(1, 5, 236, 55),
|
||||
);
|
||||
|
||||
darkColorScheme = ColorScheme.fromSeed(
|
||||
seedColor: const Color.fromARGB(1, 5, 236, 55),
|
||||
brightness: Brightness.dark,
|
||||
);
|
||||
}
|
||||
|
||||
return MaterialApp(
|
||||
title: 'Tunas',
|
||||
theme: ThemeData(colorScheme: lightColorScheme),
|
||||
darkTheme: ThemeData(colorScheme: darkColorScheme),
|
||||
initialRoute: '/home',
|
||||
routes: {
|
||||
'/home':(context) => const HomePage(),
|
||||
},
|
||||
localizationsDelegates: const [
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate
|
||||
],
|
||||
supportedLocales: const [
|
||||
Locale('fr')
|
||||
],
|
||||
);
|
||||
})
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user