scrollable buy form on mobile if keyboard covers part of it

This commit is contained in:
julian 2023-01-15 17:30:07 -06:00
parent a23c17d83e
commit 0c9dcf6403

View file

@ -23,6 +23,7 @@ import 'package:stackwallet/utilities/logger.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
import 'package:stackwallet/utilities/util.dart';
import 'package:stackwallet/widgets/conditional_parent.dart';
import 'package:stackwallet/widgets/custom_buttons/blue_text_button.dart';
import 'package:stackwallet/widgets/custom_loading_overlay.dart';
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
@ -351,9 +352,26 @@ class _BuyFormState extends ConsumerState<BuyForm> {
buyWithFiat = ref.watch(
prefsChangeNotifierProvider.select((value) => value.buyWithFiat));
return SizedBox(
width:
458, // TODO test that this displays well on mobile or else put in a ternary or something else appropriate to switch here
return ConditionalParent(
condition: isDesktop,
builder: (child) => SizedBox(
width: 458,
child: child,
),
child: ConditionalParent(
condition: !isDesktop,
builder: (child) => LayoutBuilder(
builder: (context, constraints) => SingleChildScrollView(
child: ConstrainedBox(
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: IntrinsicHeight(
child: child,
),
),
),
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
@ -376,7 +394,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
selectCrypto();
},
child: RoundedContainer(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
padding:
const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
color: _hovering1
? Theme.of(context)
.extension<StackColors>()!
@ -426,7 +445,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
Text(
"I want to pay with",
style: STextStyles.itemSubtitle(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark3,
color:
Theme.of(context).extension<StackColors>()!.textDark3,
),
),
],
@ -444,7 +464,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
selectFiat();
},
child: RoundedContainer(
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
padding:
const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
color: _hovering2
? Theme.of(context)
.extension<StackColors>()!
@ -460,8 +481,9 @@ class _BuyFormState extends ConsumerState<BuyForm> {
radiusMultiplier: 0.5,
padding: const EdgeInsets.symmetric(
vertical: 2, horizontal: 4),
color:
Theme.of(context).extension<StackColors>()!.highlight,
color: Theme.of(context)
.extension<StackColors>()!
.highlight,
child: Text(
"\$",
style: STextStyles.itemSubtitle12(context),
@ -505,7 +527,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
Text(
buyWithFiat ? "Enter amount" : "Enter crypto amount",
style: STextStyles.itemSubtitle(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark3,
color:
Theme.of(context).extension<StackColors>()!.textDark3,
),
),
const FiatCryptoToggle(),
@ -579,7 +602,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
Text(
"Enter receiving address",
style: STextStyles.itemSubtitle(context).copyWith(
color: Theme.of(context).extension<StackColors>()!.textDark3,
color:
Theme.of(context).extension<StackColors>()!.textDark3,
),
),
if (isStackCoin(selectedCrypto?.ticker))
@ -737,8 +761,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
"qrResult content: ${qrResult.rawContent}",
level: LogLevel.Info);
final results =
AddressUtils.parseUri(qrResult.rawContent);
final results = AddressUtils.parseUri(
qrResult.rawContent);
Logging.instance.log(
"qrResult parsed: $results",
@ -790,8 +814,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
),
PrimaryButton(
buttonHeight: isDesktop ? ButtonHeight.l : null,
enabled: ref.watch(
exchangeFormStateProvider.select((value) => value.canExchange)),
enabled: ref.watch(exchangeFormStateProvider
.select((value) => value.canExchange)),
onPressed: () {
// preview buy quote
},
@ -799,6 +823,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
)
],
),
),
);
}
}