scope cloud backups to dedicated folder

This commit is contained in:
ngfchl
2026-07-19 14:04:09 +08:00
parent c612e139c0
commit f3865a9a82
2 changed files with 112 additions and 82 deletions
+58 -60
View File
@@ -1281,66 +1281,17 @@ class _MediaLibraryPageState extends ConsumerState<MediaLibraryPage> {
height: (MediaQuery.sizeOf(dialogContext).height - 260)
.clamp(240.0, 360.0)
.toDouble(),
child: ListView.separated(
itemCount: backups.length,
separatorBuilder: (_, _) => const ShadSeparator.horizontal(),
itemBuilder: (itemContext, index) {
final backup = backups[index];
final cs = ShadTheme.of(itemContext).colorScheme;
return LayoutBuilder(
builder: (context, constraints) => ShadButton.ghost(
width: constraints.maxWidth,
expands: false,
padding: const EdgeInsets.symmetric(
horizontal: 10,
vertical: 9,
),
onPressed: () => Navigator.of(dialogContext).pop(backup),
child: Row(
children: [
Icon(
Icons.storage_rounded,
size: 18,
color: cs.mutedForeground,
),
const SizedBox(width: 10),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
backup.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: cs.foreground,
),
),
const SizedBox(height: 3),
Text(
'${backup.formattedSize} · ${backup.modifiedAt}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 11,
color: cs.mutedForeground,
),
),
],
),
),
Icon(
Icons.chevron_right_rounded,
color: cs.mutedForeground,
),
],
),
),
);
},
child: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
for (var index = 0; index < backups.length; index++) ...[
_cloudBackupRestoreRow(dialogContext, backup: backups[index]),
if (index < backups.length - 1)
const ShadSeparator.horizontal(),
],
],
),
),
),
),
@@ -1354,6 +1305,53 @@ class _MediaLibraryPageState extends ConsumerState<MediaLibraryPage> {
}
}
Widget _cloudBackupRestoreRow(
BuildContext context, {
required CloudFile backup,
}) {
final cs = ShadTheme.of(context).colorScheme;
return LayoutBuilder(
builder: (context, constraints) => ShadButton.ghost(
width: constraints.maxWidth,
expands: false,
padding: const EdgeInsets.symmetric(horizontal: 10, vertical: 9),
onPressed: () => Navigator.of(context).pop(backup),
child: Row(
children: [
Icon(Icons.storage_rounded, size: 18, color: cs.mutedForeground),
const SizedBox(width: 10),
Expanded(
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
backup.name,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 13,
fontWeight: FontWeight.w600,
color: cs.foreground,
),
),
const SizedBox(height: 3),
Text(
'${backup.formattedSize} · ${backup.modifiedAt}',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(fontSize: 11, color: cs.mutedForeground),
),
],
),
),
Icon(Icons.chevron_right_rounded, color: cs.mutedForeground),
],
),
),
);
}
Future<void> _searchTMDB(String query) async {
final text = query.trim();
if (text.isEmpty || _tmdbApiKey.isEmpty) return;