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>();
class Application extends StatefulWidget {
class Application extends StatelessWidget {
final EvSourceType evSource;
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
Widget build(BuildContext context) {
return FutureBuilder<SharedPreferences>(
future: SharedPreferences.getInstance(),
builder: (context, snapshot) {
builder: (_, snapshot) {
if (snapshot.data != null) {
return MultiProvider(
providers: [
Provider(create: (_) => UserPreferencesService(snapshot.data!)),
Provider.value(value: widget.evSource),
Provider.value(value: evSource),
],
child: Provider(
create: (context) => PermissionsService(),
create: (_) => PermissionsService(),
child: StopTypeProvider(
child: ThemeProvider(
initialPrimaryColor: const Color(0xFF2196f3),
builder: (context, child) => MaterialApp(
theme: context.watch<ThemeData>(),
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
builder: (context, child) => MediaQuery(
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
child: child!,
builder: (context, child) => AnnotatedRegion(
value: SystemUiOverlayStyle(
statusBarColor: context.watch<ThemeData>().colorScheme.surface,
systemNavigationBarColor: context.watch<ThemeData>().colorScheme.surface,
),
child: MaterialApp(
theme: context.watch<ThemeData>(),
localizationsDelegates: const [
S.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
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);
_closedSize = _key.currentContext!.size!;