mirror of
https://github.com/gabehf/Fladder.git
synced 2026-03-07 21:48:14 -08:00
fix: Hide duplicate floating player in phone layout (#218)
Co-authored-by: PartyDonut <PartyDonut@users.noreply.github.com>
This commit is contained in:
parent
fe96c7e258
commit
cf53f02d90
5 changed files with 16 additions and 2 deletions
|
|
@ -160,6 +160,8 @@ class _LibrarySearchScreenState extends ConsumerState<LibrarySearchScreen> {
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
|
floatingActionButtonAnimator:
|
||||||
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonAnimator.noAnimation : null,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
playerState == VideoPlayerState.minimized ? FloatingActionButtonLocation.centerFloat : null,
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonLocation.centerFloat : null,
|
||||||
floatingActionButton: switch (playerState) {
|
floatingActionButton: switch (playerState) {
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,8 @@ class _DetailScaffoldState extends ConsumerState<DetailScaffold> {
|
||||||
},
|
},
|
||||||
refreshOnStart: true,
|
refreshOnStart: true,
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
|
floatingActionButtonAnimator:
|
||||||
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonAnimator.noAnimation : null,
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||||
floatingActionButton: switch (playerState) {
|
floatingActionButton: switch (playerState) {
|
||||||
VideoPlayerState.minimized => const Padding(
|
VideoPlayerState.minimized => const Padding(
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,8 @@ class NestedScaffold extends ConsumerWidget {
|
||||||
return Card(
|
return Card(
|
||||||
child: Scaffold(
|
child: Scaffold(
|
||||||
backgroundColor: Colors.transparent,
|
backgroundColor: Colors.transparent,
|
||||||
|
floatingActionButtonAnimator:
|
||||||
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonAnimator.noAnimation : null,
|
||||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
floatingActionButtonLocation: FloatingActionButtonLocation.centerFloat,
|
||||||
floatingActionButton: switch (AdaptiveLayout.layoutOf(context)) {
|
floatingActionButton: switch (AdaptiveLayout.layoutOf(context)) {
|
||||||
ViewSize.phone => null,
|
ViewSize.phone => null,
|
||||||
|
|
|
||||||
|
|
@ -75,7 +75,8 @@ class _CurrentlyPlayingBarState extends ConsumerState<FloatingPlayerBar> {
|
||||||
fladderSnackbar(context, title: "Swipe up/down to open/close the player");
|
fladderSnackbar(context, title: "Swipe up/down to open/close the player");
|
||||||
},
|
},
|
||||||
child: Card(
|
child: Card(
|
||||||
elevation: 3,
|
elevation: 5,
|
||||||
|
color: Theme.of(context).colorScheme.primaryContainer,
|
||||||
child: ConstrainedBox(
|
child: ConstrainedBox(
|
||||||
constraints: const BoxConstraints(minHeight: 50, maxHeight: 85),
|
constraints: const BoxConstraints(minHeight: 50, maxHeight: 85),
|
||||||
child: LayoutBuilder(builder: (context, constraints) {
|
child: LayoutBuilder(builder: (context, constraints) {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:auto_route/auto_route.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
import 'package:fladder/models/media_playback_model.dart';
|
import 'package:fladder/models/media_playback_model.dart';
|
||||||
|
|
@ -53,6 +54,8 @@ class _NavigationScaffoldState extends ConsumerState<NavigationScaffold> {
|
||||||
final playerState = ref.watch(mediaPlaybackProvider.select((value) => value.state));
|
final playerState = ref.watch(mediaPlaybackProvider.select((value) => value.state));
|
||||||
final views = ref.watch(viewsProvider.select((value) => value.views));
|
final views = ref.watch(viewsProvider.select((value) => value.views));
|
||||||
|
|
||||||
|
final isHomeRoutes = homeRoutes.any((element) => element.name.contains(context.router.current.name));
|
||||||
|
|
||||||
return PopScope(
|
return PopScope(
|
||||||
canPop: currentIndex == 0,
|
canPop: currentIndex == 0,
|
||||||
onPopInvokedWithResult: (didPop, result) {
|
onPopInvokedWithResult: (didPop, result) {
|
||||||
|
|
@ -65,9 +68,13 @@ class _NavigationScaffoldState extends ConsumerState<NavigationScaffold> {
|
||||||
appBar: const FladderAppBar(),
|
appBar: const FladderAppBar(),
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
|
floatingActionButtonAnimator:
|
||||||
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonAnimator.noAnimation : null,
|
||||||
floatingActionButtonLocation:
|
floatingActionButtonLocation:
|
||||||
playerState == VideoPlayerState.minimized ? FloatingActionButtonLocation.centerFloat : null,
|
playerState == VideoPlayerState.minimized ? FloatingActionButtonLocation.centerFloat : null,
|
||||||
floatingActionButton: AdaptiveLayout.layoutModeOf(context) == LayoutMode.single
|
floatingActionButton: AdaptiveLayout.layoutModeOf(context) == LayoutMode.single &&
|
||||||
|
AdaptiveLayout.viewSizeOf(context) == ViewSize.phone &&
|
||||||
|
isHomeRoutes
|
||||||
? switch (playerState) {
|
? switch (playerState) {
|
||||||
VideoPlayerState.minimized => const Padding(
|
VideoPlayerState.minimized => const Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue