Skip to content

Instantly share code, notes, and snippets.

@lawreyios
Created August 28, 2019 03:17
Show Gist options
  • Save lawreyios/00f5320ad872dd698e91a44d9cb9a3c2 to your computer and use it in GitHub Desktop.
Save lawreyios/00f5320ad872dd698e91a44d9cb9a3c2 to your computer and use it in GitHub Desktop.
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