Skip to content

Instantly share code, notes, and snippets.

@PoojaB26
Created April 22, 2020 00:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PoojaB26/b4fb1e9bd187d4a808f85d962f63e9d1 to your computer and use it in GitHub Desktop.
Save PoojaB26/b4fb1e9bd187d4a808f85d962f63e9d1 to your computer and use it in GitHub Desktop.
Button Widget
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;
}
}
Copy link

ghost commented Apr 22, 2020

Add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment