-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcustom_button_with_gradient.dart
53 lines (50 loc) · 1.25 KB
/
custom_button_with_gradient.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import 'package:flutter/material.dart';
class CustomButtonWithGradient extends StatelessWidget {
final Widget child;
final Gradient gradient;
final double width;
final double height;
final double radius;
final VoidCallback onPressed;
const CustomButtonWithGradient({
Key? key,
required this.child,
this.radius = 0.0,
required this.gradient,
this.width = double.infinity,
this.height = 50.0,
required this.onPressed,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Container(
width: width,
height: 50.0,
decoration: BoxDecoration(
gradient: gradient,
borderRadius: BorderRadius.circular(radius),
// boxShadow: [
// BoxShadow(
// color: Colors.grey[500]!,
// offset: const Offset(0.0, 1.5),
// blurRadius: 1.5,
// ),
// ],
),
child: Material(
textStyle: const TextStyle(
color: Colors.white,
fontSize: 20,
fontWeight: FontWeight.bold,
),
color: Colors.transparent,
child: GestureDetector(
onTap: onPressed,
child: Center(
child: child,
),
),
),
);
}
}