Unverified Commit cded7efb authored by xster's avatar xster Committed by GitHub

Fix CupertinoSwitch accessibility (#19927)

parent dfe5b591
...@@ -26,7 +26,9 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -26,7 +26,9 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
child: new Column( child: new Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: <Widget>[ children: <Widget>[
new Column( new Semantics(
container: true,
child: new Column(
children: <Widget>[ children: <Widget>[
new CupertinoSwitch( new CupertinoSwitch(
value: _switchValue, value: _switchValue,
...@@ -41,7 +43,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -41,7 +43,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
), ),
], ],
), ),
new Column( ),
new Semantics(
container: true,
child: new Column(
children: const <Widget>[ children: const <Widget>[
const CupertinoSwitch( const CupertinoSwitch(
value: true, value: true,
...@@ -52,7 +57,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -52,7 +57,10 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
), ),
], ],
), ),
new Column( ),
new Semantics(
container: true,
child: new Column(
children: const <Widget>[ children: const <Widget>[
const CupertinoSwitch( const CupertinoSwitch(
value: false, value: false,
...@@ -63,6 +71,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> { ...@@ -63,6 +71,7 @@ class _CupertinoSwitchDemoState extends State<CupertinoSwitchDemo> {
), ),
], ],
), ),
),
], ],
), ),
), ),
......
...@@ -380,10 +380,11 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox { ...@@ -380,10 +380,11 @@ class _RenderCupertinoSwitch extends RenderConstrainedBox {
void describeSemanticsConfiguration(SemanticsConfiguration config) { void describeSemanticsConfiguration(SemanticsConfiguration config) {
super.describeSemanticsConfiguration(config); super.describeSemanticsConfiguration(config);
config.isSemanticBoundary = isInteractive;
if (isInteractive) if (isInteractive)
config.onTap = _handleTap; config.onTap = _handleTap;
config.isChecked = _value;
config.isEnabled = isInteractive;
config.isToggled = _value;
} }
final CupertinoThumbPainter _thumbPainter = new CupertinoThumbPainter(); final CupertinoThumbPainter _thumbPainter = new CupertinoThumbPainter();
......
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