a11y fix for list_demo.dart (#11142)
* a11y fix for list_demo.dart * fix semantics of persistant bottom sheet
This commit is contained in:
committed by
GitHub
parent
18d9b20ffb
commit
792c98751f
@@ -58,83 +58,97 @@ class _ListDemoState extends State<ListDemo> {
|
||||
shrinkWrap: true,
|
||||
primary: false,
|
||||
children: <Widget>[
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('One-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
)
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Two-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _MaterialListType.twoLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
)
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Three-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _MaterialListType.threeLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('One-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _showAvatars ? _MaterialListType.oneLineWithAvatar : _MaterialListType.oneLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
)
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show avatar'),
|
||||
trailing: new Checkbox(
|
||||
value: _showAvatars,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showAvatars = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Two-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _MaterialListType.twoLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
)
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show icon'),
|
||||
trailing: new Checkbox(
|
||||
value: _showIcons,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showIcons = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Three-line'),
|
||||
trailing: new Radio<_MaterialListType>(
|
||||
value: _MaterialListType.threeLine,
|
||||
groupValue: _itemType,
|
||||
onChanged: changeItemType,
|
||||
),
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show dividers'),
|
||||
trailing: new Checkbox(
|
||||
value: _showDividers,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showDividers = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show avatar'),
|
||||
trailing: new Checkbox(
|
||||
value: _showAvatars,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showAvatars = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Dense layout'),
|
||||
trailing: new Checkbox(
|
||||
value: _dense,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_dense = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show icon'),
|
||||
trailing: new Checkbox(
|
||||
value: _showIcons,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showIcons = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Show dividers'),
|
||||
trailing: new Checkbox(
|
||||
value: _showDividers,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_showDividers = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
new MergeSemantics(
|
||||
child: new ListTile(
|
||||
dense: true,
|
||||
title: const Text('Dense layout'),
|
||||
trailing: new Checkbox(
|
||||
value: _dense,
|
||||
onChanged: (bool value) {
|
||||
setState(() {
|
||||
_dense = value;
|
||||
});
|
||||
_bottomSheet?.setState(() { });
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -164,13 +178,15 @@ class _ListDemoState extends State<ListDemo> {
|
||||
"Even more additional list item information appears on line three.",
|
||||
);
|
||||
}
|
||||
return new ListTile(
|
||||
isThreeLine: _itemType == _MaterialListType.threeLine,
|
||||
dense: _dense,
|
||||
leading: _showAvatars ? new CircleAvatar(child: new Text(item)) : null,
|
||||
title: new Text('This item represents $item.'),
|
||||
subtitle: secondary,
|
||||
trailing: _showIcons ? new Icon(Icons.info, color: Theme.of(context).disabledColor) : null,
|
||||
return new MergeSemantics(
|
||||
child: new ListTile(
|
||||
isThreeLine: _itemType == _MaterialListType.threeLine,
|
||||
dense: _dense,
|
||||
leading: _showAvatars ? new ExcludeSemantics(child: new CircleAvatar(child: new Text(item))) : null,
|
||||
title: new Text('This item represents $item.'),
|
||||
subtitle: secondary,
|
||||
trailing: _showIcons ? new Icon(Icons.info, color: Theme.of(context).disabledColor) : null,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user