intercept back button to minimize player first

and also navigate stack of branches like youtube
This commit is contained in:
Dr-Blank 2024-06-20 00:58:12 -04:00
parent ed236ef117
commit 402e264137
No known key found for this signature in database
GPG key ID: 7452CC63F210A266
4 changed files with 106 additions and 68 deletions

View file

@ -58,10 +58,4 @@ double playerHeight(
return playerExpandProgress.value;
}
// a final MiniplayerController controller = MiniplayerController();
@Riverpod(keepAlive: true)
Raw<MiniplayerController> miniplayerController(
MiniplayerControllerRef ref,
) {
return MiniplayerController();
}
final audioBookMiniplayerController = MiniplayerController();

View file

@ -38,22 +38,5 @@ final playerHeightProvider = Provider<double>.internal(
);
typedef PlayerHeightRef = ProviderRef<double>;
String _$miniplayerControllerHash() =>
r'a3677e63a9823881f45a12855e74bf558322e0ec';
/// See also [miniplayerController].
@ProviderFor(miniplayerController)
final miniplayerControllerProvider =
Provider<Raw<MiniplayerController>>.internal(
miniplayerController,
name: r'miniplayerControllerProvider',
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
? null
: _$miniplayerControllerHash,
dependencies: null,
allTransitiveDependencies: null,
);
typedef MiniplayerControllerRef = ProviderRef<Raw<MiniplayerController>>;
// ignore_for_file: type=lint
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member

View file

@ -93,7 +93,7 @@ class AudiobookPlayer extends HookConsumerWidget {
minHeight: playerMinHeight,
// subtract the height of notches and other system UI
maxHeight: playerMaxHeight,
controller: ref.watch(miniplayerControllerProvider),
controller: audioBookMiniplayerController,
elevation: 4,
onDismissed: () {
// add a delay before closing the player