color gradient in flutter
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green, Colors.blue])
),
color gradient in flutter
decoration: BoxDecoration(
gradient: LinearGradient(
colors: [Colors.green, Colors.blue])
),
flutter floating action button gradient
floatingActionButton: FloatingActionButton(
child: Container(
width: 60,
height: 60,
child: Icon(Icons.add),
decoration: BoxDecoration(
shape: BoxShape.circle,
gradient: LinearGradient(colors: [Colors.red, Colors.blue])),
),
onPressed: () {},
)
add gradient to flutter button
DecoratedBox(
decoration: BoxDecoration(gradient: LinearGradient(colors: [Colors.pink, Colors.green])),
child: ElevatedButton(
onPressed: () {},
style: ElevatedButton.styleFrom(primary: Colors.transparent),
child: Text('Elevated Button'),
),
)
how to add gradient to button in flutter elevated button
RaisedGradientButton(
child: Text(
'Button',
style: TextStyle(color: Colors.white),
),
gradient: LinearGradient(
colors: <Color>[Colors.green, Colors.black],
),
onPressed: (){
print('button clicked');
}
),
Make your own outlined button with gradient in flutter
class MyOutlinedButton extends StatelessWidget {
final VoidCallback onPressed;
final Widget child;
final ButtonStyle? style;
final Gradient? gradient;
final double thickness;
const MyOutlinedButton({
Key? key,
required this.onPressed,
required this.child,
this.style,
this.gradient,
this.thickness = 2,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return DecoratedBox(
decoration: BoxDecoration(gradient: gradient),
child: Container(
color: Colors.white,
margin: EdgeInsets.all(thickness),
child: OutlinedButton(
onPressed: onPressed,
style: style,
child: child,
),
),
);
}
}
//Usage:
MyOutlinedButton(
onPressed: () {},
gradient: LinearGradient(colors: [Colors.indigo, Colors.pink]),
child: Text('OutlinedButton'),
)
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us