mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2025-01-29 22:16:05 +00:00
Fix nullability of selected provider (#562)
Remove un-necessary null operators
This commit is contained in:
parent
c34c3b0737
commit
65b87ecae0
3 changed files with 12 additions and 14 deletions
|
@ -80,7 +80,7 @@ class PreOrderPage extends BasePage {
|
|||
return KeyboardActions(
|
||||
config: KeyboardActionsConfig(
|
||||
keyboardActionsPlatform: KeyboardActionsPlatform.IOS,
|
||||
keyboardBarColor: Theme.of(context).accentTextTheme!.bodyText1!
|
||||
keyboardBarColor: Theme.of(context).accentTextTheme.bodyText1!
|
||||
.backgroundColor!,
|
||||
nextFocus: false,
|
||||
actions: [
|
||||
|
@ -102,10 +102,9 @@ class PreOrderPage extends BasePage {
|
|||
bottomLeft: Radius.circular(24),
|
||||
bottomRight: Radius.circular(24)),
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).primaryTextTheme!.subtitle1!.color!,
|
||||
Theme.of(context).primaryTextTheme.subtitle1!.color!,
|
||||
Theme.of(context)
|
||||
.primaryTextTheme!
|
||||
.subtitle1!
|
||||
.primaryTextTheme.subtitle1!
|
||||
.decorationColor!,
|
||||
], begin: Alignment.topLeft, end: Alignment.bottomRight),
|
||||
),
|
||||
|
@ -161,11 +160,11 @@ class PreOrderPage extends BasePage {
|
|||
),
|
||||
),
|
||||
hintText: '0.00',
|
||||
borderColor: Theme.of(context).primaryTextTheme!.bodyText1!.decorationColor!,
|
||||
borderColor: Theme.of(context).primaryTextTheme.bodyText1!.decorationColor!,
|
||||
borderWidth: 0.5,
|
||||
textStyle: TextStyle(fontSize: 36, fontWeight: FontWeight.w500, color: Colors.white),
|
||||
placeholderTextStyle: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme!.headline5!.decorationColor!,
|
||||
color: Theme.of(context).primaryTextTheme.headline5!.decorationColor!,
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 36,
|
||||
),
|
||||
|
@ -180,7 +179,7 @@ class PreOrderPage extends BasePage {
|
|||
S.of(context).buy_with + ':',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).primaryTextTheme!.headline6!.color!,
|
||||
color: Theme.of(context).primaryTextTheme.headline6!.color!,
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.bold
|
||||
),
|
||||
|
@ -197,11 +196,11 @@ class PreOrderPage extends BasePage {
|
|||
double achAmount;
|
||||
int minAmount;
|
||||
|
||||
if (snapshot.hasData) {
|
||||
if (snapshot.hasData && snapshot.data != null) {
|
||||
sourceAmount = snapshot.data!.sourceAmount;
|
||||
destAmount = snapshot.data!.destAmount;
|
||||
minAmount = snapshot.data!.minAmount;
|
||||
achAmount = snapshot.data!.achSourceAmount!;
|
||||
achAmount = snapshot.data!.achSourceAmount ?? 0;
|
||||
} else {
|
||||
sourceAmount = 0.0;
|
||||
destAmount = 0.0;
|
||||
|
@ -215,7 +214,7 @@ class PreOrderPage extends BasePage {
|
|||
child: Observer(builder: (_) {
|
||||
return BuyListItem(
|
||||
selectedProvider:
|
||||
buyViewModel.selectedProvider!,
|
||||
buyViewModel.selectedProvider,
|
||||
provider: item.provider,
|
||||
sourceAmount: sourceAmount,
|
||||
sourceCurrency: buyViewModel.fiatCurrency,
|
||||
|
@ -247,7 +246,7 @@ class PreOrderPage extends BasePage {
|
|||
? S.of(context).buy
|
||||
: S.of(context).buy_with +
|
||||
' ${buyViewModel.selectedProvider!.description.title}',
|
||||
color: Theme.of(context).accentTextTheme!.bodyText1!.color!,
|
||||
color: Theme.of(context).accentTextTheme.bodyText1!.color!,
|
||||
textColor: Colors.white,
|
||||
isLoading: buyViewModel.isRunning,
|
||||
isDisabled: (buyViewModel.selectedProvider == null) ||
|
||||
|
|
|
@ -18,7 +18,7 @@ class BuyListItem extends StatelessWidget {
|
|||
this.onTap
|
||||
});
|
||||
|
||||
final BuyProvider selectedProvider;
|
||||
final BuyProvider? selectedProvider;
|
||||
final BuyProvider provider;
|
||||
final double sourceAmount;
|
||||
final FiatCurrency sourceCurrency;
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'package:cake_wallet/entities/fiat_currency.dart';
|
|||
import 'package:cw_core/wallet_type.dart';
|
||||
import 'package:cake_wallet/store/settings_store.dart';
|
||||
import 'package:cake_wallet/view_model/buy/buy_item.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:hive/hive.dart';
|
||||
import 'package:cake_wallet/buy/order.dart';
|
||||
import 'package:cake_wallet/store/dashboard/orders_store.dart';
|
||||
|
@ -103,7 +102,7 @@ abstract class BuyViewModelBase with Store {
|
|||
print(e.toString());
|
||||
}
|
||||
|
||||
if (isMoonPayEnabled ?? false) {
|
||||
if (isMoonPayEnabled) {
|
||||
_providerList.add(MoonPayBuyProvider(wallet: wallet));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue