mirror of
https://github.com/immich-app/immich.git
synced 2024-12-26 10:50:29 +02:00
don't show transparent bar for sdk < 26 (#2193)
This commit is contained in:
parent
8e3a7caebd
commit
e241fd0418
@ -1,5 +1,6 @@
|
|||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
import 'package:device_info_plus/device_info_plus.dart';
|
||||||
import 'package:easy_localization/easy_localization.dart';
|
import 'package:easy_localization/easy_localization.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
@ -46,6 +47,7 @@ import 'package:permission_handler/permission_handler.dart';
|
|||||||
|
|
||||||
void main() async {
|
void main() async {
|
||||||
WidgetsFlutterBinding.ensureInitialized();
|
WidgetsFlutterBinding.ensureInitialized();
|
||||||
|
|
||||||
final db = await loadDb();
|
final db = await loadDb();
|
||||||
await initApp();
|
await initApp();
|
||||||
await migrateHiveToStoreIfNecessary();
|
await migrateHiveToStoreIfNecessary();
|
||||||
@ -185,6 +187,22 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
|
|
||||||
Future<void> initApp() async {
|
Future<void> initApp() async {
|
||||||
WidgetsBinding.instance.addObserver(this);
|
WidgetsBinding.instance.addObserver(this);
|
||||||
|
|
||||||
|
// Draw the app from edge to edge
|
||||||
|
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
||||||
|
|
||||||
|
// Sets the navigation bar color
|
||||||
|
SystemUiOverlayStyle overlayStyle = const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent);
|
||||||
|
if (Platform.isAndroid) {
|
||||||
|
// Android 8 does not support transparent app bars
|
||||||
|
final info = await DeviceInfoPlugin().androidInfo;
|
||||||
|
if (info.version.sdkInt <= 26) {
|
||||||
|
overlayStyle = MediaQuery.of(context).platformBrightness == Brightness.light
|
||||||
|
? SystemUiOverlayStyle.light
|
||||||
|
: SystemUiOverlayStyle.dark;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SystemChrome.setSystemUIOverlayStyle(overlayStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -195,6 +213,9 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
// needs to be delayed so that EasyLocalization is working
|
// needs to be delayed so that EasyLocalization is working
|
||||||
ref.read(backgroundServiceProvider).resumeServiceIfEnabled();
|
ref.read(backgroundServiceProvider).resumeServiceIfEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -208,11 +229,6 @@ class ImmichAppState extends ConsumerState<ImmichApp>
|
|||||||
var router = ref.watch(appRouterProvider);
|
var router = ref.watch(appRouterProvider);
|
||||||
ref.watch(releaseInfoProvider.notifier).checkGithubReleaseInfo();
|
ref.watch(releaseInfoProvider.notifier).checkGithubReleaseInfo();
|
||||||
|
|
||||||
SystemChrome.setEnabledSystemUIMode(SystemUiMode.edgeToEdge);
|
|
||||||
SystemChrome.setSystemUIOverlayStyle(
|
|
||||||
const SystemUiOverlayStyle(systemNavigationBarColor: Colors.transparent),
|
|
||||||
);
|
|
||||||
|
|
||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
localizationsDelegates: context.localizationDelegates,
|
localizationsDelegates: context.localizationDelegates,
|
||||||
supportedLocales: context.supportedLocales,
|
supportedLocales: context.supportedLocales,
|
||||||
|
Loading…
Reference in New Issue
Block a user