Flutter Add Image Icon Inside Rounded Raised Button Example Tutorial

Raised button has a sub widget called as RaisedButton.icon() which is used to create raised button with Icon images. Using RaisedButton.icon() widget can easily put icon at the left side of button. But to set icon at right side of raised button we have to modify the raised button structure and create custom raised button with Row widget. We are using the default Icon library of flutter in our tutorial because it covers all the icons. So in this tutorial we would Flutter Add Image Icon Inside Rounded Raised Button Android iOS Example Tutorial. In many apps we have seen button with different icons like Signing buttons, Which has a icon placed on the left side side of button to differentiate the purpose of button in single look.

Contents in this project Flutter Add Image Icon Inside Rounded Raised Button Android iOS Example Tutorial:

1. Import material.dart package in your app’s main.dart file.

2. Creating void main runApp() method and here we would call our main MyApp class.

3. Creating our main MyApp class extends with State less widget.

4. Creating Widget build area in MyApp class. Now we would make our main Scaffold widget -> Center widget -> Column widget.

5. Creating RaisedButton.icon() widget in Column widget.

  • onPressed : Used to set on item click event on Button.
  • shape : Used to make the circular corners around button.
  • label : Used to create Button Title Text.
  • icon : Used to put icon inside button at the left side of text.
  • textColor : To set Text color.
  • color : Used to set Background color of Raised Button.

Button Screenshot:

6. Creating another RaisedButton.icon() widget in Column widget.

Button Screenshot:

7. Creating a Container Widget -> Raised Button widget. We would put a Row widget as child of Raised button than put Text widget and Icon widget wrap in Padding widget to put image icon at the right side of button.

Button Screenshot:

8. Complete source code for main.dart file:

Screenshot:

Flutter Add Image Icon Inside Rounded Raised Button Example Tutorial

Leave a Reply

Your email address will not be published.