Flutter FlatButton Example

Hi, developer in this flutter tutorial I am sharing how to used flutter FlatButton an easy example.FlatButton is a Flutter Widgets. FlatButton is similar to the Android button filed.

Flutter FlatButton

In Flutter, FlatButton basically used to Showing buttons that lead to secondary functionalities of the application like viewing files from the Gallery, navigate to other screen, etc.

Flutter FlatButton does not have any elevation and  Raised Button. Also, by default, it’s a simple button without any advance designing. But if you want you may provide the color of the button and text using textColor and color respectively. You can access the callback function onPressed() when using pressed FlatButton.

Example – Flutter FlatButton

main.dart File source code 

import 'package:flutter/material.dart';

void main() {
 runApp(MyApp());
}


class MyApp extends StatefulWidget {

  @override
  _MyState createState() => _MyState();
}

class _MyState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: Text('codeplayon'),
          ),

          body: Center(child: Column(children: <Widget>[
            Container(
              margin: EdgeInsets.all(20),
              child: FlatButton(
                child: Text('FlatButton Example'),
                onPressed: () {},
              ),
            ),

            Container(
              margin: EdgeInsets.all(20),
              child: FlatButton(
                child: Text('Login'),
                color: Colors.blueAccent,
                textColor: Colors.white,
                onPressed: () {},
              ),
            ),
          ]))),
    );
  }
}

 

Facebooktwitterredditpinterestlinkedinmail
Recommended
Hi everyone in this article I am working with flutter…