- Notifications
You must be signed in to change notification settings - Fork 1
Refactor toast notifications and update settings UI#4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
f45c12b85424d00d229341deba72d6edbaeFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| import 'package:flutter/material.dart'; | ||
| import 'package:get/get.dart'; | ||
| import 'package:time_machine/utils/toast_util.dart'; | ||
| import '../../config/storage_keys.dart'; | ||
| class SettingState { | ||
| @@ -137,13 +138,7 @@ class SettingState { | ||
| if (microBreakIntervalMinMinutes.value > microBreakIntervalMaxMinutes.value) { | ||
| microBreakIntervalMinMinutes.value = microBreakIntervalMaxMinutes.value; | ||
| microBreakIntervalMinController.text = microBreakIntervalMinMinutes.value.toString(); | ||
| Get.snackbar( | ||
| '设置已调整', | ||
| '最小间隔不能大于最大间隔,已调整为相同值', | ||
| snackPosition: SnackPosition.TOP, | ||
| barBlur: 100, | ||
| duration: Duration(seconds: 2), | ||
| ); | ||
| ToastUtil.show('设置已调整', '最小间隔不能大于最大间隔,已调整为相同值'); | ||
| } | ||
Comment on lines
138
to
142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 在失去焦点时静默覆盖用户的输入并弹出 Toast 提示,可能会给用户带来非常挫败的体验。例如,当用户想要同时调大最小和最大间隔(例如在当前最大间隔为 相比于自动调整数值并弹出 Toast,更好的做法是设置一个验证错误信息( if (microBreakIntervalMinMinutes.value > microBreakIntervalMaxMinutes.value) {
microBreakIntervalMinError.value ='最小间隔不能大于最大间隔';
isValid =false;
} | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
使用
split('/0/').last来截断备份路径可能不够健壮。如果路径中包含其他带有/0/的片段(例如 Android 应用私有存储路径/data/user/0/...或用户创建的名为0的文件夹),它会进行错误的分割,从而导致显示不完整或具有误导性的路径。更健壮的方法是专门检查并移除标准的 Android 外部存储根路径前缀(
/storage/emulated/0/)。