|
1 | 1 | import 'dart:async'; |
2 | 2 |
|
3 | 3 | import 'package:flutter/material.dart'; |
| 4 | +import 'package:flutter/rendering.dart'; |
4 | 5 |
|
5 | 6 | import '../generated/l10n/zulip_localizations.dart'; |
6 | 7 | import '../model/narrow.dart'; |
@@ -74,14 +75,21 @@ class _HomePageState extends State<HomePage> { |
74 | 75 |
|
75 | 76 | String get _currentTabTitle { |
76 | 77 | final zulipLocalizations = ZulipLocalizations.of(context); |
| 78 | + String pageTitle; |
77 | 79 | switch(_tab.value) { |
78 | 80 | case _HomePageTab.inbox: |
79 | | - return zulipLocalizations.inboxPageTitle; |
| 81 | + pageTitle = zulipLocalizations.inboxPageTitle; |
| 82 | + break; |
80 | 83 | case _HomePageTab.channels: |
81 | | - return zulipLocalizations.channelsPageTitle; |
| 84 | + pageTitle = zulipLocalizations.channelsPageTitle; |
| 85 | + break; |
82 | 86 | case _HomePageTab.directMessages: |
83 | | - return zulipLocalizations.recentDmConversationsPageTitle; |
| 87 | + pageTitle = zulipLocalizations.recentDmConversationsPageTitle; |
84 | 88 | } |
| 89 | + |
| 90 | + SemanticsService.sendAnnouncement(View.of(context), pageTitle, |
| 91 | + Directionality.of(context)); |
| 92 | + return pageTitle; |
85 | 93 | } |
86 | 94 |
|
87 | 95 | @override |
@@ -132,9 +140,6 @@ class _HomePageState extends State<HomePage> { |
132 | 140 | body: Stack( |
133 | 141 | children: [ |
134 | 142 | for (final (tab, body) in pageBodies) |
135 | | - // TODO(#535): Decide if we find it helpful to use something like |
136 | | - // [SemanticsProperties.namesRoute] to structure this UI better |
137 | | - // for screen-reader software. |
138 | 143 | Offstage(offstage: tab != _tab.value, child: body), |
139 | 144 | ]), |
140 | 145 | bottomNavigationBar: DecoratedBox( |
@@ -304,6 +309,8 @@ void _showMainMenu(BuildContext context, { |
304 | 309 | // TODO(#1095): VersionInfo |
305 | 310 | ]; |
306 | 311 |
|
| 312 | + SemanticsService.sendAnnouncement(View.of(context), |
| 313 | + ZulipLocalizations.of(context).navBarMenuLabel, Directionality.of(context)); |
307 | 314 | final designVariables = DesignVariables.of(context); |
308 | 315 | final accountId = PerAccountStoreWidget.accountIdOf(context); |
309 | 316 | showModalBottomSheet<void>( |
|
0 commit comments