[英]Flutter 2: Remove additional margin from ElevatedButton / TextButton
我想知道如何刪除 ElevatedButton 和 TextButton 周圍的邊距。
這里詳細介紹一下它的外觀:
Column(
children: [
ElevatedButton(
onPressed: () {
},
child: Text('Login')
),
TextButton(
onPressed: () {
},
child: Text('Login')
),
],
)
這是解決方案:
ElevatedButton(
onPressed: () {
},
style: ElevatedButton.styleFrom(
tapTargetSize: MaterialTapTargetSize.shrinkWrap
),
child: Text('Login')
),
TextButton(
onPressed: () {
},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
minimumSize: Size(0, 0)
),
child: Text('Login')
),
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.