mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 18:44:31 +00:00
fix: Onchain notes missing for desktop
This commit is contained in:
parent
1920034e1f
commit
ff944928b6
2 changed files with 76 additions and 1 deletions
|
@ -89,6 +89,11 @@ class _ConfirmTransactionViewState
|
||||||
late final FocusNode _noteFocusNode;
|
late final FocusNode _noteFocusNode;
|
||||||
late final TextEditingController noteController;
|
late final TextEditingController noteController;
|
||||||
|
|
||||||
|
|
||||||
|
late final FocusNode _onChainNoteFocusNode;
|
||||||
|
late final TextEditingController onChainNoteController;
|
||||||
|
|
||||||
|
|
||||||
Future<void> _attemptSend(BuildContext context) async {
|
Future<void> _attemptSend(BuildContext context) async {
|
||||||
final manager =
|
final manager =
|
||||||
ref.read(walletsChangeNotifierProvider).getManager(walletId);
|
ref.read(walletsChangeNotifierProvider).getManager(walletId);
|
||||||
|
@ -138,6 +143,9 @@ class _ConfirmTransactionViewState
|
||||||
txidFuture = (manager.wallet as FiroWallet)
|
txidFuture = (manager.wallet as FiroWallet)
|
||||||
.confirmSendPublic(txData: transactionInfo);
|
.confirmSendPublic(txData: transactionInfo);
|
||||||
} else {
|
} else {
|
||||||
|
if (coin == Coin.epicCash) {
|
||||||
|
transactionInfo["onChainNote"] = onChainNoteController.text;
|
||||||
|
}
|
||||||
txidFuture = manager.confirmSend(txData: transactionInfo);
|
txidFuture = manager.confirmSend(txData: transactionInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -272,14 +280,21 @@ class _ConfirmTransactionViewState
|
||||||
_noteFocusNode = FocusNode();
|
_noteFocusNode = FocusNode();
|
||||||
noteController = TextEditingController();
|
noteController = TextEditingController();
|
||||||
noteController.text = transactionInfo["note"] as String? ?? "";
|
noteController.text = transactionInfo["note"] as String? ?? "";
|
||||||
|
|
||||||
|
_onChainNoteFocusNode = FocusNode();
|
||||||
|
onChainNoteController = TextEditingController();
|
||||||
|
onChainNoteController.text = transactionInfo["onChainNote"] as String? ?? "";
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
noteController.dispose();
|
noteController.dispose();
|
||||||
|
onChainNoteController.dispose();
|
||||||
|
|
||||||
_noteFocusNode.dispose();
|
_noteFocusNode.dispose();
|
||||||
|
_onChainNoteFocusNode.dispose();
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,8 +855,64 @@ class _ConfirmTransactionViewState
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
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(
|
Text(
|
||||||
"Note (optional)",
|
(coin == Coin.epicCash) ? "Local Note (optional)"
|
||||||
|
: "Note (optional)",
|
||||||
style:
|
style:
|
||||||
STextStyles.desktopTextExtraSmall(context).copyWith(
|
STextStyles.desktopTextExtraSmall(context).copyWith(
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
|
|
|
@ -105,6 +105,7 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
final _baseFocus = FocusNode();
|
final _baseFocus = FocusNode();
|
||||||
|
|
||||||
String? _note;
|
String? _note;
|
||||||
|
String? _onChainNote;
|
||||||
|
|
||||||
Amount? _amountToSend;
|
Amount? _amountToSend;
|
||||||
Amount? _cachedAmountToSend;
|
Amount? _cachedAmountToSend;
|
||||||
|
@ -354,6 +355,9 @@ class _DesktopSendState extends ConsumerState<DesktopSend> {
|
||||||
} else {
|
} else {
|
||||||
txData["address"] = _address;
|
txData["address"] = _address;
|
||||||
txData["note"] = _note ?? "";
|
txData["note"] = _note ?? "";
|
||||||
|
if (coin == Coin.epicCash) {
|
||||||
|
txData['onChainNote'] = _onChainNote ?? "";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// pop building dialog
|
// pop building dialog
|
||||||
Navigator.of(
|
Navigator.of(
|
||||||
|
|
Loading…
Reference in a new issue