From 47a576b296073157e84efdc088c50e3bb8360839 Mon Sep 17 00:00:00 2001 From: ztplz Date: Thu, 5 Apr 2018 05:42:35 +0800 Subject: [PATCH] Add disable Cupertino Switch example (#15853) * Add disable Cupertino Switch example * keep trailing commas consistent * fix Cupertino Switch example linter error --- .../demo/cupertino/cupertino_switch_demo.dart | 48 ++++++++++++++++--- 1 file changed, 41 insertions(+), 7 deletions(-) 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 8c62569aaa..313733ec33 100644 --- a/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart +++ b/examples/flutter_gallery/lib/demo/cupertino/cupertino_switch_demo.dart @@ -23,13 +23,47 @@ class _CupertinoSwitchDemoState extends State { title: const Text('Cupertino Switch'), ), body: new Center( - child: new CupertinoSwitch( - value: _switchValue, - onChanged: (bool value) { - setState(() { - _switchValue = value; - }); - } + child: new Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + children: [ + new Column( + children: [ + new CupertinoSwitch( + value: _switchValue, + onChanged: (bool value) { + setState(() { + _switchValue = value; + }); + }, + ), + const Text( + 'Active' + ), + ], + ), + new Column( + children: [ + new CupertinoSwitch( + value: true, + onChanged: null, + ), + const Text( + 'Disabled' + ), + ], + ), + new Column( + children: [ + new CupertinoSwitch( + value: false, + onChanged: null, + ), + const Text( + 'Disabled' + ), + ], + ), + ], ), ), );