fix: set dark theme globally to prevent white flash on page transitions
This commit is contained in:
parent
4f16db59b2
commit
4bbc0bcdcb
2 changed files with 37 additions and 10 deletions
|
|
@ -1,12 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<!-- Modify this file to customize your launch splash screen -->
|
<!-- Modify this file to customize your launch splash screen -->
|
||||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
<item android:drawable="@android:color/white" />
|
<item android:drawable="#0d0d0d" />
|
||||||
|
|
||||||
<!-- You can insert your own image assets here -->
|
|
||||||
<!-- <item>
|
|
||||||
<bitmap
|
|
||||||
android:gravity="center"
|
|
||||||
android:src="@mipmap/launch_image" />
|
|
||||||
</item> -->
|
|
||||||
</layer-list>
|
</layer-list>
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:flutter/services.dart';
|
||||||
import 'package:traccar_client/main_screen.dart';
|
import 'package:traccar_client/main_screen.dart';
|
||||||
import 'package:traccar_client/permission_screen.dart';
|
import 'package:traccar_client/permission_screen.dart';
|
||||||
import 'package:traccar_client/preferences.dart';
|
import 'package:traccar_client/preferences.dart';
|
||||||
|
|
@ -6,6 +7,15 @@ import 'package:traccar_client/preferences.dart';
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
await Preferences.init();
|
await Preferences.init();
|
||||||
|
|
||||||
|
// Keep status bar dark throughout the app
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(
|
||||||
|
const SystemUiOverlayStyle(
|
||||||
|
statusBarColor: Color(0xFF0d0d0d),
|
||||||
|
statusBarIconBrightness: Brightness.light,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
runApp(const TraccarClientApp());
|
runApp(const TraccarClientApp());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -19,8 +29,32 @@ class TraccarClientApp extends StatelessWidget {
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
useMaterial3: true,
|
useMaterial3: true,
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.blue),
|
brightness: Brightness.dark,
|
||||||
appBarTheme: const AppBarTheme(centerTitle: true),
|
scaffoldBackgroundColor: const Color(0xFF0d0d0d),
|
||||||
|
colorScheme: const ColorScheme.dark(
|
||||||
|
surface: Color(0xFF0d0d0d),
|
||||||
|
primary: Color(0xFF00bcd4),
|
||||||
|
secondary: Color(0xFF00e676),
|
||||||
|
),
|
||||||
|
appBarTheme: const AppBarTheme(
|
||||||
|
centerTitle: true,
|
||||||
|
backgroundColor: Color(0xFF161616),
|
||||||
|
foregroundColor: Color(0xFFe0e0e0),
|
||||||
|
elevation: 0,
|
||||||
|
),
|
||||||
|
snackBarTheme: const SnackBarThemeData(
|
||||||
|
backgroundColor: Color(0xFF1a1a1a),
|
||||||
|
contentTextStyle: TextStyle(
|
||||||
|
fontFamily: 'monospace',
|
||||||
|
color: Color(0xFFe0e0e0),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
pageTransitionsTheme: const PageTransitionsTheme(
|
||||||
|
builders: {
|
||||||
|
TargetPlatform.android: ZoomPageTransitionsBuilder(),
|
||||||
|
TargetPlatform.iOS: CupertinoPageTransitionsBuilder(),
|
||||||
|
},
|
||||||
|
),
|
||||||
),
|
),
|
||||||
home: Preferences.permissionsGranted
|
home: Preferences.permissionsGranted
|
||||||
? const MainScreen()
|
? const MainScreen()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue