Code for showing the Alert Dialog when the OutlinedButton is clicked:
OutlinedButton(
onPressed: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: const Text(
"This is the title",
style: TextStyle(color: Colors.red),
),
content: Column(
mainAxisSize: MainAxisSize.min,
children: [
Image.asset(
"assets/images/bike.jpg",
height: 100,
width: 100,
),
const Text("This is the body of the dialog!"),
],
),
backgroundColor: Colors.green,
actions: [
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
child: const Text(
"CLOSE",
),
),
IconButton(
onPressed: () {},
icon: Icon(Icons.star),
),
],
);
});
},
style: OutlinedButton.styleFrom(
foregroundColor: Colors.red,
// shape: BeveledRectangleBorder(
// borderRadius: BorderRadius.circular(
// 5.0,
// ),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: const Text(
"Show Alert Dialog",
),
),
No comments:
Post a Comment