Commit 792c9875 authored by Michael Goderbauer's avatar Michael Goderbauer Committed by GitHub

a11y fix for list_demo.dart (#11142)

* a11y fix for list_demo.dart

* fix semantics of persistant bottom sheet
parent 18d9b20f
...@@ -58,83 +58,97 @@ class _ListDemoState extends State<ListDemo> { ...@@ -58,83 +58,97 @@ class _ListDemoState extends State<ListDemo> {
shrinkWrap: true, shrinkWrap: true,
primary: false, primary: false,
children: <Widget>[ children: <Widget>[
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('One-line'), dense: true,
trailing: new Radio<_MaterialListType>( title: const Text('One-line'),
value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine, trailing: new Radio<_MaterialListType>(
groupValue: _itemType, value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine,
onChanged: changeItemType, groupValue: _itemType,
) onChanged: changeItemType,
)
),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Two-line'), dense: true,
trailing: new Radio<_MaterialListType>( title: const Text('Two-line'),
value: _MaterialListType.twoLine, trailing: new Radio<_MaterialListType>(
groupValue: _itemType, value: _MaterialListType.twoLine,
onChanged: changeItemType, groupValue: _itemType,
) onChanged: changeItemType,
)
),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Three-line'), dense: true,
trailing: new Radio<_MaterialListType>( title: const Text('Three-line'),
value: _MaterialListType.threeLine, trailing: new Radio<_MaterialListType>(
groupValue: _itemType, value: _MaterialListType.threeLine,
onChanged: changeItemType, groupValue: _itemType,
onChanged: changeItemType,
),
), ),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Show avatar'), dense: true,
trailing: new Checkbox( title: const Text('Show avatar'),
value: _showAvatars, trailing: new Checkbox(
onChanged: (bool value) { value: _showAvatars,
setState(() { onChanged: (bool value) {
_showAvatars = value; setState(() {
}); _showAvatars = value;
_bottomSheet?.setState(() { }); });
}, _bottomSheet?.setState(() { });
},
),
), ),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Show icon'), dense: true,
trailing: new Checkbox( title: const Text('Show icon'),
value: _showIcons, trailing: new Checkbox(
onChanged: (bool value) { value: _showIcons,
setState(() { onChanged: (bool value) {
_showIcons = value; setState(() {
}); _showIcons = value;
_bottomSheet?.setState(() { }); });
}, _bottomSheet?.setState(() { });
},
),
), ),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Show dividers'), dense: true,
trailing: new Checkbox( title: const Text('Show dividers'),
value: _showDividers, trailing: new Checkbox(
onChanged: (bool value) { value: _showDividers,
setState(() { onChanged: (bool value) {
_showDividers = value; setState(() {
}); _showDividers = value;
_bottomSheet?.setState(() { }); });
}, _bottomSheet?.setState(() { });
},
),
), ),
), ),
new ListTile( new MergeSemantics(
dense: true, child: new ListTile(
title: const Text('Dense layout'), dense: true,
trailing: new Checkbox( title: const Text('Dense layout'),
value: _dense, trailing: new Checkbox(
onChanged: (bool value) { value: _dense,
setState(() { onChanged: (bool value) {
_dense = value; setState(() {
}); _dense = value;
_bottomSheet?.setState(() { }); });
}, _bottomSheet?.setState(() { });
},
),
), ),
), ),
], ],
...@@ -164,13 +178,15 @@ class _ListDemoState extends State<ListDemo> { ...@@ -164,13 +178,15 @@ class _ListDemoState extends State<ListDemo> {
"Even more additional list item information appears on line three.", "Even more additional list item information appears on line three.",
); );
} }
return new ListTile( return new MergeSemantics(
isThreeLine: _itemType == _MaterialListType.threeLine, child: new ListTile(
dense: _dense, isThreeLine: _itemType == _MaterialListType.threeLine,
leading: _showAvatars ? new CircleAvatar(child: new Text(item)) : null, dense: _dense,
title: new Text('This item represents $item.'), leading: _showAvatars ? new ExcludeSemantics(child: new CircleAvatar(child: new Text(item))) : null,
subtitle: secondary, title: new Text('This item represents $item.'),
trailing: _showIcons ? new Icon(Icons.info, color: Theme.of(context).disabledColor) : null, subtitle: secondary,
trailing: _showIcons ? new Icon(Icons.info, color: Theme.of(context).disabledColor) : null,
),
); );
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment