-
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
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
f45c12b
refactor: replace getx.snackbar with fluttertoast
Merack 85424d0
refactor: truncate long backup path for toast show
Merack 0d22934
change default mode to pomodoro
Merack 1deba72
UI: adjust setting page ui
Merack d6edbae
UI: adjust setting page ui
Merack File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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;
} |
||
| } | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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/)。