diff --git a/lib/exchange/exchange_trade_state.dart b/lib/exchange/exchange_trade_state.dart index 324ae9338..109293bec 100644 --- a/lib/exchange/exchange_trade_state.dart +++ b/lib/exchange/exchange_trade_state.dart @@ -14,7 +14,8 @@ class TradeIsCreatedSuccessfully extends ExchangeTradeState { } class TradeIsCreatedFailure extends ExchangeTradeState { - TradeIsCreatedFailure({@required this.error}); + TradeIsCreatedFailure({@required this.title, @required this.error}); + final String title; final String error; } \ No newline at end of file diff --git a/lib/src/screens/exchange/exchange_page.dart b/lib/src/screens/exchange/exchange_page.dart index 784337648..b47874275 100644 --- a/lib/src/screens/exchange/exchange_page.dart +++ b/lib/src/screens/exchange/exchange_page.dart @@ -558,7 +558,7 @@ class ExchangePage extends BasePage { context: context, builder: (BuildContext context) { return AlertWithOneAction( - alertTitle: S.of(context).error, + alertTitle: state.title, alertContent: state.error, buttonText: S.of(context).ok, buttonAction: () => Navigator.of(context).pop()); diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index e6c946a87..1ea299600 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -247,10 +247,12 @@ abstract class ExchangeViewModelBase with Store { if (limitsState is LimitsLoadedSuccessfully && amount != null) { if (double.parse(amount) < limits.min) { tradeState = TradeIsCreatedFailure( + title: provider.title, error: S.current.error_text_minimal_limit('${provider.description}', '${limits.min}', currency.toString())); } else if (limits.max != null && double.parse(amount) > limits.max) { tradeState = TradeIsCreatedFailure( + title: provider.title, error: S.current.error_text_maximum_limit('${provider.description}', '${limits.max}', currency.toString())); } else { @@ -262,11 +264,14 @@ abstract class ExchangeViewModelBase with Store { await trades.add(trade); tradeState = TradeIsCreatedSuccessfully(trade: trade); } catch (e) { - tradeState = TradeIsCreatedFailure(error: e.toString()); + tradeState = TradeIsCreatedFailure( + title: provider.title, + error: e.toString()); } } } else { tradeState = TradeIsCreatedFailure( + title: provider.title, error: S.current .error_text_limits_loading_failed('${provider.description}')); }