Skip to content

Commit e96397c

Browse files
refactor(sell): localize loading label and rename error-card widget
Replace a hardcoded 'Loading...' with the existing sellLoadingGeneric key, and rename the private _SellError error-card widget to _SellErrorCard to avoid confusion with the SellFailure family.
1 parent 8d3e1b0 commit e96397c

6 files changed

Lines changed: 27 additions & 28 deletions

lib/features/sell/presentation/sell_failure_l10n.dart

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ import 'package:flutter/widgets.dart';
55

66
extension SellFailureL10n on SellFailure {
77
String toTranslated(BuildContext context) => switch (this) {
8-
SellUnauthenticatedFailure() => context.loc.sellUnauthenticatedError,
9-
SellBelowMinAmountFailure(:final minAmountSat) =>
10-
context.loc.sellBelowMinAmountError(FormatAmount.sats(minAmountSat)),
11-
SellAboveMaxAmountFailure(:final maxAmountSat) =>
12-
context.loc.sellAboveMaxAmountError(FormatAmount.sats(maxAmountSat)),
13-
SellInsufficientBalanceFailure(:final requiredAmountSat) =>
14-
context.loc.sellInsufficientBalanceError(
15-
FormatAmount.sats(requiredAmountSat),
16-
),
17-
SellPrepareTransactionFailure() =>
18-
context.loc.sellErrorFeesNotCalculated,
19-
SellSendPaymentFailure() => context.loc.sellErrorSendPayment,
20-
SellLoadUtxosFailure() => context.loc.sellErrorLoadUtxos,
21-
SellUnexpectedFailure() => context.loc.oopsSomethingWentWrong,
22-
};
8+
SellUnauthenticatedFailure() => context.loc.sellUnauthenticatedError,
9+
SellBelowMinAmountFailure(:final minAmountSat) =>
10+
context.loc.sellBelowMinAmountError(FormatAmount.sats(minAmountSat)),
11+
SellAboveMaxAmountFailure(:final maxAmountSat) =>
12+
context.loc.sellAboveMaxAmountError(FormatAmount.sats(maxAmountSat)),
13+
SellInsufficientBalanceFailure(:final requiredAmountSat) =>
14+
context.loc.sellInsufficientBalanceError(
15+
FormatAmount.sats(requiredAmountSat),
16+
),
17+
SellPrepareTransactionFailure() => context.loc.sellErrorFeesNotCalculated,
18+
SellSendPaymentFailure() => context.loc.sellErrorSendPayment,
19+
SellLoadUtxosFailure() => context.loc.sellErrorLoadUtxos,
20+
SellUnexpectedFailure() => context.loc.oopsSomethingWentWrong,
21+
};
2322
}

lib/features/sell/ui/screens/sell_external_wallet_network_selection_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ class SellExternalWalletNetworkSelectionScreen extends StatelessWidget {
8484
),
8585
),
8686
const Gap(24.0),
87-
const _SellError(),
87+
const _SellErrorCard(),
8888
],
8989
),
9090
),
@@ -95,8 +95,8 @@ class SellExternalWalletNetworkSelectionScreen extends StatelessWidget {
9595
}
9696
}
9797

98-
class _SellError extends StatelessWidget {
99-
const _SellError();
98+
class _SellErrorCard extends StatelessWidget {
99+
const _SellErrorCard();
100100

101101
@override
102102
Widget build(BuildContext context) {

lib/features/sell/ui/screens/sell_receive_payment_screen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ class SellReceivePaymentScreen extends StatelessWidget {
168168
_buildDetailRow(
169169
context,
170170
context.loc.sellOrderNumber,
171-
order?.orderNumber.toString() ?? 'Loading...',
171+
order?.orderNumber.toString() ?? context.loc.sellLoadingGeneric,
172172
copyValue: order?.orderNumber.toString(),
173173
),
174174
const Gap(48),

lib/features/sell/ui/screens/sell_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class _SellScreenState extends State<SellScreen> {
7373
},
7474
),
7575
const Gap(16.0),
76-
const _SellError(),
76+
const _SellErrorCard(),
7777
const Spacer(),
7878
SellAmountInputBottomButtons(
7979
formKey: _formKey,
@@ -98,8 +98,8 @@ class _SellScreenState extends State<SellScreen> {
9898
}
9999
}
100100

101-
class _SellError extends StatelessWidget {
102-
const _SellError();
101+
class _SellErrorCard extends StatelessWidget {
102+
const _SellErrorCard();
103103

104104
@override
105105
Widget build(BuildContext context) {

lib/features/sell/ui/screens/sell_send_payment_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ class _BottomButtons extends StatelessWidget {
317317
);
318318
return Column(
319319
children: [
320-
const _SellError(),
320+
const _SellErrorCard(),
321321
if (wallet != null && !wallet.isLiquid) ...[
322322
BBButton.big(
323323
label: context.loc.sellAdvancedSettings,
@@ -349,8 +349,8 @@ class _BottomButtons extends StatelessWidget {
349349
}
350350
}
351351

352-
class _SellError extends StatelessWidget {
353-
const _SellError();
352+
class _SellErrorCard extends StatelessWidget {
353+
const _SellErrorCard();
354354

355355
@override
356356
Widget build(BuildContext context) {

lib/features/sell/ui/screens/sell_wallet_selection_screen.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class SellWalletSelectionScreen extends StatelessWidget {
7676
),
7777
),
7878
const Gap(24.0),
79-
const _SellError(),
79+
const _SellErrorCard(),
8080
],
8181
),
8282
),
@@ -87,8 +87,8 @@ class SellWalletSelectionScreen extends StatelessWidget {
8787
}
8888
}
8989

90-
class _SellError extends StatelessWidget {
91-
const _SellError();
90+
class _SellErrorCard extends StatelessWidget {
91+
const _SellErrorCard();
9292

9393
@override
9494
Widget build(BuildContext context) {

0 commit comments

Comments
 (0)