48 lines
1.3 KiB
Dart
48 lines
1.3 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
import 'package:pshared/utils/currency.dart';
|
|
|
|
import 'package:pweb/models/wallet.dart';
|
|
|
|
|
|
class BalanceAmount extends StatelessWidget {
|
|
final Wallet wallet;
|
|
final VoidCallback onToggleVisibility;
|
|
|
|
const BalanceAmount({
|
|
super.key,
|
|
required this.wallet,
|
|
required this.onToggleVisibility,
|
|
});
|
|
|
|
static const double _iconSpacing = 12.0;
|
|
static const double _iconSize = 24.0;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final textTheme = Theme.of(context).textTheme;
|
|
final colorScheme = Theme.of(context).colorScheme;
|
|
final currencyBalance = currencyCodeToSymbol(wallet.currency);
|
|
|
|
return Row(
|
|
children: [
|
|
Text(
|
|
wallet.isHidden ? '•••• $currencyBalance' : '${amountToString(wallet.balance)} $currencyBalance',
|
|
style: textTheme.headlineSmall?.copyWith(
|
|
fontWeight: FontWeight.bold,
|
|
color: colorScheme.onSurface,
|
|
),
|
|
),
|
|
const SizedBox(width: _iconSpacing),
|
|
GestureDetector(
|
|
onTap: onToggleVisibility,
|
|
child: Icon(
|
|
wallet.isHidden ? Icons.visibility_off : Icons.visibility,
|
|
size: _iconSize,
|
|
color: colorScheme.onSurface,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
} |