https://i.stack.imgur.com/oUxNk.jpg
I wanted like this. I have used RadioListTile
in ALertDialog
. It results in diffrent sized Dialog box in different android devices. Thus resulted in overflowing pixel errors or just a black screen.
Here is my code
@override Widget build(BuildContext context) { Size size = MediaQuery.of(context).size;
return AlertDialog(
insetPadding: EdgeInsets.symmetric(
horizontal: SizeConfig.safeBlockHorizontal * 16,
vertical: SizeConfig.safeBlockHorizontal * 40),
title: Text("Methods"),
content: ListView(children: <Widget>[
Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(
color: Theme.of(context).hintColor, width: 1.0)),
child: RadioListTile(
value: 1,
groupValue: _crtIndex,
title: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"12 months",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
),
Text(
"Rs.4,375",
style: TextStyle(
fontWeight: FontWeight.bold, fontSize: 13),
),
],
),
SizedBox(width: size.width * 0.005),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
"50% off",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 13,
),
),
Text(
"9,876",
style: TextStyle(
fontWeight: FontWeight.normal,
fontSize: 13,
decoration: TextDecoration.lineThrough),
),
],
),
],
),
activeColor: Colors.teal,
onChanged: (val) {
setState(() {
_crtIndex = val;
});
}),
),
SizedBox(height: size.height * 0.01),
new FlatButton(
color: Colors.red,
child: new Text('BUY NOW AND SAVE'),
onPressed: () {
Navigator.of(context).pop();
},
),
]));
I have also tried putting AlertDialog
inside SizedBox
and also in Container
and tried setting height and width.
I have used Size size = MediaQuery.of(context).size;
to get the height and width.
I have also tried insetPadding: EdgeInsets.symmetric(horizontal: *value,vertical: *value),
Nothing really worked.
I am new in flutter. Please help. Thank you in advance
Check out this example that I have made :
This is the offers page :
check this out and let me know if it works.