Files
sendico/frontend/pweb/lib/pages/dashboard/buttons/balance/card.dart
2025-12-30 18:36:29 +03:00

65 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:pshared/models/payment/wallet.dart';
import 'package:pweb/pages/dashboard/buttons/balance/add_funds.dart';
import 'package:pweb/pages/dashboard/buttons/balance/amount.dart';
import 'package:pweb/pages/dashboard/buttons/balance/config.dart';
import 'package:pweb/pages/dashboard/buttons/balance/header.dart';
import 'package:pshared/provider/payment/wallets.dart';
import 'package:pweb/widgets/wallet_balance_refresh_button.dart';
class WalletCard extends StatelessWidget {
final Wallet wallet;
final VoidCallback onTopUp;
const WalletCard({
super.key,
required this.wallet,
required this.onTopUp,
});
@override
Widget build(BuildContext context) {
return Card(
color: Theme.of(context).colorScheme.onSecondary,
elevation: WalletCardConfig.elevation,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(WalletCardConfig.borderRadius),
),
child: Padding(
padding: WalletCardConfig.contentPadding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
BalanceHeader(
walletNetwork: wallet.network,
tokenSymbol: wallet.tokenSymbol,
),
Row(
children: [
BalanceAmount(
wallet: wallet,
onToggleVisibility: () {
context.read<WalletsProvider>().toggleVisibility(wallet.id);
},
),
WalletBalanceRefreshButton(
walletId: wallet.id,
),
],
),
BalanceAddFunds(
onTopUp: () {
onTopUp();
},
),
],
),
),
);
}
}