The core concept of the Flutter framework is, In Flutter Everything is a widget. Widgets are basically user interface components used to create the user interface of the application.

Button Widget in Flutter

There are different types of button widget in flutter among them RaisedButton, FlatButton and IconButton are the most popular and mostly used button widgets in a flutter application:-

Raised Button in Flutter

A raised button is based on a Material widget whose Material.elevation increases when the button is pressed. Use raised buttons to add dimension to otherwise mostly flat layouts, e.g. in long busy lists of content, or in wide spaces.

It has properties like color, a child with a Text Widget which is shown in Raised Button and onPressed which takes a function. It also has style property which is used to style or make the button more attractive.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
          child: Center(
            child: RaisedButton(onPressed: (){ }, child: Text("Raised Button")), //Raised Button
          ),
        ),
      );
  }
}

the function in onPressed is called when the button is clicked by the user.

Flat Button in Flutter

FlatButton is used to create text like button which do not have a shape like RaisedButton but is clickable in a text. In general, A flat button is a section printed on a Material Components widget that reacts to touches by filling with color. It has almost the same properties as RaisedButton and most popular are onPressed and Text property with style.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
          child: Center(
            child: FlatButton(onPressed: (){ }, child: Text("Flat Button")), //Flat Button
          ),
        ),
      );
  }
}

Icon Button in Flutter

The icon button widget is a picture printed on a Material widget that reacts to touches by filling with color (ink). Icon button is similar to other buttons but it has only icons rather than Text widget. Its properties are almost the same as Raised and Flat button beside that it has Icon property rather than Text property.

import "package:flutter/material.dart";

void main() => runApp(MaterialApp(debugShowCheckedModeBanner: false, home: MyApp(),));

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text("Review2Tech Application"),
        ),
        body: Container(
          child: Center(
            child: IconButton(onPressed: (){ }, icon: Icon(Icons.arrow_forward),), //Icon Button
          ),
       ),
    );
  }
}

Output of Buttons Widget in Flutter

flutter buttons widget

Complete Flutter Series List: Click here 

Categories: Blog Tags: flutter, review2tech flutter series, button widget, button in flutter, raised button, flat button, icon button, flutter android, flutter ios


4 Comments

  • Comment

    hermes belt

    2020-08-09 04:18:24

    you have got an important weblog here! would you prefer to make some invite posts on my blog?

    Reply

  • Comment

    air jordan

    2020-08-11 04:10:43

    I simply wanted to construct a remark to be able to express gratitude to you for the lovely steps you are writing here. My rather long internet research has at the end of the day been rewarded with professional details to exchange with my co-workers. I would mention that most of us site visitors are truly lucky to live in a fabulous site with very many special individuals with great tips. I feel truly privileged to have come across your entire web site and look forward to many more entertaining times reading here. Thank you once again for a lot of things.

    Reply

  • Comment

    goyard bags

    2020-08-13 15:38:16

    Thanks a lot for giving everyone a very breathtaking opportunity to check tips from this website. It is often so cool plus jam-packed with a great time for me and my office colleagues to search your site nearly 3 times in 7 days to read the newest stuff you have got. And lastly, we are actually happy for the great things you serve. Selected 2 tips in this post are unquestionably the simplest we have ever had.

    Reply

  • Comment

    yeezy

    2020-08-16 02:22:26

    I wanted to write down a simple word so as to express gratitude to you for those stunning advice you are sharing on this site. My time intensive internet investigation has at the end been honored with awesome information to exchange with my colleagues. I would state that that most of us site visitors actually are really fortunate to be in a superb place with many outstanding people with insightful methods. I feel pretty lucky to have encountered the web page and look forward to so many more fabulous times reading here. Thanks once more for everything.

    Reply

Leave a comment