From d6b1b1aebf49a7bb4dc843ac02c18844bb293b60 Mon Sep 17 00:00:00 2001 From: SquidSpirit Date: Sat, 12 Jul 2025 05:19:22 +0800 Subject: [PATCH] MCSI-9 refactor: use Strings constants for text and button labels --- lib/main/framework/ui/about_tab.dart | 29 ++++++++++++++-------------- lib/main/framework/ui/strings.dart | 6 ++++++ 2 files changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/main/framework/ui/about_tab.dart b/lib/main/framework/ui/about_tab.dart index 4b6eb9a..9d9a596 100644 --- a/lib/main/framework/ui/about_tab.dart +++ b/lib/main/framework/ui/about_tab.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:gap/gap.dart'; import 'package:minecraft_server_installer/main/constants.dart'; +import 'package:minecraft_server_installer/main/framework/ui/strings.dart'; import 'package:package_info_plus/package_info_plus.dart'; class AboutTab extends StatelessWidget { @@ -54,11 +55,11 @@ class AboutTab extends StatelessWidget { ), const Gap(8), Text( - '讓 Minecraft 伺服器安裝變得更簡單!', - style: Theme.of(context).textTheme.bodyLarge?.copyWith( - fontWeight: FontWeight.w500, - color: Colors.grey.shade700, - ), + Strings.textSlogen, + style: Theme.of(context) + .textTheme + .bodyLarge + ?.copyWith(fontWeight: FontWeight.w500, color: Colors.grey.shade700), ), ], ), @@ -66,18 +67,18 @@ class AboutTab extends StatelessWidget { const Gap(32), Row( children: [ - _actionButton(text: '教學影片', svgAssetName: 'assets/svg/youtube.svg'), + _actionButton(text: Strings.buttonTutorialVideo, svgAssetName: 'assets/svg/youtube.svg'), const Gap(12), - _actionButton(text: '問題回報', svgAssetName: 'assets/svg/bug.svg'), + _actionButton(text: Strings.buttonBugReport, svgAssetName: 'assets/svg/bug.svg'), const Gap(12), - _actionButton(text: '聯絡作者', svgAssetName: 'assets/svg/send.svg'), + _actionButton(text: Strings.buttonContactAuthor, svgAssetName: 'assets/svg/send.svg'), const Gap(12), - _actionButton(text: '原始碼', svgAssetName: 'assets/svg/github.svg'), + _actionButton(text: Strings.buttonSourceCode, svgAssetName: 'assets/svg/github.svg'), ], ), const Spacer(), Text( - 'Copyright © 2025 SquidSpirit', + Strings.textCopyright, style: Theme.of(context).textTheme.bodyMedium?.copyWith(color: Colors.grey.shade700), ), ], @@ -114,10 +115,10 @@ class AboutTab extends StatelessWidget { const Gap(12), Text( text, - style: Theme.of(context).textTheme.bodyMedium?.copyWith( - fontWeight: FontWeight.w500, - color: Colors.grey.shade700, - ), + style: Theme.of(context) + .textTheme + .bodyMedium + ?.copyWith(fontWeight: FontWeight.w500, color: Colors.grey.shade700), ), ], ), diff --git a/lib/main/framework/ui/strings.dart b/lib/main/framework/ui/strings.dart index 68da21d..f045224 100644 --- a/lib/main/framework/ui/strings.dart +++ b/lib/main/framework/ui/strings.dart @@ -8,6 +8,10 @@ abstract class Strings { static const fieldMaxRamSize = '最大 RAM 大小'; static const buttonStartToInstall = '開始安裝'; static const buttonBrowse = '瀏覽'; + static const buttonTutorialVideo = '教學影片'; + static const buttonBugReport = '問題回報'; + static const buttonContactAuthor = '聯絡作者'; + static const buttonSourceCode = '原始碼'; static const tabBasicConfiguration = '基本設定'; static const tabModConfiguration = '模組設定'; static const tabServerProperties = '伺服器選項'; @@ -15,4 +19,6 @@ abstract class Strings { static const tabInstallationProgress = '安裝進度'; static const tooltipEulaInfo = '點擊查看 EULA 條款'; static const dialogTitleSelectDirectory = '選擇安裝目錄'; + static const textSlogen = '讓 Minecraft 伺服器安裝變得更簡單!'; + static const textCopyright = 'Copyright © 2025 SquidSpirit'; }