mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-15 07:29:30 +00:00
fix: content behind miniplayer not visible (#53)
This commit is contained in:
parent
e8903081b7
commit
09eafb2c28
7 changed files with 59 additions and 4 deletions
|
|
@ -6,6 +6,7 @@ import 'package:flutter/widgets.dart';
|
|||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:miniplayer/miniplayer.dart';
|
||||
import 'package:riverpod_annotation/riverpod_annotation.dart';
|
||||
import 'package:vaani/features/player/providers/audiobook_player.dart';
|
||||
|
||||
part 'player_form.g.dart';
|
||||
|
||||
|
|
@ -60,3 +61,20 @@ double playerHeight(
|
|||
}
|
||||
|
||||
final audioBookMiniplayerController = MiniplayerController();
|
||||
|
||||
@Riverpod(keepAlive: true)
|
||||
bool isPlayerActive(
|
||||
IsPlayerActiveRef ref,
|
||||
) {
|
||||
try {
|
||||
final player = ref.watch(audiobookPlayerProvider);
|
||||
if (player.book != null) {
|
||||
return true;
|
||||
} else {
|
||||
final playerHeight = ref.watch(playerHeightProvider);
|
||||
return playerHeight < playerMinHeight;
|
||||
}
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,5 +38,20 @@ final playerHeightProvider = Provider<double>.internal(
|
|||
);
|
||||
|
||||
typedef PlayerHeightRef = ProviderRef<double>;
|
||||
String _$isPlayerActiveHash() => r'147e13cd7fd6fd3823623557ce4f300dc15b6fe6';
|
||||
|
||||
/// See also [isPlayerActive].
|
||||
@ProviderFor(isPlayerActive)
|
||||
final isPlayerActiveProvider = Provider<bool>.internal(
|
||||
isPlayerActive,
|
||||
name: r'isPlayerActiveProvider',
|
||||
debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product')
|
||||
? null
|
||||
: _$isPlayerActiveHash,
|
||||
dependencies: null,
|
||||
allTransitiveDependencies: null,
|
||||
);
|
||||
|
||||
typedef IsPlayerActiveRef = ProviderRef<bool>;
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member
|
||||
|
|
|
|||
16
lib/features/player/view/mini_player_bottom_padding.dart
Normal file
16
lib/features/player/view/mini_player_bottom_padding.dart
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
import 'package:vaani/features/player/providers/player_form.dart';
|
||||
|
||||
class MiniPlayerBottomPadding extends HookConsumerWidget {
|
||||
const MiniPlayerBottomPadding({super.key});
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
return AnimatedSize(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
child: ref.watch(isPlayerActiveProvider)
|
||||
? const SizedBox(height: playerMinHeight + 8)
|
||||
: const SizedBox.shrink(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue