Skip to content

Instantly share code, notes, and snippets.

@jmolins
Last active June 27, 2018 10:15
Show Gist options
  • Save jmolins/23d577ab4327b7f991ba10dd587e8954 to your computer and use it in GitHub Desktop.
Save jmolins/23d577ab4327b7f991ba10dd587e8954 to your computer and use it in GitHub Desktop.
Hot Reload Medium post snippet 2
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