Skip to content
This repository has been archived by the owner on Jun 13, 2024. It is now read-only.

[BottomAppBar Demo] Ensured fab is traversed before bottomAppBar buttons by accessibility… #837

Merged
merged 6 commits into from
Dec 13, 2022
Merged
Show file tree
Hide file tree
Changes from 3 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
105 changes: 93 additions & 12 deletions lib/codeviewer/code_segments.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,13 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
TextSpan(style: codeStyle.keywordStyle, text: 'import'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(
style: codeStyle.stringStyle,
text: '\u0027package:flutter/rendering.dart\u0027'),
TextSpan(style: codeStyle.punctuationStyle, text: ';'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a'),
TextSpan(style: codeStyle.keywordStyle, text: 'import'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(
style: codeStyle.stringStyle,
text:
Expand Down Expand Up @@ -1713,22 +1720,43 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: 'value\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '?'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'Semantics'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a container'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'true'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a sortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'OrdinalSortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.numberStyle, text: '0'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'FloatingActionButton'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a onPressed'),
style: codeStyle.baseStyle, text: '\u000a onPressed'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '()'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '{},'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' localizations'),
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
TextSpan(style: codeStyle.baseStyle, text: 'buttonTextCreate'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
Expand All @@ -1739,6 +1767,8 @@ class CodeSegments {
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
TextSpan(style: codeStyle.baseStyle, text: 'add'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: ')'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
Expand Down Expand Up @@ -1924,9 +1954,24 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '['),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.classStyle, text: 'Semantics'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a sortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'OrdinalSortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.numberStyle, text: '1'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'IconButton'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'MaterialLocalizations'),
Expand All @@ -1937,7 +1982,7 @@ class CodeSegments {
TextSpan(style: codeStyle.punctuationStyle, text: ').'),
TextSpan(style: codeStyle.baseStyle, text: 'openAppDrawerTooltip'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
Expand All @@ -1949,12 +1994,14 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: 'menu'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a onPressed'),
style: codeStyle.baseStyle, text: '\u000a onPressed'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '()'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '{},'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
Expand All @@ -1973,15 +2020,30 @@ class CodeSegments {
TextSpan(style: codeStyle.classStyle, text: 'Spacer'),
TextSpan(style: codeStyle.punctuationStyle, text: '(),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.classStyle, text: 'Semantics'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a sortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'OrdinalSortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.numberStyle, text: '2'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'IconButton'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' localizations'),
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
TextSpan(style: codeStyle.baseStyle, text: 'starterAppTooltipSearch'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
Expand All @@ -1993,24 +2055,41 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: 'search'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a onPressed'),
style: codeStyle.baseStyle, text: '\u000a onPressed'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '()'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '{},'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.classStyle, text: 'Semantics'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a sortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'OrdinalSortKey'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.numberStyle, text: '3'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a child'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.classStyle, text: 'IconButton'),
TextSpan(style: codeStyle.punctuationStyle, text: '('),
TextSpan(style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a tooltip'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' localizations'),
TextSpan(style: codeStyle.punctuationStyle, text: '.'),
TextSpan(style: codeStyle.baseStyle, text: 'starterAppTooltipFavorite'),
TextSpan(style: codeStyle.punctuationStyle, text: ','),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a icon'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.keywordStyle, text: 'const'),
Expand All @@ -2022,12 +2101,14 @@ class CodeSegments {
TextSpan(style: codeStyle.baseStyle, text: 'favorite'),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(
style: codeStyle.baseStyle, text: '\u000a onPressed'),
style: codeStyle.baseStyle, text: '\u000a onPressed'),
TextSpan(style: codeStyle.punctuationStyle, text: ':'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '()'),
TextSpan(style: codeStyle.baseStyle, text: ' '),
TextSpan(style: codeStyle.punctuationStyle, text: '{},'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
TextSpan(style: codeStyle.punctuationStyle, text: '),'),
TextSpan(style: codeStyle.baseStyle, text: '\u000a '),
Expand Down
46 changes: 30 additions & 16 deletions lib/demos/material/bottom_app_bar_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// found in the LICENSE file.

import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_gen/gen_l10n/gallery_localizations.dart';

// BEGIN bottomAppBarDemo
Expand Down Expand Up @@ -127,10 +128,14 @@ class _BottomAppBarDemoState extends State<BottomAppBarDemo>
],
),
floatingActionButton: _showFab.value
? FloatingActionButton(
onPressed: () {},
tooltip: localizations.buttonTextCreate,
child: const Icon(Icons.add),
? Semantics(
container: true,
sortKey: const OrdinalSortKey(0),
child: FloatingActionButton(
onPressed: () {},
tooltip: localizations.buttonTextCreate,
child: const Icon(Icons.add),
),
)
: null,
floatingActionButtonLocation: _fabLocations[_currentFabLocation.value],
Expand Down Expand Up @@ -165,21 +170,30 @@ class _DemoBottomAppBar extends StatelessWidget {
data: IconThemeData(color: Theme.of(context).colorScheme.onPrimary),
child: Row(
children: [
IconButton(
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
icon: const Icon(Icons.menu),
onPressed: () {},
Semantics(
sortKey: const OrdinalSortKey(1),
harperl-lgtm marked this conversation as resolved.
Show resolved Hide resolved
child: IconButton(
tooltip: MaterialLocalizations.of(context).openAppDrawerTooltip,
icon: const Icon(Icons.menu),
onPressed: () {},
),
),
if (centerLocations.contains(fabLocation)) const Spacer(),
IconButton(
tooltip: localizations.starterAppTooltipSearch,
icon: const Icon(Icons.search),
onPressed: () {},
Semantics(
sortKey: const OrdinalSortKey(2),
child: IconButton(
tooltip: localizations.starterAppTooltipSearch,
icon: const Icon(Icons.search),
onPressed: () {},
),
),
IconButton(
tooltip: localizations.starterAppTooltipFavorite,
icon: const Icon(Icons.favorite),
onPressed: () {},
Semantics(
sortKey: const OrdinalSortKey(3),
child: IconButton(
tooltip: localizations.starterAppTooltipFavorite,
icon: const Icon(Icons.favorite),
onPressed: () {},
),
),
],
),
Expand Down
Loading