Fix theme and nullability errors

This commit is contained in:
OmarHatem 2022-10-21 21:12:38 +02:00
parent 2fb05bccc1
commit b831165aca
23 changed files with 163 additions and 173 deletions

View file

@ -805,7 +805,7 @@ Future setup(
)); ));
getIt.registerFactory(() { getIt.registerFactory(() {
final wallet = getIt.get<AppStore>().wallet; final wallet = getIt.get<AppStore>().wallet!;
return AddBalanceViewModel(getIt.get<BuyAmountViewModel>(), wallet: wallet); return AddBalanceViewModel(getIt.get<BuyAmountViewModel>(), wallet: wallet);
}); });

View file

@ -1,11 +1,11 @@
class PhoneNumberService { class PhoneNumberService {
const PhoneNumberService({ const PhoneNumberService({
this.id, required this.id,
this.phoneNumber, required this.phoneNumber,
this.planId, required this.planId,
this.usedUntil, required this.usedUntil,
this.messageReceiveEnabled, this.messageReceiveEnabled = false,
this.autoRenew, this.autoRenew = false,
}); });
final String id; final String id;

View file

@ -2,10 +2,10 @@ import 'package:flutter/material.dart';
class ServicePlan { class ServicePlan {
const ServicePlan({ const ServicePlan({
@required this.id, required this.id,
@required this.duration, required this.duration,
@required this.price, required this.price,
@required this.quantity, required this.quantity,
}); });
final String id; final String id;

View file

@ -190,7 +190,7 @@ class AddBalancePage extends BasePage {
.get<AppStore>() .get<AppStore>()
.wallet .wallet
!.calculateEstimatedFee( !.calculateEstimatedFee(
getIt.get<AppStore>().settingsStore!.priority[getIt.get<AppStore>().wallet!.type], getIt.get<AppStore>().settingsStore.priority[getIt.get<AppStore>().wallet!.type]!,
addBalanceViewModel.buyAmountViewModel.doubleAmount.floor(), addBalanceViewModel.buyAmountViewModel.doubleAmount.floor(),
) )
.toDouble())), .toDouble())),
@ -200,7 +200,7 @@ class AddBalancePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -220,8 +220,8 @@ class AddBalancePage extends BasePage {
isDividerExists: true, isDividerExists: true,
rightButtonText: S.of(context).ok, rightButtonText: S.of(context).ok,
leftButtonText: S.of(context).cancel, leftButtonText: S.of(context).cancel,
rightActionButtonColor: Theme.of(context).accentTextTheme.bodyText1?.color, rightActionButtonColor: Theme.of(context).accentTextTheme.bodyText1!.color!,
leftActionButtonColor: Theme.of(context).primaryTextTheme.bodyText1?.backgroundColor, leftActionButtonColor: Theme.of(context).primaryTextTheme.bodyText1!.backgroundColor!,
actionRightButton: () { actionRightButton: () {
Navigator.of(dialogContext).pop(); Navigator.of(dialogContext).pop();
showPaymentConfirmationPopup(context); showPaymentConfirmationPopup(context);
@ -244,15 +244,15 @@ class AddBalancePage extends BasePage {
// TODO: Make it reusable after finding the models related and use it here and in phone_number_product_page.dart // TODO: Make it reusable after finding the models related and use it here and in phone_number_product_page.dart
Widget cryptoAmount(double totalPrice) { Widget cryptoAmount(double totalPrice) {
return FutureBuilder<BuyAmount>( return FutureBuilder<BuyAmount>(
future: MoonPayBuyProvider(wallet: getIt.get<AppStore>().wallet) future: MoonPayBuyProvider(wallet: getIt.get<AppStore>().wallet!)
.calculateAmount(totalPrice.toString(), FiatCurrency.usd.title), .calculateAmount(totalPrice.toString(), FiatCurrency.usd.title),
builder: (context, AsyncSnapshot<BuyAmount> snapshot) { builder: (context, AsyncSnapshot<BuyAmount> snapshot) {
double sourceAmount; double sourceAmount;
double destAmount; double destAmount;
if (snapshot.hasData) { if (snapshot.hasData && snapshot.data != null) {
sourceAmount = snapshot.data.sourceAmount; sourceAmount = snapshot.data!.sourceAmount;
destAmount = snapshot.data.destAmount; destAmount = snapshot.data!.destAmount;
} else { } else {
sourceAmount = 0.0; sourceAmount = 0.0;
destAmount = 0.0; destAmount = 0.0;
@ -262,11 +262,11 @@ class AddBalancePage extends BasePage {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( Text(
"${sourceAmount} ${getIt.get<AppStore>().wallet.currency.toString()}", "${sourceAmount} ${getIt.get<AppStore>().wallet!.currency.toString()}",
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
Text( Text(
@ -290,7 +290,7 @@ class AddBalancePage extends BasePage {
builder: (dialogContext) { builder: (dialogContext) {
return InfoAlertDialog( return InfoAlertDialog(
alertTitle: S.of(context).awaiting_payment_confirmation, alertTitle: S.of(context).awaiting_payment_confirmation,
alertTitleColor: Theme.of(context).primaryTextTheme.title.decorationColor, alertTitleColor: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
alertContentPadding: EdgeInsets.zero, alertContentPadding: EdgeInsets.zero,
alertContent: Padding( alertContent: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 32), padding: const EdgeInsets.only(top: 8, bottom: 32),
@ -305,7 +305,7 @@ class AddBalancePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -337,7 +337,7 @@ class AddBalancePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -357,7 +357,7 @@ class AddBalancePage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),

View file

@ -1,7 +1,6 @@
import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -9,7 +8,7 @@ import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
class CakePhoneAuthPage extends BasePage { class CakePhoneAuthPage extends BasePage {
CakePhoneAuthPage({@required this.isLogin}); CakePhoneAuthPage({required this.isLogin});
final bool isLogin; final bool isLogin;
@ -24,7 +23,7 @@ class CakePhoneAuthPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -58,9 +57,11 @@ class CakePhoneAuthBodyState extends State<CakePhoneAuthBody> {
keyboardType: TextInputType.emailAddress, keyboardType: TextInputType.emailAddress,
maxLines: 1, maxLines: 1,
hintText: S.of(context).email_address, hintText: S.of(context).email_address,
validator: (String text) { validator: (String? text) {
text = text.trim(); text = text?.trim();
if (text.isNotEmpty && RegExp(r"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$").hasMatch(text)) { if (text != null
&& text.isNotEmpty
&& RegExp(r"^[\w-\.]+@([\w-]+\.)+[\w-]{2,4}$").hasMatch(text)) {
return null; return null;
} }
@ -130,7 +131,7 @@ class CakePhoneAuthBodyState extends State<CakePhoneAuthBody> {
void _registerCakePhone() { void _registerCakePhone() {
// TODO: Add Registration logic // TODO: Add Registration logic
if (_formKey.currentState.validate()) { if (_formKey.currentState!.validate()) {
Navigator.pushNamed(context, Routes.cakePhoneVerification); Navigator.pushNamed(context, Routes.cakePhoneVerification);
} else { } else {
setState(() { setState(() {
@ -141,7 +142,7 @@ class CakePhoneAuthBodyState extends State<CakePhoneAuthBody> {
void _loginCakePhone() { void _loginCakePhone() {
// TODO: Add Login logic // TODO: Add Login logic
if (_formKey.currentState.validate()) { if (_formKey.currentState!.validate()) {
Navigator.pushNamed(context, Routes.cakePhoneVerification); Navigator.pushNamed(context, Routes.cakePhoneVerification);
} else { } else {
setState(() { setState(() {

View file

@ -1,6 +1,5 @@
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
@ -18,7 +17,7 @@ class CakePhoneProductsPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -44,7 +43,7 @@ class CakePhoneProductsBodyState extends State<CakePhoneProductsBody> {
"${S.of(context).choose_phone_products}:", "${S.of(context).choose_phone_products}:",
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
fontFamily: 'Lato', fontFamily: 'Lato',
), ),
), ),

View file

@ -2,7 +2,6 @@ import 'dart:async';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
@ -23,7 +22,7 @@ class CakePhoneVerificationPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -77,7 +76,7 @@ class CakePhoneVerificationBodyState extends State<CakePhoneVerificationBody> {
S.of(context).fill_verification_code, S.of(context).fill_verification_code,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
fontFamily: 'Lato', fontFamily: 'Lato',
), ),
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -100,20 +99,20 @@ class CakePhoneVerificationBodyState extends State<CakePhoneVerificationBody> {
padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12), padding: EdgeInsets.symmetric(vertical: 8, horizontal: 12),
margin: EdgeInsets.only(bottom: 12), margin: EdgeInsets.only(bottom: 12),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Theme.of(context).accentTextTheme.caption.color, color: Theme.of(context).accentTextTheme.caption?.color,
borderRadius: BorderRadius.circular(6), borderRadius: BorderRadius.circular(6),
), ),
child: Text( child: Text(
S.of(context).get_code, S.of(context).get_code,
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),
)), )),
), ),
validator: (String text) { validator: (String? text) {
// TODO: check and apply verification constraints with backend // TODO: check and apply verification constraints with backend
if (text.length < 4) { if ((text?.length ?? 0) < 4) {
return S.of(context).invalid_verification_code; return S.of(context).invalid_verification_code;
} }
return null; return null;
@ -137,7 +136,7 @@ class CakePhoneVerificationBodyState extends State<CakePhoneVerificationBody> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).textTheme.subtitle.color, color: Theme.of(context).textTheme.subtitle2?.color,
), ),
), ),
], ],
@ -149,7 +148,7 @@ class CakePhoneVerificationBodyState extends State<CakePhoneVerificationBody> {
children: <Widget>[ children: <Widget>[
PrimaryButton( PrimaryButton(
onPressed: () { onPressed: () {
if (_formKey.currentState.validate()) { if (_formKey.currentState!.validate()) {
Navigator.pushNamedAndRemoveUntil( Navigator.pushNamedAndRemoveUntil(
context, context,
Routes.cakePhoneProducts, Routes.cakePhoneProducts,

View file

@ -1,6 +1,5 @@
import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
@ -20,7 +19,7 @@ class CakePhoneWelcomePage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -43,7 +42,7 @@ class CakePhoneWelcomeBodyState extends State<CakePhoneWelcomeBody> {
S.of(context).cake_phone_introduction, S.of(context).cake_phone_introduction,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
fontFamily: 'Lato', fontFamily: 'Lato',
), ),
), ),
@ -63,7 +62,7 @@ class CakePhoneWelcomeBodyState extends State<CakePhoneWelcomeBody> {
child: Text( child: Text(
S.of(context).already_have_account, S.of(context).already_have_account,
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
), ),
), ),
@ -75,7 +74,7 @@ class CakePhoneWelcomeBodyState extends State<CakePhoneWelcomeBody> {
child: Text( child: Text(
S.of(context).login, S.of(context).login,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentTextTheme.display1.color, color: Theme.of(context).accentTextTheme.headline4?.color,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w900, fontWeight: FontWeight.w900,
), ),

View file

@ -3,7 +3,6 @@ import 'package:cake_wallet/src/screens/cake_phone/widgets/cake_phone_settings_t
import 'package:cake_wallet/src/screens/cake_phone/widgets/plan_card.dart'; import 'package:cake_wallet/src/screens/cake_phone/widgets/plan_card.dart';
import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart'; import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
@ -11,7 +10,7 @@ import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:flutter_mobx/flutter_mobx.dart';
class AutoRenewSettingsPage extends BasePage { class AutoRenewSettingsPage extends BasePage {
AutoRenewSettingsPage({@required this.phoneNumberService, @required this.phonePlanViewModel}); AutoRenewSettingsPage({required this.phoneNumberService, required this.phonePlanViewModel});
final PhoneNumberService phoneNumberService; final PhoneNumberService phoneNumberService;
final PhonePlanViewModel phonePlanViewModel; final PhonePlanViewModel phonePlanViewModel;
@ -27,7 +26,7 @@ class AutoRenewSettingsPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -59,7 +58,7 @@ class AutoRenewSettingsBodyState extends State<AutoRenewSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.decorationColor, color: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
fontFamily: 'Lato', fontFamily: 'Lato',
), ),
), ),
@ -113,7 +112,7 @@ class AutoRenewSettingsBodyState extends State<AutoRenewSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
); );
}), }),
@ -125,7 +124,7 @@ class AutoRenewSettingsBodyState extends State<AutoRenewSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -141,8 +140,8 @@ class AutoRenewSettingsBodyState extends State<AutoRenewSettingsBody> {
onPressed: () { onPressed: () {
}, },
text: "${S.of(context).disable} ${S.of(context).auto_renew}", text: "${S.of(context).disable} ${S.of(context).auto_renew}",
color: Theme.of(context).accentTextTheme.caption.backgroundColor, color: Theme.of(context).accentTextTheme.caption?.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.title.color, textColor: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
PrimaryButton( PrimaryButton(

View file

@ -3,14 +3,13 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/src/screens/cake_phone/widgets/cake_phone_settings_tile.dart'; import 'package:cake_wallet/src/screens/cake_phone/widgets/cake_phone_settings_tile.dart';
import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart'; import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/standart_switch.dart'; import 'package:cake_wallet/src/widgets/standart_switch.dart';
import 'package:cake_wallet/entities/cake_phone_entities/phone_number_service.dart'; import 'package:cake_wallet/entities/cake_phone_entities/phone_number_service.dart';
class NumberSettingsPage extends BasePage { class NumberSettingsPage extends BasePage {
NumberSettingsPage({@required this.phoneNumberService, @required this.phonePlanViewModel}); NumberSettingsPage({required this.phoneNumberService, required this.phonePlanViewModel});
final PhoneNumberService phoneNumberService; final PhoneNumberService phoneNumberService;
final PhonePlanViewModel phonePlanViewModel; final PhonePlanViewModel phonePlanViewModel;
@ -26,7 +25,7 @@ class NumberSettingsPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -42,7 +41,7 @@ class NumberSettingsBody extends StatefulWidget {
} }
class NumberSettingsBodyState extends State<NumberSettingsBody> { class NumberSettingsBodyState extends State<NumberSettingsBody> {
ServicePlan selectedPhoneNumberPlan; ServicePlan? selectedPhoneNumberPlan;
bool blockIncomingSMS = true; bool blockIncomingSMS = true;
@override @override
@ -51,7 +50,7 @@ class NumberSettingsBodyState extends State<NumberSettingsBody> {
try { try {
selectedPhoneNumberPlan = widget.phonePlanViewModel.servicePlans selectedPhoneNumberPlan = widget.phonePlanViewModel.servicePlans
.firstWhere((element) => element.id == widget.phoneNumberService.planId); ?.firstWhere((element) => element.id == widget.phoneNumberService.planId);
} catch (err) { } catch (err) {
// the current phone plan is no longer available so check for nullability // the current phone plan is no longer available so check for nullability
} }
@ -72,7 +71,7 @@ class NumberSettingsBodyState extends State<NumberSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -87,13 +86,13 @@ class NumberSettingsBodyState extends State<NumberSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
size: 16, size: 16,
), ),
], ],
@ -112,13 +111,13 @@ class NumberSettingsBodyState extends State<NumberSettingsBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
size: 16, size: 16,
), ),
], ],
@ -134,7 +133,7 @@ class NumberSettingsBodyState extends State<NumberSettingsBody> {
child: Text( child: Text(
S.of(context).block_incoming_sms, S.of(context).block_incoming_sms,
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),

View file

@ -16,7 +16,6 @@ import 'package:cake_wallet/view_model/cake_phone/phone_plan_view_model.dart';
import 'package:country_pickers/country.dart'; import 'package:country_pickers/country.dart';
import 'package:dotted_border/dotted_border.dart'; import 'package:dotted_border/dotted_border.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:country_pickers/country_pickers.dart'; import 'package:country_pickers/country_pickers.dart';
import 'package:country_pickers/countries.dart'; import 'package:country_pickers/countries.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
@ -29,7 +28,7 @@ class PhoneNumberProductPage extends BasePage {
PhoneNumberProductPage(this.phonePlanViewModel, {this.phoneNumberService}); PhoneNumberProductPage(this.phonePlanViewModel, {this.phoneNumberService});
final PhonePlanViewModel phonePlanViewModel; final PhonePlanViewModel phonePlanViewModel;
final PhoneNumberService phoneNumberService; final PhoneNumberService? phoneNumberService;
@override @override
Widget body(BuildContext context) => PhoneNumberProductBody(phonePlanViewModel, phoneNumberService); Widget body(BuildContext context) => PhoneNumberProductBody(phonePlanViewModel, phoneNumberService);
@ -42,7 +41,7 @@ class PhoneNumberProductPage extends BasePage {
fontSize: 22, fontSize: 22,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme.title.decorationColor), color: Theme.of(context).primaryTextTheme.headline6?.decorationColor),
); );
} }
} }
@ -51,7 +50,7 @@ class PhoneNumberProductBody extends StatefulWidget {
PhoneNumberProductBody(this.phonePlanViewModel, this.phoneNumberService); PhoneNumberProductBody(this.phonePlanViewModel, this.phoneNumberService);
final PhonePlanViewModel phonePlanViewModel; final PhonePlanViewModel phonePlanViewModel;
final PhoneNumberService phoneNumberService; final PhoneNumberService? phoneNumberService;
@override @override
PhoneNumberProductBodyState createState() => PhoneNumberProductBodyState(); PhoneNumberProductBodyState createState() => PhoneNumberProductBodyState();
@ -75,7 +74,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 20, fontSize: 20,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.decorationColor, color: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
fontFamily: 'Lato', fontFamily: 'Lato',
), ),
), ),
@ -131,7 +130,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
); );
}), }),
@ -140,11 +139,11 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
CakePhoneSettingsTile( CakePhoneSettingsTile(
title: S.of(context).phone_number, title: S.of(context).phone_number,
value: Text( value: Text(
widget.phoneNumberService.phoneNumber, widget.phoneNumberService!.phoneNumber,
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -173,7 +172,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -183,7 +182,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w400, fontWeight: FontWeight.w400,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
], ],
@ -191,7 +190,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
), ),
Icon( Icon(
Icons.arrow_forward_ios, Icons.arrow_forward_ios,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
size: 16, size: 16,
), ),
], ],
@ -263,7 +262,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
); );
}), }),
@ -294,7 +293,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
text: "\$${widget.phonePlanViewModel.totalPrice}", text: "\$${widget.phonePlanViewModel.totalPrice}",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
], ],
@ -314,7 +313,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
builder: (dialogContext) { builder: (dialogContext) {
return AlertWithTwoActions( return AlertWithTwoActions(
alertTitle: S.of(context).confirm_payment, alertTitle: S.of(context).confirm_payment,
alertTitleColor: Theme.of(context).primaryTextTheme.title.decorationColor, alertTitleColor: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
alertContent: S.of(context).confirm_delete_template, alertContent: S.of(context).confirm_delete_template,
contentWidget: Column( contentWidget: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -341,8 +340,8 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
}); });
}, },
text: "${S.of(context).pay_with} ${S.of(context).cake_pay_balance}", text: "${S.of(context).pay_with} ${S.of(context).cake_pay_balance}",
color: Theme.of(context).accentTextTheme.caption.backgroundColor, color: Theme.of(context).accentTextTheme.caption?.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.title.color, textColor: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
const SizedBox(height: 8), const SizedBox(height: 8),
PrimaryButton( PrimaryButton(
@ -352,7 +351,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
builder: (dialogContext) { builder: (dialogContext) {
return AlertWithTwoActions( return AlertWithTwoActions(
alertTitle: S.of(context).confirm_sending, alertTitle: S.of(context).confirm_sending,
alertTitleColor: Theme.of(context).primaryTextTheme.title.decorationColor, alertTitleColor: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
alertContent: S.of(context).confirm_delete_template, alertContent: S.of(context).confirm_delete_template,
contentWidget: Column( contentWidget: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -365,9 +364,9 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
title: S.of(context).send_fee, title: S.of(context).send_fee,
value: cryptoAmount(getIt value: cryptoAmount(getIt
.get<AppStore>() .get<AppStore>()
.wallet .wallet!
.calculateEstimatedFee( .calculateEstimatedFee(
getIt.get<AppStore>().settingsStore.priority[getIt.get<AppStore>().wallet.type], getIt.get<AppStore>().settingsStore.priority[getIt.get<AppStore>().wallet!.type]!,
widget.phonePlanViewModel.totalPrice.floor(), widget.phonePlanViewModel.totalPrice.floor(),
) )
.toDouble()), .toDouble()),
@ -378,7 +377,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
const SizedBox(height: 16), const SizedBox(height: 16),
@ -406,7 +405,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
actionLeftButton: () => Navigator.of(dialogContext).pop()); actionLeftButton: () => Navigator.of(dialogContext).pop());
}); });
}, },
text: "${S.of(context).pay_with} ${getIt.get<AppStore>().wallet.currency.toString()}", text: "${S.of(context).pay_with} ${getIt.get<AppStore>().wallet!.currency.toString()}",
color: Theme.of(context).accentTextTheme.bodyText1?.color, color: Theme.of(context).accentTextTheme.bodyText1?.color,
textColor: Colors.white, textColor: Colors.white,
), ),
@ -433,7 +432,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
child: DottedBorder( child: DottedBorder(
borderType: BorderType.Circle, borderType: BorderType.Circle,
dashPattern: [3, 3], dashPattern: [3, 3],
color: Theme.of(context).primaryTextTheme.displayMedium?.color, color: Theme.of(context).primaryTextTheme.headline2!.color!,
strokeWidth: 3, strokeWidth: 3,
child: Padding( child: Padding(
padding: const EdgeInsets.all(6), padding: const EdgeInsets.all(6),
@ -453,22 +452,22 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
); );
} }
Widget cryptoAmount(double totalPrice) { Widget cryptoAmount(double totalPrice) {
return FutureBuilder<BuyAmount>( return FutureBuilder<BuyAmount>(
future: MoonPayBuyProvider(wallet: getIt.get<AppStore>().wallet) future: MoonPayBuyProvider(wallet: getIt.get<AppStore>().wallet!)
.calculateAmount(totalPrice.toString(), FiatCurrency.usd.title), .calculateAmount(totalPrice.toString(), FiatCurrency.usd.title),
builder: (context, AsyncSnapshot<BuyAmount> snapshot) { builder: (context, AsyncSnapshot<BuyAmount> snapshot) {
double sourceAmount; double sourceAmount;
double destAmount; double destAmount;
if (snapshot.hasData) { if (snapshot.hasData && snapshot.data != null) {
sourceAmount = snapshot.data.sourceAmount; sourceAmount = snapshot.data!.sourceAmount;
destAmount = snapshot.data.destAmount; destAmount = snapshot.data!.destAmount;
} else { } else {
sourceAmount = 0.0; sourceAmount = 0.0;
destAmount = 0.0; destAmount = 0.0;
@ -478,11 +477,11 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
crossAxisAlignment: CrossAxisAlignment.end, crossAxisAlignment: CrossAxisAlignment.end,
children: [ children: [
Text( Text(
"${sourceAmount} ${getIt.get<AppStore>().wallet.currency.toString()}", "${sourceAmount} ${getIt.get<AppStore>().wallet!.currency.toString()}",
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
Text( Text(
@ -505,7 +504,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
builder: (dialogContext) { builder: (dialogContext) {
return InfoAlertDialog( return InfoAlertDialog(
alertTitle: S.of(context).awaiting_payment_confirmation, alertTitle: S.of(context).awaiting_payment_confirmation,
alertTitleColor: Theme.of(context).primaryTextTheme.title.decorationColor, alertTitleColor: Theme.of(context).primaryTextTheme.headline6?.decorationColor,
alertContentPadding: EdgeInsets.zero, alertContentPadding: EdgeInsets.zero,
alertContent: Padding( alertContent: Padding(
padding: const EdgeInsets.only(top: 8, bottom: 32), padding: const EdgeInsets.only(top: 8, bottom: 32),
@ -518,7 +517,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -550,7 +549,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),
@ -570,7 +569,7 @@ class PhoneNumberProductBodyState extends State<PhoneNumberProductBody> {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),

View file

@ -1,10 +1,10 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class AddOptionsTile extends StatelessWidget { class AddOptionsTile extends StatelessWidget {
const AddOptionsTile({Key key, @required this.leading, this.onTap}) : super(key: key); const AddOptionsTile({Key? key, required this.leading, this.onTap}) : super(key: key);
final Widget leading; final Widget leading;
final Function() onTap; final Function()? onTap;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -24,12 +24,12 @@ class AddOptionsTile extends StatelessWidget {
Container( Container(
width: 2, width: 2,
height: 48, height: 48,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
), ),
const SizedBox(width: 16), const SizedBox(width: 16),
Icon( Icon(
Icons.add_circle, Icons.add_circle,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
size: 24, size: 24,
), ),
], ],

View file

@ -1,11 +1,11 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class CakePhoneSettingsTile extends StatelessWidget { class CakePhoneSettingsTile extends StatelessWidget {
const CakePhoneSettingsTile({Key key, @required this.value, this.title, this.onTap}) : super(key: key); const CakePhoneSettingsTile({Key? key, required this.value, this.title, this.onTap}) : super(key: key);
final String title; final String? title;
final Widget value; final Widget value;
final Function() onTap; final Function()? onTap;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -16,7 +16,7 @@ class CakePhoneSettingsTile extends StatelessWidget {
children: [ children: [
if (title != null) if (title != null)
Text( Text(
title, title!,
style: TextStyle( style: TextStyle(
color: Theme.of(context).accentTextTheme.subtitle1?.color, color: Theme.of(context).accentTextTheme.subtitle1?.color,
), ),
@ -27,7 +27,7 @@ class CakePhoneSettingsTile extends StatelessWidget {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border( border: Border(
bottom: BorderSide( bottom: BorderSide(
color: Theme.of(context).accentTextTheme.title.backgroundColor, color: Theme.of(context).accentTextTheme.headline6?.backgroundColor ?? Colors.transparent,
), ),
), ),
), ),

View file

@ -2,9 +2,9 @@ import 'package:flutter/material.dart';
class InfoTextColumn extends StatelessWidget { class InfoTextColumn extends StatelessWidget {
const InfoTextColumn({ const InfoTextColumn({
Key key, Key? key,
@required this.title, required this.title,
@required this.subtitle, required this.subtitle,
this.isReversed = false, this.isReversed = false,
this.padding, this.padding,
}) : super(key: key); }) : super(key: key);
@ -12,7 +12,7 @@ class InfoTextColumn extends StatelessWidget {
final String title; final String title;
final String subtitle; final String subtitle;
final bool isReversed; final bool isReversed;
final EdgeInsets padding; final EdgeInsets? padding;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -42,6 +42,6 @@ class InfoTextColumn extends StatelessWidget {
TextStyle titleTextStyle(BuildContext context) => TextStyle( TextStyle titleTextStyle(BuildContext context) => TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w700, fontWeight: FontWeight.w700,
color: Theme.of(context).primaryTextTheme.title.color, color: Theme.of(context).primaryTextTheme.headline6?.color,
); );
} }

View file

@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart'; import 'package:cake_wallet/generated/i18n.dart';
class PlanCard extends StatelessWidget { class PlanCard extends StatelessWidget {
const PlanCard({Key key, @required this.plan, @required this.onTap, this.isSelected = false}) : super(key: key); const PlanCard({Key? key, required this.plan, required this.onTap, this.isSelected = false}) : super(key: key);
final ServicePlan plan; final ServicePlan plan;
final bool isSelected; final bool isSelected;
@ -36,7 +36,7 @@ class PlanCard extends StatelessWidget {
"\$${plan.price}/${S.of(context).month}", "\$${plan.price}/${S.of(context).month}",
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: isSelected ? Colors.white : Theme.of(context).primaryTextTheme.title.color, color: isSelected ? Colors.white : Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
Text( Text(

View file

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class ReceiptRow extends StatelessWidget { class ReceiptRow extends StatelessWidget {
const ReceiptRow({Key key, @required this.title, @required this.value}) : super(key: key); const ReceiptRow({Key? key, required this.title, required this.value}) : super(key: key);
final String title; final String title;
final Widget value; final Widget value;

View file

@ -6,7 +6,7 @@ import 'package:cake_wallet/src/screens/cake_phone/widgets/add_options_tile.dart
import 'package:cake_wallet/src/screens/cake_phone/widgets/info_text_column.dart'; import 'package:cake_wallet/src/screens/cake_phone/widgets/info_text_column.dart';
class SubscribedPhoneNumbers extends StatefulWidget { class SubscribedPhoneNumbers extends StatefulWidget {
const SubscribedPhoneNumbers({Key key}) : super(key: key); const SubscribedPhoneNumbers({Key? key}) : super(key: key);
@override @override
_SubscribedPhoneNumbersState createState() => _SubscribedPhoneNumbersState(); _SubscribedPhoneNumbersState createState() => _SubscribedPhoneNumbersState();
@ -104,7 +104,7 @@ class _SubscribedPhoneNumbersState extends State<SubscribedPhoneNumbers> {
style: TextStyle( style: TextStyle(
fontSize: 16, fontSize: 16,
fontWeight: selected ? FontWeight.w700 : FontWeight.w500, fontWeight: selected ? FontWeight.w700 : FontWeight.w500,
color: selected ? Colors.white : Theme.of(context).primaryTextTheme.title.color, color: selected ? Colors.white : Theme.of(context).primaryTextTheme.headline6?.color,
), ),
), ),
), ),

View file

@ -1,17 +1,15 @@
import 'dart:ui';
import 'package:cake_wallet/src/widgets/base_alert_dialog.dart'; import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
class AlertWithTwoActions extends BaseAlertDialog { class AlertWithTwoActions extends BaseAlertDialog {
AlertWithTwoActions({ AlertWithTwoActions({
required this.alertTitle, required this.alertTitle,
required this.alertContent,
required this.leftButtonText, required this.leftButtonText,
required this.rightButtonText, required this.rightButtonText,
required this.actionLeftButton, required this.actionLeftButton,
required this.actionRightButton, required this.actionRightButton,
this.alertBarrierDismissible = true, this.alertBarrierDismissible = true,
this.isDividerExist = false, this.isDividerExists = false,
this.alertContent, this.alertContent,
this.contentWidget, this.contentWidget,
this.leftActionButtonColor, this.leftActionButtonColor,
@ -21,18 +19,18 @@ class AlertWithTwoActions extends BaseAlertDialog {
final String alertTitle; final String alertTitle;
final String alertContent; final String? alertContent;
final String leftButtonText; final String leftButtonText;
final String rightButtonText; final String rightButtonText;
final VoidCallback actionLeftButton; final VoidCallback actionLeftButton;
final VoidCallback actionRightButton; final VoidCallback actionRightButton;
final bool alertBarrierDismissible; final bool alertBarrierDismissible;
final Color alertTitleColor; final Color? alertTitleColor;
@override @override
String get titleText => alertTitle; String get titleText => alertTitle;
@override @override
String get contentText => alertContent; String get contentText => alertContent ?? '';
@override @override
String get leftActionButtonText => leftButtonText; String get leftActionButtonText => leftButtonText;
@override @override
@ -44,13 +42,13 @@ class AlertWithTwoActions extends BaseAlertDialog {
@override @override
bool get barrierDismissible => alertBarrierDismissible; bool get barrierDismissible => alertBarrierDismissible;
@override @override
final Widget contentWidget; final Widget? contentWidget;
@override @override
final bool isDividerExists; final bool isDividerExists;
@override @override
final Color leftActionButtonColor; final Color? leftActionButtonColor;
@override @override
final Color rightActionButtonColor; final Color? rightActionButtonColor;
@override @override
Color get titleColor => alertTitleColor; Color? get titleColor => alertTitleColor;
} }

View file

@ -11,11 +11,11 @@ class BaseAlertDialog extends StatelessWidget {
VoidCallback get actionLeft => () {}; VoidCallback get actionLeft => () {};
VoidCallback get actionRight => () {}; VoidCallback get actionRight => () {};
bool get barrierDismissible => true; bool get barrierDismissible => true;
Widget get contentWidget => null; Widget? get contentWidget => null;
EdgeInsets get contentPadding => null; EdgeInsets? get contentPadding => null;
Color get leftActionButtonColor => null; Color? get leftActionButtonColor => null;
Color get rightActionButtonColor => null; Color? get rightActionButtonColor => null;
Color get titleColor => null; Color? get titleColor => null;
Widget title(BuildContext context) { Widget title(BuildContext context) {
return Text( return Text(
@ -25,7 +25,7 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 20, fontSize: 20,
fontFamily: 'Lato', fontFamily: 'Lato',
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: titleColor ?? Theme.of(context).primaryTextTheme!.headline6!.color!, color: titleColor ?? Theme.of(context).primaryTextTheme.headline6!.color!,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
); );
@ -39,7 +39,7 @@ class BaseAlertDialog extends StatelessWidget {
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
fontFamily: 'Lato', fontFamily: 'Lato',
color: Theme.of(context).primaryTextTheme!.headline6!.color!, color: Theme.of(context).primaryTextTheme.headline6!.color!,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
); );
@ -55,7 +55,7 @@ class BaseAlertDialog extends StatelessWidget {
Flexible( Flexible(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
color: leftActionButtonColor ?? Theme.of(context).accentTextTheme!.bodyText1!.decorationColor!, color: leftActionButtonColor ?? Theme.of(context).accentTextTheme.bodyText1!.decorationColor!,
child: TextButton( child: TextButton(
onPressed: actionLeft, onPressed: actionLeft,
child: Text( child: Text(
@ -67,7 +67,7 @@ class BaseAlertDialog extends StatelessWidget {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: leftActionButtonColor != null color: leftActionButtonColor != null
? Colors.white ? Colors.white
: Theme.of(context).primaryTextTheme!.bodyText1!.backgroundColor!, : Theme.of(context).primaryTextTheme.bodyText1!.backgroundColor!,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
)), )),
@ -81,7 +81,7 @@ class BaseAlertDialog extends StatelessWidget {
Flexible( Flexible(
child: Container( child: Container(
width: double.infinity, width: double.infinity,
color: rightActionButtonColor ?? Theme.of(context).accentTextTheme!.bodyText2!.backgroundColor!, color: rightActionButtonColor ?? Theme.of(context).accentTextTheme.bodyText2!.backgroundColor!,
child: TextButton( child: TextButton(
onPressed: actionRight, onPressed: actionRight,
child: Text( child: Text(
@ -93,7 +93,7 @@ class BaseAlertDialog extends StatelessWidget {
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: rightActionButtonColor != null color: rightActionButtonColor != null
? Colors.white ? Colors.white
: Theme.of(context).primaryTextTheme!.bodyText2!.backgroundColor!, : Theme.of(context).primaryTextTheme.bodyText2!.backgroundColor!,
decoration: TextDecoration.none, decoration: TextDecoration.none,
), ),
)), )),
@ -120,7 +120,7 @@ class BaseAlertDialog extends StatelessWidget {
borderRadius: BorderRadius.all(Radius.circular(30)), borderRadius: BorderRadius.all(Radius.circular(30)),
child: Container( child: Container(
width: 300, width: 300,
color: Theme.of(context).accentTextTheme!.headline6!.decorationColor!, color: Theme.of(context).accentTextTheme.headline6!.decorationColor!,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[

View file

@ -3,17 +3,17 @@ import 'package:cake_wallet/src/widgets/base_alert_dialog.dart';
class InfoAlertDialog extends BaseAlertDialog { class InfoAlertDialog extends BaseAlertDialog {
InfoAlertDialog({ InfoAlertDialog({
@required this.alertTitle, required this.alertTitle,
@required this.alertContent, required this.alertContent,
this.alertTitleColor, this.alertTitleColor,
this.alertContentPadding, this.alertContentPadding,
this.alertBarrierDismissible = true this.alertBarrierDismissible = true
}); });
final String alertTitle; final String alertTitle;
final Color alertTitleColor; final Color? alertTitleColor;
final Widget alertContent; final Widget alertContent;
final EdgeInsets alertContentPadding; final EdgeInsets? alertContentPadding;
final bool alertBarrierDismissible; final bool alertBarrierDismissible;
@override @override
@ -29,10 +29,10 @@ class InfoAlertDialog extends BaseAlertDialog {
bool get isDividerExists => true; bool get isDividerExists => true;
@override @override
Color get titleColor => alertTitleColor; Color? get titleColor => alertTitleColor;
@override @override
EdgeInsets get contentPadding => alertContentPadding; EdgeInsets? get contentPadding => alertContentPadding;
@override @override
Widget actionButtons(BuildContext context) { Widget actionButtons(BuildContext context) {

View file

@ -5,8 +5,8 @@ import 'package:flutter/material.dart';
class PrimaryButton extends StatelessWidget { class PrimaryButton extends StatelessWidget {
const PrimaryButton( const PrimaryButton(
{required this.text, {required this.text,
required this.color, this.textColor,
required this.textColor, this.color,
this.onPressed, this.onPressed,
this.isDisabled = false, this.isDisabled = false,
this.isDottedBorder = false, this.isDottedBorder = false,
@ -15,8 +15,8 @@ class PrimaryButton extends StatelessWidget {
final VoidCallback? onPressed; final VoidCallback? onPressed;
final VoidCallback? onDisabledPressed; final VoidCallback? onDisabledPressed;
final Color color; final Color? color;
final Color textColor; final Color? textColor;
final Color borderColor; final Color borderColor;
final String text; final String text;
final bool isDisabled; final bool isDisabled;
@ -30,7 +30,7 @@ class PrimaryButton extends StatelessWidget {
child: TextButton( child: TextButton(
onPressed: isDisabled onPressed: isDisabled
? (onDisabledPressed != null ? onDisabledPressed : null) : onPressed, ? (onDisabledPressed != null ? onDisabledPressed : null) : onPressed,
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color), style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color?.withOpacity(0.5) : color),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(26.0), borderRadius: BorderRadius.circular(26.0),
@ -43,7 +43,7 @@ class PrimaryButton extends StatelessWidget {
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: isDisabled color: isDisabled
? textColor.withOpacity(0.5) ? textColor?.withOpacity(0.5)
: textColor)), : textColor)),
)); ));
@ -63,14 +63,14 @@ class LoadingPrimaryButton extends StatelessWidget {
const LoadingPrimaryButton( const LoadingPrimaryButton(
{required this.onPressed, {required this.onPressed,
required this.text, required this.text,
required this.color, this.color,
required this.textColor, this.textColor,
this.isDisabled = false, this.isDisabled = false,
this.isLoading = false}); this.isLoading = false});
final VoidCallback onPressed; final VoidCallback onPressed;
final Color color; final Color? color;
final Color textColor; final Color? textColor;
final bool isLoading; final bool isLoading;
final bool isDisabled; final bool isDisabled;
final String text; final String text;
@ -82,7 +82,7 @@ class LoadingPrimaryButton extends StatelessWidget {
height: 52.0, height: 52.0,
child: TextButton( child: TextButton(
onPressed: (isLoading || isDisabled) ? null : onPressed, onPressed: (isLoading || isDisabled) ? null : onPressed,
style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color.withOpacity(0.5) : color), style: ButtonStyle(backgroundColor: MaterialStateProperty.all(isDisabled ? color?.withOpacity(0.5) : color),
shape: MaterialStateProperty.all<RoundedRectangleBorder>( shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder( RoundedRectangleBorder(
borderRadius: BorderRadius.circular(26.0), borderRadius: BorderRadius.circular(26.0),
@ -96,7 +96,7 @@ class LoadingPrimaryButton extends StatelessWidget {
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.w600, fontWeight: FontWeight.w600,
color: isDisabled color: isDisabled
? textColor.withOpacity(0.5) ? textColor?.withOpacity(0.5)
: textColor : textColor
)), )),
)); ));

View file

@ -2,7 +2,6 @@ import 'package:cake_wallet/view_model/buy/buy_amount_view_model.dart';
import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/crypto_currency.dart';
import 'package:cake_wallet/entities/fiat_currency.dart'; import 'package:cake_wallet/entities/fiat_currency.dart';
import 'package:cw_core/wallet_type.dart'; import 'package:cw_core/wallet_type.dart';
import 'package:flutter/foundation.dart';
import 'package:mobx/mobx.dart'; import 'package:mobx/mobx.dart';
import 'package:cw_core/wallet_base.dart'; import 'package:cw_core/wallet_base.dart';
@ -11,10 +10,9 @@ part 'add_balance_view_model.g.dart';
class AddBalanceViewModel = AddBalanceViewModelBase with _$AddBalanceViewModel; class AddBalanceViewModel = AddBalanceViewModelBase with _$AddBalanceViewModel;
abstract class AddBalanceViewModelBase with Store { abstract class AddBalanceViewModelBase with Store {
AddBalanceViewModelBase(this.buyAmountViewModel, {@required this.wallet}) { AddBalanceViewModelBase(this.buyAmountViewModel, {required this.wallet})
isRunning = false; : this.isDisabled = true,
isDisabled = true; this.isRunning = false;
}
final BuyAmountViewModel buyAmountViewModel; final BuyAmountViewModel buyAmountViewModel;
final WalletBase wallet; final WalletBase wallet;

View file

@ -8,8 +8,7 @@ part 'phone_plan_view_model.g.dart';
class PhonePlanViewModel = PhonePlanViewModelBase with _$PhonePlanViewModel; class PhonePlanViewModel = PhonePlanViewModelBase with _$PhonePlanViewModel;
abstract class PhonePlanViewModelBase with Store { abstract class PhonePlanViewModelBase with Store {
PhonePlanViewModelBase({this.selectedPlan}) { PhonePlanViewModelBase({this.selectedPlan}) : this.additionalSms = 0 {
additionalSms = 0;
rateInCents = 20; // TODO: get from api rateInCents = 20; // TODO: get from api
servicePlans = [ servicePlans = [
@ -21,25 +20,25 @@ abstract class PhonePlanViewModelBase with Store {
]; ];
// TODO: servicePlans = _getServicesFromApi // TODO: servicePlans = _getServicesFromApi
selectedPlan ??= servicePlans.first; selectedPlan ??= servicePlans!.first;
selectedCountry = countryList.firstWhere((element) => element.iso3Code == "USA"); selectedCountry = countryList.firstWhere((element) => element.iso3Code == "USA");
} }
@observable @observable
ServicePlan selectedPlan; ServicePlan? selectedPlan;
@observable @observable
Country selectedCountry; Country? selectedCountry;
@observable @observable
List<ServicePlan> servicePlans; List<ServicePlan>? servicePlans;
@observable @observable
int additionalSms; int additionalSms;
@observable @observable
int rateInCents; int? rateInCents;
@computed @computed
double get totalPrice => (selectedPlan?.price ?? 0) double get totalPrice => (selectedPlan?.price ?? 0)