-
Notifications
You must be signed in to change notification settings - Fork 140
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added: Ability to keep screen on while using app * Modified: Moved battery state determination into KeepScreenOnHelper class. * Used events where possible * Revert lyrics_screen and music_player_background_task to redesign branch * Small changes and adding generated files * Use wakelock_plus instead of KeepScreenOn package * Converted KeepScreenOnHelper to singleton rather than static class * Reverted to calling KeepScreenOnHelper from build and dispose of LyicsScreen * Removed code that extends Navigator Observer. * Modified: Use NavigatorObserver to listen for lyrics screen show and hide events. Modified: Changed default settings to "While Lyrics are Showing" --------- Co-authored-by: Rich T <[email protected]>
- Loading branch information
Showing
14 changed files
with
408 additions
and
19 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
lib/components/InteractionSettingsScreen/keep_screen_on_dropdown_list_tile.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:hive/hive.dart'; | ||
|
||
import '../../models/finamp_models.dart'; | ||
import '../../services/finamp_settings_helper.dart'; | ||
|
||
class KeepScreenOnDropdownListTile extends StatelessWidget { | ||
const KeepScreenOnDropdownListTile({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ValueListenableBuilder<Box<FinampSettings>>( | ||
valueListenable: FinampSettingsHelper.finampSettingsListener, | ||
builder: (_, box, __) { | ||
return ListTile( | ||
title: Text(AppLocalizations.of(context)!.keepScreenOn), | ||
subtitle: Text(AppLocalizations.of(context)!.keepScreenOnSubtitle), | ||
trailing: DropdownButton<KeepScreenOnOption>( | ||
value: box.get("FinampSettings")?.keepScreenOnOption, | ||
items: KeepScreenOnOption.values | ||
.map((e) => DropdownMenuItem<KeepScreenOnOption>( | ||
value: e, | ||
child: Text(e.toLocalisedString(context)), | ||
)) | ||
.toList(), | ||
onChanged: (value) { | ||
if (value != null) { | ||
FinampSettingsHelper.setKeepScreenOnOption(value); | ||
} | ||
}, | ||
), | ||
); | ||
}, | ||
); | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
lib/components/InteractionSettingsScreen/keep_screen_on_while_charging_selector.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_gen/gen_l10n/app_localizations.dart'; | ||
import 'package:hive/hive.dart'; | ||
|
||
import '../../models/finamp_models.dart'; | ||
import '../../services/finamp_settings_helper.dart'; | ||
|
||
class KeepScreenOnWhilePluggedInSelector extends StatelessWidget { | ||
const KeepScreenOnWhilePluggedInSelector({super.key}); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ValueListenableBuilder<Box<FinampSettings>>( | ||
valueListenable: FinampSettingsHelper.finampSettingsListener, | ||
builder: (_, box, __) { | ||
return SwitchListTile.adaptive( | ||
title: Text(AppLocalizations.of(context)!.keepScreenOnWhilePluggedIn), | ||
subtitle: Text(AppLocalizations.of(context)!.keepScreenOnWhilePluggedInSubtitle), | ||
value: FinampSettingsHelper.finampSettings.keepScreenOnWhilePluggedIn, | ||
onChanged: (value) { | ||
FinampSettingsHelper.setKeepScreenOnWhileCharging(value); | ||
}, | ||
); | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.