Revert "wrap send view content in padding"

This reverts commit 2aa3bebf78.
This commit is contained in:
sneurlax 2024-03-11 23:05:55 -05:00
parent 10233550b1
commit 181ec5e539

View file

@ -391,215 +391,207 @@ class _FrostSendViewState extends ConsumerState<FrostSendView> {
const SizedBox( const SizedBox(
height: 16, height: 16,
), ),
Padding( Row(
padding: const EdgeInsets.symmetric( mainAxisAlignment: MainAxisAlignment.spaceBetween,
horizontal: 20, children: [
Text(
"Recipients",
style: STextStyles.smallMed12(context),
textAlign: TextAlign.left,
),
CustomTextButton(
text: "Add",
onTap: () {
// used for tracking recipient forms
_greatestWidgetIndex++;
recipientWidgetIndexes.add(_greatestWidgetIndex);
setState(() {});
},
),
],
),
const SizedBox(
height: 8,
),
Column(
children: [
for (int i = 0; i < recipientWidgetIndexes.length; i++)
ConditionalParent(
condition: recipientWidgetIndexes.length > 1,
builder: (child) => Padding(
padding: const EdgeInsets.only(top: 8),
child: child,
),
child: Recipient(
key: Key(
"recipientKey_${recipientWidgetIndexes[i]}",
),
index: recipientWidgetIndexes[i],
coin: coin,
onChanged: () {
_validateRecipientFormStates();
},
remove: i == 0 && recipientWidgetIndexes.length == 1
? null
: () {
recipientWidgetIndexes.removeAt(i);
setState(() {});
},
),
),
],
),
if (showCoinControl)
const SizedBox(
height: 8,
), ),
child: Column(children: [ if (showCoinControl)
Row( RoundedWhiteContainer(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
"Recipients", "Coin control",
style: STextStyles.smallMed12(context), style: STextStyles.w500_14(context).copyWith(
textAlign: TextAlign.left, color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
), ),
CustomTextButton( CustomTextButton(
text: "Add", text: selectedUTXOs.isEmpty
onTap: () { ? "Select coins"
// used for tracking recipient forms : "Selected coins (${selectedUTXOs.length})",
_greatestWidgetIndex++; onTap: () async {
recipientWidgetIndexes.add(_greatestWidgetIndex); if (FocusScope.of(context).hasFocus) {
setState(() {}); FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 100),
);
}
if (mounted) {
// finally spendable = ref
// .read(walletsChangeNotifierProvider)
// .getManager(widget.walletId)
// .balance
// .spendable;
// TODO: [prio=high] make sure this coincontrol works correctly
Amount? amount;
final result = await Navigator.of(context).pushNamed(
CoinControlView.routeName,
arguments: Tuple4(
walletId,
CoinControlViewType.use,
amount,
selectedUTXOs,
),
);
if (result is Set<UTXO>) {
setState(() {
selectedUTXOs = result;
});
}
}
}, },
), ),
], ],
), ),
const SizedBox( ),
height: 8, const SizedBox(
), height: 12,
Column( ),
children: [ Text(
for (int i = 0; i < recipientWidgetIndexes.length; i++) "Note (optional)",
ConditionalParent( style: STextStyles.smallMed12(context),
condition: recipientWidgetIndexes.length > 1, textAlign: TextAlign.left,
builder: (child) => Padding( ),
padding: const EdgeInsets.only(top: 8), const SizedBox(
child: child, height: 8,
), ),
child: Recipient( ClipRRect(
key: Key( borderRadius: BorderRadius.circular(
"recipientKey_${recipientWidgetIndexes[i]}", Constants.size.circularBorderRadius,
), ),
index: recipientWidgetIndexes[i], child: TextField(
coin: coin, autocorrect: Util.isDesktop ? false : true,
onChanged: () { enableSuggestions: Util.isDesktop ? false : true,
_validateRecipientFormStates(); controller: noteController,
}, focusNode: _noteFocusNode,
remove: i == 0 && recipientWidgetIndexes.length == 1 style: STextStyles.field(context),
? null onChanged: (_) => setState(() {}),
: () { decoration: standardInputDecoration(
recipientWidgetIndexes.removeAt(i); "Type something...",
setState(() {}); _noteFocusNode,
}, context,
), ).copyWith(
), suffixIcon: noteController.text.isNotEmpty
], ? Padding(
), padding: const EdgeInsets.only(right: 0),
if (showCoinControl) child: UnconstrainedBox(
const SizedBox( child: Row(
height: 8, children: [
), TextFieldIconButton(
if (showCoinControl) child: const XIcon(),
RoundedWhiteContainer( onTap: () async {
child: Row( setState(() {
mainAxisAlignment: MainAxisAlignment.spaceBetween, noteController.text = "";
children: [ });
Text( },
"Coin control",
style: STextStyles.w500_14(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textSubtitle1,
),
),
CustomTextButton(
text: selectedUTXOs.isEmpty
? "Select coins"
: "Selected coins (${selectedUTXOs.length})",
onTap: () async {
if (FocusScope.of(context).hasFocus) {
FocusScope.of(context).unfocus();
await Future<void>.delayed(
const Duration(milliseconds: 100),
);
}
if (mounted) {
// finally spendable = ref
// .read(walletsChangeNotifierProvider)
// .getManager(widget.walletId)
// .balance
// .spendable;
// TODO: [prio=high] make sure this coincontrol works correctly
Amount? amount;
final result =
await Navigator.of(context).pushNamed(
CoinControlView.routeName,
arguments: Tuple4(
walletId,
CoinControlViewType.use,
amount,
selectedUTXOs,
), ),
); ],
),
if (result is Set<UTXO>) { ),
setState(() { )
selectedUTXOs = result;
});
}
}
},
),
],
),
),
const SizedBox(
height: 12,
),
Text(
"Note (optional)",
style: STextStyles.smallMed12(context),
textAlign: TextAlign.left,
),
const SizedBox(
height: 8,
),
ClipRRect(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
child: TextField(
autocorrect: Util.isDesktop ? false : true,
enableSuggestions: Util.isDesktop ? false : true,
controller: noteController,
focusNode: _noteFocusNode,
style: STextStyles.field(context),
onChanged: (_) => setState(() {}),
decoration: standardInputDecoration(
"Type something...",
_noteFocusNode,
context,
).copyWith(
suffixIcon: noteController.text.isNotEmpty
? Padding(
padding: const EdgeInsets.only(right: 0),
child: UnconstrainedBox(
child: Row(
children: [
TextFieldIconButton(
child: const XIcon(),
onTap: () async {
setState(() {
noteController.text = "";
});
},
),
],
),
),
)
: null,
),
),
),
const SizedBox(
height: 12,
),
Padding(
padding: const EdgeInsets.only(
bottom: 12,
top: 16,
),
child: FeeSlider(
coin: coin,
onSatVByteChanged: (rate) {
customFeeRate = rate;
},
),
),
Util.isDesktop
? const SizedBox(
height: 12,
)
: const Spacer(),
const SizedBox(
height: 12,
),
TextButton(
onPressed: ref.watch(previewTxButtonStateProvider.state).state
? _createSignConfig
: null, : null,
style: ref.watch(previewTxButtonStateProvider.state).state
? Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context)
: Theme.of(context)
.extension<StackColors>()!
.getPrimaryDisabledButtonStyle(context),
child: Text(
"Create config",
style: STextStyles.button(context),
),
), ),
const SizedBox( ),
height: 16, ),
), const SizedBox(
]), height: 12,
),
Padding(
padding: const EdgeInsets.only(
bottom: 12,
top: 16,
),
child: FeeSlider(
coin: coin,
onSatVByteChanged: (rate) {
customFeeRate = rate;
},
),
),
Util.isDesktop
? const SizedBox(
height: 12,
)
: const Spacer(),
const SizedBox(
height: 12,
),
TextButton(
onPressed: ref.watch(previewTxButtonStateProvider.state).state
? _createSignConfig
: null,
style: ref.watch(previewTxButtonStateProvider.state).state
? Theme.of(context)
.extension<StackColors>()!
.getPrimaryEnabledButtonStyle(context)
: Theme.of(context)
.extension<StackColors>()!
.getPrimaryDisabledButtonStyle(context),
child: Text(
"Create config",
style: STextStyles.button(context),
),
),
const SizedBox(
height: 16,
), ),
], ],
), ),