-
Notifications
You must be signed in to change notification settings - Fork 77
Expand file tree
/
Copy pathbalance_card.dart
More file actions
59 lines (54 loc) · 1.71 KB
/
Copy pathbalance_card.dart
File metadata and controls
59 lines (54 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import 'package:bb_mobile/core/exchange/domain/entity/user_summary.dart';
import 'package:bb_mobile/core/themes/app_theme.dart';
import 'package:bb_mobile/core/widgets/text/text.dart';
import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
class BalanceCard extends StatelessWidget {
const BalanceCard({super.key, required this.balance, required this.onTap});
final UserBalance balance;
final Function onTap;
String _removeTrailingFiatZeros(String value) {
if (value.endsWith('.00')) {
return value.replaceAll('.00', '');
}
return value;
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: () => onTap(),
child: SizedBox(
height: 60,
child: Material(
clipBehavior: .antiAlias,
elevation: 2,
color: context.appColors.surface,
borderRadius: BorderRadius.circular(2),
child: Row(
children: [
const Gap(12),
BBText(
'${balance.currencyCode.toUpperCase()} account balance',
style: context.font.bodyLarge,
color: context.appColors.secondary,
),
const Spacer(),
BBText(
'${_removeTrailingFiatZeros(balance.amount.toStringAsFixed(2))} ${balance.currencyCode.toUpperCase()}',
style: context.font.bodyLarge,
color: context.appColors.secondary,
),
const Gap(8),
Icon(
Icons.chevron_right,
color: context.appColors.outline,
size: 24,
),
const Gap(8),
],
),
),
),
);
}
}