Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
ef20f726
Unverified
Commit
ef20f726
authored
May 11, 2018
by
Hans Muller
Committed by
GitHub
May 11, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gallery a11y fix: give the categories and demos pages "route" scope (#17516)
parent
6c8d5f1b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
59 additions
and
47 deletions
+59
-47
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+59
-47
No files found.
examples/flutter_gallery/lib/gallery/home.dart
View file @
ef20f726
...
...
@@ -109,47 +109,53 @@ class _CategoriesPage extends StatelessWidget {
final
List
<
GalleryDemoCategory
>
categoriesList
=
categories
.
toList
();
final
int
columnCount
=
(
MediaQuery
.
of
(
context
).
orientation
==
Orientation
.
portrait
)
?
2
:
3
;
return
new
SingleChildScrollView
(
key:
const
PageStorageKey
<
String
>(
'categories'
),
child:
new
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
final
double
columnWidth
=
constraints
.
biggest
.
width
/
columnCount
.
toDouble
();
final
double
rowHeight
=
columnWidth
*
aspectRatio
;
final
int
rowCount
=
(
categories
.
length
+
columnCount
-
1
)
~/
columnCount
;
// This repaint boundary prevents the inner contents of the front layer
// from repainting when the backdrop toggle triggers a repaint on the
// LayoutBuilder.
return
new
RepaintBoundary
(
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
new
List
<
Widget
>.
generate
(
rowCount
,
(
int
rowIndex
)
{
final
int
columnCountForRow
=
rowIndex
==
rowCount
-
1
?
categories
.
length
-
columnCount
*
math
.
max
(
0
,
rowCount
-
1
)
:
columnCount
;
return
new
Row
(
children:
new
List
<
Widget
>.
generate
(
columnCountForRow
,
(
int
columnIndex
)
{
final
int
index
=
rowIndex
*
columnCount
+
columnIndex
;
final
GalleryDemoCategory
category
=
categoriesList
[
index
];
return
new
SizedBox
(
width:
columnWidth
,
height:
rowHeight
,
child:
new
_CategoryItem
(
category:
category
,
onTap:
()
{
onCategoryTap
(
category
);
},
),
);
}),
);
}),
),
);
},
return
new
Semantics
(
scopesRoute:
true
,
namesRoute:
true
,
label:
'categories'
,
explicitChildNodes:
true
,
child:
new
SingleChildScrollView
(
key:
const
PageStorageKey
<
String
>(
'categories'
),
child:
new
LayoutBuilder
(
builder:
(
BuildContext
context
,
BoxConstraints
constraints
)
{
final
double
columnWidth
=
constraints
.
biggest
.
width
/
columnCount
.
toDouble
();
final
double
rowHeight
=
columnWidth
*
aspectRatio
;
final
int
rowCount
=
(
categories
.
length
+
columnCount
-
1
)
~/
columnCount
;
// This repaint boundary prevents the inner contents of the front layer
// from repainting when the backdrop toggle triggers a repaint on the
// LayoutBuilder.
return
new
RepaintBoundary
(
child:
new
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
stretch
,
children:
new
List
<
Widget
>.
generate
(
rowCount
,
(
int
rowIndex
)
{
final
int
columnCountForRow
=
rowIndex
==
rowCount
-
1
?
categories
.
length
-
columnCount
*
math
.
max
(
0
,
rowCount
-
1
)
:
columnCount
;
return
new
Row
(
children:
new
List
<
Widget
>.
generate
(
columnCountForRow
,
(
int
columnIndex
)
{
final
int
index
=
rowIndex
*
columnCount
+
columnIndex
;
final
GalleryDemoCategory
category
=
categoriesList
[
index
];
return
new
SizedBox
(
width:
columnWidth
,
height:
rowHeight
,
child:
new
_CategoryItem
(
category:
category
,
onTap:
()
{
onCategoryTap
(
category
);
},
),
);
}),
);
}),
),
);
},
),
),
);
}
...
...
@@ -240,12 +246,18 @@ class _DemosPage extends StatelessWidget {
Widget
build
(
BuildContext
context
)
{
return
new
KeyedSubtree
(
key:
const
ValueKey
<
String
>(
'GalleryDemoList'
),
// So the tests can find this ListView
child:
new
ListView
(
key:
new
PageStorageKey
<
String
>(
category
.
name
),
padding:
const
EdgeInsets
.
only
(
top:
8.0
),
children:
kGalleryCategoryToDemos
[
category
].
map
<
Widget
>((
GalleryDemo
demo
)
{
return
new
_DemoItem
(
demo:
demo
);
}).
toList
(),
child:
new
Semantics
(
scopesRoute:
true
,
namesRoute:
true
,
label:
category
.
name
,
explicitChildNodes:
true
,
child:
new
ListView
(
key:
new
PageStorageKey
<
String
>(
category
.
name
),
padding:
const
EdgeInsets
.
only
(
top:
8.0
),
children:
kGalleryCategoryToDemos
[
category
].
map
<
Widget
>((
GalleryDemo
demo
)
{
return
new
_DemoItem
(
demo:
demo
);
}).
toList
(),
),
),
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment