gradient_coloured_buttons 0.0.2 gradient_coloured_buttons: ^0.0.2 copied to clipboard
A Flutter package that offers customizable buttons with gradient colors. Enhance your Flutter UI by easily creating buttons with smooth gradient backgrounds. Customize the gradient colors, button dime [...]
Gradient Button #
A Flutter package that provides customizable buttons with gradient colors. Enhance your Flutter UI by easily creating buttons with smooth gradient backgrounds.
Features #
- Create buttons with gradient backgrounds using the
GradientButton
widget. - Customize button dimensions, border radius, and more.
- Easy integration and usage within your Flutter projects.
Getting started #
To use this package, add gradient_button
as a dependency in your pubspec.yaml
file:
dependencies: #
gradient_coloured_buttons: ^0.0.2
Example #
There are a number of properties that you can modify:
text onPressed gradientColors width height borderRadius textStyle
//Import the package in your Dart file:
import 'package:gradient_coloured_buttons/gradient_coloured_buttons.dart';
// Create a gradient button:
class GradientButton extends StatelessWidget {
const GradientButton({Key? key, }) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
width: width,
height: height,
child: ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(borderRadius),
), backgroundColor: Colors.transparent,
padding: EdgeInsets.zero,
elevation: 0,
),
child: Ink(
decoration: BoxDecoration(
gradient: LinearGradient(
colors: gradientColors,
begin: Alignment.centerLeft,
end: Alignment.centerRight,
),
borderRadius: BorderRadius.circular(borderRadius),
),
child: Container(
alignment: Alignment.center,
child: Text(
text,
style: textStyle,
),
),
),
),
);
}
}
Additional information #
This package just gives you the Gradient Colours to the buttons in simple steps.