Fixed navigation bar color

Cleanup
This commit is contained in:
Vadim 2023-01-07 12:14:18 +03:00
parent cdd714f12c
commit 56480cca0a
2 changed files with 28 additions and 40 deletions

View file

@ -15,46 +15,33 @@ import 'utils/stop_type_provider.dart';
final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>(); final RouteObserver<PageRoute> routeObserver = RouteObserver<PageRoute>();
class Application extends StatefulWidget { class Application extends StatelessWidget {
final EvSourceType evSource; final EvSourceType evSource;
const Application(this.evSource, {super.key}); const Application(this.evSource, {super.key});
@override
State<Application> createState() => _ApplicationState();
}
class _ApplicationState extends State<Application> {
@override
void initState() {
super.initState();
final mySystemTheme = SystemUiOverlayStyle.light.copyWith(
statusBarColor: Colors.transparent,
statusBarBrightness: Brightness.light,
statusBarIconBrightness: Brightness.dark,
systemNavigationBarColor: Colors.transparent,
systemNavigationBarIconBrightness: Brightness.dark,
);
SystemChrome.setSystemUIOverlayStyle(mySystemTheme);
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return FutureBuilder<SharedPreferences>( return FutureBuilder<SharedPreferences>(
future: SharedPreferences.getInstance(), future: SharedPreferences.getInstance(),
builder: (context, snapshot) { builder: (_, snapshot) {
if (snapshot.data != null) { if (snapshot.data != null) {
return MultiProvider( return MultiProvider(
providers: [ providers: [
Provider(create: (_) => UserPreferencesService(snapshot.data!)), Provider(create: (_) => UserPreferencesService(snapshot.data!)),
Provider.value(value: widget.evSource), Provider.value(value: evSource),
], ],
child: Provider( child: Provider(
create: (context) => PermissionsService(), create: (_) => PermissionsService(),
child: StopTypeProvider( child: StopTypeProvider(
child: ThemeProvider( child: ThemeProvider(
initialPrimaryColor: const Color(0xFF2196f3), initialPrimaryColor: const Color(0xFF2196f3),
builder: (context, child) => MaterialApp( builder: (context, child) => AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: context.watch<ThemeData>().colorScheme.surface,
systemNavigationBarColor: context.watch<ThemeData>().colorScheme.surface,
),
child: MaterialApp(
theme: context.watch<ThemeData>(), theme: context.watch<ThemeData>(),
localizationsDelegates: const [ localizationsDelegates: const [
S.delegate, S.delegate,
@ -67,7 +54,7 @@ class _ApplicationState extends State<Application> {
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child!, child: child!,
), ),
home: const MeteringFlow(), initialRoute: "metering",
routes: { routes: {
"metering": (context) => const MeteringFlow(), "metering": (context) => const MeteringFlow(),
"settings": (context) => const SettingsScreen(), "settings": (context) => const SettingsScreen(),
@ -76,6 +63,7 @@ class _ApplicationState extends State<Application> {
), ),
), ),
), ),
),
); );
} }
return const SizedBox(); return const SizedBox();

View file

@ -80,7 +80,7 @@ class AnimatedDialogState extends State<AnimatedDialog> with SingleTickerProvide
), ),
)); ));
WidgetsBinding.instance.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((_) {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
_closedSize = _key.currentContext!.size!; _closedSize = _key.currentContext!.size!;