mirror of
https://github.com/KRTirtho/spotube.git
synced 2025-09-13 07:55:18 +00:00

* feat: add riverpod based favorite album provider * feat: add album is saved, new releases and tracks providers * feat: add artist related providers * feat: add all categories providers * feat: add lyrics provider * feat: add playlist related providers * feat: add search provider * feat: add view and spotify friends provider * feat: add playlist create and update and favorite handlers * feat: use providers in home screen * chore: fix dart lint issues * feat: use new providers for playlist and albums screen * feat: use providers in artist page * feat: use providers on library page * feat: use provider for playlist and album card and heart button * feat: use provider in search page * feat: use providers in generate playlist * feat: use provider in lyrics screen * feat: use provider for create playlist * feat: use provider in add track dialog * feat: use providers in remaining pages and remove fl_query * fix: remove direct access to provider.value * fix: glitching when loading * fix: user album loading next page indicator * feat: make many provider autoDispose after 5 minutes of no usage * fix: ignore episodes in tracks
74 lines
2.2 KiB
Dart
74 lines
2.2 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import 'package:spotify/spotify.dart';
|
|
import 'package:spotube/extensions/context.dart';
|
|
|
|
final replaceDownloadedFileState = StateProvider<bool?>((ref) => null);
|
|
|
|
class ReplaceDownloadedDialog extends ConsumerWidget {
|
|
final Track track;
|
|
const ReplaceDownloadedDialog({required this.track, super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context, ref) {
|
|
final groupValue = ref.watch(replaceDownloadedFileState);
|
|
final theme = Theme.of(context);
|
|
final replaceAll = ref.watch(replaceDownloadedFileState);
|
|
|
|
return AlertDialog(
|
|
title: Text(context.l10n.track_exists(track.name ?? "")),
|
|
content: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(context.l10n.do_you_want_to_replace),
|
|
RadioListTile<bool>(
|
|
dense: true,
|
|
contentPadding: EdgeInsets.zero,
|
|
activeColor: theme.colorScheme.primary,
|
|
value: true,
|
|
groupValue: groupValue,
|
|
onChanged: (value) {
|
|
if (value != null) {
|
|
ref.read(replaceDownloadedFileState.notifier).state = true;
|
|
}
|
|
},
|
|
title: Text(context.l10n.replace_downloaded_tracks),
|
|
),
|
|
RadioListTile<bool>(
|
|
dense: true,
|
|
contentPadding: EdgeInsets.zero,
|
|
activeColor: theme.colorScheme.primary,
|
|
value: false,
|
|
groupValue: groupValue,
|
|
onChanged: (value) {
|
|
if (value != null) {
|
|
ref.read(replaceDownloadedFileState.notifier).state = false;
|
|
}
|
|
},
|
|
title: Text(context.l10n.skip_download_tracks),
|
|
),
|
|
],
|
|
),
|
|
actions: [
|
|
OutlinedButton(
|
|
onPressed: replaceAll == true
|
|
? null
|
|
: () {
|
|
Navigator.pop(context, false);
|
|
},
|
|
child: Text(context.l10n.skip),
|
|
),
|
|
FilledButton(
|
|
onPressed: replaceAll == false
|
|
? null
|
|
: () {
|
|
Navigator.pop(context, true);
|
|
},
|
|
child: Text(context.l10n.replace),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|