mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 11:59:30 +00:00
Merge pull request #437 from cypherstack/xmr_bugs
send from exchange fix
This commit is contained in:
commit
c83ea5c0a0
3 changed files with 53 additions and 6 deletions
|
@ -579,7 +579,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
|
|||
time,
|
||||
]);
|
||||
|
||||
final txData = results.last
|
||||
final txData = results.first
|
||||
as Map<String, dynamic>;
|
||||
|
||||
if (!wasCancelled) {
|
||||
|
|
|
@ -44,6 +44,7 @@ import 'package:stackwallet/utilities/enums/coin_enum.dart';
|
|||
import 'package:stackwallet/utilities/enums/derive_path_type_enum.dart';
|
||||
import 'package:stackwallet/utilities/enums/wallet_balance_toggle_state.dart';
|
||||
import 'package:stackwallet/utilities/logger.dart';
|
||||
import 'package:stackwallet/utilities/show_loading.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/background.dart';
|
||||
|
@ -260,11 +261,6 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
void _onExchangePressed(BuildContext context) async {
|
||||
final coin = ref.read(managerProvider).coin;
|
||||
|
||||
final currency = ExchangeDataLoadingService.instance.isar.currencies
|
||||
.where()
|
||||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||
.findFirstSync();
|
||||
|
||||
if (coin.isTestNet) {
|
||||
await showDialog<void>(
|
||||
context: context,
|
||||
|
@ -273,6 +269,15 @@ class _WalletViewState extends ConsumerState<WalletView> {
|
|||
),
|
||||
);
|
||||
} else {
|
||||
final currency = await showLoading(
|
||||
whileFuture: ExchangeDataLoadingService.instance.isar.currencies
|
||||
.where()
|
||||
.tickerEqualToAnyExchangeNameName(coin.ticker)
|
||||
.findFirst(),
|
||||
context: context,
|
||||
message: "Loading...",
|
||||
);
|
||||
|
||||
if (mounted) {
|
||||
unawaited(
|
||||
Navigator.of(context).pushNamed(
|
||||
|
|
42
lib/utilities/show_loading.dart
Normal file
42
lib/utilities/show_loading.dart
Normal file
|
@ -0,0 +1,42 @@
|
|||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
|
||||
|
||||
Future<T> showLoading<T>({
|
||||
required Future<T> whileFuture,
|
||||
required BuildContext context,
|
||||
required String message,
|
||||
String? subMessage,
|
||||
bool isDesktop = false,
|
||||
}) async {
|
||||
unawaited(
|
||||
showDialog<void>(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => WillPopScope(
|
||||
onWillPop: () async => false,
|
||||
child: Container(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.overlay
|
||||
.withOpacity(0.6),
|
||||
child: CustomLoadingOverlay(
|
||||
message: message,
|
||||
subMessage: subMessage,
|
||||
eventBus: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
final result = await whileFuture;
|
||||
|
||||
if (context.mounted) {
|
||||
Navigator.of(context, rootNavigator: isDesktop).pop();
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
Loading…
Reference in a new issue