Skip to content

feat: setting pages重构#10

Merged
lxdklp merged 29 commits into
lxdklp:mainfrom
futurw4v:feature/setting_page
Mar 28, 2026
Merged

feat: setting pages重构#10
lxdklp merged 29 commits into
lxdklp:mainfrom
futurw4v:feature/setting_page

Conversation

@futurw4v
Copy link
Copy Markdown
Contributor

  1. 重构了SettingPage AboutPage ThemePage LogSettingPage LogViewerPage JavaPage,优化样式与代码结构
  2. 更改了about页面里的版权信息

重构后
image
image
image
image
image
image

关于视觉不统一与其他页面与代码复用:
不在这个PR的职责内,下个PR会提取出一些组件然后全局替换和做一些代码重构

@futurw4v
Copy link
Copy Markdown
Contributor Author

futurw4v commented Feb 19, 2026

关于页面在小窗口会有点溢出,现在最小窗口大小还不是很合理,不过我打算到时候用window_manager来定制窗口样式(去标题栏按钮等),也不在这个PR的职责内了,所以暂时先不管

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the settings pages (SettingPage, AboutPage, ThemePage, LogSettingPage, LogViewerPage, JavaPage) to modernize the UI and improve code structure. The refactor adopts Material Design 3 principles with consistent card styling (elevation 0, outlined borders), replaces separate navigation with a unified drawer-based navigation pattern using IndexedStack for state preservation, and consolidates common styling patterns. The about page is also updated to use the global gAppVersion constant instead of reading from SharedPreferences.

Changes:

  • Implemented unified navigation drawer in SettingPage with IndexedStack for state preservation
  • Standardized card styling across all settings pages using MD3 guidelines (elevation: 0, outlined borders with colorScheme.outlineVariant)
  • Refactored ThemePage to use SegmentedButton for theme mode selection and improved color picker UI
  • Enhanced LogViewerPage with FutureBuilder pattern and centralized date formatting
  • Improved JavaPage with better variable naming and UI consistency
  • Updated AboutPage to use global gAppVersion constant and extracted helper method for card creation

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
lib/pages/setting_page.dart Replaced card-based navigation with NavigationDrawer and IndexedStack; removed slide navigation
lib/pages/setting/theme.dart Replaced switch-based UI with SegmentedButton; customized color picker to match MD3; changed dialog button from "确定" to "关闭"
lib/pages/setting/log_viewer/log_setting.dart Updated Card styling to MD3 standards; improved layout of log level dropdown
lib/pages/setting/log_viewer.dart Converted to FutureBuilder pattern; added centralized date formatting; removed loading state variable; improved UI layout
lib/pages/setting/java.dart Renamed variables for clarity; refactored UI with consistent card styling; improved code organization with better documentation
lib/pages/setting/about.dart Replaced _appVersion with gAppVersion; extracted _buildCardWithListTile helper method; updated card styling to MD3 standards

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/pages/setting/java.dart Outdated
Comment thread lib/pages/setting/log_viewer.dart
Comment thread lib/pages/setting/java.dart Outdated
Comment thread lib/pages/setting/log_viewer.dart Outdated
Comment thread lib/pages/setting/log_viewer/log_setting.dart Outdated
Comment thread lib/pages/setting/log_viewer.dart Outdated
Comment thread lib/pages/setting/log_viewer.dart
Comment thread lib/pages/setting/about.dart Outdated
@futurw4v futurw4v force-pushed the feature/setting_page branch from 6724292 to fba6d2b Compare February 20, 2026 15:54
@futurw4v futurw4v force-pushed the feature/setting_page branch from fba6d2b to 29d0380 Compare February 20, 2026 15:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/pages/setting/log_viewer.dart Outdated
Comment thread lib/function/java/java_manager.dart Outdated
Comment thread lib/pages/setting/java.dart Outdated
Comment on lines +61 to +63
child: Text(
'设备上的Java列表',
style: Theme.of(context).textTheme.headlineMedium,
Copy link

Copilot AI Feb 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Java 页面原先 AppBar 上有“刷新”按钮,当前重构后 _refresh() 只在 initState() 调用一次,UI 上不再提供重新扫描/刷新 Java 列表的入口。这会导致用户安装/移除 Java 后只能重启应用才能更新列表。建议在标题区域增加一个刷新 IconButton(类似 LogViewer 的刷新),或提供下拉刷新等触发方式来调用 _refresh()

Suggested change
child: Text(
'设备上的Java列表',
style: Theme.of(context).textTheme.headlineMedium,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'设备上的Java列表',
style: Theme.of(context).textTheme.headlineMedium,
),
IconButton(
icon: const Icon(Icons.refresh),
tooltip: '刷新',
onPressed: _refresh,
),
],

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这一块可能会重写

@futurw4v
Copy link
Copy Markdown
Contributor Author

啊我还没改好搜索java的(
我想的是遍历
但是每次启动都遍历有点吃性能

@lxdklp
Copy link
Copy Markdown
Owner

lxdklp commented Feb 21, 2026

啊我还没改好搜索java的(
我想的是遍历
但是每次启动都遍历有点吃性能

搜索Java应该是只打开设置Java的页面才会去搜索吧,我原本的Java搜索是参考hmcl写的

@futurw4v
Copy link
Copy Markdown
Contributor Author

最近没什么时间摸电脑T_T 所以这个可能会拖比较久

@lxdklp
Copy link
Copy Markdown
Owner

lxdklp commented Feb 23, 2026

最近没什么时间摸电脑T_T 所以这个可能会拖比较久

没事,我最近也没啥空,甚至今年上半年因为实习之类的都没啥空,不出意外今年上半年最多只能再发一个版 :(

将系统默认Java的标记从 'java' 改为 'default'(可能会有兼容问题)
@futurw4v
Copy link
Copy Markdown
Contributor Author

futurw4v commented Mar 7, 2026

Windows 四个磁盘(代码中排除了C,因为搜索常用目录个人认为足够) 搜索深度4 搜索效果
image

当然现在只是个不完整的实现,没有写macos和linux的
留了个print输出搜索时间
现在还很不合理,因为IndexedStack的原因还没点进去打开应用就开始搜索,以及initState的时候就搜索 后期会改

@futurw4v
Copy link
Copy Markdown
Contributor Author

futurw4v commented Mar 7, 2026

macos和linux我这没得测试,更改大致是这样
image

@futurw4v
Copy link
Copy Markdown
Contributor Author

futurw4v commented Mar 7, 2026

这个pr我觉得有点职责过重了,java留到下个pr先?

@lxdklp
Copy link
Copy Markdown
Owner

lxdklp commented Mar 8, 2026

这个pr我觉得有点职责过重了,java留到下个pr先?

也可以,这个pr先把setting改完,java相关的另外再开pr吧

@futurw4v futurw4v force-pushed the feature/setting_page branch from 856d8c1 to 189464d Compare March 15, 2026 05:39
@futurw4v futurw4v requested a review from lxdklp March 21, 2026 05:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/pages/setting/java.dart
Comment on lines +113 to +117
Expanded(
child: IndexedStack(
index: _selectedIndex,
children: _settingPageItems.map((item) => item.page).toList(),
),
Copy link

Copilot AI Mar 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IndexedStack 会在首次 build 时构建所有子页面并触发它们的 initState。当前设置页的子项里包含 JavaPage(会启动 Java 扫描)和 LogViewerPage(会加载日志),这会让打开设置页就立刻执行这些耗时操作,即使用户没有切换到对应 tab。建议在这里也改用 LazyLoadIndexedStack(项目已在 main.dart 引入)或用 WidgetBuilder 延迟创建页面,避免不必要的初始化与性能开销。

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

个人认为打开页面之后加载子页面更合理点

Comment thread lib/function/java/java_manager.dart
Comment thread lib/function/java/java_manager.dart
Comment thread lib/pages/setting/log_viewer.dart Outdated
Comment thread lib/pages/setting/theme.dart
SizedBox(width: 8),
Chip(label: Text(javaRuntime.info.vendor ?? 'Unknown')),
if (isCurrent) ...[
Chip(label: Text('当前')),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

似乎也不是特别必要?毕竟已经有加深颜色作为视觉提示了,加多了一个反而让 Chip 数量对不齐

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加深颜色对于当前的显示不太明显, 我觉得应该找个更好的方案吧

@futurw4v futurw4v requested a review from lxdklp March 28, 2026 04:25
@lxdklp lxdklp merged commit 5bdf1d3 into lxdklp:main Mar 28, 2026
1 check passed
@futurw4v futurw4v deleted the feature/setting_page branch March 28, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants