refactor: playlist editor dialog

This commit is contained in:
Kingkor Roy Tirtho 2023-09-27 12:27:32 +06:00
parent 460f3471b5
commit 2eb3754953
3 changed files with 86 additions and 60 deletions

View File

@ -170,30 +170,27 @@ class PlaylistCreateDialog extends HookConsumerWidget {
return null; return null;
}, },
builder: (field) { builder: (field) {
return Center( return Column(
child: Stack(
children: [ children: [
UniversalImage( UniversalImage(
path: field.value?.path ?? path: field.value?.path ??
TypeConversionUtils.image_X_UrlString( TypeConversionUtils.image_X_UrlString(
updatingPlaylist?.images, updatingPlaylist?.images,
placeholder: placeholder: ImagePlaceholder.collection,
ImagePlaceholder.collection,
), ),
height: 200, height: 200,
), ),
Positioned( const SizedBox(height: 10),
bottom: 20, Row(
right: 20, mainAxisAlignment: MainAxisAlignment.center,
child: IconButton.filled( children: [
FilledButton.icon(
icon: const Icon(SpotubeIcons.edit), icon: const Icon(SpotubeIcons.edit),
style: IconButton.styleFrom( label: Text(
backgroundColor: field.value?.path != null ||
theme.colorScheme.surface, updatingPlaylist?.images != null
foregroundColor: ? context.l10n.change_cover
theme.colorScheme.primary, : context.l10n.add_cover,
elevation: 2,
shadowColor: theme.colorScheme.onSurface,
), ),
onPressed: () async { onPressed: () async {
final imageFile = await ImagePicker() final imageFile = await ImagePicker()
@ -207,31 +204,32 @@ class PlaylistCreateDialog extends HookConsumerWidget {
} }
}, },
), ),
const SizedBox(width: 10),
IconButton.filled(
icon: const Icon(SpotubeIcons.trash),
style: IconButton.styleFrom(
backgroundColor:
theme.colorScheme.errorContainer,
foregroundColor: theme.colorScheme.error,
), ),
if (field.hasError) onPressed: field.value == null
Positioned( ? null
bottom: 20, : () {
left: 20, field.didChange(null);
child: Container( field.validate();
padding: const EdgeInsets.symmetric( field.save();
horizontal: 8, },
vertical: 4,
),
decoration: BoxDecoration(
color: theme.colorScheme.error,
borderRadius: BorderRadius.circular(4),
),
child: Text(
field.errorText ?? "",
style: theme.textTheme.bodyMedium!
.copyWith(
color: theme.colorScheme.onError,
),
),
),
), ),
], ],
), ),
if (field.hasError)
Text(
field.errorText ?? "",
style: theme.textTheme.bodyMedium!.copyWith(
color: theme.colorScheme.error,
),
)
],
); );
}), }),
const SizedBox(height: 10), const SizedBox(height: 10),

View File

@ -265,5 +265,7 @@
"crunching_results": "Crunching results...", "crunching_results": "Crunching results...",
"search_to_get_results": "Search to get results", "search_to_get_results": "Search to get results",
"use_amoled_dark_theme": "Use AMOLED (Pitch Black) dark theme", "use_amoled_dark_theme": "Use AMOLED (Pitch Black) dark theme",
"normalize_audio": "Normalize audio" "normalize_audio": "Normalize audio",
"change_cover": "Change cover",
"add_cover": "Add cover"
} }

View File

@ -1,66 +1,92 @@
{ {
"ar": [ "ar": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"bn": [ "bn": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"ca": [ "ca": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"de": [ "de": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"es": [ "es": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"fr": [ "fr": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"hi": [ "hi": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"ja": [ "ja": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"pl": [ "pl": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"pt": [ "pt": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"ru": [ "ru": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"uk": [ "uk": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
], ],
"zh": [ "zh": [
"use_amoled_dark_theme", "use_amoled_dark_theme",
"normalize_audio" "normalize_audio",
"change_cover",
"add_cover"
] ]
} }