Button 如何在Flatter中创建没有标签的矩形图标按钮?
我们可以使用Button 如何在Flatter中创建没有标签的矩形图标按钮?,button,flutter,Button,Flutter,我们可以使用FlatButton.icon()创建图标按钮,但它需要标签参数。 我们也可以使用IconButton(),但它会生成一个圆形图标按钮 如何制作一个矩形图标按钮,如FlatButton(),但只使用flatter中的图标?您可以创建一个带有图标的容器,并使用InkWell小部件包装容器,使其可点击。通过这种方式,您可以根据自己的需要来塑造容器,在本例中,容器是一个矩形 Container( height: 100.0, width: 100.0, child: FlatB
FlatButton.icon()
创建图标按钮,但它需要标签
参数。
我们也可以使用IconButton()
,但它会生成一个圆形图标按钮
如何制作一个矩形图标按钮,如
FlatButton()
,但只使用flatter中的图标?您可以创建一个带有图标的容器,并使用InkWell小部件包装容器,使其可点击。通过这种方式,您可以根据自己的需要来塑造容器,在本例中,容器是一个矩形
Container(
height: 100.0,
width: 100.0,
child: FlatButton(
child: Icon(Icons.place),
onPressed: () {},
),
),
这是一个代码示例-
InkWell(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(
width: 1,
)),
child: Icon(Icons.add, color: Colors.black),
),
onTap: () {},
),
只需使用FlatButton(子项:Icon(Icons.add),最小宽度:0,)