From 2ae810c6b24bf5de6b71798cf10c6ead4adf8984 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 17:42:04 +0000 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Enhance=20accessi?= =?UTF-8?q?bility=20and=20semantics=20for=20Appbar=20and=20Modal=20icon=20?= =?UTF-8?q?buttons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .Jules/palette.md | 3 ++ .../TaskCreationPage/task_creation_page.dart | 34 +++++++++++++------ lib/shared/custom_appbar.dart | 11 ++++-- 3 files changed, 35 insertions(+), 13 deletions(-) create mode 100644 .Jules/palette.md diff --git a/.Jules/palette.md b/.Jules/palette.md new file mode 100644 index 0000000..bf2c57e --- /dev/null +++ b/.Jules/palette.md @@ -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`)。 diff --git a/lib/pages/TaskCreationPage/task_creation_page.dart b/lib/pages/TaskCreationPage/task_creation_page.dart index 406c48c..8606c1d 100644 --- a/lib/pages/TaskCreationPage/task_creation_page.dart +++ b/lib/pages/TaskCreationPage/task_creation_page.dart @@ -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(), + ), + ), ), ), ), @@ -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), ), ), ); diff --git a/lib/shared/custom_appbar.dart b/lib/shared/custom_appbar.dart index d0857a8..436ef71 100644 --- a/lib/shared/custom_appbar.dart +++ b/lib/shared/custom_appbar.dart @@ -110,9 +110,14 @@ 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: GlassIconButton( + tooltip: '返回', + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.pop(), + ), ), ), ), From 89be40e98282cb69cf2eeec9f9fb827a6aa5e4b4 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 19 Aug 2026 17:53:09 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=8E=A8=20Palette:=20Enhance=20accessi?= =?UTF-8?q?bility=20and=20semantics=20for=20Appbar=20and=20Modal=20icon=20?= =?UTF-8?q?buttons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/shared/custom_appbar.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/shared/custom_appbar.dart b/lib/shared/custom_appbar.dart index 436ef71..f7a6b2d 100644 --- a/lib/shared/custom_appbar.dart +++ b/lib/shared/custom_appbar.dart @@ -113,10 +113,12 @@ class CustomAppbar extends StatelessWidget implements PreferredSizeWidget { child: Semantics( label: '返回', button: true, - child: GlassIconButton( - tooltip: '返回', - icon: const Icon(Icons.arrow_back_rounded), - onPressed: () => context.pop(), + child: Tooltip( + message: '返回', + child: GlassIconButton( + icon: const Icon(Icons.arrow_back_rounded), + onPressed: () => context.pop(), + ), ), ), ),