Skip to content

Instantly share code, notes, and snippets.

@josue1dario2
Created February 28, 2023 05:23
Show Gist options
  • Save josue1dario2/4aed3533c4fa18118cd221e1546cf2ff to your computer and use it in GitHub Desktop.
Save josue1dario2/4aed3533c4fa18118cd221e1546cf2ff to your computer and use it in GitHub Desktop.
3. AlertScreen
class AlertScreen extends StatelessWidget {
const AlertScreen({super.key});
void displayDialog(BuildContext context) {
showDialog(
barrierDismissible: false,
context: context,
builder: ((context) {
return AlertDialog(
elevation: 5,
title: const CustomText(
text: 'Descartar creación',
size: 16,
weight: FontWeight.w600,
color: Color(0xFF482F74)),
shape:
RoundedRectangleBorder(borderRadius: BorderRadius.circular(8)),
content: Column(
mainAxisSize: MainAxisSize.min,
children: const [
CustomText(
text:
'Al salir vas a perder todo el progreso y cambios que has realizado.',
size: 16,
weight: FontWeight.w400,
color: Color(0xFF89868F)),
//SizedBox(height: 10),
],
),
actions: [
const Padding(
padding: EdgeInsets.only(bottom: 20),
child: GreenButton(
text: 'Seguir editando',
paddingHorizontal: 25,
paddingVertical: 12),
),
Padding(
padding: const EdgeInsets.only(right: 20, bottom: 20),
child: TextButton(
onPressed: () => Navigator.pop(context),
child: const CustomText(
text: 'Descartar y salir',
size: 14,
weight: FontWeight.w500,
color: Color(0xFF6197F7))),
)
],
);
}));
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: ElevatedButton(
onPressed: () => displayDialog(context),
child: const Text('Alerta'),
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment