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,63 +15,51 @@ 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(
theme: context.watch<ThemeData>(), value: SystemUiOverlayStyle(
localizationsDelegates: const [ statusBarColor: context.watch<ThemeData>().colorScheme.surface,
S.delegate, systemNavigationBarColor: context.watch<ThemeData>().colorScheme.surface,
GlobalMaterialLocalizations.delegate, ),
GlobalWidgetsLocalizations.delegate, child: MaterialApp(
GlobalCupertinoLocalizations.delegate, theme: context.watch<ThemeData>(),
], localizationsDelegates: const [
supportedLocales: S.delegate.supportedLocales, S.delegate,
builder: (context, child) => MediaQuery( GlobalMaterialLocalizations.delegate,
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), GlobalWidgetsLocalizations.delegate,
child: child!, GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
builder: (context, child) => MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child!,
),
initialRoute: "metering",
routes: {
"metering": (context) => const MeteringFlow(),
"settings": (context) => const SettingsScreen(),
},
), ),
home: const MeteringFlow(),
routes: {
"metering": (context) => const MeteringFlow(),
"settings": (context) => const SettingsScreen(),
},
), ),
), ),
), ),

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!;