Skip to content

Commit 2d51fd6

Browse files
author
MritunjayTiwari14
committed
semantic: Add announce service for screens on home
1 parent 4d46cfb commit 2d51fd6

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

lib/widgets/home.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import 'dart:async';
22

33
import 'package:flutter/material.dart';
4+
import 'package:flutter/rendering.dart';
45

56
import '../generated/l10n/zulip_localizations.dart';
67
import '../model/narrow.dart';
@@ -74,14 +75,20 @@ class _HomePageState extends State<HomePage> {
7475

7576
String get _currentTabTitle {
7677
final zulipLocalizations = ZulipLocalizations.of(context);
78+
String pageTitle;
7779
switch(_tab.value) {
7880
case _HomePageTab.inbox:
79-
return zulipLocalizations.inboxPageTitle;
81+
pageTitle = zulipLocalizations.inboxPageTitle;
82+
break;
8083
case _HomePageTab.channels:
81-
return zulipLocalizations.channelsPageTitle;
84+
pageTitle = zulipLocalizations.channelsPageTitle;
85+
break;
8286
case _HomePageTab.directMessages:
83-
return zulipLocalizations.recentDmConversationsPageTitle;
87+
pageTitle = zulipLocalizations.recentDmConversationsPageTitle;
8488
}
89+
90+
SemanticsService.announce(pageTitle, Directionality.of(context));
91+
return pageTitle;
8592
}
8693

8794
@override
@@ -132,9 +139,6 @@ class _HomePageState extends State<HomePage> {
132139
body: Stack(
133140
children: [
134141
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.
138142
Offstage(offstage: tab != _tab.value, child: body),
139143
]),
140144
bottomNavigationBar: DecoratedBox(
@@ -304,6 +308,8 @@ void _showMainMenu(BuildContext context, {
304308
// TODO(#1095): VersionInfo
305309
];
306310

311+
SemanticsService.announce(ZulipLocalizations.of(context).navBarMenuLabel,
312+
Directionality.of(context));
307313
final designVariables = DesignVariables.of(context);
308314
final accountId = PerAccountStoreWidget.accountIdOf(context);
309315
showModalBottomSheet<void>(

0 commit comments

Comments
 (0)