mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 17:57:40 +00:00
Merge pull request #642 from cypherstack/fix-desktop-onchain-notes
fix: Onchain notes missing for desktop
This commit is contained in:
commit
f5ac193a11
2 changed files with 76 additions and 1 deletions
|
@ -89,6 +89,11 @@ class _ConfirmTransactionViewState
|
|||
late final FocusNode _noteFocusNode;
|
||||
late final TextEditingController noteController;
|
||||
|
||||
|
||||
late final FocusNode _onChainNoteFocusNode;
|
||||
late final TextEditingController onChainNoteController;
|
||||
|
||||
|
||||
Future<void> _attemptSend(BuildContext context) async {
|
||||
final manager =
|
||||
ref.read(walletsChangeNotifierProvider).getManager(walletId);
|
||||
|
@ -138,6 +143,9 @@ class _ConfirmTransactionViewState
|
|||
txidFuture = (manager.wallet as FiroWallet)
|
||||
.confirmSendPublic(txData: transactionInfo);
|
||||
} else {
|
||||
if (coin == Coin.epicCash) {
|
||||
transactionInfo["onChainNote"] = onChainNoteController.text;
|
||||
}
|
||||
txidFuture = manager.confirmSend(txData: transactionInfo);
|
||||
}
|
||||
}
|
||||
|
@ -272,14 +280,21 @@ class _ConfirmTransactionViewState
|
|||
_noteFocusNode = FocusNode();
|
||||
noteController = TextEditingController();
|
||||
noteController.text = transactionInfo["note"] as String? ?? "";
|
||||
|
||||
_onChainNoteFocusNode = FocusNode();
|
||||
onChainNoteController = TextEditingController();
|
||||
onChainNoteController.text = transactionInfo["onChainNote"] as String? ?? "";
|
||||
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
noteController.dispose();
|
||||
onChainNoteController.dispose();
|
||||
|
||||
_noteFocusNode.dispose();
|
||||
_onChainNoteFocusNode.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
|
@ -840,8 +855,64 @@ class _ConfirmTransactionViewState
|
|||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
if (coin == Coin.epicCash)
|
||||
Text(
|
||||
"On chain Note (optional)",
|
||||
style: STextStyles.smallMed12(context),
|
||||
textAlign: TextAlign.left,
|
||||
),
|
||||
if (coin == Coin.epicCash)
|
||||
const SizedBox(
|
||||
height: 8,
|
||||
),
|
||||
if (coin == Coin.epicCash)
|
||||
ClipRRect(
|
||||
borderRadius: BorderRadius.circular(
|
||||
Constants.size.circularBorderRadius,
|
||||
),
|
||||
child: TextField(
|
||||
autocorrect: Util.isDesktop ? false : true,
|
||||
enableSuggestions: Util.isDesktop ? false : true,
|
||||
maxLength: 256,
|
||||
controller: onChainNoteController,
|
||||
focusNode: _onChainNoteFocusNode,
|
||||
style: STextStyles.field(context),
|
||||
onChanged: (_) => setState(() {}),
|
||||
decoration: standardInputDecoration(
|
||||
"Type something...",
|
||||
_onChainNoteFocusNode,
|
||||
context,
|
||||
).copyWith(
|
||||
suffixIcon: onChainNoteController.text.isNotEmpty
|
||||
? Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(right: 0),
|
||||
child: UnconstrainedBox(
|
||||
child: Row(
|
||||
children: [
|
||||
TextFieldIconButton(
|
||||
child: const XIcon(),
|
||||
onTap: () async {
|
||||
setState(() {
|
||||
onChainNoteController.text = "";
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
: null,
|
||||
),
|
||||
),
|
||||
),
|
||||
if (coin == Coin.epicCash)
|
||||
const SizedBox(
|
||||
height: 12,
|
||||
),
|
||||
Text(
|
||||
"Note (optional)",
|
||||
(coin == Coin.epicCash) ? "Local Note (optional)"
|
||||
: "Note (optional)",
|
||||
style:
|
||||
STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||
color: Theme.of(context)
|
||||
|
|
|
@ -105,6 +105,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
final _baseFocus = FocusNode();
|
||||
|
||||
String? _note;
|
||||
String? _onChainNote;
|
||||
|
||||
Amount? _amountToSend;
|
||||
Amount? _cachedAmountToSend;
|
||||
|
@ -354,6 +355,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
|||
} else {
|
||||
txData["address"] = _address;
|
||||
txData["note"] = _note ?? "";
|
||||
if (coin == Coin.epicCash) {
|
||||
txData['onChainNote'] = _onChainNote ?? "";
|
||||
}
|
||||
}
|
||||
// pop building dialog
|
||||
Navigator.of(
|
||||
|
|
Loading…
Reference in a new issue