mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-18 05:51:34 +02:00
Pay Anything RC Fixes (#2511)
* feat: Swap flow for Pay Anything. [WIP] * feat: Pay Anything Swap Flow [WIP] * feat: Pay anything swap flow [WIP] - Add fiat values for send and receive amounts to swap details confirmation bottomsheet * feat: Pay anything swap flow [WIP] - Switch exchangeviewmodel back to factory - Expand address box to fill width * Handle second swipe to swap cta * Add fiat for receive amount * Scope Observers for bottomsheets and add validator * fix: Repeated instances issue for exchangeVM * fix: Estimated fee and balance not correctly updating after wallet switching occurs * fix: Available balance not updating properly after wallet switching * fix: Available balance and fee rate not displaying after wallet is switched in pay anything flow * fixes: Pay anything related RC fixes - Recieve fiat amount showing as 0.0 - ID overlapping when there's enough space - receive amount changing even in fixed rate mode - Invalid double error for setReceiveFiatAmount
This commit is contained in:
@@ -180,6 +180,7 @@ class SwapConfirmationContentState extends State<SwapConfirmationContent> {
|
||||
hintText: 'Amount (${detectedCurrencyName})',
|
||||
focusNode: _amountFocus,
|
||||
controller: _amountController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
validator: (value) {
|
||||
return AmountValidator(
|
||||
isAutovalidate: true,
|
||||
@@ -252,6 +253,7 @@ class SwapConfirmationContentState extends State<SwapConfirmationContent> {
|
||||
hintText: 'Amount (${widget.exchangeViewModel.fiat.title})',
|
||||
focusNode: _amountFiatFocus,
|
||||
controller: _amountFiatController,
|
||||
keyboardType: TextInputType.numberWithOptions(decimal: true),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
SwapConfirmationTextfield(
|
||||
@@ -418,6 +420,7 @@ class SwapConfirmationTextfield extends StatelessWidget {
|
||||
this.isAddress = false,
|
||||
this.maxLines = 1,
|
||||
this.validator,
|
||||
this.keyboardType,
|
||||
});
|
||||
|
||||
final FocusNode focusNode;
|
||||
@@ -427,6 +430,8 @@ class SwapConfirmationTextfield extends StatelessWidget {
|
||||
final bool isAddress;
|
||||
final int maxLines;
|
||||
final String? Function(String?)? validator;
|
||||
final TextInputType? keyboardType;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
@@ -470,6 +475,7 @@ class SwapConfirmationTextfield extends StatelessWidget {
|
||||
controller: controller,
|
||||
maxLines: maxLines,
|
||||
validator: validator,
|
||||
keyboardType: keyboardType,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -10,7 +10,6 @@ import 'package:cake_wallet/src/widgets/standard_slide_button_widget.dart';
|
||||
import 'package:cake_wallet/themes/core/material_base_theme.dart';
|
||||
import 'package:cake_wallet/core/execution_state.dart';
|
||||
import 'package:cake_wallet/view_model/send/send_view_model_state.dart';
|
||||
import 'package:cake_wallet/src/widgets/bottom_sheet/confirm_sending_bottom_sheet_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/bottom_sheet/info_bottom_sheet_widget.dart';
|
||||
import 'package:cake_wallet/src/widgets/alert_with_one_action.dart';
|
||||
import 'package:cake_wallet/utils/show_pop_up.dart';
|
||||
@@ -19,7 +18,6 @@ import 'package:cw_core/utils/print_verbose.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:mobx/mobx.dart';
|
||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||
import 'package:cake_wallet/reactions/wallet_connect.dart';
|
||||
|
||||
class SwapDetailsBottomSheet extends StatefulWidget {
|
||||
SwapDetailsBottomSheet({
|
||||
@@ -289,7 +287,8 @@ class _SwapDetailsContent extends StatelessWidget {
|
||||
_SwapDetailsTile(
|
||||
label: 'You Get',
|
||||
value: '${trade.receiveAmount ?? '0'} ${trade.to?.title ?? ''}',
|
||||
valueFiatFormatted: exchangeTradeViewModel.receiveAmountFiatFormatted,
|
||||
valueFiatFormatted: exchangeTradeViewModel
|
||||
.getReceiveAmountFiatFormatted(trade.receiveAmount ?? '0.0'),
|
||||
),
|
||||
const SizedBox(height: 8),
|
||||
Container(
|
||||
@@ -330,6 +329,7 @@ class _SwapDetailsContent extends StatelessWidget {
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
@@ -346,28 +346,27 @@ class _SwapDetailsContent extends StatelessWidget {
|
||||
fontSize: 16,
|
||||
),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
],
|
||||
),
|
||||
Spacer(),
|
||||
Expanded(
|
||||
// flex: 4,
|
||||
child: GestureDetector(
|
||||
onTap: () {
|
||||
Clipboard.setData(ClipboardData(text: trade.id));
|
||||
showBar<void>(context, S.of(context).copied_to_clipboard);
|
||||
},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'ID: ',
|
||||
style: Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 18),
|
||||
),
|
||||
Expanded(
|
||||
Flexible(
|
||||
child: Text(
|
||||
trade.id,
|
||||
style:
|
||||
Theme.of(context).textTheme.bodyMedium!.copyWith(fontSize: 18),
|
||||
softWrap: true,
|
||||
),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user