Merge pull request #437 from cypherstack/xmr_bugs

send from exchange fix
This commit is contained in:
Diego Salazar 2023-03-27 15:02:39 -06:00 committed by GitHub
commit c83ea5c0a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 53 additions and 6 deletions

View file

@ -579,7 +579,7 @@ class _Step4ViewState extends ConsumerState<Step4View> {
time,
]);
final txData = results.last
final txData = results.first
as Map<String, dynamic>;
if (!wasCancelled) {

View file

@ -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(

View 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;
}