fix: android 15 warnings
This commit is contained in:
@@ -326,25 +326,21 @@ class PlatformService {
|
||||
statusBarIconBrightness: isDarkContent
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
// iOS: it's safe to pass a color; leave behavior unchanged
|
||||
statusBarColor: backgroundColor,
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// For Android 15+, use edge-to-edge approach
|
||||
// Avoid deprecated setStatusBarColor, setNavigationBarColor, setNavigationBarDividerColor
|
||||
// Android: Avoid passing any bar colors to prevent invoking
|
||||
// deprecated Window.setStatusBarColor / setNavigationBarColor / setNavigationBarDividerColor
|
||||
// on Android 15+. Only control icon brightness; colors come from theme + EdgeToEdge.
|
||||
SystemChrome.setSystemUIOverlayStyle(
|
||||
SystemUiOverlayStyle(
|
||||
// Only set icon brightness for edge-to-edge compatibility
|
||||
statusBarIconBrightness: isDarkContent
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
systemNavigationBarIconBrightness: isDarkContent
|
||||
? Brightness.dark
|
||||
: Brightness.light,
|
||||
// Use transparent colors for proper edge-to-edge display
|
||||
statusBarColor: Colors.transparent,
|
||||
systemNavigationBarColor: Colors.transparent,
|
||||
systemNavigationBarDividerColor: Colors.transparent,
|
||||
statusBarIconBrightness:
|
||||
isDarkContent ? Brightness.dark : Brightness.light,
|
||||
systemNavigationBarIconBrightness:
|
||||
isDarkContent ? Brightness.dark : Brightness.light,
|
||||
// Do NOT set status/navigation bar colors on Android.
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'core/services/navigation_service.dart';
|
||||
import 'core/widgets/error_boundary.dart';
|
||||
@@ -23,6 +24,10 @@ import 'core/services/share_receiver_service.dart';
|
||||
void main() async {
|
||||
WidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
// Enable edge-to-edge globally (back-compat on pre-Android 15)
|
||||
// Pairs with Activity's EdgeToEdge.enable and our SafeArea usage.
|
||||
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||
|
||||
final sharedPrefs = await SharedPreferences.getInstance();
|
||||
const secureStorage = FlutterSecureStorage();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user