Last active
June 27, 2018 10:15
-
-
Save jmolins/23d577ab4327b7f991ba10dd587e8954 to your computer and use it in GitHub Desktop.
Hot Reload Medium post snippet 2
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 MyHome extends StatelessWidget { | |
MyHome({Key key}) : super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Center( | |
child: RaisedButton( | |
child: Text('Click here'), | |
onPressed: () { | |
showDialog( | |
context: context, | |
builder: (context) { | |
return CustomAlertDialog( | |
title: "Title", | |
content: "Some random content", | |
); | |
}, | |
); | |
}, | |
), | |
); | |
} | |
} | |
class CustomAlertDialog extends StatelessWidget { | |
final String title; | |
final String content; | |
const CustomAlertDialog({Key key, this.title, this.content}) | |
: super(key: key); | |
@override | |
Widget build(BuildContext context) { | |
return Container( | |
child: AlertDialog( | |
title: Text(title), | |
content: Text(content), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment