Keep system bar content usable under edge-to-edge

- Lift the QR scanner's torch and camera controls above the navigation
  bar instead of 16 px from the screen edge
- Use light system bar icons on the black QR camera and received-image
  viewer, and keep Android's contrast scrim behind three-button
  navigation for any other dark route
- Note that Flutter only applies edge-to-edge from Android 10
This commit is contained in:
zjs81 committed 2026-10-07 21:06:41 -07:00
1 parent 551bf128c6
commit 1d64399d42
3 files changed
+68 -54

No files matched your search

+8 -4
View File
@@ -49,8 +49,9 @@ void main() async {
debugPrint = (String? message, {int? wrapWidth}) {};
}
// Android 15+ forces edge-to-edge for apps targeting SDK 35; opt older
// versions in too so every device lays out the same way under the bars.
// Android 15+ forces edge-to-edge for apps targeting SDK 35; opt Android
// 10-14 in too so they lay out the same way under the bars. Flutter ignores
// this mode before Android 10, where the old layout remains.
if (PlatformInfo.isAndroid) {
await SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
}
@@ -471,7 +472,10 @@ class _MeshCoreAppState extends State<MeshCoreApp> with WidgetsBindingObserver {
final iconBrightness = isDark ? Brightness.light : Brightness.dark;
// The app draws edge-to-edge, so both system bars stay transparent and
// only their icon brightness follows the resolved Flutter theme.
// their icon brightness follows the resolved Flutter theme. Contrast
// enforcement keeps a scrim behind three-button navigation in case a
// route paints a dark surface under light-theme icons; dark full-screen
// routes also set light icons themselves.
return SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: iconBrightness,
@@ -479,7 +483,7 @@ class _MeshCoreAppState extends State<MeshCoreApp> with WidgetsBindingObserver {
systemNavigationBarColor: Colors.transparent,
systemNavigationBarIconBrightness: iconBrightness,
systemNavigationBarDividerColor: Colors.transparent,
systemNavigationBarContrastEnforced: false,
systemNavigationBarContrastEnforced: true,
);
}