【发布时间】:2023-01-02 03:11:30
【问题描述】:
我在 Flutter 中仍然是绿色的,并且面临着 IconButton 间距问题:
图标周围有不需要的空间。我没有在小部件之间添加任何填充或大小框,而且我对来自很棒的字体的图标也有同样的问题。这是我的代码:
Widget contactCard(context, dl, i) {
return GestureDetector(
onTap: () {},
child: Card(
color: Colors.grey[300],
child: SizedBox(
height: 190,
child: Padding(
padding: EdgeInsets.all(10),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(dl[i].englishName, style: TextStyle(fontSize: 20, fontWeight: FontWeight.bold)),
Text(dl[i].chineseName, style: TextStyle(fontSize: 14, fontWeight: FontWeight.bold)),
constructPhone(dl[i].phone1),
constructPhone(dl[i].phone2),
],
),
),
),
),
);
}
Widget constructPhone(tel){
if (tel.runes.length==0){
return Text('');
}else{
return Row(
children: [
IconButton(
padding: EdgeInsets.all(0),
icon: const Icon(Icons.phone, size: 20),
onPressed: () => launchUrl(Uri.parse("tel://" + tel)),
),
Text(
tel,
style: TextStyle(fontSize: 18),
),
],
);
};
}
【问题讨论】:
标签: flutter iconbutton