Skip to content

Instantly share code, notes, and snippets.

@vijayinyoutube
Created January 20, 2020 12:10
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 vijayinyoutube/a4c7f5a1934be884685b203f5434e334 to your computer and use it in GitHub Desktop.
Save vijayinyoutube/a4c7f5a1934be884685b203f5434e334 to your computer and use it in GitHub Desktop.
Button decoration
import 'package:flutter/material.dart';
void main() => runApp(HomePage());
class HomePage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: LoginPage(),
);
}
}
class LoginPage extends StatefulWidget {
@override
_LoginPageState createState() => _LoginPageState();
}
class _LoginPageState extends State<LoginPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
resizeToAvoidBottomPadding: false,
body: SingleChildScrollView(
child: Form(
child: Container(
padding: EdgeInsets.only(
top: 100.0, right: 20.0, left: 20.0, bottom: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 200.0),
buildButtonContainer(),
SizedBox(
height: 30.0,
),
],
),
),
),
),
);
}
Widget buildButtonContainer() {
return Container(
height: 56.0,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(23.0),
gradient: LinearGradient(colors: [
Color(0xFFFF1000),
Color(0xFF2508FF),
], begin: Alignment.centerRight, end: Alignment.centerLeft),
),
child: Center(
child: Container(
height: 100.0,
width: 500.0,
child: FlatButton(
shape: new RoundedRectangleBorder(
borderRadius: new BorderRadius.circular(20.0)),
child: Text(
"Login",
style: TextStyle(
color: Colors.white,
fontSize: 25,
),
),
onPressed: () {}),
),
));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment