Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .Jules/palette.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 2026-08-19 - Accessibility & Tooltips for Icon-only Navigation Buttons
经验心得: 在 Flutter 中,仅有 Icon 的按钮(如 CustomAppbar 的返回按钮、TaskCreationPage 的关闭与新增按钮)容易遗漏屏幕阅读器标签与悬停/长按提示。将 Icon 按钮包裹在 `Semantics(label: '...', button: true)` 和 `Tooltip(message: '...')` 下,可大幅提升无障碍体验(a11y)和桌面/长按交互体验。
后续行动: 未来构建仅图标按钮组件时,应确保同时传递 `tooltip` 与语义说明(`Semantics`)。
34 changes: 24 additions & 10 deletions lib/pages/TaskCreationPage/task_creation_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,17 @@ class TaskCreationPage {
onPrimary: Theme.of(context).colorScheme.onSurface,
),
),
child: M3EIconButton(
icon: Icon(Icons.close_rounded),
variant: M3EIconButtonVariant.filled,
onPressed: () => Navigator.of(context).pop(),
child: Semantics(
label: '关闭',
button: true,
child: Tooltip(
message: '关闭',
child: M3EIconButton(
icon: const Icon(Icons.close_rounded),
variant: M3EIconButtonVariant.filled,
onPressed: () => Navigator.of(context).pop(),
),
),
),
),
),
Expand All @@ -46,13 +53,20 @@ class TaskCreationPage {
onPrimary: Theme.of(context).colorScheme.onPrimaryContainer,
),
),
child: M3EIconButton(
icon: Icon(
Icons.add_rounded,
color: Theme.of(context).colorScheme.onPrimaryContainer,
child: Semantics(
label: '新建任务',
button: true,
child: Tooltip(
message: '新建任务',
child: M3EIconButton(
icon: Icon(
Icons.add_rounded,
color: Theme.of(context).colorScheme.onPrimaryContainer,
),
variant: M3EIconButtonVariant.filled,
onPressed: () => _handleCreate(context, ref),
),
),
variant: M3EIconButtonVariant.filled,
onPressed: () => _handleCreate(context, ref),
),
),
);
Expand Down
13 changes: 10 additions & 3 deletions lib/shared/custom_appbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,16 @@ class CustomAppbar extends StatelessWidget implements PreferredSizeWidget {
top: 0,
bottom: 0,
child: Center(
child: GlassIconButton(
icon: const Icon(Icons.arrow_back_rounded),
onPressed: () => context.pop(),
child: Semantics(
label: '返回',
button: true,
child: Tooltip(
message: '返回',
child: GlassIconButton(
icon: const Icon(Icons.arrow_back_rounded),
onPressed: () => context.pop(),
),
),
),
),
),
Expand Down
Loading