| 1 | import 'package:cake_wallet/entities/fiat_currency.dart'; |
| 2 | import 'package:cake_wallet/generated/i18n.dart'; |
| 3 | import 'package:cake_wallet/src/screens/integrations/deuro/widgets/savings_card_widget.dart'; |
| 4 | import 'package:cake_wallet/themes/core/theme_extension.dart'; |
| 5 | import 'package:cw_core/crypto_currency.dart'; |
| 6 | import 'package:flutter/material.dart'; |
| 7 | |
| 8 | class InterestCardWidget extends StatelessWidget { |
| 9 | const InterestCardWidget({ |
| 10 | required this.title, |
| 11 | required this.accruedInterest, |
| 12 | required this.isEnabled, |
| 13 | required this.onCollectInterest, |
| 14 | required this.onReinvestInterest, |
| 15 | required this.onTooltipPressed, |
| 16 | this.fiatAccruedInterest, |
| 17 | this.fiatCurrency, |
| 18 | }); |
| 19 | |
| 20 | final String title; |
| 21 | final String accruedInterest; |
| 22 | final String? fiatAccruedInterest; |
| 23 | final FiatCurrency? fiatCurrency; |
| 24 | final bool isEnabled; |
| 25 | final VoidCallback onCollectInterest; |
| 26 | final VoidCallback onReinvestInterest; |
| 27 | final VoidCallback onTooltipPressed; |
| 28 | |
| 29 | @override |
| 30 | Widget build(BuildContext context) => Stack(children: [ |
| 31 | Container( |
| 32 | margin: EdgeInsets.symmetric(horizontal: 16), |
| 33 | width: double.infinity, |
| 34 | decoration: BoxDecoration( |
| 35 | borderRadius: BorderRadius.circular(15), |
| 36 | gradient: LinearGradient( |
| 37 | colors: [ |
| 38 | context.customColors.cardGradientColorPrimary, |
| 39 | context.customColors.cardGradientColorSecondary, |
| 40 | ], |
| 41 | begin: Alignment.topCenter, |
| 42 | end: Alignment.bottomCenter, |
| 43 | ), |
| 44 | ), |
| 45 | child: Padding( |
| 46 | padding: EdgeInsets.all(20), |
| 47 | child: Column( |
| 48 | children: [ |
| 49 | SavingsCard.getAssetBalanceRow(context, |
| 50 | title: title, |
| 51 | amount: accruedInterest, |
| 52 | fiatAmount: fiatAccruedInterest, |
| 53 | currency: CryptoCurrency.deuro, |
| 54 | fiatCurrency: fiatCurrency, |
| 55 | hideSymbol: false, |
| 56 | onTooltipPressed: onTooltipPressed), |
| 57 | SizedBox(height: 10), |
| 58 | Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ |
| 59 | Expanded( |
| 60 | child: SavingsCard.getButton( |
| 61 | context, |
| 62 | imagePath: 'assets/images/collect_interest.png', |
| 63 | label: S.of(context).deuro_collect_interest, |
| 64 | onPressed: onCollectInterest, |
| 65 | backgroundColor: Theme.of(context).colorScheme.primary, |
| 66 | color: Theme.of(context).colorScheme.onPrimary, |
| 67 | enabled: isEnabled, |
| 68 | ), |
| 69 | ), |
| 70 | SizedBox(width: 12), |
| 71 | Expanded( |
| 72 | child: SavingsCard.getButton( |
| 73 | context, |
| 74 | label: S.of(context).deuro_reinvest_interest, |
| 75 | icon: Icons.account_balance_outlined, |
| 76 | onPressed: onReinvestInterest, |
| 77 | backgroundColor: Theme.of(context).colorScheme.surface, |
| 78 | color: Theme.of(context).colorScheme.onSecondaryContainer, |
| 79 | enabled: isEnabled, |
| 80 | ), |
| 81 | ), |
| 82 | ]), |
| 83 | ], |
| 84 | ), |
| 85 | ), |
| 86 | ), |
| 87 | ]); |
| 88 | } |