58 lines
1.4 KiB
Dart
58 lines
1.4 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
class GradientButton extends StatelessWidget {
|
|
final String text;
|
|
final VoidCallback onPressed;
|
|
final double width;
|
|
final double height;
|
|
final List<Color> gradientColors;
|
|
|
|
const GradientButton({
|
|
super.key,
|
|
required this.text,
|
|
required this.onPressed,
|
|
this.width = double.infinity,
|
|
this.height = 50.0,
|
|
this.gradientColors = const [
|
|
Color(0xFF5674ED),
|
|
Color(0xFF34C3F9),
|
|
],
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return SizedBox(
|
|
width: width,
|
|
height: height,
|
|
child: DecoratedBox(
|
|
decoration: BoxDecoration(
|
|
gradient: LinearGradient(
|
|
colors: gradientColors,
|
|
),
|
|
borderRadius: BorderRadius.circular(6),
|
|
),
|
|
child: ElevatedButton(
|
|
style: ElevatedButton.styleFrom(
|
|
backgroundColor: Colors.transparent,
|
|
shadowColor: Colors.transparent,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(30.0),
|
|
),
|
|
),
|
|
onPressed: onPressed,
|
|
child: Text(
|
|
text,
|
|
style: const TextStyle(
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w600,
|
|
fontFamily: 'inter',
|
|
color: Colors.white,
|
|
height: 0.10,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|