fix(desktop): double titlebar in local library folders and massive space in overlay player

This commit is contained in:
Kingkor Roy Tirtho 2025-03-11 21:28:57 +06:00
parent bd4cd22e4e
commit 3d334d96fd
8 changed files with 41 additions and 36 deletions

View File

@ -75,17 +75,17 @@ class AppRouter extends RootStackRouter {
path: "local", path: "local",
page: UserLocalLibraryRoute.page, page: UserLocalLibraryRoute.page,
), ),
AutoRoute(
path: "local/folder",
page: LocalLibraryRoute.page,
// parentNavigatorKey: shellRouteNavigatorKey,
),
AutoRoute( AutoRoute(
path: "downloads", path: "downloads",
page: UserDownloadsRoute.page, page: UserDownloadsRoute.page,
), ),
], ],
), ),
AutoRoute(
path: "local/folder",
page: LocalLibraryRoute.page,
// parentNavigatorKey: shellRouteNavigatorKey,
),
AutoRoute( AutoRoute(
path: "library/generate", path: "library/generate",
page: PlaylistGeneratorRoute.page, page: PlaylistGeneratorRoute.page,

View File

@ -28,7 +28,7 @@ class AdaptiveMenuButton<T> extends MenuButton {
/// or equal to 640px /// or equal to 640px
/// In smaller screen, a [IconButton] with a [showModalBottomSheet] is shown /// In smaller screen, a [IconButton] with a [showModalBottomSheet] is shown
class AdaptivePopSheetList<T> extends StatelessWidget { class AdaptivePopSheetList<T> extends StatelessWidget {
final List<AdaptiveMenuButton<T>> children; final List<AdaptiveMenuButton<T>> Function(BuildContext context) items;
final Widget? icon; final Widget? icon;
final Widget? child; final Widget? child;
final bool useRootNavigator; final bool useRootNavigator;
@ -43,7 +43,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
const AdaptivePopSheetList({ const AdaptivePopSheetList({
super.key, super.key,
required this.children, required this.items,
this.icon, this.icon,
this.child, this.child,
this.useRootNavigator = true, this.useRootNavigator = true,
@ -59,27 +59,28 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
Future<void> showDropdownMenu(BuildContext context, Offset position) async { Future<void> showDropdownMenu(BuildContext context, Offset position) async {
final mediaQuery = MediaQuery.of(context); final mediaQuery = MediaQuery.of(context);
final childrenModified = children.map((s) { List<MenuButton> childrenModified(BuildContext context) =>
if (s.onPressed == null) { items(context).map((s) {
return MenuButton( if (s.onPressed == null) {
key: s.key, return MenuButton(
autoClose: s.autoClose, key: s.key,
enabled: s.enabled, autoClose: s.autoClose,
leading: s.leading, enabled: s.enabled,
focusNode: s.focusNode, leading: s.leading,
onPressed: (context) { focusNode: s.focusNode,
if (s.value != null) { onPressed: (context) {
onSelected?.call(s.value as T); if (s.value != null) {
} onSelected?.call(s.value as T);
}, }
popoverController: s.popoverController, },
subMenu: s.subMenu, popoverController: s.popoverController,
trailing: s.trailing, subMenu: s.subMenu,
child: s.child, trailing: s.trailing,
); child: s.child,
} );
return s; }
}).toList(); return s;
}).toList();
if (mediaQuery.mdAndUp) { if (mediaQuery.mdAndUp) {
await showDropdown<T?>( await showDropdown<T?>(
@ -92,7 +93,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
position: position, position: position,
builder: (context) { builder: (context) {
return DropdownMenu( return DropdownMenu(
children: childrenModified, children: childrenModified(context),
); );
}, },
).future; ).future;
@ -109,11 +110,12 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
), ),
backgroundColor: context.theme.colorScheme.card, backgroundColor: context.theme.colorScheme.card,
builder: (context) { builder: (context) {
final children = childrenModified(context);
return ListView.builder( return ListView.builder(
itemCount: childrenModified.length, itemCount: children.length,
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final data = childrenModified[index]; final data = children[index];
return Button( return Button(
enabled: data.enabled, enabled: data.enabled,

View File

@ -166,7 +166,7 @@ class TrackPresentationActionsSection extends HookConsumerWidget {
}, },
icon: const Icon(SpotubeIcons.moreVertical), icon: const Icon(SpotubeIcons.moreVertical),
variance: ButtonVariance.outline, variance: ButtonVariance.outline,
children: [ items: (context) => [
AdaptiveMenuButton( AdaptiveMenuButton(
value: "download", value: "download",
leading: const Icon(SpotubeIcons.download), leading: const Icon(SpotubeIcons.download),

View File

@ -23,7 +23,7 @@ class SortTracksDropdown extends StatelessWidget {
onSelected: onChanged, onSelected: onChanged,
tooltip: context.l10n.sort_tracks, tooltip: context.l10n.sort_tracks,
icon: const Icon(SpotubeIcons.sort), icon: const Icon(SpotubeIcons.sort),
children: [ items: (context) => [
AdaptiveMenuButton( AdaptiveMenuButton(
value: SortBy.none, value: SortBy.none,
enabled: value != SortBy.none, enabled: value != SortBy.none,

View File

@ -366,7 +366,7 @@ class TrackOptions extends HookConsumerWidget {
), ),
), ),
], ],
children: [ items: (context) => [
if (isLocalTrack) if (isLocalTrack)
AdaptiveMenuButton( AdaptiveMenuButton(
value: TrackOptionValue.delete, value: TrackOptionValue.delete,

View File

@ -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/server/active_sourced_track.dart';
import 'package:spotube/provider/volume_provider.dart'; import 'package:spotube/provider/volume_provider.dart';
import 'package:spotube/services/sourced_track/sources/youtube.dart'; import 'package:spotube/services/sourced_track/sources/youtube.dart';
import 'package:spotube/utils/platform.dart';
import 'package:url_launcher/url_launcher_string.dart'; import 'package:url_launcher/url_launcher_string.dart';
@ -101,7 +102,8 @@ class PlayerView extends HookConsumerWidget {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
headers: [ headers: [
SafeArea( SafeArea(
minimum: const EdgeInsets.only(top: 80), minimum:
kIsMobile ? const EdgeInsets.only(top: 80) : EdgeInsets.zero,
bottom: false, bottom: false,
child: TitleBar( child: TitleBar(
surfaceOpacity: 0, surfaceOpacity: 0,

View File

@ -191,7 +191,7 @@ class PlayerActions extends HookConsumerWidget {
sleepTimerNotifier.setSleepTimer(value); sleepTimerNotifier.setSleepTimer(value);
} }
}, },
children: [ items: (context) => [
for (final entry in sleepTimerEntries.entries) for (final entry in sleepTimerEntries.entries)
AdaptiveMenuButton( AdaptiveMenuButton(
value: entry.value, value: entry.value,

View File

@ -81,6 +81,7 @@ class LyricsPage extends HookConsumerWidget {
title: tabbar, title: tabbar,
height: 58 * context.theme.scaling, height: 58 * context.theme.scaling,
surfaceBlur: 0, surfaceBlur: 0,
automaticallyImplyLeading: false,
) )
: tabbar : tabbar
], ],