Skip to content

Commit

Permalink
Update settings constants and refactor settings page to use new local…
Browse files Browse the repository at this point in the history
…ized strings; increment app version to v2.0.0.
  • Loading branch information
DargonLee committed Jan 6, 2025
1 parent fcbbc08 commit ab7eb85
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 16 deletions.
26 changes: 25 additions & 1 deletion lib/model/settings_constants.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
class SettingsConstants {
static const String appVersion = 'v1.0.0';
static const String aboutTitle = '关于';
static const String appVersion = 'v2.0.0';
static const String githubUrl = 'https://github.com/DargonLee/easy_pasta';
static const String versionInfoTitle = '版本信息';
static const String versionInfoSubtitle = '查看版本和项目信息';

static const String basicSettingsTitle = '基本设置';
// 快捷键
static const String hotkeyTitle = '快捷键';
static const String hotkeySubtitle = '设置全局快捷键';

// 开机自启
static const String autoLaunchTitle = '开机自启';
static const String autoLaunchSubtitle = '系统启动时自动运行';

// 最大存储
static const String maxStorageTitle = '最大存储';
static const String maxStorageSubtitle = '设置最大存储条数';

// 清除记录
static const String clearDataTitle = '清除记录';
static const String clearDataSubtitle = '删除所有剪贴板记录';

// 退出应用
static const String exitAppTitle = '退出应用';
static const String exitAppSubtitle = '完全退出应用程序';

// Dialog texts
static const String clearConfirmTitle = '确认清除';
Expand Down
30 changes: 15 additions & 15 deletions lib/page/settings_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'package:easy_pasta/model/settings_model.dart';
import 'package:easy_pasta/core/settings_service.dart';
import 'package:easy_pasta/widget/settting_page_widgets.dart';
import 'package:easy_pasta/page/confirm_dialog_view.dart';

import 'package:easy_pasta/model/settings_constants.dart';
class SettingsPage extends StatefulWidget {
const SettingsPage({Key? key}) : super(key: key);

Expand All @@ -20,34 +20,34 @@ class _SettingsPageState extends State<SettingsPage> {
final List<SettingItem> _basicSettings = [
const SettingItem(
type: SettingType.hotkey,
title: '快捷键',
subtitle: '设置全局快捷键',
title: SettingsConstants.hotkeyTitle,
subtitle: SettingsConstants.hotkeySubtitle,
icon: Icons.keyboard,
),
const SettingItem(
type: SettingType.autoLaunch,
title: '开机自启',
subtitle: '系统启动时自动运行',
title: SettingsConstants.autoLaunchTitle,
subtitle: SettingsConstants.autoLaunchSubtitle,
icon: Icons.launch,
),
const SettingItem(
type: SettingType.maxStorage,
title: '最大存储',
subtitle: '设置最大存储条数',
title: SettingsConstants.maxStorageTitle,
subtitle: SettingsConstants.maxStorageSubtitle,
icon: Icons.storage,
),
const SettingItem(
type: SettingType.clearData,
title: '清除记录',
subtitle: '删除所有剪贴板记录',
title: SettingsConstants.clearDataTitle,
subtitle: SettingsConstants.clearDataSubtitle,
icon: Icons.delete_outline,
iconColor: Colors.red,
textColor: Colors.red,
),
const SettingItem(
type: SettingType.exitApp,
title: '退出应用',
subtitle: '完全退出应用程序',
title: SettingsConstants.exitAppTitle,
subtitle: SettingsConstants.exitAppSubtitle,
icon: Icons.exit_to_app,
iconColor: Colors.red,
textColor: Colors.red,
Expand Down Expand Up @@ -78,17 +78,17 @@ class _SettingsPageState extends State<SettingsPage> {
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
children: [
_buildSection(
title: '基本设置',
title: SettingsConstants.basicSettingsTitle,
items: _basicSettings,
),
const SizedBox(height: 32),
_buildSection(
title: '关于',
title: SettingsConstants.aboutTitle,
items: [
const SettingItem(
type: SettingType.about,
title: '版本信息',
subtitle: '查看版本和项目信息',
title: SettingsConstants.versionInfoTitle,
subtitle: SettingsConstants.versionInfoSubtitle,
icon: Icons.info_outline,
),
],
Expand Down

0 comments on commit ab7eb85

Please sign in to comment.