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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
import 'package:flutter_ics_homescreen/export.dart';
class GenericButton extends StatefulWidget {
final double height;
final double width;
final String text;
final Function onTap;
const GenericButton({
super.key,
required this.height,
required this.width,
required this.text,
required this.onTap,
});
@override
State<GenericButton> createState() => _GenericButtonState();
}
class _GenericButtonState extends State<GenericButton> {
LinearGradient gradientEnable1 = const LinearGradient(colors: <Color>[
Color(0xFF2962FF),
Color(0x802962FF),
]);
LinearGradient gradientEnable2 = const LinearGradient(colors: <Color>[
Color(0xFF1A237E),
Color(0xFF141F64),
]);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTapDown: (details) {
setState(() {
gradientEnable1 = const LinearGradient(colors: <Color>[
Color(0x802962FF),
Color(0xFF2962FF),
]);
gradientEnable2 = const LinearGradient(colors: <Color>[
Color(0xFF1A237E),
Color(0xFF1C2D92),
]);
});
//change style
},
onTapUp: (details) {
setState(() {
gradientEnable1 = const LinearGradient(colors: <Color>[
Color(0xFF2962FF),
Color(0x802962FF),
]);
gradientEnable2 = const LinearGradient(colors: <Color>[
Color(0xFF1A237E),
Color(0xFF141F64),
]);
});
widget.onTap();
},
child: Container(
height: widget.height,
width: widget.width,
decoration: BoxDecoration(
gradient: Gradient.lerp(gradientEnable1, gradientEnable2, 0.5),
boxShadow: const [
BoxShadow(
color: Colors.black,
blurRadius: 2,
offset: Offset(0, 2), // Shadow position
),
],
border: Border.all(
color: const Color(0xFF285DF4),
width: 1,
),
borderRadius: const BorderRadius.all(
Radius.circular(4),
),
),
child: Center(
child: Text(
widget.text,
style: const TextStyle(
color: Color(0xFFC1D8FF),
fontSize: 44,
),
),
),
),
);
}
}
|