89 lines
3.0 KiB
Dart
89 lines
3.0 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:provider/provider.dart';
|
|
|
|
import 'package:pshared/utils/currency.dart';
|
|
import 'package:pshared/models/payment/wallet.dart';
|
|
import 'package:pshared/provider/payment/wallets.dart';
|
|
import 'package:pweb/models/visibility.dart';
|
|
|
|
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
|
|
import 'package:pweb/widgets/wallet_balance_refresh_button.dart';
|
|
|
|
import 'package:pweb/generated/i18n/app_localizations.dart';
|
|
|
|
|
|
class WalletCard extends StatelessWidget {
|
|
final Wallet wallet;
|
|
final VoidCallback onTap;
|
|
|
|
const WalletCard({super.key, required this.wallet, required this.onTap});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final theme = Theme.of(context);
|
|
|
|
return Card(
|
|
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
|
elevation: theme.cardTheme.elevation ?? 4,
|
|
color: theme.colorScheme.onSecondary,
|
|
child: InkWell(
|
|
borderRadius: BorderRadius.circular(12),
|
|
onTap: onTap,
|
|
child: Container(
|
|
padding: const EdgeInsets.only(left: 50, top: 16, bottom: 16),
|
|
child: Row(
|
|
spacing: 3,
|
|
children: [
|
|
CircleAvatar(
|
|
radius: 24,
|
|
child: Icon(iconForCurrencyType(wallet.currency), size: 28),
|
|
),
|
|
const SizedBox(width: 16),
|
|
Expanded(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
BalanceAmount(
|
|
wallet: wallet,
|
|
onToggleVisibility: () {
|
|
context.read<WalletsProvider>().toggleVisibility(wallet.id);
|
|
},
|
|
),
|
|
WalletBalanceRefreshButton(
|
|
walletId: wallet.id,
|
|
iconOnly: VisibilityState.hidden,
|
|
),
|
|
],
|
|
),
|
|
Text(
|
|
AppLocalizations.of(context)!.paymentTypeCryptoWallet,
|
|
style: theme.textTheme.bodyLarge!.copyWith(
|
|
fontWeight: FontWeight.w600,
|
|
color: theme.colorScheme.onSurface,
|
|
),
|
|
),
|
|
if (wallet.tokenSymbol != null) ...[
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
wallet.tokenSymbol!,
|
|
style: theme.textTheme.bodyMedium?.copyWith(
|
|
color: theme.colorScheme.onSurfaceVariant,
|
|
),
|
|
),
|
|
],
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|