summaryrefslogtreecommitdiffstats
path: root/lib/presentation/common_widget/generic_button.dart
diff options
context:
space:
mode:
authorLisandro Pérez Meyer <lpmeyer@ics.com>2023-11-14 17:20:58 -0300
committerLisandro Pérez Meyer <lpmeyer@ics.com>2023-11-14 17:31:12 -0300
commit70ec8a79a121471a004e7e4c23157d10157e136f (patch)
treea4f9c0a4fac4e4274ec4324a289b6ef62e1c5653 /lib/presentation/common_widget/generic_button.dart
Initial cleanup push.
Based on agldemo2024 on commit 2a5dc04d801134338150c3f6afc67eaa65599763 Disable device preview. Disable Lottie animation. The original commit was b3c493c340fcb4bb0a937692838fc830bec3e9ea but I am just keeping this change, because the json did not really needed to change. I think. Signed-off-by: Lisandro Pérez Meyer <lpmeyer@ics.com>
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,
+ ),
+ ),
+ ),
+ ),
+ );
+ }
+}