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",
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,

View File

@ -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,7 +59,8 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
Future<void> showDropdownMenu(BuildContext context, Offset position) async {
final mediaQuery = MediaQuery.of(context);
final childrenModified = children.map((s) {
List<MenuButton> childrenModified(BuildContext context) =>
items(context).map((s) {
if (s.onPressed == null) {
return MenuButton(
key: s.key,
@ -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,

View File

@ -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),

View File

@ -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,

View File

@ -366,7 +366,7 @@ class TrackOptions extends HookConsumerWidget {
),
),
],
children: [
items: (context) => [
if (isLocalTrack)
AdaptiveMenuButton(
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/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,

View File

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

View File

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