Flutter Buttons

flutter-buttons-example
flutter-buttons-example

In our flutter tutorial series, we’re going to learn how to display multiple types of buttons. Flutter has multiple button types such as

  • RaisedButton
  • OutlineButton
  • FlatButton
  • IconButton

Display Raised Button on Flutter

To display RaisedButton, we need to execute the following code

<span class="hljs-selector-tag">RaisedButton</span>(
<span class="hljs-attribute">child</span>: Text(<span class="hljs-string">"RaisedButton"</span>), 
<span class="hljs-attribute">onpressed</span>: (){ 

    <span class="hljs-comment">// some code here</span>

})

Display FlatButton on Flutter

To display FlatButton, we need to execute the following code

<span class="hljs-selector-tag">FlatButton</span>(
<span class="hljs-attribute">child</span>: Text(<span class="hljs-string">"FlatButton"</span>), 
<span class="hljs-attribute">onpressed</span>: (){ 
    <span class="hljs-comment">// some code here</span>
})

Display OutlineButton on Flutter

To display OutlineButton, we need to execute the following code

<span class="hljs-selector-tag">OutlineButton</span>(
    <span class="hljs-attribute">child</span>: Text(<span class="hljs-string">"OutlineButton"</span>), 
    <span class="hljs-attribute">onpressed</span>: (){ 
        <span class="hljs-comment">// some code here</span>
    })

Display IconButton on Flutter

To display IconButton, we need to execute the following code

<span class="hljs-selector-tag">IconButton</span>(
<span class="hljs-attribute">icon</span>: Icon(Icons.favorite)
<span class="hljs-attribute">onpressed</span>: (){ 
    <span class="hljs-comment">// some code here</span>
})