generated from dellevin/template
书籍接口与界面
This commit is contained in:
@@ -49,16 +49,16 @@ class _BackupPageState extends State<BackupPage> {
|
||||
body: _isLoading
|
||||
? const Center(child: CircularProgressIndicator())
|
||||
: ListView(
|
||||
padding: const EdgeInsets.all(24),
|
||||
padding: const EdgeInsets.all(20),
|
||||
children: [
|
||||
// 自动备份开关 - 紧凑一行
|
||||
_buildAutoBackupSection(colors),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
// 手动备份
|
||||
_buildSectionTitle(colors, '手动备份'),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
_buildActionCard(
|
||||
colors: colors,
|
||||
title: '导出数据',
|
||||
@@ -68,7 +68,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
isLoading: _isExporting,
|
||||
onTap: _exportData,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
_buildActionCard(
|
||||
colors: colors,
|
||||
title: '导入数据',
|
||||
@@ -80,7 +80,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
isDestructive: true,
|
||||
),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 使用说明
|
||||
_buildInfoSection(colors),
|
||||
@@ -126,7 +126,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
bool isDestructive = false,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -137,23 +137,19 @@ class _BackupPageState extends State<BackupPage> {
|
||||
Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(
|
||||
color: isDestructive ? Colors.red.withOpacity(0.3) : colors.outline,
|
||||
width: 0.5,
|
||||
),
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Icon(
|
||||
icon,
|
||||
size: 22,
|
||||
size: 18,
|
||||
color: isDestructive ? Colors.red : colors.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 16),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
@@ -161,18 +157,18 @@ class _BackupPageState extends State<BackupPage> {
|
||||
Text(
|
||||
title,
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colors.onSurface,
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 4),
|
||||
const SizedBox(height: 1),
|
||||
Text(
|
||||
description,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: colors.onSurface.withValues(alpha: 0.6),
|
||||
height: 1.4,
|
||||
fontSize: 11,
|
||||
color: colors.onSurface.withValues(alpha: 0.4),
|
||||
height: 1.3,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -180,12 +176,12 @@ class _BackupPageState extends State<BackupPage> {
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
const SizedBox(height: 12),
|
||||
GestureDetector(
|
||||
onTap: isLoading ? null : onTap,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: isLoading ? colors.onSurface.withValues(alpha: 0.25) : colors.primary,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -193,8 +189,8 @@ class _BackupPageState extends State<BackupPage> {
|
||||
child: Center(
|
||||
child: isLoading
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
valueColor: AlwaysStoppedAnimation(colors.onPrimary),
|
||||
@@ -203,7 +199,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
: Text(
|
||||
buttonText,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colors.onPrimary,
|
||||
),
|
||||
@@ -219,7 +215,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
/// 构建信息说明区域
|
||||
Widget _buildInfoSection(ColorScheme colors) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(20),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -233,9 +229,8 @@ class _BackupPageState extends State<BackupPage> {
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: Border.all(color: colors.outline, width: 0.5),
|
||||
),
|
||||
child: Icon(
|
||||
Icons.info_outline,
|
||||
@@ -243,60 +238,47 @@ class _BackupPageState extends State<BackupPage> {
|
||||
color: colors.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
'使用说明',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: colors.onSurface,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildInfoItem(colors, '1', '导出数据会生成一个 .zip 文件,包含所有数据和图片'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoItem(colors, '2', '选择保存路径后,可以通过微信、邮件等方式发送备份文件'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoItem(colors, '3', '在新设备上选择导入数据,选择备份文件即可恢复'),
|
||||
const SizedBox(height: 12),
|
||||
_buildInfoItem(colors, '4', '导入数据会完全覆盖当前设备的数据,请谨慎操作'),
|
||||
_buildInfoItem(colors, '导出数据会生成一个 .zip 文件,包含所有数据和图片'),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoItem(colors, '选择保存路径后,可以通过微信、邮件等方式发送备份文件'),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoItem(colors, '在新设备上选择导入数据,选择备份文件即可恢复'),
|
||||
const SizedBox(height: 8),
|
||||
_buildInfoItem(colors, '导入数据会完全覆盖当前设备的数据,请谨慎操作'),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建信息项
|
||||
Widget _buildInfoItem(ColorScheme colors, String number, String text) {
|
||||
Widget _buildInfoItem(ColorScheme colors, String text) {
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Container(
|
||||
width: 20,
|
||||
height: 20,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.outline,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
number,
|
||||
style: TextStyle(
|
||||
fontSize: 11,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: colors.onSurface.withValues(alpha: 0.6),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 8),
|
||||
child: Icon(Icons.circle,
|
||||
size: 4, color: colors.onSurface.withValues(alpha: 0.25)),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
color: colors.onSurface.withValues(alpha: 0.6),
|
||||
color: colors.onSurface.withValues(alpha: 0.5),
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
@@ -318,29 +300,17 @@ class _BackupPageState extends State<BackupPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
title: Column(
|
||||
children: [
|
||||
Container(
|
||||
width: 48,
|
||||
height: 48,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Icon(Icons.check, color: colors.primary, size: 24),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 17, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
],
|
||||
),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
titlePadding: const EdgeInsets.fromLTRB(24, 24, 24, 0),
|
||||
content: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
Icon(Icons.check_circle_outline, color: colors.primary, size: 40),
|
||||
const SizedBox(height: 16),
|
||||
Text(
|
||||
content,
|
||||
style: TextStyle(
|
||||
@@ -370,13 +340,17 @@ class _BackupPageState extends State<BackupPage> {
|
||||
contentPadding: const EdgeInsets.fromLTRB(24, 0, 24, 0),
|
||||
actionsPadding: const EdgeInsets.fromLTRB(16, 20, 16, 16),
|
||||
actions: [
|
||||
TextButton(
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(ctx),
|
||||
style: TextButton.styleFrom(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.primary,
|
||||
foregroundColor: colors.onPrimary,
|
||||
elevation: 0,
|
||||
minimumSize: const Size(120, 40),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: Text('确定', style: TextStyle(fontSize: 14, color: colors.primary)),
|
||||
child: const Text('确定', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -426,14 +400,14 @@ class _BackupPageState extends State<BackupPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.08),
|
||||
color: Colors.red.withValues(alpha: 0.08),
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
),
|
||||
child: const Icon(Icons.warning_amber_rounded, color: Colors.red, size: 22),
|
||||
@@ -441,7 +415,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
const SizedBox(width: 12),
|
||||
Text('确认导入',
|
||||
style: TextStyle(
|
||||
fontSize: 17, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
],
|
||||
),
|
||||
titlePadding: const EdgeInsets.fromLTRB(24, 24, 24, 0),
|
||||
@@ -459,21 +433,22 @@ class _BackupPageState extends State<BackupPage> {
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
foregroundColor: colors.onSurface.withValues(alpha: 0.6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: Text('取消',
|
||||
style: TextStyle(
|
||||
color: colors.onSurface.withValues(alpha: 0.6), fontSize: 14)),
|
||||
child: const Text('取消', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
TextButton(
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.error,
|
||||
foregroundColor: colors.onError,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
|
||||
),
|
||||
child: const Text('确认导入',
|
||||
style: TextStyle(color: Colors.red, fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
child: const Text('确认导入', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -520,7 +495,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
/// 构建自动备份区域 - 紧凑一行
|
||||
Widget _buildAutoBackupSection(ColorScheme colors) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
@@ -529,17 +504,16 @@ class _BackupPageState extends State<BackupPage> {
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
border: Border.all(color: colors.outline, width: 0.5),
|
||||
),
|
||||
child: Icon(Icons.schedule,
|
||||
size: 20, color: colors.onSurface.withValues(alpha: 0.6)),
|
||||
size: 18, color: colors.onSurface.withValues(alpha: 0.6)),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: _backupDirPath != null && _autoBackupEnabled
|
||||
? Column(
|
||||
@@ -548,7 +522,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
Text(
|
||||
'自动本地备份',
|
||||
style: TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w600, color: colors.onSurface),
|
||||
fontSize: 13, fontWeight: FontWeight.w500, color: colors.onSurface),
|
||||
),
|
||||
const SizedBox(height: 2),
|
||||
Text(
|
||||
@@ -563,7 +537,7 @@ class _BackupPageState extends State<BackupPage> {
|
||||
: Text(
|
||||
'自动本地备份',
|
||||
style: TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w600, color: colors.onSurface),
|
||||
fontSize: 13, fontWeight: FontWeight.w500, color: colors.onSurface),
|
||||
),
|
||||
),
|
||||
Switch(
|
||||
|
||||
@@ -15,7 +15,7 @@ class CloudSyncPage extends StatelessWidget {
|
||||
padding: const EdgeInsets.all(20),
|
||||
children: [
|
||||
_buildSectionTitle(colors, '选择备份方式'),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
_buildOption(
|
||||
colors: colors,
|
||||
icon: Icons.storage_outlined,
|
||||
@@ -24,7 +24,7 @@ class CloudSyncPage extends StatelessWidget {
|
||||
onTap: () =>
|
||||
Navigator.push(context, MaterialPageRoute(builder: (_) => const WebDAVSyncPage())),
|
||||
),
|
||||
const SizedBox(height: 28),
|
||||
const SizedBox(height: 20),
|
||||
_buildInfo(colors),
|
||||
],
|
||||
),
|
||||
@@ -40,7 +40,7 @@ class CloudSyncPage extends StatelessWidget {
|
||||
BoxDecoration(color: colors.primary, borderRadius: BorderRadius.circular(2))),
|
||||
const SizedBox(width: 8),
|
||||
Text(title,
|
||||
style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
style: TextStyle(fontSize: 13, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -55,10 +55,10 @@ class CloudSyncPage extends StatelessWidget {
|
||||
return GestureDetector(
|
||||
onTap: enabled ? onTap : null,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: enabled ? colors.surface : colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
@@ -68,27 +68,27 @@ class CloudSyncPage extends StatelessWidget {
|
||||
),
|
||||
child: Row(children: [
|
||||
Container(
|
||||
width: 44,
|
||||
height: 44,
|
||||
width: 36,
|
||||
height: 36,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest, borderRadius: BorderRadius.circular(10)),
|
||||
color: colors.surfaceContainerHighest, borderRadius: BorderRadius.circular(8)),
|
||||
child: Icon(icon,
|
||||
color: enabled
|
||||
? colors.onSurface.withValues(alpha: 0.6)
|
||||
: colors.onSurface.withValues(alpha: 0.3),
|
||||
size: 22)),
|
||||
const SizedBox(width: 14),
|
||||
size: 20)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Text(title,
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w500,
|
||||
color: enabled ? colors.onSurface : colors.onSurface.withValues(alpha: 0.3))),
|
||||
const SizedBox(height: 3),
|
||||
const SizedBox(height: 2),
|
||||
Text(subtitle,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
fontSize: 11,
|
||||
color: enabled
|
||||
? colors.onSurface.withValues(alpha: 0.4)
|
||||
: colors.onSurface.withValues(alpha: 0.25))),
|
||||
@@ -104,10 +104,10 @@ class CloudSyncPage extends StatelessWidget {
|
||||
|
||||
Widget _buildInfo(ColorScheme colors) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(18),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surface,
|
||||
borderRadius: BorderRadius.circular(14),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.03),
|
||||
@@ -118,8 +118,8 @@ class CloudSyncPage extends StatelessWidget {
|
||||
child: Column(crossAxisAlignment: CrossAxisAlignment.start, children: [
|
||||
Row(children: [
|
||||
Container(
|
||||
width: 36,
|
||||
height: 36,
|
||||
width: 32,
|
||||
height: 32,
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest, borderRadius: BorderRadius.circular(8)),
|
||||
child: Icon(Icons.info_outline,
|
||||
@@ -127,9 +127,9 @@ class CloudSyncPage extends StatelessWidget {
|
||||
const SizedBox(width: 10),
|
||||
Text('使用说明',
|
||||
style: TextStyle(
|
||||
fontSize: 14, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
fontSize: 13, fontWeight: FontWeight.w500, color: colors.onSurface)),
|
||||
]),
|
||||
const SizedBox(height: 14),
|
||||
const SizedBox(height: 12),
|
||||
_infoItem(colors, 'WebDAV 备份:将数据备份到支持 WebDAV 的云盘'),
|
||||
const SizedBox(height: 8),
|
||||
_infoItem(colors, '建议定期备份到本地或云盘'),
|
||||
|
||||
@@ -149,7 +149,7 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Column(
|
||||
children: [
|
||||
Container(
|
||||
@@ -270,19 +270,19 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
return AlertDialog(
|
||||
backgroundColor: colors.surface,
|
||||
elevation: 0,
|
||||
shape: const RoundedRectangleBorder(borderRadius: BorderRadius.zero),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: Row(
|
||||
children: [
|
||||
Container(
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withOpacity(0.08), borderRadius: BorderRadius.circular(10)),
|
||||
color: Colors.red.withValues(alpha: 0.08), borderRadius: BorderRadius.circular(10)),
|
||||
child: const Icon(Icons.warning_amber_rounded, color: Colors.red, size: 22),
|
||||
),
|
||||
const SizedBox(width: 12),
|
||||
Text('清除配置',
|
||||
style: TextStyle(fontSize: 17, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
style: TextStyle(fontSize: 18, fontWeight: FontWeight.w600, color: colors.onSurface)),
|
||||
],
|
||||
),
|
||||
titlePadding: const EdgeInsets.fromLTRB(24, 24, 24, 0),
|
||||
@@ -297,18 +297,20 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(ctx, false),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
foregroundColor: colors.onSurface.withValues(alpha: 0.6),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
child: Text('取消',
|
||||
style: TextStyle(color: colors.onSurface.withValues(alpha: 0.6), fontSize: 14)),
|
||||
child: const Text('取消', style: TextStyle(fontSize: 14)),
|
||||
),
|
||||
TextButton(
|
||||
ElevatedButton(
|
||||
onPressed: () => Navigator.pop(ctx, true),
|
||||
style: TextButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: colors.error,
|
||||
foregroundColor: colors.onError,
|
||||
elevation: 0,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8))),
|
||||
child: const Text('清除',
|
||||
style: TextStyle(color: Colors.red, fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
child: const Text('清除', style: TextStyle(fontSize: 14, fontWeight: FontWeight.w600)),
|
||||
),
|
||||
],
|
||||
);
|
||||
@@ -340,30 +342,30 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
body: _isLoading && !_isConfigured
|
||||
? Center(child: CircularProgressIndicator(strokeWidth: 2, color: colors.primary))
|
||||
: ListView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
children: [
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 4),
|
||||
|
||||
// 已连接提示
|
||||
if (_isConfigured) _buildConnectedBanner(colors),
|
||||
|
||||
// 服务器配置
|
||||
_buildSectionLabel(colors, '服务器配置'),
|
||||
const SizedBox(height: 16),
|
||||
const SizedBox(height: 12),
|
||||
_buildInput(
|
||||
colors: colors,
|
||||
controller: _urlController,
|
||||
hint: '服务器地址,如 https://dav.example.com',
|
||||
icon: Icons.link,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
_buildInput(
|
||||
colors: colors,
|
||||
controller: _usernameController,
|
||||
hint: '用户名',
|
||||
icon: Icons.person_outline,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
_buildInput(
|
||||
colors: colors,
|
||||
controller: _passwordController,
|
||||
@@ -378,23 +380,42 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
color: colors.onSurface.withValues(alpha: 0.3)),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 8),
|
||||
_buildInput(
|
||||
colors: colors,
|
||||
controller: _pathController,
|
||||
hint: '同步路径,如 /mooknote',
|
||||
icon: Icons.folder_outlined,
|
||||
),
|
||||
const SizedBox(height: 24),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
// 测试并保存
|
||||
_buildBtn(colors, '测试并保存', onTap: _isLoading ? null : _saveConfig),
|
||||
const SizedBox(height: 40),
|
||||
const SizedBox(height: 28),
|
||||
|
||||
if (_isConfigured) ...[
|
||||
// 手动同步
|
||||
_buildSectionLabel(colors, '手动同步'),
|
||||
const SizedBox(height: 12),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildDirectionChip(
|
||||
colors, '上传到云端', SyncDirection.upload, Icons.upload)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildDirectionChip(
|
||||
colors, '下载到本地', SyncDirection.download, Icons.download)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
_buildBtn(colors, '立即同步', onTap: _isLoading ? null : _syncData, loading: _isLoading),
|
||||
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 自动同步
|
||||
_buildSectionLabel(colors, '自动同步'),
|
||||
const SizedBox(height: 12),
|
||||
const SizedBox(height: 10),
|
||||
_buildSwitchRow(
|
||||
colors: colors,
|
||||
icon: Icons.sync,
|
||||
@@ -413,35 +434,16 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
),
|
||||
],
|
||||
|
||||
const SizedBox(height: 32),
|
||||
|
||||
// 手动同步
|
||||
_buildSectionLabel(colors, '手动同步'),
|
||||
const SizedBox(height: 16),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildDirectionChip(
|
||||
colors, '上传到云端', SyncDirection.upload, Icons.upload)),
|
||||
const SizedBox(width: 12),
|
||||
Expanded(
|
||||
child: _buildDirectionChip(
|
||||
colors, '下载到本地', SyncDirection.download, Icons.download)),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
_buildBtn(colors, '立即同步', onTap: _isLoading ? null : _syncData, loading: _isLoading),
|
||||
|
||||
const SizedBox(height: 32),
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 清除配置
|
||||
_buildTextBtn(colors, '清除配置', onTap: _isLoading ? null : _clearConfig),
|
||||
const SizedBox(height: 8),
|
||||
const SizedBox(height: 4),
|
||||
],
|
||||
|
||||
const SizedBox(height: 32),
|
||||
const SizedBox(height: 24),
|
||||
_buildTips(colors),
|
||||
const SizedBox(height: 60),
|
||||
const SizedBox(height: 40),
|
||||
],
|
||||
),
|
||||
);
|
||||
@@ -451,8 +453,8 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
|
||||
Widget _buildConnectedBanner(ColorScheme colors) {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(bottom: 24),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10),
|
||||
margin: const EdgeInsets.only(bottom: 16),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHighest,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
@@ -525,7 +527,7 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderSide: BorderSide(color: colors.primary, width: 1),
|
||||
),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 15),
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 14, vertical: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -536,21 +538,21 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: disabled ? colors.onSurface.withValues(alpha: 0.15) : colors.primary,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Center(
|
||||
child: loading
|
||||
? SizedBox(
|
||||
width: 20,
|
||||
height: 20,
|
||||
width: 18,
|
||||
height: 18,
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2, valueColor: AlwaysStoppedAnimation(colors.onPrimary)))
|
||||
: Text(text,
|
||||
style: TextStyle(
|
||||
fontSize: 15, fontWeight: FontWeight.w600, color: colors.onPrimary)),
|
||||
fontSize: 14, fontWeight: FontWeight.w500, color: colors.onPrimary)),
|
||||
),
|
||||
),
|
||||
);
|
||||
@@ -561,7 +563,7 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
onTap: onTap,
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
padding: const EdgeInsets.symmetric(vertical: 8),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(
|
||||
@@ -583,22 +585,22 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
required ValueChanged<bool>? onChanged,
|
||||
}) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(icon,
|
||||
size: 20,
|
||||
size: 18,
|
||||
color: value ? colors.primary : colors.onSurface.withValues(alpha: 0.3)),
|
||||
const SizedBox(width: 12),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Text(
|
||||
value ? sub : label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontSize: 13,
|
||||
color: value ? colors.onSurface.withValues(alpha: 0.6) : colors.onSurface),
|
||||
),
|
||||
),
|
||||
@@ -624,19 +626,19 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
return GestureDetector(
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 8),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
const SizedBox(width: 32),
|
||||
const SizedBox(width: 28),
|
||||
Text(label,
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.4))),
|
||||
style: TextStyle(fontSize: 13, color: colors.onSurface.withValues(alpha: 0.4))),
|
||||
const Spacer(),
|
||||
Text(value,
|
||||
style: TextStyle(fontSize: 14, color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
style: TextStyle(fontSize: 13, color: colors.onSurface.withValues(alpha: 0.6))),
|
||||
const SizedBox(width: 4),
|
||||
Icon(Icons.chevron_right,
|
||||
size: 16, color: colors.onSurface.withValues(alpha: 0.25)),
|
||||
@@ -651,10 +653,10 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
return GestureDetector(
|
||||
onTap: () => setState(() => _syncDirection = dir),
|
||||
child: Container(
|
||||
padding: const EdgeInsets.symmetric(vertical: 14),
|
||||
padding: const EdgeInsets.symmetric(vertical: 10),
|
||||
decoration: BoxDecoration(
|
||||
color: selected ? colors.primary : colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
@@ -680,7 +682,7 @@ class _WebDAVSyncPageState extends State<WebDAVSyncPage> {
|
||||
|
||||
Widget _buildTips(ColorScheme colors) {
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
padding: const EdgeInsets.all(14),
|
||||
decoration: BoxDecoration(
|
||||
color: colors.surfaceContainerHigh,
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
|
||||
Reference in New Issue
Block a user