buy form ui tweaks

This commit is contained in:
julian 2023-01-15 18:47:28 -06:00
parent 6d338b68a1
commit bda6865657

View file

@ -563,7 +563,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
signed: false, signed: false,
decimal: true, decimal: true,
), ),
textAlign: TextAlign.right, textAlign: TextAlign.left,
inputFormatters: [ inputFormatters: [
// regex to validate a crypto amount with 8 decimal places or // regex to validate a crypto amount with 8 decimal places or
// 2 if fiat // 2 if fiat
@ -582,9 +582,13 @@ class _BuyFormState extends ConsumerState<BuyForm> {
], ],
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: const EdgeInsets.only( contentPadding: const EdgeInsets.only(
top: 22, // top: 22,
right: 12, // right: 12,
bottom: 22, // bottom: 22,
left: 0,
top: 8,
bottom: 10,
right: 5,
), ),
hintText: "0", hintText: "0",
hintStyle: STextStyles.desktopTextExtraSmall(context).copyWith( hintStyle: STextStyles.desktopTextExtraSmall(context).copyWith(
@ -607,6 +611,47 @@ class _BuyFormState extends ConsumerState<BuyForm> {
), ),
), ),
), ),
suffixIcon: Padding(
padding: const EdgeInsets.all(0),
child: UnconstrainedBox(
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
_buyAmountController.text.isNotEmpty
? TextFieldIconButton(
key: const Key(
"buyViewClearAddressFieldButtonKey"),
onTap: () {
_buyAmountController.text = "";
// _receiveAddress = "";
setState(() {});
},
child: const XIcon(),
)
: TextFieldIconButton(
key: const Key(
"buyViewPasteAddressFieldButtonKey"),
onTap: () async {
final ClipboardData? data = await clipboard
.getData(Clipboard.kTextPlain);
final amountString =
Decimal.tryParse(data?.text ?? "");
if (amountString != null) {
_buyAmountController.text =
amountString.toString();
setState(() {});
}
},
child: _buyAmountController.text.isEmpty
? const ClipboardIcon()
: const XIcon(),
),
],
),
),
),
), ),
), ),
SizedBox( SizedBox(
@ -690,8 +735,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
focusNode: _receiveAddressFocusNode, focusNode: _receiveAddressFocusNode,
style: STextStyles.field(context), style: STextStyles.field(context),
decoration: standardInputDecoration( decoration: standardInputDecoration(
/*"Enter ${coin.ticker} address",*/ "Enter ${selectedCrypto?.ticker} address",
"Enter address",
_receiveAddressFocusNode, _receiveAddressFocusNode,
context, context,
).copyWith( ).copyWith(