From f78293c6ff1e293102a610afeb355dd7ef558040 Mon Sep 17 00:00:00 2001 From: lmy <2534290808@qq.com> Date: Thu, 5 Sep 2019 14:41:46 +0800 Subject: [PATCH] add IconToggle example --- example/lib/main.dart | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/example/lib/main.dart b/example/lib/main.dart index 125d72d..a7574d4 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -45,6 +45,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { + bool _value = false; @override Widget build(BuildContext context) { // This method is rerun every time setState is called, for instance as done @@ -87,6 +88,14 @@ class _MyHomePageState extends State { Icon(AntDesign.getIconData("stepforward")), Icon(FontAwesome.getIconData("glass")), Icon(MaterialIcons.getIconData("ac-unit")), + IconToggle( + value: _value, + onChanged: (value) { + setState(() { + _value = value; + }); + }, + ), ], ), ),