Skip to content

Commit

Permalink
fix status bar icon contrast on player screen on Android
Browse files Browse the repository at this point in the history
- fixes #957 and #798
  • Loading branch information
Chaphasilor committed Nov 19, 2024
1 parent 2512ecd commit c21055c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
13 changes: 7 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ void main() async {
FlutterError.presentError(details);
flutterLogger.severe(error, error, details.stack);
};
// On iOS, the status bar will have black icons by default on the login
// screen as it does not have an AppBar. To fix this, we set the
// brightness to dark manually on startup.
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark));

await findSystemLocale();
await initializeDateFormatting();
Expand All @@ -129,6 +124,12 @@ Future<void> _setupEdgeToEdgeOverlayStyle() async {
systemNavigationBarColor: Colors.transparent));
final binding = WidgetsFlutterBinding.ensureInitialized();
binding.addObserver(UIOverlaySetterObserver());
} else if (Platform.isIOS) {
// On iOS, the status bar will have black icons by default on the login
// screen as it does not have an AppBar. To fix this, we set the
// brightness to dark manually on startup.
SystemChrome.setSystemUIOverlayStyle(
const SystemUiOverlayStyle(statusBarBrightness: Brightness.dark));
}
}

Expand Down Expand Up @@ -442,7 +443,7 @@ class _FinampState extends ConsumerState<Finamp> with WindowListener {
}

@override
Widget build(BuildContext context) {
Widget build(BuildContext context) {
return ProviderScope(
child: GestureDetector(
onTap: () {
Expand Down
7 changes: 6 additions & 1 deletion lib/screens/player_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import 'package:finamp/services/finamp_settings_helper.dart';
import 'package:finamp/services/queue_service.dart';
import 'package:finamp/services/theme_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_tabler_icons/flutter_tabler_icons.dart';
Expand Down Expand Up @@ -217,6 +218,9 @@ class _PlayerScreenContent extends ConsumerWidget {
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
systemOverlayStyle: Theme.of(context).brightness == Brightness.dark
? SystemUiOverlayStyle.light
: SystemUiOverlayStyle.dark,
elevation: 0,
scrolledUnderElevation:
0.0, // disable tint/shadow when content is scrolled under the app bar
Expand Down Expand Up @@ -249,7 +253,8 @@ class _PlayerScreenContent extends ConsumerWidget {
],
),
// Required for sleep timer input
resizeToAvoidBottomInset: false, extendBodyBehindAppBar: true,
resizeToAvoidBottomInset: false,
extendBodyBehindAppBar: true,
body: Stack(
children: [
if (FinampSettingsHelper.finampSettings.useCoverAsBackground)
Expand Down

0 comments on commit c21055c

Please sign in to comment.