mirror of
https://github.com/Dr-Blank/Vaani.git
synced 2025-12-07 11:39:29 +00:00
Update player height calculation to use full screen height
This commit is contained in:
parent
de94be965a
commit
99fb8264f1
3 changed files with 43 additions and 7 deletions
|
|
@ -69,8 +69,7 @@ class AudiobookPlayer extends HookConsumerWidget {
|
||||||
);
|
);
|
||||||
|
|
||||||
// max height of the player is the height of the screen
|
// max height of the player is the height of the screen
|
||||||
final playerMaxHeight =
|
final playerMaxHeight = MediaQuery.of(context).size.height;
|
||||||
MediaQuery.of(context).size.height * playerMaxHeightPercentOfScreen;
|
|
||||||
|
|
||||||
final availWidth = MediaQuery.of(context).size.width;
|
final availWidth = MediaQuery.of(context).size.width;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,10 @@ import 'package:duration_picker/duration_picker.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_hooks/flutter_hooks.dart';
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
||||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||||
|
import 'package:miniplayer/miniplayer.dart';
|
||||||
import 'package:whispering_pages/constants/sizes.dart';
|
import 'package:whispering_pages/constants/sizes.dart';
|
||||||
import 'package:whispering_pages/features/player/providers/currently_playing_provider.dart';
|
import 'package:whispering_pages/features/player/providers/currently_playing_provider.dart';
|
||||||
|
import 'package:whispering_pages/features/player/providers/player_form.dart';
|
||||||
import 'package:whispering_pages/features/player/view/audiobook_player.dart';
|
import 'package:whispering_pages/features/player/view/audiobook_player.dart';
|
||||||
import 'package:whispering_pages/features/sleep_timer/core/sleep_timer.dart';
|
import 'package:whispering_pages/features/sleep_timer/core/sleep_timer.dart';
|
||||||
import 'package:whispering_pages/features/sleep_timer/providers/sleep_timer_provider.dart'
|
import 'package:whispering_pages/features/sleep_timer/providers/sleep_timer_provider.dart'
|
||||||
|
|
@ -49,11 +51,47 @@ class PlayerWhenExpanded extends HookConsumerWidget {
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
// sized box for system status bar; not needed as not full screen
|
// sized box for system status bar; not needed as not full screen
|
||||||
// SizedBox(
|
SizedBox(
|
||||||
// height: MediaQuery.of(context).padding.top * earlyPercentage,
|
height: MediaQuery.of(context).padding.top * earlyPercentage,
|
||||||
// ),
|
),
|
||||||
|
|
||||||
// a row with a down arrow to minimize the player, a pill shaped container to drag the player, and a cast button
|
// a row with a down arrow to minimize the player, a pill shaped container to drag the player, and a cast button
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
maxHeight: 100 * earlyPercentage,
|
||||||
|
),
|
||||||
|
child: Opacity(
|
||||||
|
opacity: earlyPercentage,
|
||||||
|
child: Padding(
|
||||||
|
padding: EdgeInsets.only(top: 8.0 * earlyPercentage),
|
||||||
|
child: Row(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
mainAxisSize: MainAxisSize.max,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
// the down arrow
|
||||||
|
IconButton(
|
||||||
|
iconSize: 30,
|
||||||
|
icon: const Icon(Icons.keyboard_arrow_down),
|
||||||
|
onPressed: () {
|
||||||
|
// minimize the player
|
||||||
|
audioBookMiniplayerController.animateToHeight(
|
||||||
|
state: PanelState.MIN,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
// the cast button
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(Icons.cast),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
|
||||||
// the image
|
// the image
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ class ScaffoldWithNavBar extends HookConsumerWidget {
|
||||||
// final playerProgress =
|
// final playerProgress =
|
||||||
// useValueListenable(ref.watch(playerExpandProgressNotifierProvider));
|
// useValueListenable(ref.watch(playerExpandProgressNotifierProvider));
|
||||||
final playerProgress = ref.watch(playerHeightProvider);
|
final playerProgress = ref.watch(playerHeightProvider);
|
||||||
final playerMaxHeight =
|
final playerMaxHeight = MediaQuery.of(context).size.height;
|
||||||
MediaQuery.of(context).size.height * playerMaxHeightPercentOfScreen;
|
|
||||||
var percentExpanded = (playerProgress - playerMinHeight) /
|
var percentExpanded = (playerProgress - playerMinHeight) /
|
||||||
(playerMaxHeight - playerMinHeight);
|
(playerMaxHeight - playerMinHeight);
|
||||||
// Clamp the value between 0 and 1
|
// Clamp the value between 0 and 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue