我有一个Check box
作为以下代码:
DelayedAnimation(
child: CheckboxListTile(
title: const Text('Check privacy & policy'),
value: timeDilation != 1.0,
onChanged: (bool value) {
setState(() {
timeDilation = value ? 5.0 : 1.0;
});
},
secondary: Image.asset(
'assets/images/policy_ic.png',
height: 30,
),
),
delay: delayedAmount + 4500,
),
如下图所示:现在,我需要为
text
和image设置padding或margin,使其类似于下图:我希望有人可以帮助我解决这个问题。
最佳答案
您所要做的只是将CheckboxListTile包装在Padding小部件中,并仅设置horizontal属性。
Padding(
padding: const EdgeInsets.symmetric(horizontal: 40.0), // Set it to your liking
child: CheckboxListTile(
title: const Text('Check privacy & policy'),
value: timeDilation != 1.0,
onChanged: (bool value) {
setState(() {
timeDilation = value ? 5.0 : 1.0;
});
},
secondary: Image.asset(
'assets/images/policy_ic.png',
height: 30,
),
),
),
关于flutter - 如何设置复选框边距或填充右边的图像和文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62597294/