add nonce field to token send view on desktop

This commit is contained in:
julian 2023-04-11 14:41:26 -06:00
parent 723ec64354
commit bb9916380d

View file

@ -71,12 +71,14 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
late TextEditingController sendToController;
late TextEditingController cryptoAmountController;
late TextEditingController baseAmountController;
late TextEditingController nonceController;
late final SendViewAutoFillData? _data;
final _addressFocusNode = FocusNode();
final _cryptoFocus = FocusNode();
final _baseFocus = FocusNode();
final _nonceFocusNode = FocusNode();
String? _note;
@ -229,6 +231,7 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
amount: amount,
args: {
"feeRate": ref.read(feeRateTypeStateProvider),
"nonce": int.tryParse(nonceController.text),
},
);
@ -585,6 +588,7 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
sendToController = TextEditingController();
cryptoAmountController = TextEditingController();
baseAmountController = TextEditingController();
nonceController = TextEditingController();
// feeController = TextEditingController();
onCryptoAmountChanged = _cryptoAmountChanged;
@ -629,11 +633,13 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
sendToController.dispose();
cryptoAmountController.dispose();
baseAmountController.dispose();
nonceController.dispose();
// feeController.dispose();
_addressFocusNode.dispose();
_cryptoFocus.dispose();
_baseFocus.dispose();
_nonceFocusNode.dispose();
super.dispose();
}
@ -1002,6 +1008,56 @@ class _DesktopTokenSendState extends ConsumerState<DesktopTokenSend> {
DesktopFeeDropDown(
walletId: walletId,
),
const SizedBox(
height: 20,
),
Text(
"Nonce",
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconRight,
),
textAlign: TextAlign.left,
),
const SizedBox(
height: 10,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
minLines: 1,
maxLines: 1,
key: const Key("sendViewNonceFieldKey"),
controller: nonceController,
readOnly: false,
autocorrect: false,
enableSuggestions: false,
keyboardType: const TextInputType.numberWithOptions(),
focusNode: _nonceFocusNode,
style: STextStyles.desktopTextExtraSmall(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveText,
height: 1.8,
),
decoration: standardInputDecoration(
"Leave empty to auto select nonce",
_nonceFocusNode,
context,
desktopMed: true,
).copyWith(
contentPadding: const EdgeInsets.only(
left: 16,
top: 11,
bottom: 12,
right: 5,
),
),
),
),
const SizedBox(
height: 36,
),