Skip to content

Commit

Permalink
chore: miniplayer dimensions tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Jan 23, 2024
1 parent 96a768b commit 2061080
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 40 deletions.
67 changes: 35 additions & 32 deletions lib/packages/miniplayer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -163,30 +163,31 @@ class _NamidaMiniPlayerState extends State<NamidaMiniPlayer> {
Widget build(BuildContext context) {
final onSecondary = context.theme.colorScheme.onSecondaryContainer;

final panelH = (MiniPlayerController.inst.maxOffset / 1.6 - 100.0);
final maxPanelHeight = velpy(a: 82.0, b: panelH, c: 2);
final topPadding = MiniPlayerController.inst.maxOffset - maxPanelHeight;
return MiniplayerRaw(
constantChild: SafeArea(
bottom: false,
child: Padding(
padding: EdgeInsets.only(top: MediaQuery.paddingOf(context).top + topPadding + MediaQuery.paddingOf(context).bottom + 16.0),
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32.0.multipliedRadius),
topRight: Radius.circular(32.0.multipliedRadius),
),
child: Column(
children: [
Expanded(
child: SizedBox(
height: context.height,
width: context.width,
child: Stack(
fit: StackFit.loose,
alignment: Alignment.bottomCenter,
children: [
SizedBox(
height: MiniPlayerController.inst.maxOffset - 100.0 - MiniPlayerController.inst.topInset - 12.0,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32.0.multipliedRadius),
topRight: Radius.circular(32.0.multipliedRadius),
),
child: Obx(
() {
final currentIndex = Player.inst.currentIndex;
return NamidaListView(
key: const Key('minikuru'),
itemExtents: List.filled(Player.inst.currentQueue.length, Dimensions.inst.trackTileItemExtent),
scrollController: MiniPlayerController.inst.queueScrollController,
padding: EdgeInsets.only(bottom: 8.0 + SelectedTracksController.inst.bottomPadding.value),
padding: EdgeInsets.only(bottom: 8.0 + SelectedTracksController.inst.bottomPadding.value + kQueueBottomRowHeight + MediaQuery.paddingOf(context).bottom),
onReorderStart: (index) => MiniPlayerController.inst.invokeStartReordering(),
onReorderEnd: (index) => MiniPlayerController.inst.invokeDoneReordering(),
onReorder: (oldIndex, newIndex) => Player.inst.reorderTrack(oldIndex, newIndex),
Expand Down Expand Up @@ -232,24 +233,24 @@ class _NamidaMiniPlayerState extends State<NamidaMiniPlayer> {
},
),
),
Container(
width: context.width,
height: kQueueBottomRowHeight + MediaQuery.paddingOf(context).bottom,
decoration: BoxDecoration(
color: context.theme.scaffoldBackgroundColor,
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.0.multipliedRadius),
),
),
Container(
width: context.width,
height: kQueueBottomRowHeight + MediaQuery.paddingOf(context).bottom,
decoration: BoxDecoration(
color: context.theme.scaffoldBackgroundColor,
borderRadius: BorderRadius.vertical(
top: Radius.circular(12.0.multipliedRadius),
),
child: Padding(
padding: const EdgeInsets.all(4.0).add(EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom)),
child: FittedBox(
child: _queueUtilsRow(context),
),
),
child: Padding(
padding: const EdgeInsets.all(4.0).add(EdgeInsets.only(bottom: MediaQuery.paddingOf(context).bottom)),
child: FittedBox(
child: _queueUtilsRow(context),
),
),
],
),
),
],
),
),
),
Expand Down Expand Up @@ -278,12 +279,14 @@ class _NamidaMiniPlayerState extends State<NamidaMiniPlayer> {
slowOpacity,
opacity,
fastOpacity,
panelHeight,
miniplayerbottomnavheight,
bottomOffset,
navBarHeight,
constantChild,
) {
final panelH = (maxOffset + navBarHeight - (100.0 + topInset + 4.0));
final panelExtra = panelH / 2.25 - navBarHeight - (100.0 + topInset + 4.0);
final panelFinal = panelH - (panelExtra * (1 - qcp));
return Obx(
() {
final currentIndex = Player.inst.currentIndex;
Expand All @@ -303,12 +306,12 @@ class _NamidaMiniPlayerState extends State<NamidaMiniPlayer> {
alignment: Alignment.bottomCenter,
child: Transform.translate(
offset: Offset(0, bottomOffset),
child: Container(
child: ColoredBox(
color: Colors.transparent, // prevents scrolling gap
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 6 * (1 - cp * 10 + 9).clamp(0, 1), vertical: 12 * icp),
child: Container(
height: velpy(a: 82.0, b: panelHeight - 4.0, c: p.clamp(0, 3)) - (navBarHeight * qcp),
height: velpy(a: 82.0, b: panelFinal, c: cp),
width: double.infinity,
decoration: BoxDecoration(
color: context.theme.scaffoldBackgroundColor,
Expand Down
10 changes: 2 additions & 8 deletions lib/packages/miniplayer_raw.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ typedef MiniplayerBuilderCallback = Widget Function(
double slowOpacity,
double opacity,
double fastOpacity,
double panelHeight,
double miniplayerbottomnavheight,
double bottomOffset,
double navBarHeight,
Expand Down Expand Up @@ -61,7 +60,7 @@ class MiniplayerRaw extends StatelessWidget {
final child = AnimatedBuilder(
animation: MiniPlayerController.inst.animation,
builder: (context, child) {
final maxOffset = MiniPlayerController.inst.maxOffset - navBarHeight;
final maxOffset = MiniPlayerController.inst.maxOffset;
final bounceUp = MiniPlayerController.inst.bounceUp;
final bounceDown = MiniPlayerController.inst.bounceDown;
final topInset = MiniPlayerController.inst.topInset;
Expand Down Expand Up @@ -99,16 +98,12 @@ class MiniplayerRaw extends StatelessWidget {
final double slowOpacity = (bcp * 4 - 3).clamp(0, 1);
final double opacity = (bcp * 5 - 4).clamp(0, 1);
final double fastOpacity = (bcp * 10 - 9).clamp(0, 1);
double panelHeight = maxOffset / 1.6;
if (p > 1.0) {
panelHeight = velpy(a: panelHeight, b: maxOffset / 1.6 - 100.0 - topInset, c: qcp);
}

final miniplayerbottomnavheight = settings.enableBottomNavBar.value ? 60.0 : 0.0;
final double bottomOffset = (-miniplayerbottomnavheight * icp + p.clamp(-1, 0) * -200) - (bottomInset * icp);

return builder(
maxOffset,
maxOffset - navBarHeight,
bounceUp,
bounceDown,
topInset,
Expand All @@ -132,7 +127,6 @@ class MiniplayerRaw extends StatelessWidget {
slowOpacity,
opacity,
fastOpacity,
panelHeight,
miniplayerbottomnavheight,
bottomOffset,
navBarHeight,
Expand Down

0 comments on commit 2061080

Please sign in to comment.