Flutter Flatbutton
Flutter Flatbutton
Flutter FlatButton
In Flutter, FlatButton is usually used to display buttons that lead to secondary functionalities of the application
like viewing all files of Gallery, opening Camera, changing permissions etc.
FlatButton does not have an elevation unlike Raised Button. Also, by default, there is no color to the button and
text is black.
But you may provide color to the text and button using textColor and color respectively.
You can access the callback function onPressed() when the FlatButton is pressed.
In this example Flutter application, we have displayed a default FlatButton and then with some styling like text
color and button color.
main.dart
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
When you run this application, you should see UI as shown below.
If you do not provide onPressed() function for FlatButton, the button is displayed as a disabled button.
In the following GIF, you could observe the behavior of FlatButton when pressed.
Conclusion
In this Flutter Tutorial, we learned how to use FlatButton and how to change some of its properties.
Flutter Tutorial
✦ Flutter Tutorial
Flutter Widgets
✦ Flutter Text
✦ Flutter TextField
➩ Flutter FlatButton
✦ Flutter RaisedButton
✦ Flutter SnackBar
✦ Flutter Switch
✦ Flutter ToggleButtons
✦ Flutter Table
✦ Flutter DataTable
✦ Flutter Tooltip
Flutter Animation
Flutter Packages
Flutter Examples