How to use the flat button in Flutter?

0 votes

Hi Team,

I am using the Flutter Framework to create an Android App. I want to use the Flat Button. How can I use that? 

Oct 20 in Others by akhtar
• 32,960 points
90 views

2 answers to this question.

0 votes

Hi@akhtar,

You can use the FlatButton inside a Widget. For example, in the container widget, you must define the onPressed property as shown below.

container( 
child: FlatButton( 
  child: Text('Text here'), 
onPressed: (){ print('Button pressed'); }, 
), 
);
answered Oct 20 by MD
• 77,700 points
+1 vote

FlatButton is really easy to use.

Where ever you need it. Just add

 FlatButton(
child: Text('FlatButton'),
color: Colors.white,
onPressed: () {
print("FlatButton tapped");
},
),
Full source code down below.
``` import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: FlatButton(
child: Text('FlatButton'),
color: Colors.white,
onPressed: () {
print("FlatButton tapped");
},
),
);
}
}
answered Nov 9 by Vijay
• 200 points

edited Nov 9 by MD

Related Questions In Others

0 votes
1 answer

How to check the connected device name in Flutter?

Hi@akhtar, Flutter has its command own command to ...READ MORE

answered Jul 17 in Others by MD
• 77,700 points
264 views
0 votes
1 answer

How to create an Icon Button in Flutter?

Hi@akhtar, To create an Icon Button in Flutter, ...READ MORE

answered Jul 24 in Others by MD
• 77,700 points
66 views
0 votes
1 answer

How to use hexadecimal color strings in Flutter?

Hi@akhtar, In Flutter the Color class only accepts integers as parameters, or there ...READ MORE

answered Jul 24 in Others by MD
• 77,700 points
65 views
0 votes
1 answer

How to change the background color of AppBar in Flutter?

Hi@akhtar, You can add backgroundColor keyword in your ...READ MORE

answered Aug 12 in Others by MD
• 77,700 points
462 views
0 votes
1 answer

How to use Card Widget in Flutter App?

Hi@akhtar, A card is a sheet of material used to ...READ MORE

answered Aug 26 in Others by MD
• 77,700 points
68 views
0 votes
1 answer

What is the future of flutter?

Hi@MD, Flutter is a rather new cross-platform framework ...READ MORE

answered Jul 17 in Others by akhtar
• 32,960 points
78 views
0 votes
1 answer

What is Flutter?

Hi@akhtar, Flutter is an app SDK for building ...READ MORE

answered Jul 17 in Others by MD
• 77,700 points
120 views
0 votes
1 answer

How to install Flutter in Windows system?

Hi@akhtar, You can follow the below-given steps to ...READ MORE

answered Jul 17 in Others by MD
• 77,700 points
178 views
0 votes
2 answers

How to create a floating button in Flutter?

Scaffold widget provides floatingActionButton property. You can ...READ MORE

answered Nov 9 in Others by Vijay
• 200 points
632 views