mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00
fix(desktop): double titlebar in local library folders and massive space in overlay player
This commit is contained in:
parent
bd4cd22e4e
commit
3d334d96fd
@ -75,17 +75,17 @@ class AppRouter extends RootStackRouter {
|
||||
path: "local",
|
||||
page: UserLocalLibraryRoute.page,
|
||||
),
|
||||
AutoRoute(
|
||||
path: "local/folder",
|
||||
page: LocalLibraryRoute.page,
|
||||
// parentNavigatorKey: shellRouteNavigatorKey,
|
||||
),
|
||||
AutoRoute(
|
||||
path: "downloads",
|
||||
page: UserDownloadsRoute.page,
|
||||
),
|
||||
],
|
||||
),
|
||||
AutoRoute(
|
||||
path: "local/folder",
|
||||
page: LocalLibraryRoute.page,
|
||||
// parentNavigatorKey: shellRouteNavigatorKey,
|
||||
),
|
||||
AutoRoute(
|
||||
path: "library/generate",
|
||||
page: PlaylistGeneratorRoute.page,
|
||||
|
@ -28,7 +28,7 @@ class AdaptiveMenuButton<T> extends MenuButton {
|
||||
/// or equal to 640px
|
||||
/// In smaller screen, a [IconButton] with a [showModalBottomSheet] is shown
|
||||
class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
final List<AdaptiveMenuButton<T>> children;
|
||||
final List<AdaptiveMenuButton<T>> Function(BuildContext context) items;
|
||||
final Widget? icon;
|
||||
final Widget? child;
|
||||
final bool useRootNavigator;
|
||||
@ -43,7 +43,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
|
||||
const AdaptivePopSheetList({
|
||||
super.key,
|
||||
required this.children,
|
||||
required this.items,
|
||||
this.icon,
|
||||
this.child,
|
||||
this.useRootNavigator = true,
|
||||
@ -59,27 +59,28 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
|
||||
Future<void> showDropdownMenu(BuildContext context, Offset position) async {
|
||||
final mediaQuery = MediaQuery.of(context);
|
||||
final childrenModified = children.map((s) {
|
||||
if (s.onPressed == null) {
|
||||
return MenuButton(
|
||||
key: s.key,
|
||||
autoClose: s.autoClose,
|
||||
enabled: s.enabled,
|
||||
leading: s.leading,
|
||||
focusNode: s.focusNode,
|
||||
onPressed: (context) {
|
||||
if (s.value != null) {
|
||||
onSelected?.call(s.value as T);
|
||||
}
|
||||
},
|
||||
popoverController: s.popoverController,
|
||||
subMenu: s.subMenu,
|
||||
trailing: s.trailing,
|
||||
child: s.child,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
}).toList();
|
||||
List<MenuButton> childrenModified(BuildContext context) =>
|
||||
items(context).map((s) {
|
||||
if (s.onPressed == null) {
|
||||
return MenuButton(
|
||||
key: s.key,
|
||||
autoClose: s.autoClose,
|
||||
enabled: s.enabled,
|
||||
leading: s.leading,
|
||||
focusNode: s.focusNode,
|
||||
onPressed: (context) {
|
||||
if (s.value != null) {
|
||||
onSelected?.call(s.value as T);
|
||||
}
|
||||
},
|
||||
popoverController: s.popoverController,
|
||||
subMenu: s.subMenu,
|
||||
trailing: s.trailing,
|
||||
child: s.child,
|
||||
);
|
||||
}
|
||||
return s;
|
||||
}).toList();
|
||||
|
||||
if (mediaQuery.mdAndUp) {
|
||||
await showDropdown<T?>(
|
||||
@ -92,7 +93,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
position: position,
|
||||
builder: (context) {
|
||||
return DropdownMenu(
|
||||
children: childrenModified,
|
||||
children: childrenModified(context),
|
||||
);
|
||||
},
|
||||
).future;
|
||||
@ -109,11 +110,12 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
),
|
||||
backgroundColor: context.theme.colorScheme.card,
|
||||
builder: (context) {
|
||||
final children = childrenModified(context);
|
||||
return ListView.builder(
|
||||
itemCount: childrenModified.length,
|
||||
itemCount: children.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (context, index) {
|
||||
final data = childrenModified[index];
|
||||
final data = children[index];
|
||||
|
||||
return Button(
|
||||
enabled: data.enabled,
|
||||
|
@ -166,7 +166,7 @@ class TrackPresentationActionsSection extends HookConsumerWidget {
|
||||
},
|
||||
icon: const Icon(SpotubeIcons.moreVertical),
|
||||
variance: ButtonVariance.outline,
|
||||
children: [
|
||||
items: (context) => [
|
||||
AdaptiveMenuButton(
|
||||
value: "download",
|
||||
leading: const Icon(SpotubeIcons.download),
|
||||
|
@ -23,7 +23,7 @@ class SortTracksDropdown extends StatelessWidget {
|
||||
onSelected: onChanged,
|
||||
tooltip: context.l10n.sort_tracks,
|
||||
icon: const Icon(SpotubeIcons.sort),
|
||||
children: [
|
||||
items: (context) => [
|
||||
AdaptiveMenuButton(
|
||||
value: SortBy.none,
|
||||
enabled: value != SortBy.none,
|
||||
|
@ -366,7 +366,7 @@ class TrackOptions extends HookConsumerWidget {
|
||||
),
|
||||
),
|
||||
],
|
||||
children: [
|
||||
items: (context) => [
|
||||
if (isLocalTrack)
|
||||
AdaptiveMenuButton(
|
||||
value: TrackOptionValue.delete,
|
||||
|
@ -27,6 +27,7 @@ import 'package:spotube/provider/audio_player/audio_player.dart';
|
||||
import 'package:spotube/provider/server/active_sourced_track.dart';
|
||||
import 'package:spotube/provider/volume_provider.dart';
|
||||
import 'package:spotube/services/sourced_track/sources/youtube.dart';
|
||||
import 'package:spotube/utils/platform.dart';
|
||||
|
||||
import 'package:url_launcher/url_launcher_string.dart';
|
||||
|
||||
@ -101,7 +102,8 @@ class PlayerView extends HookConsumerWidget {
|
||||
backgroundColor: Colors.transparent,
|
||||
headers: [
|
||||
SafeArea(
|
||||
minimum: const EdgeInsets.only(top: 80),
|
||||
minimum:
|
||||
kIsMobile ? const EdgeInsets.only(top: 80) : EdgeInsets.zero,
|
||||
bottom: false,
|
||||
child: TitleBar(
|
||||
surfaceOpacity: 0,
|
||||
|
@ -191,7 +191,7 @@ class PlayerActions extends HookConsumerWidget {
|
||||
sleepTimerNotifier.setSleepTimer(value);
|
||||
}
|
||||
},
|
||||
children: [
|
||||
items: (context) => [
|
||||
for (final entry in sleepTimerEntries.entries)
|
||||
AdaptiveMenuButton(
|
||||
value: entry.value,
|
||||
|
@ -81,6 +81,7 @@ class LyricsPage extends HookConsumerWidget {
|
||||
title: tabbar,
|
||||
height: 58 * context.theme.scaling,
|
||||
surfaceBlur: 0,
|
||||
automaticallyImplyLeading: false,
|
||||
)
|
||||
: tabbar
|
||||
],
|
||||
|
Loading…
Reference in New Issue
Block a user