mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
formatting, linter fixes, don't call apis in build method
This commit is contained in:
parent
f80b47d467
commit
2f0824b1f4
2 changed files with 449 additions and 453 deletions
|
@ -247,6 +247,11 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
coins = ref.read(supportedSimplexCurrenciesProvider).supportedCryptos;
|
coins = ref.read(supportedSimplexCurrenciesProvider).supportedCryptos;
|
||||||
fiats = ref.read(supportedSimplexCurrenciesProvider).supportedFiats;
|
fiats = ref.read(supportedSimplexCurrenciesProvider).supportedFiats;
|
||||||
|
|
||||||
|
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
|
||||||
|
BuyDataLoadingService().loadAll(
|
||||||
|
ref); // Why does this need to be called here? Shouldn't it already be called by main.dart?
|
||||||
|
});
|
||||||
|
|
||||||
// TODO set initial crypto to open wallet if a wallet is open
|
// TODO set initial crypto to open wallet if a wallet is open
|
||||||
|
|
||||||
super.initState();
|
super.initState();
|
||||||
|
@ -264,10 +269,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
buyWithFiat = ref.watch(
|
buyWithFiat = ref.watch(
|
||||||
prefsChangeNotifierProvider.select((value) => value.buyWithFiat));
|
prefsChangeNotifierProvider.select((value) => value.buyWithFiat));
|
||||||
|
|
||||||
BuyDataLoadingService().loadAll(
|
return SizedBox(
|
||||||
ref); // Why does this need to be called here? Shouldn't it already be called by main.dart?
|
|
||||||
|
|
||||||
return Container(
|
|
||||||
width:
|
width:
|
||||||
458, // TODO test that this displays well on mobile or else put in a ternary or something else appropriate to switch here
|
458, // TODO test that this displays well on mobile or else put in a ternary or something else appropriate to switch here
|
||||||
child: Column(
|
child: Column(
|
||||||
|
@ -292,8 +294,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
selectCrypto();
|
selectCrypto();
|
||||||
},
|
},
|
||||||
child: RoundedContainer(
|
child: RoundedContainer(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
|
||||||
const EdgeInsets.symmetric(vertical: 6, horizontal: 6),
|
|
||||||
color: _hovering1
|
color: _hovering1
|
||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -343,8 +344,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
Text(
|
Text(
|
||||||
"I want to pay with",
|
"I want to pay with",
|
||||||
style: STextStyles.itemSubtitle(context).copyWith(
|
style: STextStyles.itemSubtitle(context).copyWith(
|
||||||
color:
|
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
Theme.of(context).extension<StackColors>()!.textDark3,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -362,8 +362,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
selectFiat();
|
selectFiat();
|
||||||
},
|
},
|
||||||
child: RoundedContainer(
|
child: RoundedContainer(
|
||||||
padding:
|
padding: const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
|
||||||
const EdgeInsets.symmetric(vertical: 3, horizontal: 6),
|
|
||||||
color: _hovering2
|
color: _hovering2
|
||||||
? Theme.of(context)
|
? Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
|
@ -379,9 +378,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
radiusMultiplier: 0.5,
|
radiusMultiplier: 0.5,
|
||||||
padding: const EdgeInsets.symmetric(
|
padding: const EdgeInsets.symmetric(
|
||||||
vertical: 2, horizontal: 4),
|
vertical: 2, horizontal: 4),
|
||||||
color: Theme.of(context)
|
color:
|
||||||
.extension<StackColors>()!
|
Theme.of(context).extension<StackColors>()!.highlight,
|
||||||
.highlight,
|
|
||||||
child: Text(
|
child: Text(
|
||||||
"\$",
|
"\$",
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
|
@ -425,8 +423,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
Text(
|
Text(
|
||||||
buyWithFiat ? "Enter amount" : "Enter crypto amount",
|
buyWithFiat ? "Enter amount" : "Enter crypto amount",
|
||||||
style: STextStyles.itemSubtitle(context).copyWith(
|
style: STextStyles.itemSubtitle(context).copyWith(
|
||||||
color:
|
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
Theme.of(context).extension<StackColors>()!.textDark3,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
const FiatCryptoToggle(),
|
const FiatCryptoToggle(),
|
||||||
|
@ -500,8 +497,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
Text(
|
Text(
|
||||||
"Enter receiving address",
|
"Enter receiving address",
|
||||||
style: STextStyles.itemSubtitle(context).copyWith(
|
style: STextStyles.itemSubtitle(context).copyWith(
|
||||||
color:
|
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||||
Theme.of(context).extension<StackColors>()!.textDark3,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
@ -604,8 +600,7 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
TextFieldIconButton(
|
TextFieldIconButton(
|
||||||
key: const Key("buyViewAddressBookButtonKey"),
|
key: const Key("buyViewAddressBookButtonKey"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
print(
|
print('TODO tapped buyViewAddressBookButtonKey');
|
||||||
'TODO tapped buyViewAddressBookButtonKey');
|
|
||||||
// Navigator.of(context).pushNamed(
|
// Navigator.of(context).pushNamed(
|
||||||
// AddressBookView.routeName,
|
// AddressBookView.routeName,
|
||||||
// arguments: widget.coin,
|
// arguments: widget.coin,
|
||||||
|
@ -636,8 +631,8 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
"qrResult content: ${qrResult.rawContent}",
|
"qrResult content: ${qrResult.rawContent}",
|
||||||
level: LogLevel.Info);
|
level: LogLevel.Info);
|
||||||
|
|
||||||
final results = AddressUtils.parseUri(
|
final results =
|
||||||
qrResult.rawContent);
|
AddressUtils.parseUri(qrResult.rawContent);
|
||||||
|
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"qrResult parsed: $results",
|
"qrResult parsed: $results",
|
||||||
|
@ -725,14 +720,15 @@ class _BuyFormState extends ConsumerState<BuyForm> {
|
||||||
),
|
),
|
||||||
PrimaryButton(
|
PrimaryButton(
|
||||||
buttonHeight: isDesktop ? ButtonHeight.l : null,
|
buttonHeight: isDesktop ? ButtonHeight.l : null,
|
||||||
enabled: ref.watch(exchangeFormStateProvider
|
enabled: ref.watch(
|
||||||
.select((value) => value.canExchange)),
|
exchangeFormStateProvider.select((value) => value.canExchange)),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
// TODO implement buy confirmation dialog
|
// TODO implement buy confirmation dialog
|
||||||
},
|
},
|
||||||
label: "Exchange",
|
label: "Exchange",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,10 +11,9 @@ class BuyView extends StatefulWidget {
|
||||||
class _BuyViewState extends State<BuyView> {
|
class _BuyViewState extends State<BuyView> {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
//todo: check if print needed
|
debugPrint("BUILD: $runtimeType");
|
||||||
// debugPrint("BUILD: BuyView");
|
|
||||||
|
|
||||||
return SafeArea(
|
return const SafeArea(
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: EdgeInsets.only(
|
padding: EdgeInsets.only(
|
||||||
left: 16,
|
left: 16,
|
||||||
|
@ -22,6 +21,7 @@ class _BuyViewState extends State<BuyView> {
|
||||||
top: 16,
|
top: 16,
|
||||||
),
|
),
|
||||||
child: BuyForm(),
|
child: BuyForm(),
|
||||||
));
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue