disconecting expiry time and savings
This commit is contained in:
@@ -81,8 +81,8 @@ class BillingRepositoryImpl implements BillingRepository {
|
||||
@override
|
||||
Future<double> getSavingsAmount() async {
|
||||
// Simulating savings calculation (e.g., comparing to market rates).
|
||||
await Future<void>.delayed(const Duration(milliseconds: 500));
|
||||
return 320.00;
|
||||
await Future<void>.delayed(const Duration(milliseconds: 0));
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
/// Fetches the breakdown of spending.
|
||||
|
||||
@@ -48,6 +48,7 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
|
||||
final String last4 =
|
||||
account?.last4.isNotEmpty == true ? account!.last4 : '----';
|
||||
final bool isPrimary = account?.isPrimary ?? false;
|
||||
final String expiryLabel = _formatExpiry(account?.expiryTime);
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(UiConstants.space4),
|
||||
@@ -127,13 +128,13 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Text(
|
||||
'•••• $last4',
|
||||
style: UiTypography.body2b.textPrimary,
|
||||
),
|
||||
Text(
|
||||
t.client_billing.expires(date: '12/25'),
|
||||
style: UiTypography.footnote2r.textSecondary,
|
||||
),
|
||||
'•••• $last4',
|
||||
style: UiTypography.body2b.textPrimary,
|
||||
),
|
||||
Text(
|
||||
t.client_billing.expires(date: expiryLabel),
|
||||
style: UiTypography.footnote2r.textSecondary,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -162,4 +163,14 @@ class _PaymentMethodCardState extends State<PaymentMethodCard> {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
String _formatExpiry(fdc.Timestamp? expiryTime) {
|
||||
if (expiryTime == null) {
|
||||
return 'N/A';
|
||||
}
|
||||
final DateTime date = expiryTime.toDateTime();
|
||||
final String month = date.month.toString().padLeft(2, '0');
|
||||
final String year = (date.year % 100).toString().padLeft(2, '0');
|
||||
return '$month/$year';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user