mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-12 23:45:18 +00:00
fix(mobile): dialogs in bottom sheet are not opening
This commit is contained in:
parent
e986baa0aa
commit
8fc319d980
@ -3,4 +3,17 @@
|
||||
to allow setting breakpoints, to provide hot reload, etc.
|
||||
-->
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<application
|
||||
android:name="${applicationName}"
|
||||
android:allowBackup="false"
|
||||
android:fullBackupContent="false"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name_en"
|
||||
android:requestLegacyExternalStorage="true"
|
||||
android:usesCleartextTraffic="true">
|
||||
<!-- Disable Impeller -->
|
||||
<meta-data
|
||||
android:name="io.flutter.embedding.android.EnableImpeller"
|
||||
android:value="false" />
|
||||
</application>
|
||||
</manifest>
|
@ -1,4 +1,3 @@
|
||||
import 'package:flutter/material.dart' show showModalBottomSheet;
|
||||
import 'package:shadcn_flutter/shadcn_flutter.dart';
|
||||
import 'package:shadcn_flutter/shadcn_flutter_extension.dart';
|
||||
import 'package:spotube/collections/spotube_icons.dart';
|
||||
@ -26,7 +25,7 @@ class AdaptiveMenuButton<T> extends MenuButton {
|
||||
|
||||
/// An adaptive widget that shows a [PopupMenuButton] when screen size is above
|
||||
/// or equal to 640px
|
||||
/// In smaller screen, a [IconButton] with a [showModalBottomSheet] is shown
|
||||
/// In smaller screen, a [IconButton] with a [openDrawer] is shown
|
||||
class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
final List<AdaptiveMenuButton<T>> Function(BuildContext context) items;
|
||||
final Widget? icon;
|
||||
@ -102,15 +101,13 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
return;
|
||||
}
|
||||
|
||||
showModalBottomSheet(
|
||||
await openDrawer(
|
||||
context: context,
|
||||
enableDrag: true,
|
||||
draggable: true,
|
||||
showDragHandle: true,
|
||||
useRootNavigator: true,
|
||||
shape: RoundedRectangleBorder(
|
||||
position: OverlayPosition.bottom,
|
||||
borderRadius: context.theme.borderRadiusMd,
|
||||
),
|
||||
backgroundColor: context.theme.colorScheme.card,
|
||||
transformBackdrop: false,
|
||||
builder: (context) {
|
||||
final children = childrenModified(context);
|
||||
return ListView.builder(
|
||||
@ -127,7 +124,7 @@ class AdaptivePopSheetList<T> extends StatelessWidget {
|
||||
onPressed: () {
|
||||
data.onPressed?.call(context);
|
||||
if (data.autoClose) {
|
||||
Navigator.of(context).pop();
|
||||
closeDrawer(context);
|
||||
}
|
||||
},
|
||||
leading: data.leading,
|
||||
|
@ -74,6 +74,26 @@ class TrackPresentationActionsSection extends HookConsumerWidget {
|
||||
ref.watch(presentationStateProvider(options.collection).notifier);
|
||||
final selectedTracks = state.selectedTracks;
|
||||
|
||||
Future<void> actionDownloadTracks({
|
||||
required BuildContext context,
|
||||
required List<Track> tracks,
|
||||
required String action,
|
||||
}) async {
|
||||
final confirmed = audioSource == AudioSource.piped ||
|
||||
(await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const ConfirmDownloadDialog();
|
||||
},
|
||||
) ??
|
||||
false);
|
||||
if (confirmed != true) return;
|
||||
downloader.batchAddToQueue(tracks);
|
||||
notifier.deselectAllTracks();
|
||||
if (!context.mounted) return;
|
||||
showToastForAction(context, action, tracks.length);
|
||||
}
|
||||
|
||||
return AdaptivePopSheetList(
|
||||
tooltip: context.l10n.more_actions,
|
||||
headings: [
|
||||
@ -95,22 +115,12 @@ class TrackPresentationActionsSection extends HookConsumerWidget {
|
||||
|
||||
switch (action) {
|
||||
case "download":
|
||||
{
|
||||
final confirmed = audioSource == AudioSource.piped ||
|
||||
(await showDialog<bool?>(
|
||||
await actionDownloadTracks(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return const ConfirmDownloadDialog();
|
||||
},
|
||||
) ??
|
||||
false);
|
||||
if (confirmed != true) return;
|
||||
downloader.batchAddToQueue(tracks);
|
||||
notifier.deselectAllTracks();
|
||||
if (!context.mounted) return;
|
||||
showToastForAction(context, action, tracks.length);
|
||||
tracks: tracks,
|
||||
action: action,
|
||||
);
|
||||
break;
|
||||
}
|
||||
case "add-to-playlist":
|
||||
{
|
||||
if (context.mounted) {
|
||||
|
@ -57,7 +57,7 @@ class TrackPresentationTopSection extends HookConsumerWidget {
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(
|
||||
child: Text(context.l10n.shuffle_playlist),
|
||||
),
|
||||
).call,
|
||||
child: IconButton.secondary(
|
||||
icon: isLoading
|
||||
? const Center(
|
||||
@ -73,7 +73,7 @@ class TrackPresentationTopSection extends HookConsumerWidget {
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(
|
||||
child: Text(context.l10n.add_to_queue),
|
||||
),
|
||||
).call,
|
||||
child: IconButton.secondary(
|
||||
icon: const Icon(SpotubeIcons.queueAdd),
|
||||
enabled: !isLoading && !isActive,
|
||||
@ -126,7 +126,7 @@ class TrackPresentationTopSection extends HookConsumerWidget {
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(
|
||||
child: Text(context.l10n.share),
|
||||
),
|
||||
).call,
|
||||
child: IconButton.outline(
|
||||
icon: const Icon(SpotubeIcons.share),
|
||||
size: ButtonSize.small,
|
||||
|
@ -91,24 +91,14 @@ class TrackOptions extends HookConsumerWidget {
|
||||
) {
|
||||
/// showDialog doesn't work for some reason. So we have to
|
||||
/// manually push a Dialog Route in the Navigator to get it working
|
||||
Navigator.push(
|
||||
context,
|
||||
DialogRoute(
|
||||
alignment: Alignment.bottomCenter,
|
||||
transitionBuilder: (context, animation, secondaryAnimation, child) {
|
||||
return FadeTransition(opacity: animation, child: child);
|
||||
},
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierColor: Colors.black.withValues(alpha: 0.5),
|
||||
builder: (context) {
|
||||
return Center(
|
||||
child: PlaylistAddTrackDialog(
|
||||
return PlaylistAddTrackDialog(
|
||||
tracks: [track],
|
||||
openFromPlaylist: playlistId,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@ -338,6 +328,7 @@ class TrackOptions extends HookConsumerWidget {
|
||||
}
|
||||
},
|
||||
icon: icon ?? const Icon(SpotubeIcons.moreHorizontal),
|
||||
variance: ButtonVariance.outline,
|
||||
headings: [
|
||||
Basic(
|
||||
leading: AspectRatio(
|
||||
|
@ -132,7 +132,7 @@ class PlayerView extends HookConsumerWidget {
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(
|
||||
child: Text(context.l10n.details),
|
||||
),
|
||||
).call,
|
||||
child: IconButton.ghost(
|
||||
icon: const Icon(SpotubeIcons.info, size: 18),
|
||||
onPressed: currentTrack == null
|
||||
|
@ -82,7 +82,7 @@ class PlayerActions extends HookConsumerWidget {
|
||||
children: [
|
||||
if (showQueue)
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(child: Text(context.l10n.queue)),
|
||||
tooltip: TooltipContainer(child: Text(context.l10n.queue)).call,
|
||||
child: IconButton.ghost(
|
||||
icon: const Icon(SpotubeIcons.queue),
|
||||
enabled: playlist.activeTrack != null,
|
||||
@ -119,7 +119,8 @@ class PlayerActions extends HookConsumerWidget {
|
||||
if (!isLocalTrack)
|
||||
Tooltip(
|
||||
tooltip: TooltipContainer(
|
||||
child: Text(context.l10n.alternative_track_sources)),
|
||||
child: Text(context.l10n.alternative_track_sources),
|
||||
).call,
|
||||
child: IconButton.ghost(
|
||||
enabled: playlist.activeTrack != null,
|
||||
icon: const Icon(SpotubeIcons.alternativeRoute),
|
||||
@ -160,7 +161,8 @@ class PlayerActions extends HookConsumerWidget {
|
||||
else
|
||||
Tooltip(
|
||||
tooltip:
|
||||
TooltipContainer(child: Text(context.l10n.download_track)),
|
||||
TooltipContainer(child: Text(context.l10n.download_track))
|
||||
.call,
|
||||
child: IconButton.ghost(
|
||||
icon: Icon(
|
||||
isDownloaded ? SpotubeIcons.done : SpotubeIcons.download,
|
||||
|
Loading…
Reference in New Issue
Block a user