refactor: app startup improvements
This commit is contained in:
17
lib/core/utils/system_ui_style.dart
Normal file
17
lib/core/utils/system_ui_style.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
/// Applies a single System UI overlay style after first frame to avoid flicker
|
||||
/// at startup and to align with the active theme brightness.
|
||||
void applySystemUiOverlayStyleOnce({required Brightness brightness}) {
|
||||
// On Android 15+, avoid setting bar colors; only control icon brightness.
|
||||
final isDark = brightness == Brightness.dark;
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
statusBarIconBrightness: isDark ? Brightness.light : Brightness.dark,
|
||||
systemNavigationBarIconBrightness: isDark
|
||||
? Brightness.light
|
||||
: Brightness.dark,
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user