iconButton 有padding

  1. # 因为iconButton 有一个最小的48px的约束
  2. IconButton(
  3. padding: EdgeInsets.zero, // 将padding改为0
  4. constraints: BoxConstraints(), // 取消约束
  5. icon: Icon(Icons.keyboard_arrow_right),
  6. onPressed: () {
  7. print('121');
  8. },
  9. )
  10. # 第二种方法
  11. Container(
  12. padding: const EdgeInsets.all(0.0),
  13. width: 30.0, // you can adjust the width as you need
  14. child: IconButton(
  15. ),
  16. )