Created
May 10, 2019 11:17
-
-
Save itsatifsiddiqui/6bdbdcc54419984764f713e2b5e0be2b to your computer and use it in GitHub Desktop.
Child widget
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 HomePage extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
final counter = Provider.of<Counter>(context); | |
return Scaffold( | |
appBar: AppBar( | |
title: Text("Provider Demo"), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
'You have pushed the button this many times:', | |
), | |
Text( | |
'${counter.getCounter()}', | |
style: Theme.of(context).textTheme.display1, | |
), | |
], | |
), | |
), | |
floatingActionButton: Column( | |
mainAxisAlignment: MainAxisAlignment.end, | |
children: <Widget>[ | |
FloatingActionButton( | |
onPressed: counter.increment, | |
tooltip: 'Increment', | |
child: Icon(Icons.add), | |
), | |
SizedBox(height: 10), | |
FloatingActionButton( | |
onPressed: counter.decrement, | |
tooltip: 'Increment', | |
child: Icon(Icons.remove), | |
) | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment