Last active
April 6, 2020 14:47
-
-
Save haroonkhan9426/cabb76c80b14fdd3878ca089138e70f7 to your computer and use it in GitHub Desktop.
Managing Local State Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyHomePage extends StatefulWidget { | |
@override | |
_MyHomePageState createState() => _MyHomePageState(); | |
} | |
class _MyHomePageState extends State<MyHomePage> { | |
bool isChecked = false; | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(), | |
body: Center( | |
child: Checkbox( | |
value: isChecked, | |
onChanged: (newVal) { | |
setState(() { | |
isChecked = newVal; | |
}); | |
})), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment