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;
},
builder: (field) {
return Center(
child: Stack(
return Column(
children: [
UniversalImage(
path: field.value?.path ??
TypeConversionUtils.image_X_UrlString(
updatingPlaylist?.images,
placeholder:
ImagePlaceholder.collection,
placeholder: ImagePlaceholder.collection,
),
height: 200,
),
Positioned(
bottom: 20,
right: 20,
child: IconButton.filled(
const SizedBox(height: 10),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
FilledButton.icon(
icon: const Icon(SpotubeIcons.edit),
style: IconButton.styleFrom(
backgroundColor:
theme.colorScheme.surface,
foregroundColor:
theme.colorScheme.primary,
elevation: 2,
shadowColor: theme.colorScheme.onSurface,
label: Text(
field.value?.path != null ||
updatingPlaylist?.images != null
? context.l10n.change_cover
: context.l10n.add_cover,
),
onPressed: () async {
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)
Positioned(
bottom: 20,
left: 20,
child: Container(
padding: const EdgeInsets.symmetric(
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,
),
),
),
onPressed: field.value == null
? null
: () {
field.didChange(null);
field.validate();
field.save();
},
),
],
),
if (field.hasError)
Text(
field.errorText ?? "",
style: theme.textTheme.bodyMedium!.copyWith(
color: theme.colorScheme.error,
),
)
],
);
}),
const SizedBox(height: 10),

View File

@ -265,5 +265,7 @@
"crunching_results": "Crunching results...",
"search_to_get_results": "Search to get results",
"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": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"bn": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"ca": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"de": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"es": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"fr": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"hi": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"ja": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"pl": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"pt": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"ru": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"uk": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
],
"zh": [
"use_amoled_dark_theme",
"normalize_audio"
"normalize_audio",
"change_cover",
"add_cover"
]
}