how to have a button with text and icon for the flutter
?
I wanted to have a button
which looks like icon with a text that is able to put at the bottom of the screen
For example, the icon is like at here: android-button-with-icon-and-text
how to have a button with text and icon for the flutter
?
I wanted to have a button
which looks like icon with a text that is able to put at the bottom of the screen
For example, the icon is like at here: android-button-with-icon-and-text
Screenshot:
You can do something like,
If You need the text to be centered, and the image to be besides it, like this:
Then You can achieve it with this widget tree:
Full example available on my dartpad.dev (link).
You can achieve that by using a
FlatButton
that contains aColumn
(for showing a text below the icon) or aRow
(for text next to the icon), and then having anIcon
Widget and aText
widget as children.Here's an example:
This will produce the following:
If you need a button like this:
You can use
RaisedButton
and use the child property to do this. You need to add a Row and inside row you can add aText
widget and anIcon
Widget to achieve this. If you want to use png image, you can use similar widget to achieve this.Use Column or Row in a Button child, Row for horizontal button, Column for vertical, and dont forget to contain it with the size you need: