Skip to content

Commit 30e2b1b

Browse files
committed
feat: add semantics to example app menu button for accessibility
1 parent ca70906 commit 30e2b1b

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## 1.5.0
22

33
* Added `drawerCloseSemanticLabel` parameter to set a semantic label for the tappable area that closes the drawer.
4-
* Integrated [`Semantics`](https://api.flutter.dev/flutter/widgets/Semantics-class.html) widgets to provide better screen reader support.
4+
* Integrated [`Semantics`](https://api.flutter.dev/flutter/widgets/Semantics-class.html) widgets to provide better screen reader support for the drawer and example app.
55
* Integrated [`ExcludeFocus`](https://api.flutter.dev/flutter/widgets/ExcludeFocus-class.html) and [`ExcludeSemantics`](https://api.flutter.dev/flutter/widgets/ExcludeSemantics-class.html) to widgets to dynamically control focus and semantics based on drawer visibility.
66
* Refactored Inkwell hiding to use `Visibility`
77

example/lib/main.dart

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,13 @@ class _HomeScreenState extends State<HomeScreen> {
6464
builder: (_, value, __) {
6565
return AnimatedSwitcher(
6666
duration: Duration(milliseconds: 250),
67-
child: Icon(
68-
value.visible ? Icons.clear : Icons.menu,
69-
key: ValueKey<bool>(value.visible),
67+
child: Semantics(
68+
label: 'Menu',
69+
onTapHint: 'expand drawer',
70+
child: Icon(
71+
value.visible ? Icons.clear : Icons.menu,
72+
key: ValueKey<bool>(value.visible),
73+
),
7074
),
7175
);
7276
},

0 commit comments

Comments
 (0)