| 1 | import 'package:cake_wallet/src/widgets/cake_image_widget.dart'; |
| 2 | import 'package:cake_wallet/src/widgets/dashboard_card_widget.dart'; |
| 3 | import 'package:flutter/material.dart'; |
| 4 | |
| 5 | class InfoCard extends StatelessWidget { |
| 6 | final String leftButtonTitle; |
| 7 | final String rightButtonTitle; |
| 8 | final String title; |
| 9 | final String description; |
| 10 | final String image; |
| 11 | final Function() leftButtonAction; |
| 12 | final Function() rightButtonAction; |
| 13 | |
| 14 | final Widget? hintWidget; |
| 15 | |
| 16 | const InfoCard({ |
| 17 | super.key, |
| 18 | required this.title, |
| 19 | required this.description, |
| 20 | required this.leftButtonTitle, |
| 21 | required this.rightButtonTitle, |
| 22 | required this.leftButtonAction, |
| 23 | required this.rightButtonAction, |
| 24 | required this.image, |
| 25 | this.hintWidget, |
| 26 | }); |
| 27 | |
| 28 | @override |
| 29 | Widget build(BuildContext context) { |
| 30 | return DashBoardRoundedCardWidget( |
| 31 | marginH: 0, |
| 32 | marginV: 0, |
| 33 | customBorder: 30, |
| 34 | title: title, |
| 35 | subTitle: description, |
| 36 | hint: Column( |
| 37 | crossAxisAlignment: CrossAxisAlignment.start, |
| 38 | children: [ |
| 39 | if (hintWidget != null) hintWidget!, |
| 40 | if (hintWidget != null) SizedBox(height: 8), |
| 41 | Row( |
| 42 | children: [ |
| 43 | Expanded( |
| 44 | child: ElevatedButton( |
| 45 | onPressed: leftButtonAction, |
| 46 | style: ElevatedButton.styleFrom( |
| 47 | backgroundColor: Theme.of(context).colorScheme.surface, |
| 48 | shape: RoundedRectangleBorder( |
| 49 | borderRadius: BorderRadius.circular(10), |
| 50 | ), |
| 51 | ), |
| 52 | child: Text( |
| 53 | leftButtonTitle, |
| 54 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 55 | color: Theme.of(context).colorScheme.onSecondaryContainer, |
| 56 | ), |
| 57 | ), |
| 58 | ), |
| 59 | ), |
| 60 | const SizedBox(width: 8), |
| 61 | Expanded( |
| 62 | child: ElevatedButton( |
| 63 | onPressed: rightButtonAction, |
| 64 | style: ElevatedButton.styleFrom( |
| 65 | backgroundColor: Theme.of(context).colorScheme.primary, |
| 66 | shape: RoundedRectangleBorder( |
| 67 | borderRadius: BorderRadius.circular(10), |
| 68 | ), |
| 69 | ), |
| 70 | child: Text( |
| 71 | rightButtonTitle, |
| 72 | maxLines: 1, |
| 73 | style: Theme.of(context).textTheme.bodyMedium?.copyWith( |
| 74 | color: Theme.of(context).colorScheme.onPrimary, |
| 75 | ), |
| 76 | ), |
| 77 | ), |
| 78 | ), |
| 79 | ], |
| 80 | ), |
| 81 | ], |
| 82 | ), |
| 83 | onTap: () => {}, |
| 84 | icon: Container( |
| 85 | decoration: BoxDecoration( |
| 86 | color: Theme.of(context).colorScheme.surfaceContainer, |
| 87 | shape: BoxShape.circle, |
| 88 | ), |
| 89 | child: CakeImageWidget( |
| 90 | imageUrl: image, |
| 91 | height: 40, |
| 92 | width: 40, |
| 93 | ), |
| 94 | ), |
| 95 | ); |
| 96 | } |
| 97 | } |