Div*_*vya 2 radio-button dart flutter
如何减少单选图标和标题之间的间距?
我尝试使用内容填充属性。但却无法缩小他们之间的差距。有什么办法可以实现这一点吗?
示例代码:
RadioListTile(
contentPadding: const EdgeInsets.only(top: 12, bottom: 12, left: 5),
title: Text(
"Tap Payment",
style: GoogleFonts.poppins(
color: Color(0xff000000),
fontSize: 16,
fontWeight: FontWeight.w500,
letterSpacing: 0.5,
),
),
value: values[0],
groupValue: currentValue,
onChanged: (value) {
setState(() {
currentValue = value.toString();
});
},
tileColor: (currentValue == values[0])
? Color(0xffececec)
: Colors.transparent,
),
Run Code Online (Sandbox Code Playgroud)
在内部,RadioListTile使用ListTile和默认的差距horizontalTitleGap是 16 。您可以覆盖主题。
Theme(
data: Theme.of(context).copyWith(
listTileTheme: ListTileThemeData(
horizontalTitleGap: 4,//here adjust based on your need
),
),
child: RadioListTile(
Run Code Online (Sandbox Code Playgroud)
您可以做的另一件事是Row与 RadioButton 一起使用。