summaryrefslogtreecommitdiffstats
path: root/lib/presentation/common_widget/generic_button.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/presentation/common_widget/generic_button.dart')
-rw-r--r--lib/presentation/common_widget/generic_button.dart91
1 files changed, 91 insertions, 0 deletions
diff --git a/lib/presentation/common_widget/generic_button.dart b/lib/presentation/common_widget/generic_button.dart
new file mode 100644
index 0000000..cca354f
--- /dev/null
+++ b/lib/presentation/common_widget/generic_button.dart
@@ -0,0 +1,91 @@
+import 'package:flutter_ics_homescreen/export.dart';
+
+class GenericButton extends StatefulWidget {
+ final double heigth;
+ final double width;
+ final String text;
+ final Function onTap;
+
+ const GenericButton({
+ super.key,
+ required this.heigth,
+ 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.heigth,
+ 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,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}