|
1 | | -import 'package:bb_mobile/core/exchange/domain/errors/pay_error.dart'; |
2 | 1 | import 'package:bb_mobile/core/themes/app_theme.dart'; |
3 | 2 | import 'package:bb_mobile/core/utils/build_context_x.dart'; |
4 | 3 | import 'package:bb_mobile/core/widgets/loading/fading_linear_progress.dart'; |
@@ -104,59 +103,16 @@ class _PayError extends StatelessWidget { |
104 | 103 | : null, |
105 | 104 | ); |
106 | 105 |
|
| 106 | + if (payError == null) return const SizedBox.shrink(); |
| 107 | + |
107 | 108 | return Center( |
108 | | - child: switch (payError) { |
109 | | - AboveMaxAmountPayError _ => Text( |
110 | | - context.loc.payAboveMaxAmount, |
111 | | - style: context.font.bodyMedium?.copyWith( |
112 | | - color: context.appColors.error, |
113 | | - ), |
114 | | - textAlign: .center, |
115 | | - ), |
116 | | - BelowMinAmountPayError _ => Text( |
117 | | - context.loc.payBelowMinAmount, |
118 | | - style: context.font.bodyMedium?.copyWith( |
119 | | - color: context.appColors.error, |
120 | | - ), |
121 | | - textAlign: .center, |
122 | | - ), |
123 | | - InsufficientBalancePayError _ => Text( |
124 | | - context.loc.payInsufficientBalance, |
125 | | - style: context.font.bodyMedium?.copyWith( |
126 | | - color: context.appColors.error, |
127 | | - ), |
128 | | - textAlign: .center, |
129 | | - ), |
130 | | - UnauthenticatedPayError _ => Text( |
131 | | - context.loc.payNotAuthenticated, |
132 | | - style: context.font.bodyMedium?.copyWith( |
133 | | - color: context.appColors.error, |
134 | | - ), |
135 | | - textAlign: .center, |
| 109 | + child: Text( |
| 110 | + payError.toTranslated(context), |
| 111 | + style: context.font.bodyMedium?.copyWith( |
| 112 | + color: context.appColors.error, |
136 | 113 | ), |
137 | | - OrderNotFoundPayError _ => Text( |
138 | | - context.loc.payOrderNotFound, |
139 | | - style: context.font.bodyMedium?.copyWith( |
140 | | - color: context.appColors.error, |
141 | | - ), |
142 | | - textAlign: .center, |
143 | | - ), |
144 | | - OrderAlreadyConfirmedPayError _ => Text( |
145 | | - context.loc.payOrderAlreadyConfirmed, |
146 | | - style: context.font.bodyMedium?.copyWith( |
147 | | - color: context.appColors.error, |
148 | | - ), |
149 | | - textAlign: .center, |
150 | | - ), |
151 | | - UnexpectedPayError _ => Text( |
152 | | - payError.message, |
153 | | - style: context.font.bodyMedium?.copyWith( |
154 | | - color: context.appColors.error, |
155 | | - ), |
156 | | - textAlign: .center, |
157 | | - ), |
158 | | - _ => const SizedBox.shrink(), |
159 | | - }, |
| 114 | + textAlign: TextAlign.center, |
| 115 | + ), |
160 | 116 | ); |
161 | 117 | } |
162 | 118 | } |
0 commit comments