Flutter 颤振扁平按钮和图标引入不需要的填充
我试图用一个图标来控制平面按钮的大小。但图标似乎正在破坏按钮Flutter 颤振扁平按钮和图标引入不需要的填充,flutter,dart,Flutter,Dart,我试图用一个图标来控制平面按钮的大小。但图标似乎正在破坏按钮 return Container(width: 180,height:30, child: Row( children: [ FlatButton(onPressed: () => _selectedDateDailyChart > 0 ? _adjustDate(-1) : null, child: Container( color:Col
return Container(width: 180,height:30,
child: Row(
children: [
FlatButton(onPressed: () => _selectedDateDailyChart > 0 ? _adjustDate(-1) : null,
child: Container(
color:Colors.red,
width: 20,
child: Icon(Icons.arrow_back_ios),
),
padding: EdgeInsets.zero
),
Container(child: Text(currentDate, style: Theme.of(context).textTheme.headline3.apply(fontSizeDelta: -2)),),
FlatButton(onPressed: () => _selectedDateDailyChart > 0 ? _adjustDate(-1) : null,
child: Container(
width: 20,
child: Icon(Icons.arrow_forward_ios),
),
padding: EdgeInsets.zero
),
],),
下面是它的外观:
你可能需要在你周围放置一个
墨水池
小部件图标
insted,同样的结果,0填充。你只需要像这样使用扩展小部件“在两个按钮之间取得平衡,用扩展的按钮包裹另一个按钮”
嘿,我试过这个解决方案,但它不起作用。你还有填充物吗?这是图标本身。它有填充物。您可以在这里看到它:另外,您可以将图标更改为
arrow\u back\u ios\u outlined
,或者自己创建一个svg并使用它。
child: Container(
width: 180,
height: 30,
child: Row(
children: [
Expanded(
child: FlatButton(
onPressed: () => _selectedDateDailyChart > 0
? _adjustDate(-1)
: null,
child: Container(
color: Colors.red,
width: 20,
child: Icon(Icons.arrow_back_ios),
),
padding: EdgeInsets.zero),
),
Container(
child: Text(currentDate,
style: Theme.of(context)
.textTheme
.headline3
.apply(fontSizeDelta: -2)),
),
FlatButton(
onPressed: () =>
_selectedDateDailyChart > 0 ? _adjustDate(-1) : null,
child: Container(
width: 20,
child: Icon(Icons.arrow_forward_ios),
),
padding: EdgeInsets.zero),
],
),
),