Skip to content

Instantly share code, notes, and snippets.

@lalkrishna
Created August 9, 2020 04:17
Show Gist options
  • Save lalkrishna/fa8e864eea57069e2537a199c0dcaa90 to your computer and use it in GitHub Desktop.
Save lalkrishna/fa8e864eea57069e2537a199c0dcaa90 to your computer and use it in GitHub Desktop.
GradientButton Widget for Flutter Apps
import 'package:flutter/material.dart';
class GradientButton extends StatelessWidget {
final String title;
final VoidCallback onPressed;
const GradientButton({
Key key,
@required this.title,
@required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: double.infinity,
height: 50.0,
// color: Colors.green,
margin: const EdgeInsets.symmetric(vertical: 15.0),
decoration: const BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(5.0)),
gradient: LinearGradient(
// begin: Alignment.topCenter,
// end: Alignment.bottomCenter,
colors: <Color>[
Color(0xFF6B5CA4),
Color(0xFF5472A5),
],
),
boxShadow: [
BoxShadow(
color: Color(0x756B5CA4),
blurRadius: 17.0,
spreadRadius: 0.0,
offset: Offset(0.0, 7.0),
),
],
),
child: FlatButton(
textColor: Colors.white,
color: Colors.transparent,
onPressed: onPressed,
child: Text(title),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment