diff --git a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart index 9b81254da6..902418758e 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart @@ -26,42 +26,51 @@ class _CupertinoSwitchDemoState extends State { child: new Column( mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ - new Column( - children: [ - new CupertinoSwitch( - value: _switchValue, - onChanged: (bool value) { - setState(() { - _switchValue = value; - }); - }, - ), - const Text( - 'Active' - ), - ], + new Semantics( + container: true, + child: new Column( + children: [ + new CupertinoSwitch( + value: _switchValue, + onChanged: (bool value) { + setState(() { + _switchValue = value; + }); + }, + ), + const Text( + 'Active' + ), + ], + ), ), - new Column( - children: const [ - const CupertinoSwitch( - value: true, - onChanged: null, - ), - const Text( - 'Disabled' - ), - ], + new Semantics( + container: true, + child: new Column( + children: const [ + const CupertinoSwitch( + value: true, + onChanged: null, + ), + const Text( + 'Disabled' + ), + ], + ), ), - new Column( - children: const [ - const CupertinoSwitch( - value: false, - onChanged: null, - ), - const Text( - 'Disabled' - ), - ], + new Semantics( + container: true, + child: new Column( + children: const [ + const CupertinoSwitch( + value: false, + onChanged: null, + ), + const Text( + 'Disabled' + ), + ], + ), ), ], ), diff --git a/packages/flutter/lib/src/cupertino/switch.dart b/packages/flutter/lib/src/cupertino/switch.dart index a149e439f7..4ea9edc33f 100644 --- a/packages/flutter/lib/src/cupertino/switch.dart +++ b/packages/flutter/lib/src/cupertino/switch.dart @@ -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();