we can create the icon button with FlatButton.icon()
but it requires label
parameter.
we can also use IconButton()
but it makes a circular icon button.
how to make a rectangle icon button like FlatButton()
but with just icon in flutter?
we can create the icon button with FlatButton.icon()
but it requires label
parameter.
we can also use IconButton()
but it makes a circular icon button.
how to make a rectangle icon button like FlatButton()
but with just icon in flutter?
Container(
height: 100.0,
width: 100.0,
child: FlatButton(
child: Icon(Icons.place),
onPressed: () {},
),
),
You can create a container with an icon as a child and wrap the container with the InkWell widget to make it clickable. This way you can shape your container to your need, which in this case is a rectangle.
Here's a code sample -
InkWell(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(
width: 1,
)),
child: Icon(Icons.add, color: Colors.black),
),
onTap: () {},
),
Using Inkwell combination with container you can make customized button easily as done in above example
InkWell(
child: Container(
decoration: BoxDecoration(
shape: BoxShape.rectangle,
border: Border.all(
width: 1,
)),
child: Icon(Icons.add, color: Colors.black),
),
onTap: () {},
),