feat: 全量英文界面(i18n 翻译表接入全部页面与服务层文案)
This commit is contained in:
1 parent
2eb3f42731
commit
71e76b1c2b
26 files changed
+775
-325
No files matched your search
@@ -4,6 +4,7 @@ import 'package:image_picker/image_picker.dart';
|
||||
import 'package:path_provider/path_provider.dart';
|
||||
import 'dart:io';
|
||||
import '../../providers/wallpaper_provider.dart';
|
||||
import '../../core/l10n/strings.dart';
|
||||
|
||||
class WallpaperSettings extends StatelessWidget {
|
||||
const WallpaperSettings({super.key});
|
||||
@@ -15,7 +16,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('壁纸设置'),
|
||||
title: T('壁纸设置'),
|
||||
backgroundColor: theme.colorScheme.primary,
|
||||
foregroundColor: Colors.white,
|
||||
),
|
||||
@@ -42,8 +43,8 @@ class WallpaperSettings extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.wallpaper, size: 48, color: Colors.grey),
|
||||
SizedBox(height: 8),
|
||||
Text('当前为默认壁纸', style: TextStyle(color: Colors.grey)),
|
||||
Text('点击下方「选择图片」自定义', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
T('当前为默认壁纸', style: TextStyle(color: Colors.grey)),
|
||||
T('点击下方「选择图片」自定义', style: TextStyle(color: Colors.grey, fontSize: 12)),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -53,7 +54,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.check_circle, size: 48, color: Colors.white),
|
||||
SizedBox(height: 8),
|
||||
Text('自定义壁纸已应用', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)),
|
||||
T('自定义壁纸已应用', style: TextStyle(color: Colors.white, fontWeight: FontWeight.w600)),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -61,9 +62,9 @@ class WallpaperSettings extends StatelessWidget {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 选择图片
|
||||
const Text('选择壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
T('选择壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 4),
|
||||
const Text('从相册选择图片作为应用背景', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
T('从相册选择图片作为应用背景', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
const SizedBox(height: 12),
|
||||
FilledButton.icon(
|
||||
onPressed: () async {
|
||||
@@ -77,14 +78,14 @@ class WallpaperSettings extends StatelessWidget {
|
||||
await provider.setCustomWallpaper(savedPath);
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('壁纸已更新'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: T('壁纸已更新'), backgroundColor: Colors.green),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
icon: const Icon(Icons.photo_library),
|
||||
label: const Text('选择图片'),
|
||||
label: T('选择图片'),
|
||||
style: FilledButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
@@ -93,16 +94,16 @@ class WallpaperSettings extends StatelessWidget {
|
||||
const SizedBox(height: 24),
|
||||
|
||||
// 重置
|
||||
const Text('重置壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
T('重置壁纸', style: TextStyle(fontSize: 16, fontWeight: FontWeight.w600)),
|
||||
const SizedBox(height: 4),
|
||||
const Text('恢复默认壁纸', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
T('恢复默认壁纸', style: TextStyle(fontSize: 12, color: Colors.grey)),
|
||||
const SizedBox(height: 12),
|
||||
OutlinedButton.icon(
|
||||
onPressed: () {
|
||||
_showResetDialog(context, provider);
|
||||
},
|
||||
icon: const Icon(Icons.restore),
|
||||
label: const Text('恢复默认'),
|
||||
label: T('恢复默认'),
|
||||
style: OutlinedButton.styleFrom(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12, horizontal: 24),
|
||||
side: const BorderSide(color: Colors.red),
|
||||
@@ -131,7 +132,7 @@ class WallpaperSettings extends StatelessWidget {
|
||||
} catch (e) {
|
||||
if (context.mounted) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('保存失败,请重试')),
|
||||
const SnackBar(content: T('保存失败,请重试')),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -159,12 +160,12 @@ class WallpaperSettings extends StatelessWidget {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
title: const Text('确认重置'),
|
||||
content: const Text('确定要恢复默认壁纸吗?'),
|
||||
title: T('确认重置'),
|
||||
content: T('确定要恢复默认壁纸吗?'),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
child: const Text('取消'),
|
||||
child: T('取消'),
|
||||
),
|
||||
FilledButton(
|
||||
onPressed: () async {
|
||||
@@ -172,12 +173,12 @@ class WallpaperSettings extends StatelessWidget {
|
||||
if (context.mounted) {
|
||||
Navigator.pop(context);
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
const SnackBar(content: Text('已恢复默认壁纸'), backgroundColor: Colors.green),
|
||||
const SnackBar(content: T('已恢复默认壁纸'), backgroundColor: Colors.green),
|
||||
);
|
||||
}
|
||||
},
|
||||
style: FilledButton.styleFrom(backgroundColor: Colors.red),
|
||||
child: const Text('重置'),
|
||||
child: T('重置'),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user