Fix CupertinoSwitch accessibility (#19927)
This commit is contained in:
parent
dfe5b591a6
commit
cded7efbd0
@ -26,7 +26,9 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
|
||||
child: new Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: <Widget>[
|
||||
new Column(
|
||||
new Semantics(
|
||||
container: true,
|
||||
child: new Column(
|
||||
children: <Widget>[
|
||||
new CupertinoSwitch(
|
||||
value: _switchValue,
|
||||
@ -41,7 +43,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
|
||||
),
|
||||
],
|
||||
),
|
||||
new Column(
|
||||
),
|
||||
new Semantics(
|
||||
container: true,
|
||||
child: new Column(
|
||||
children: const <Widget>[
|
||||
const CupertinoSwitch(
|
||||
value: true,
|
||||
@ -52,7 +57,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
|
||||
),
|
||||
],
|
||||
),
|
||||
new Column(
|
||||
),
|
||||
new Semantics(
|
||||
container: true,
|
||||
child: new Column(
|
||||
children: const <Widget>[
|
||||
const CupertinoSwitch(
|
||||
value: false,
|
||||
@ -63,6 +71,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
@ -380,10 +380,11 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
|
||||
void describeSemanticsConfiguration(SemanticsConfiguration config) {
|
||||
super.describeSemanticsConfiguration(config);
|
||||
|
||||
config.isSemanticBoundary = isInteractive;
|
||||
if (isInteractive)
|
||||
config.onTap = _handleTap;
|
||||
config.isChecked = _value;
|
||||
|
||||
config.isEnabled = isInteractive;
|
||||
config.isToggled = _value;
|
||||
}
|
||||
|
||||
final CupertinoThumbPainter _thumbPainter = new CupertinoThumbPainter();
|
||||
|
Loading…
x
Reference in New Issue
Block a user