Last active
July 24, 2020 02:15
-
-
Save sthefanoss/97a10b6c60668cc5ef85879c0763e63b 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
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