Compare commits

..

1 Commits

Author SHA1 Message Date
Richard Hajek
e30b6cfa93
Merge 42e954428b into bd4cd22e4e 2025-03-11 10:51:08 +06:00
8 changed files with 36 additions and 41 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>> Function(BuildContext context) items; final List<AdaptiveMenuButton<T>> children;
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.items, required this.children,
this.icon, this.icon,
this.child, this.child,
this.useRootNavigator = true, this.useRootNavigator = true,
@ -59,28 +59,27 @@ 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);
List<MenuButton> childrenModified(BuildContext context) => final childrenModified = children.map((s) {
items(context).map((s) { if (s.onPressed == null) {
if (s.onPressed == null) { return MenuButton(
return MenuButton( key: s.key,
key: s.key, autoClose: s.autoClose,
autoClose: s.autoClose, enabled: s.enabled,
enabled: s.enabled, leading: s.leading,
leading: s.leading, focusNode: s.focusNode,
focusNode: s.focusNode, onPressed: (context) {
onPressed: (context) { if (s.value != null) {
if (s.value != null) { onSelected?.call(s.value as T);
onSelected?.call(s.value as T); }
} },
}, popoverController: s.popoverController,
popoverController: s.popoverController, subMenu: s.subMenu,
subMenu: s.subMenu, trailing: s.trailing,
trailing: s.trailing, child: s.child,
child: s.child, );
); }
} return s;
return s; }).toList();
}).toList();
if (mediaQuery.mdAndUp) { if (mediaQuery.mdAndUp) {
await showDropdown<T?>( await showDropdown<T?>(
@ -93,7 +92,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
position: position, position: position,
builder: (context) { builder: (context) {
return DropdownMenu( return DropdownMenu(
children: childrenModified(context), children: childrenModified,
); );
}, },
).future; ).future;
@ -110,12 +109,11 @@ 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: children.length, itemCount: childrenModified.length,
shrinkWrap: true, shrinkWrap: true,
itemBuilder: (context, index) { itemBuilder: (context, index) {
final data = children[index]; final data = childrenModified[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,
items: (context) => [ children: [
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),
items: (context) => [ children: [
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 {
), ),
), ),
], ],
items: (context) => [ children: [
if (isLocalTrack) if (isLocalTrack)
AdaptiveMenuButton( AdaptiveMenuButton(
value: TrackOptionValue.delete, value: TrackOptionValue.delete,

View File

@ -27,7 +27,6 @@ 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';
@ -102,8 +101,7 @@ class PlayerView extends HookConsumerWidget {
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
headers: [ headers: [
SafeArea( SafeArea(
minimum: minimum: const EdgeInsets.only(top: 80),
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);
} }
}, },
items: (context) => [ children: [
for (final entry in sleepTimerEntries.entries) for (final entry in sleepTimerEntries.entries)
AdaptiveMenuButton( AdaptiveMenuButton(
value: entry.value, value: entry.value,

View File

@ -81,7 +81,6 @@ 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
], ],