Skip to content

Commit 45b2397

Browse files
goderbauergspencergoog
authored andcommitted
Make Demos in flutter_gallery more accessible (flutter#10832)
Remaining known issues are flutter#10831 and flutter#10830.
1 parent bddf804 commit 45b2397

File tree

3 files changed

+106
-98
lines changed

3 files changed

+106
-98
lines changed

examples/flutter_gallery/lib/demo/contacts_demo.dart

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,14 @@ class _ContactItem extends StatelessWidget {
7070
)
7171
));
7272
}
73-
return new Padding(
74-
padding: const EdgeInsets.symmetric(vertical: 16.0),
75-
child: new Row(
76-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
77-
children: rowChildren
78-
)
73+
return new MergeSemantics(
74+
child: new Padding(
75+
padding: const EdgeInsets.symmetric(vertical: 16.0),
76+
child: new Row(
77+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
78+
children: rowChildren
79+
)
80+
),
7981
);
8082
}
8183
}

examples/flutter_gallery/lib/demo/pesto_demo.dart

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -246,41 +246,43 @@ class RecipeCard extends StatelessWidget {
246246

247247
@override
248248
Widget build(BuildContext context) {
249-
return new GestureDetector(
250-
onTap: onTap,
251-
child: new Card(
252-
child: new Column(
253-
crossAxisAlignment: CrossAxisAlignment.start,
254-
children: <Widget>[
255-
new Hero(
256-
tag: recipe.imagePath,
257-
child: new Image.asset(recipe.imagePath, fit: BoxFit.contain)
258-
),
259-
new Expanded(
260-
child: new Row(
261-
children: <Widget>[
262-
new Padding(
263-
padding: const EdgeInsets.all(16.0),
264-
child: new Image.asset(
265-
recipe.ingredientsImagePath,
266-
width: 48.0,
267-
height: 48.0,
249+
return new MergeSemantics(
250+
child: new GestureDetector(
251+
onTap: onTap,
252+
child: new Card(
253+
child: new Column(
254+
crossAxisAlignment: CrossAxisAlignment.start,
255+
children: <Widget>[
256+
new Hero(
257+
tag: recipe.imagePath,
258+
child: new Image.asset(recipe.imagePath, fit: BoxFit.contain)
259+
),
260+
new Expanded(
261+
child: new Row(
262+
children: <Widget>[
263+
new Padding(
264+
padding: const EdgeInsets.all(16.0),
265+
child: new Image.asset(
266+
recipe.ingredientsImagePath,
267+
width: 48.0,
268+
height: 48.0,
269+
),
268270
),
269-
),
270-
new Expanded(
271-
child: new Column(
272-
crossAxisAlignment: CrossAxisAlignment.start,
273-
mainAxisAlignment: MainAxisAlignment.center,
274-
children: <Widget>[
275-
new Text(recipe.name, style: titleStyle, softWrap: false, overflow: TextOverflow.ellipsis),
276-
new Text(recipe.author, style: authorStyle),
277-
],
271+
new Expanded(
272+
child: new Column(
273+
crossAxisAlignment: CrossAxisAlignment.start,
274+
mainAxisAlignment: MainAxisAlignment.center,
275+
children: <Widget>[
276+
new Text(recipe.name, style: titleStyle, softWrap: false, overflow: TextOverflow.ellipsis),
277+
new Text(recipe.author, style: authorStyle),
278+
],
279+
),
278280
),
279-
),
280-
],
281+
],
282+
),
281283
),
282-
),
283-
],
284+
],
285+
),
284286
),
285287
),
286288
);

examples/flutter_gallery/lib/demo/shrine/shrine_home.dart

Lines changed: 64 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -252,39 +252,41 @@ class _Heading extends StatelessWidget {
252252
Widget build(BuildContext context) {
253253
final Size screenSize = MediaQuery.of(context).size;
254254
final ShrineTheme theme = ShrineTheme.of(context);
255-
return new SizedBox(
256-
height: screenSize.width > screenSize.height
257-
? (screenSize.height - kToolbarHeight) * 0.85
258-
: (screenSize.height - kToolbarHeight) * 0.70,
259-
child: new Container(
260-
decoration: new BoxDecoration(
261-
color: theme.cardBackgroundColor,
262-
border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
263-
),
264-
child: new CustomMultiChildLayout(
265-
delegate: new _HeadingLayout(),
266-
children: <Widget>[
267-
new LayoutId(
268-
id: _HeadingLayout.price,
269-
child: new _FeaturePriceItem(product: product),
270-
),
271-
new LayoutId(
272-
id: _HeadingLayout.image,
273-
child: new Image.asset(product.imageAsset, fit: BoxFit.cover),
274-
),
275-
new LayoutId(
276-
id: _HeadingLayout.title,
277-
child: new Text(product.featureTitle, style: theme.featureTitleStyle),
278-
),
279-
new LayoutId(
280-
id: _HeadingLayout.description,
281-
child: new Text(product.featureDescription, style: theme.featureStyle),
282-
),
283-
new LayoutId(
284-
id: _HeadingLayout.vendor,
285-
child: new _VendorItem(vendor: product.vendor),
286-
),
287-
],
255+
return new MergeSemantics(
256+
child: new SizedBox(
257+
height: screenSize.width > screenSize.height
258+
? (screenSize.height - kToolbarHeight) * 0.85
259+
: (screenSize.height - kToolbarHeight) * 0.70,
260+
child: new Container(
261+
decoration: new BoxDecoration(
262+
color: theme.cardBackgroundColor,
263+
border: new Border(bottom: new BorderSide(color: theme.dividerColor)),
264+
),
265+
child: new CustomMultiChildLayout(
266+
delegate: new _HeadingLayout(),
267+
children: <Widget>[
268+
new LayoutId(
269+
id: _HeadingLayout.price,
270+
child: new _FeaturePriceItem(product: product),
271+
),
272+
new LayoutId(
273+
id: _HeadingLayout.image,
274+
child: new Image.asset(product.imageAsset, fit: BoxFit.cover),
275+
),
276+
new LayoutId(
277+
id: _HeadingLayout.title,
278+
child: new Text(product.featureTitle, style: theme.featureTitleStyle),
279+
),
280+
new LayoutId(
281+
id: _HeadingLayout.description,
282+
child: new Text(product.featureDescription, style: theme.featureStyle),
283+
),
284+
new LayoutId(
285+
id: _HeadingLayout.vendor,
286+
child: new _VendorItem(vendor: product.vendor),
287+
),
288+
],
289+
),
288290
),
289291
),
290292
);
@@ -303,35 +305,37 @@ class _ProductItem extends StatelessWidget {
303305

304306
@override
305307
Widget build(BuildContext context) {
306-
return new Card(
307-
child: new Stack(
308-
children: <Widget>[
309-
new Column(
310-
children: <Widget>[
311-
new Align(
312-
alignment: FractionalOffset.centerRight,
313-
child: new _ProductPriceItem(product: product),
314-
),
315-
new Container(
316-
width: 144.0,
317-
height: 144.0,
318-
padding: const EdgeInsets.symmetric(horizontal: 8.0),
319-
child: new Hero(
320-
tag: product.tag,
321-
child: new Image.asset(product.imageAsset, fit: BoxFit.contain),
308+
return new MergeSemantics(
309+
child: new Card(
310+
child: new Stack(
311+
children: <Widget>[
312+
new Column(
313+
children: <Widget>[
314+
new Align(
315+
alignment: FractionalOffset.centerRight,
316+
child: new _ProductPriceItem(product: product),
317+
),
318+
new Container(
319+
width: 144.0,
320+
height: 144.0,
321+
padding: const EdgeInsets.symmetric(horizontal: 8.0),
322+
child: new Hero(
323+
tag: product.tag,
324+
child: new Image.asset(product.imageAsset, fit: BoxFit.contain),
325+
),
322326
),
327+
new Padding(
328+
padding: const EdgeInsets.symmetric(horizontal: 8.0),
329+
child: new _VendorItem(vendor: product.vendor),
323330
),
324-
new Padding(
325-
padding: const EdgeInsets.symmetric(horizontal: 8.0),
326-
child: new _VendorItem(vendor: product.vendor),
327-
),
328-
],
329-
),
330-
new Material(
331-
type: MaterialType.transparency,
332-
child: new InkWell(onTap: onPressed),
333-
),
334-
],
331+
],
332+
),
333+
new Material(
334+
type: MaterialType.transparency,
335+
child: new InkWell(onTap: onPressed),
336+
),
337+
],
338+
),
335339
),
336340
);
337341
}

0 commit comments

Comments
 (0)