我有以下 RadioButtonListTile 作为以下代码:
import 'package:flutter/material.dart';
import 'package:getxflutter/helper/enum.dart';
class DeliveryTypesRadioListTile extends StatelessWidget {
final dynamic value;
final dynamic groupValue;
final Function onChanged;
final Widget title;
final Widget subtitle;
final Color activeColor;
const DeliveryTypesRadioListTile({
Key key,
@required this.value,
@required this.groupValue,
@required this.onChanged,
@required this.title,
@required this.subtitle,
@required this.activeColor,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return RadioListTile<Delivery>(
value: value,
groupValue: groupValue,
onChanged: onChanged,
title: title,
subtitle: subtitle,
activeColor: activeColor,
);
}
}
它显示如下图:那么是否可以使单选按钮显示在右侧,如下图所示:
最佳答案
尝试添加 controlAffinity: ListTileControlAffinity.trailing
给您的 RadioListTile
像这样的东西:
return RadioListTile<Delivery>(
value: value,
groupValue: groupValue,
onChanged: onChanged,
title: title,
subtitle: subtitle,
activeColor: activeColor,
controlAffinity: ListTileControlAffinity.trailing,
);
关于flutter - 如何在 flutter 右侧的 RadioButtonList Tile 中设置单选按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67664923/