[英]How to put a button next to a RadioListTile ? - Flutter
I want to put an information button that works just like an AlertDialog()
but I'm having problems to put it next to the checkbox text since they're organized inside a Column()
and I cannot just put a Row()
inside of it.我想放置一个像AlertDialog()
一样工作的信息按钮,但我无法将它放在复选框文本旁边,因为它们是在Column()
中组织的,我不能只将Row()
放在它。
Here is the code of the checkboxes:这是复选框的代码:
Column (
// ...
RadioListTile(
title: Text('Pelagens de camundongos',
style: TextStyle(
fontSize: 17.0, color: Colors.white)),
value: 1,
groupValue: id,
onChanged: (val) {
setState(() {
predominant = 'recessiva_aa';
id = 1;
});
},
),
const SizedBox(
height: 5.0,
),
RadioListTile(
title: Text('Pelagem em cães labradores',
style: TextStyle(
fontSize: 17.0, color: Colors.white)),
value: 2,
groupValue: id,
onChanged: (val) {
setState(() {
predominant = 'recessiva_ee';
id = 2;
});
},
),
),
Inside of the title of your RadioListTile
instead of putting a text widget you can put a row and inside of that row have Text
and an IconButton
that will pop up your alert dialog when pressed like this在你的RadioListTile
的标题里面,而不是放置一个文本小部件,你可以放一行,在那一行里面有Text
和一个IconButton
,当像这样按下时会弹出你的警告对话框
Column(
children: [
RadioListTile(
title: Row(
children: [
Text('Pelagens de camundongos',
style: TextStyle(fontSize: 17.0, color: Colors.white)),
IconButton(
icon: Icon(
Icons.info_outline,
),
onPressed: () {
// code to pop up alert dialog
},
),
],
),
value: 1,
groupValue: id,
onChanged: (val) {
setState(() {
predominant = 'recessiva_aa';
id = 1;
});
},
),
const SizedBox(
height: 5.0,
),
RadioListTile(
title: Row(
children: [
Text('Pelagem em cães labradores',
style: TextStyle(fontSize: 17.0, color: Colors.white)),
IconButton(
icon: Icon(
Icons.info_outline,
),
onPressed: () {
// code to pop up alert dialog
},
),
],
),
value: 2,
groupValue: id,
onChanged: (val) {
setState(() {
predominant = 'recessiva_ee';
id = 2;
});
},
),
],
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.