Skip to content

Instantly share code, notes, and snippets.

@sthefanoss
Last active July 24, 2020 02:15
Show Gist options
  • Save sthefanoss/97a10b6c60668cc5ef85879c0763e63b to your computer and use it in GitHub Desktop.
Save sthefanoss/97a10b6c60668cc5ef85879c0763e63b to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
void main() {
runApp(
MaterialApp(
debugShowCheckedModeBanner: false,
home: StrangeWidget(),
),
);
}
class StrangeWidget extends StatefulWidget {
@override
_StrangeWidgetState createState() => _StrangeWidgetState();
}
class _StrangeWidgetState extends State<StrangeWidget> {
String input = "CLICA ALI";
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: Center(
child: Text(input),
),
floatingActionButton: FloatingActionButton(
child: Text('AQUI'),
onPressed: () async {
String response = await showDialog(
context: context,
builder: (context) =>
AlertDialog(title: Text('Eu ja dizia:'), actions: [
FlatButton(
child: Text('A vida'),
onPressed: () => Navigator.of(context).pop('A vida'),
),
FlatButton(
child: Text('nao e'),
onPressed: () => Navigator.of(context).pop('nao e'),
),
FlatButton(
child: Text('um ๐Ÿ“'),
onPressed: () => Navigator.of(context).pop('um ๐Ÿ“'),
),
]),
);
setState(() => input = response);
},
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment