Skip to content

Commit

Permalink
fix inconsistent swipe target between lyrics and player screen
Browse files Browse the repository at this point in the history
- fixes #1012
  • Loading branch information
Chaphasilor committed Feb 8, 2025
1 parent 43a33be commit 1195f45
Showing 1 changed file with 69 additions and 67 deletions.
136 changes: 69 additions & 67 deletions lib/screens/lyrics_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import 'dart:async';
import 'dart:io';

import 'package:finamp/color_schemes.g.dart';
import 'package:finamp/components/AddToPlaylistScreen/playlist_actions_menu.dart';
import 'package:finamp/components/AlbumScreen/song_menu.dart';
import 'package:finamp/components/PlayerScreen/player_screen_appbar_title.dart';
import 'package:finamp/models/finamp_models.dart';
import 'package:finamp/models/jellyfin_models.dart';
Expand Down Expand Up @@ -78,67 +80,67 @@ class _LyricsScreenContentState extends State<_LyricsScreenContent> {

var controller = PlayerHideableController();

return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
scrolledUnderElevation:
0.0, // disable tint/shadow when content is scrolled under the app bar
centerTitle: true,
toolbarHeight: toolbarHeight,
title: PlayerScreenAppBarTitle(
maxLines: maxLines,
),
leading: FinampAppBarButton(
dismissDirection: AxisDirection.right,
onPressed: () => Navigator.of(context).pop(),
),
actions: [
if (Platform.isIOS)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: AirPlayRoutePickerView(
tintColor: IconTheme.of(context).color ?? Colors.white,
activeTintColor: jellyfinBlueColor,
onShowPickerView: () =>
FeedbackHelper.feedback(FeedbackType.selection),
),
return SimpleGestureDetector(
onVerticalSwipe: (direction) {
if (direction == SwipeDirection.up) {
// This should never actually be called until widget finishes build and controller is initialized
if (!FinampSettingsHelper.finampSettings.disableGesture ||
!controller.shouldShow(PlayerHideable.bottomActions)) {
showQueueBottomSheet(context);
}
}
},
onHorizontalSwipe: (direction) {
if (direction == SwipeDirection.right) {
if (!FinampSettingsHelper.finampSettings.disableGesture) {
Navigator.of(context).pop();
}
}
},
child: Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
scrolledUnderElevation:
0.0, // disable tint/shadow when content is scrolled under the app bar
centerTitle: true,
toolbarHeight: toolbarHeight,
title: PlayerScreenAppBarTitle(
maxLines: maxLines,
),
],
),
// Required for sleep timer input
resizeToAvoidBottomInset: false, extendBodyBehindAppBar: true,
body: Stack(
children: [
if (FinampSettingsHelper.finampSettings.useCoverAsBackground)
const BlurredPlayerScreenBackground(),
SafeArea(
minimum: EdgeInsets.only(top: toolbarHeight),
child: LayoutBuilder(builder: (context, constraints) {
controller.setSize(
Size(constraints.maxWidth, constraints.maxHeight),
MediaQuery.orientationOf(context));
if (controller.useLandscape) {
return SimpleGestureDetector(
onHorizontalSwipe: (direction) {
if (direction == SwipeDirection.right) {
if (!FinampSettingsHelper
.finampSettings.disableGesture) {
Navigator.of(context).pop();
}
}
},
child: const LyricsView());
} else {
return SimpleGestureDetector(
onHorizontalSwipe: (direction) {
if (direction == SwipeDirection.right) {
if (!FinampSettingsHelper.finampSettings.disableGesture) {
Navigator.of(context).pop();
}
}
},
child: Column(
leading: FinampAppBarButton(
dismissDirection: AxisDirection.right,
onPressed: () => Navigator.of(context).pop(),
),
actions: [
if (Platform.isIOS)
Padding(
padding: const EdgeInsets.symmetric(horizontal: 8.0),
child: AirPlayRoutePickerView(
tintColor: IconTheme.of(context).color ?? Colors.white,
activeTintColor: jellyfinBlueColor,
onShowPickerView: () =>
FeedbackHelper.feedback(FeedbackType.selection),
),
),
],
),
// Required for sleep timer input
resizeToAvoidBottomInset: false, extendBodyBehindAppBar: true,
body: Stack(
children: [
if (FinampSettingsHelper.finampSettings.useCoverAsBackground)
const BlurredPlayerScreenBackground(),
SafeArea(
minimum: EdgeInsets.only(top: toolbarHeight),
child: LayoutBuilder(builder: (context, constraints) {
controller.setSize(
Size(constraints.maxWidth, constraints.maxHeight),
MediaQuery.orientationOf(context));
if (controller.useLandscape) {
return const LyricsView();
} else {
return Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
const Expanded(
Expand All @@ -163,14 +165,14 @@ class _LyricsScreenContentState extends State<_LyricsScreenContent> {
)
],
))
],
),
);
}
}),
],
);
}
}),
),
],
),
],
),
)
);
}
}
Expand Down

0 comments on commit 1195f45

Please sign in to comment.