chore: settings popup menu constraints

This commit is contained in:
Kingkor Roy Tirtho 2025-01-23 21:11:59 +06:00
parent 082f711018
commit 768bab8bbb
2 changed files with 9 additions and 0 deletions

View File

@ -23,6 +23,9 @@ class AdaptiveSelectTile<T> extends HookWidget {
final bool? breakLayout;
final BoxConstraints? popupConstraints;
final PopoverConstraint? popupWidthConstraint;
const AdaptiveSelectTile({
required this.title,
required this.value,
@ -34,6 +37,8 @@ class AdaptiveSelectTile<T> extends HookWidget {
this.breakLayout,
this.showValueWhenUnfolded = true,
super.key,
this.popupConstraints,
this.popupWidthConstraint,
});
@override
@ -47,6 +52,8 @@ class AdaptiveSelectTile<T> extends HookWidget {
},
value: value,
onChanged: onChanged,
popupConstraints: popupConstraints ?? const BoxConstraints(maxWidth: 200),
popupWidthConstraint: popupWidthConstraint ?? PopoverConstraint.flexible,
children: options,
);

View File

@ -281,6 +281,7 @@ class SettingsPlaybackSection extends HookConsumerWidget {
),
if (preferences.audioSource != AudioSource.jiosaavn) ...[
AdaptiveSelectTile<SourceCodecs>(
popupConstraints: const BoxConstraints(maxWidth: 300),
secondary: const Icon(SpotubeIcons.stream),
title: Text(context.l10n.streaming_music_codec),
value: preferences.streamMusicCodec,
@ -300,6 +301,7 @@ class SettingsPlaybackSection extends HookConsumerWidget {
},
),
AdaptiveSelectTile<SourceCodecs>(
popupConstraints: const BoxConstraints(maxWidth: 300),
secondary: const Icon(SpotubeIcons.file),
title: Text(context.l10n.download_music_codec),
value: preferences.downloadMusicCodec,