| 1 | import 'package:cake_wallet/themes/core/theme_extension.dart'; |
| 2 | import 'package:flutter/material.dart'; |
| 3 | import 'package:flutter_svg/flutter_svg.dart'; |
| 4 | |
| 5 | class DashBoardRoundedCardWidget extends StatelessWidget { |
| 6 | DashBoardRoundedCardWidget({ |
| 7 | this.onTap, |
| 8 | required this.title, |
| 9 | required this.subTitle, |
| 10 | this.hint, |
| 11 | this.svgPicture, |
| 12 | this.image, |
| 13 | this.icon, |
| 14 | this.onClose, |
| 15 | this.customBorder, |
| 16 | this.shadowSpread, |
| 17 | this.shadowBlur, |
| 18 | super.key, |
| 19 | this.marginV, |
| 20 | this.marginH, |
| 21 | }); |
| 22 | |
| 23 | final VoidCallback? onTap; |
| 24 | final VoidCallback? onClose; |
| 25 | final String title; |
| 26 | final String subTitle; |
| 27 | final Widget? hint; |
| 28 | final SvgPicture? svgPicture; |
| 29 | final Widget? icon; |
| 30 | final Image? image; |
| 31 | final double? customBorder; |
| 32 | final double? marginV; |
| 33 | final double? marginH; |
| 34 | final double? shadowSpread; |
| 35 | final double? shadowBlur; |
| 36 | |
| 37 | @override |
| 38 | Widget build(BuildContext context) { |
| 39 | return Stack( |
| 40 | children: [ |
| 41 | Container( |
| 42 | margin: EdgeInsets.symmetric(horizontal: marginH ?? 20, vertical: marginV ?? 5), |
| 43 | width: double.infinity, |
| 44 | decoration: BoxDecoration( |
| 45 | borderRadius: BorderRadius.circular(15), |
| 46 | gradient: LinearGradient( |
| 47 | colors: [ |
| 48 | context.customColors.cardGradientColorPrimary, |
| 49 | context.customColors.cardGradientColorSecondary, |
| 50 | ], |
| 51 | begin: Alignment.topCenter, |
| 52 | end: Alignment.bottomCenter, |
| 53 | ), |
| 54 | // border: Border.all( |
| 55 | // color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor, |
| 56 | // width: 1 |
| 57 | // ), |
| 58 | // boxShadow: [ |
| 59 | // BoxShadow( |
| 60 | // color: Theme.of(context).extension<BalancePageTheme>()!.cardBorderColor |
| 61 | // .withAlpha(50), |
| 62 | // spreadRadius: shadowSpread ?? 3, |
| 63 | // blurRadius: shadowBlur ?? 7, |
| 64 | // ) |
| 65 | // ], |
| 66 | ), |
| 67 | child: TextButton( |
| 68 | onPressed: onTap, |
| 69 | style: TextButton.styleFrom( |
| 70 | shape: RoundedRectangleBorder( |
| 71 | borderRadius: BorderRadius.circular(15), |
| 72 | side: BorderSide( |
| 73 | width: 1.25, color: Theme.of(context).colorScheme.surfaceContainerHigh), |
| 74 | ), |
| 75 | padding: EdgeInsets.only(left: 24, top: 24, right: 20, bottom: 24), |
| 76 | ), |
| 77 | child: Column( |
| 78 | children: [ |
| 79 | Row( |
| 80 | crossAxisAlignment: CrossAxisAlignment.start, |
| 81 | children: [ |
| 82 | Expanded( |
| 83 | child: Column( |
| 84 | crossAxisAlignment: CrossAxisAlignment.start, |
| 85 | children: [ |
| 86 | Text( |
| 87 | title, |
| 88 | style: Theme.of(context).textTheme.titleLarge?.copyWith( |
| 89 | color: Theme.of(context).colorScheme.onSurface, |
| 90 | fontWeight: FontWeight.w800, |
| 91 | fontSize: 24, |
| 92 | ), |
| 93 | softWrap: true, |
| 94 | ), |
| 95 | SizedBox(height: 5), |
| 96 | Text( |
| 97 | subTitle, |
| 98 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 99 | color: Theme.of(context).colorScheme.onSurfaceVariant, |
| 100 | fontWeight: FontWeight.w500, |
| 101 | ), |
| 102 | softWrap: true, |
| 103 | ), |
| 104 | ], |
| 105 | ), |
| 106 | ), |
| 107 | Padding(padding: EdgeInsets.only(left: 10)), |
| 108 | if (image != null) image! else if (svgPicture != null) svgPicture!, |
| 109 | if (icon != null) icon! |
| 110 | ], |
| 111 | ), |
| 112 | if (hint != null) ...[ |
| 113 | SizedBox(height: 10), |
| 114 | hint!, |
| 115 | ] |
| 116 | ], |
| 117 | ), |
| 118 | ), |
| 119 | ), |
| 120 | if (onClose != null) |
| 121 | Positioned( |
| 122 | top: 10, |
| 123 | right: 10, |
| 124 | child: IconButton( |
| 125 | icon: Icon(Icons.close), |
| 126 | onPressed: onClose, |
| 127 | //color: Theme.of(context).colorScheme.onSurface, |
| 128 | ), |
| 129 | ), |
| 130 | ], |
| 131 | ); |
| 132 | } |
| 133 | } |