Flutter 更改 flutter icon touch area 触摸区域

9 min read
@override
  Widget build(BuildContext context) {
    final iconBtnSize = 24.0;
    return ButtonBar(
      buttonPadding: EdgeInsets.all(1),
      alignment: MainAxisAlignment.spaceBetween,
      children: [
        IconButton(
          iconSize: iconBtnSize,
          icon: Icon(
            FontAwesomeIcons.save,
            color: Colors.blue,
          ),
          onPressed: () => print('Test IconButton'),
        ),
        InkWell(
          child: Icon(
            FontAwesomeIcons.upload,
            color: Colors.yellow,
            size: iconBtnSize,
          ),
          onTap: () => print('Test InkWell'),
        ),
        InkResponse(
          child: Icon(
            FontAwesomeIcons.shareAlt,
            color: Colors.green,
            size: iconBtnSize,
          ),
          onTap: () => print('Test InkResponse'),
        ),
        GestureDetector(
          child: Icon(
            FontAwesomeIcons.pencilAlt,
            color: Colors.green,
            size: iconBtnSize,
          ),
          onTap: () => print('Test GestureDetector'),
        ),
      ],
    );
  }