improve backup diagnostics and mobile sidebar
This commit is contained in:
@@ -123,7 +123,9 @@ class _BackupActionsMenuState extends State<_BackupActionsMenu> {
|
||||
final label = active
|
||||
? '${progress!.phase} $percentage%'
|
||||
: progress?.error != null
|
||||
? '数据备份失败'
|
||||
? progress!.phase.contains('恢复')
|
||||
? '数据恢复失败'
|
||||
: '数据备份失败'
|
||||
: '数据备份';
|
||||
return ShadPopover(
|
||||
controller: _controller,
|
||||
@@ -132,6 +134,51 @@ class _BackupActionsMenuState extends State<_BackupActionsMenu> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
if (progress?.error?.trim().isNotEmpty == true) ...[
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.all(10),
|
||||
decoration: BoxDecoration(
|
||||
color: ShadTheme.of(
|
||||
context,
|
||||
).colorScheme.destructive.withValues(alpha: 0.10),
|
||||
borderRadius: BorderRadius.circular(6),
|
||||
border: Border.all(
|
||||
color: ShadTheme.of(
|
||||
context,
|
||||
).colorScheme.destructive.withValues(alpha: 0.34),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'${progress!.phase}原因',
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: ShadTheme.of(context).colorScheme.destructive,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
ConstrainedBox(
|
||||
constraints: const BoxConstraints(maxHeight: 96),
|
||||
child: SingleChildScrollView(
|
||||
child: SelectableText(
|
||||
progress.error!,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
height: 1.35,
|
||||
color: ShadTheme.of(context).colorScheme.foreground,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 6),
|
||||
],
|
||||
_item(
|
||||
icon: Icons.save_alt_rounded,
|
||||
label: '导出数据',
|
||||
@@ -1200,6 +1247,8 @@ class _MediaLibraryPageState extends ConsumerState<MediaLibraryPage> {
|
||||
List<CloudFile> backups;
|
||||
try {
|
||||
backups = await notifier.cloudScrapedBackups();
|
||||
} catch (_) {
|
||||
return;
|
||||
} finally {
|
||||
if (mounted) setState(() => _backupBusy = false);
|
||||
}
|
||||
|
||||
@@ -1531,55 +1531,62 @@ class _SidebarTile extends StatelessWidget {
|
||||
final cs = ShadTheme.of(context).colorScheme;
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 6),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
onTap: onTap,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 140),
|
||||
child: Semantics(
|
||||
button: true,
|
||||
selected: selected,
|
||||
label: label,
|
||||
child: ShadButton.ghost(
|
||||
width: double.infinity,
|
||||
height: 42,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 9),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? const Color(0xFFFFB18A).withValues(alpha: 0.72)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? Colors.white.withValues(alpha: 0.36)
|
||||
: const Color(0xFFFFE4D2).withValues(alpha: 0.82),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
padding: EdgeInsets.zero,
|
||||
onPressed: onTap,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 140),
|
||||
height: 42,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 9),
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? const Color(0xFFFFB18A).withValues(alpha: 0.72)
|
||||
: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 28,
|
||||
height: 28,
|
||||
decoration: BoxDecoration(
|
||||
color: selected
|
||||
? Colors.white.withValues(alpha: 0.36)
|
||||
: const Color(0xFFFFE4D2).withValues(alpha: 0.82),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(icon, size: 17, color: cs.primary),
|
||||
),
|
||||
child: Icon(icon, size: 17, color: cs.primary),
|
||||
),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: selected ? FontWeight.w800 : FontWeight.w600,
|
||||
color: selected ? cs.foreground : cs.mutedForeground,
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
label,
|
||||
maxLines: 1,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: selected ? FontWeight.w800 : FontWeight.w600,
|
||||
color: selected ? cs.foreground : cs.mutedForeground,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (count != null)
|
||||
Text(
|
||||
count.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.mutedForeground,
|
||||
if (count != null)
|
||||
Text(
|
||||
count.toString(),
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: cs.mutedForeground,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user