Skip to content

Instantly share code, notes, and snippets.

@JeisonSanches
Last active June 14, 2021 17:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeisonSanches/fd16c270d841e477e049265ae4cd553e to your computer and use it in GitHub Desktop.
Save JeisonSanches/fd16c270d841e477e049265ae4cd553e to your computer and use it in GitHub Desktop.
import 'package:flutter/material.dart';
final Color darkBlue = Color.fromARGB(255, 18, 32, 47);
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue),
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: MyWidget(),
),
),
);
}
}
class MyWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return ElevatedButton(child: Text("Press here"),onPressed: ()=>showDialog(
context: context,
builder: (context) {
return AlertDialog(
backgroundColor: Color.fromRGBO(8, 19, 40, 1),
actions: [
TextButton(
onPressed: () {
print('No');
Navigator.of(context).pop();
},
child: Text(
'No',
style: TextStyle(color: Colors.red),
)),
TextButton(
onPressed: () async {
print("Yes");
Navigator.of(context).pop();
},
child: Text(
'Yes',
style: TextStyle(color: Colors.red),
)),
],
content:Text("Choose a option")
);
}).then((val){
print("closed");
}));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment