android - 如何在 RadioListTile 旁边放置一个按钮?- 颤振
问题描述
我想放置一个像 an 一样工作的信息按钮AlertDialog()
,但我无法将其放在复选框文本旁边,因为它们组织在 a 内Column()
,我不能只将 aRow()
放在其中。
这是复选框的代码:
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;
});
},
),
),
解决方案
在您的标题内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;
});
},
),
],
)
推荐阅读
- java - Android 最近的设备按钮监听器
- java - 如何在逗号上用逗号分割java中的字符串但有一定的标准
- css - 带有 asp.net web.sitemap 的 Bootstrap 4 导航栏;如何去除这些点?
- restcomm - 非本地 dpc=1111 的传入 Mtp3 消息。但是没有找到 RemoteSpc
- eclipse - 日食光子视图中的奇怪内容
- python - Numpy 性能 - 向量与其转置的外积
- post - CSRF 令牌验证失败:Retrofit Post
- android - 使用 Theme.MaterialComponents 代替 Theme.AppCompat 有什么好处?
- python - 增强 RabbitMQ 库 pika 的可靠性或有更好的选择
- php - Doctrine - 代理实体未正确更新