Created
April 22, 2020 00:00
-
-
Save PoojaB26/b4fb1e9bd187d4a808f85d962f63e9d1 to your computer and use it in GitHub Desktop.
Button Widget
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
appBar: AppBar(title: Text("Button Widget: Examples")), | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
static final TextStyle bigStyle = TextStyle(fontSize: 20); | |
final btn1 = RaisedButton( | |
onPressed: () {}, | |
color: Colors.yellow, | |
disabledTextColor: Colors.grey, | |
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), | |
elevation: 20.0, | |
splashColor: Colors.green, | |
highlightColor: Colors.red, | |
highlightElevation: 1.0, | |
child: Text("Raised Button"), | |
); | |
final btn2 = MaterialButton( | |
minWidth: 250.0, | |
onPressed: () {}, | |
colorBrightness: Brightness.dark, | |
color: Colors.deepPurpleAccent, | |
elevation: 20.0, | |
splashColor: Colors.green, | |
//highlightColor: Colors.red, | |
highlightElevation: 1.0, | |
child: Text("Material Button"), | |
); | |
final btn3 = FlatButton( | |
onPressed: () {}, | |
colorBrightness: Brightness.dark, | |
color: Colors.deepPurpleAccent, | |
splashColor: Colors.green, | |
highlightColor: Colors.red, | |
child: Text("Raised Button"), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.horizontal( | |
left: Radius.circular(20.0), right: Radius.circular(1.0))), | |
); | |
final btn4 = OutlineButton( | |
onPressed: () {}, | |
borderSide: BorderSide(width: 5.0, color: Colors.deepPurpleAccent), | |
color: Colors.deepPurpleAccent, | |
highlightedBorderColor: Colors.purple, | |
splashColor: Colors.green, | |
//highlightColor: Colors.red, | |
child: Text("Raised Button"), | |
shape: RoundedRectangleBorder( | |
borderRadius: BorderRadius.vertical( | |
top: Radius.circular(20.0), bottom: Radius.circular(1.0))), | |
); | |
final btn5 = IconButton( | |
color: Colors.purple, | |
splashColor: Colors.yellow, | |
// highlightColor: Colors.red, | |
icon: Icon( | |
Icons.build, | |
size: 40.0, | |
), | |
onPressed: () {}); | |
final btn6 = Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
FloatingActionButton( | |
backgroundColor: Colors.orange, | |
child: Icon( | |
Icons.mic, | |
size: 30.0, | |
color: Colors.white, | |
), | |
onPressed: () {}), | |
FloatingActionButton( | |
mini: true, | |
backgroundColor: Colors.green, | |
child: Icon( | |
Icons.mic, | |
size: 30.0, | |
color: Colors.white, | |
), | |
onPressed: () {}), | |
], | |
); | |
@override | |
Widget build(BuildContext context) { | |
return btn6; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add