From 5d88d0c088fe417197d4ae7512779c97a8653e10 Mon Sep 17 00:00:00 2001 From: ryan730 Date: Sun, 13 Jan 2019 19:06:08 +0800 Subject: [PATCH] Modify: checkbosListTile bug --- lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart | 4 ++-- .../elements/Form/CheckBox/CheckboxListTile/index.dart | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart index bae9572c..ce63afa7 100644 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart +++ b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/demo.dart @@ -119,9 +119,9 @@ class CheckboxListTileDefault extends StatelessWidget { return CheckboxListTile( title: Text('一个简单的例子'), activeColor: Colors.red, - value: widget.valBool, + value: widget.valBool['val'], onChanged: (bool value) { - parant.setState(()=> widget.valBool = value); + parant.setState(()=> widget.valBool['val'] = value); }, secondary: const Icon(Icons.hourglass_empty), ); diff --git a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart index a5e48eb8..a38f9cbc 100644 --- a/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart +++ b/lib/widgets/elements/Form/CheckBox/CheckboxListTile/index.dart @@ -34,9 +34,10 @@ const String _CheckboxListTileText2 = """### **进阶用法** > CheckboxListTile 单选和全选的示例 """; -var valBool = true; + class Demo extends StatefulWidget { static const String routeName = '/element/Form/Checkbox/CheckboxListTile'; + final Map valBool = {'val':true}; @override _DemoState createState() => _DemoState(); }