Created
August 28, 2019 03:17
-
-
Save lawreyios/00f5320ad872dd698e91a44d9cb9a3c2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 _MyHomePageState extends State<MyHomePage> { | |
String _information = 'No Information Yet'; | |
void updateInformation(String information) { | |
setState(() => _information = information); | |
} | |
void moveToSecondPage() async { | |
final information = await Navigator.push( | |
context, | |
CupertinoPageRoute( | |
fullscreenDialog: true, builder: (context) => SecondPage()), | |
); | |
updateInformation(information); | |
} | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text(widget.title), | |
), | |
body: Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: <Widget>[ | |
Text( | |
_information, | |
), | |
SizedBox( | |
height: 8.0, | |
), | |
RaisedButton( | |
color: Colors.blue, | |
child: Text( | |
'Get Information', | |
style: TextStyle(color: Colors.white), | |
), | |
onPressed: () { | |
moveToSecondPage(); | |
}, | |
) | |
], | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment