diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 2a1ce27473..d90ef8ca39 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -98,9 +98,6 @@ PODS: - Flutter (1.0.0) - flutter_secure_storage (3.3.1): - Flutter - - FMDB (2.7.5): - - FMDB/standard (= 2.7.5) - - FMDB/standard (2.7.5) - local_auth (0.0.1): - Flutter - MTBBarcodeScanner (5.0.11) @@ -118,9 +115,6 @@ PODS: - Flutter - shared_preferences (0.0.1): - Flutter - - sqflite (0.0.2): - - Flutter - - FMDB (>= 2.7.5) - SwiftProtobuf (1.12.0) - SwiftyGif (5.3.0) - uni_links (0.0.1): @@ -151,7 +145,6 @@ DEPENDENCIES: - permission_handler (from `.symlinks/plugins/permission_handler/ios`) - share (from `.symlinks/plugins/share/ios`) - shared_preferences (from `.symlinks/plugins/shared_preferences/ios`) - - sqflite (from `.symlinks/plugins/sqflite/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - UnstoppableDomainsResolution (~> 4.0.0) - url_launcher (from `.symlinks/plugins/url_launcher/ios`) @@ -163,7 +156,6 @@ SPEC REPOS: - CryptoSwift - DKImagePickerController - DKPhotoGallery - - FMDB - MTBBarcodeScanner - Reachability - SDWebImage @@ -204,8 +196,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/share/ios" shared_preferences: :path: ".symlinks/plugins/shared_preferences/ios" - sqflite: - :path: ".symlinks/plugins/sqflite/ios" uni_links: :path: ".symlinks/plugins/uni_links/ios" url_launcher: @@ -228,7 +218,6 @@ SPEC CHECKSUMS: file_picker: 3e6c3790de664ccf9b882732d9db5eaf6b8d4eb1 Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c flutter_secure_storage: 7953c38a04c3fdbb00571bcd87d8e3b5ceb9daec - FMDB: 2ce00b547f966261cd18927a3ddb07cb6f3db82a local_auth: 25938960984c3a7f6e3253e3f8d962fdd16852bd MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 @@ -238,7 +227,6 @@ SPEC CHECKSUMS: SDWebImage: a990c053fff71e388a10f3357edb0be17929c9c5 share: 0b2c3e82132f5888bccca3351c504d0003b3b410 shared_preferences: af6bfa751691cdc24be3045c43ec037377ada40d - sqflite: 6d358c025f5b867b29ed92fc697fd34924e11904 SwiftProtobuf: 4ef85479c18ca85b5482b343df9c319c62bda699 SwiftyGif: e466e86c660d343357ab944a819a101c4127cb40 uni_links: d97da20c7701486ba192624d99bffaaffcfc298a @@ -248,4 +236,4 @@ SPEC CHECKSUMS: PODFILE CHECKSUM: ae71bdf0eb731a1ffc399c122f6aa4dea0cb5f6f -COCOAPODS: 1.11.3 +COCOAPODS: 1.11.2 diff --git a/lib/src/screens/ionia/auth/ionia_create_account_page.dart b/lib/src/screens/ionia/auth/ionia_create_account_page.dart index e1b257e139..3fd9124040 100644 --- a/lib/src/screens/ionia/auth/ionia_create_account_page.dart +++ b/lib/src/screens/ionia/auth/ionia_create_account_page.dart @@ -14,8 +14,6 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:mobx/mobx.dart'; class IoniaCreateAccountPage extends BasePage { - final IoniaViewModel _ioniaViewModel; - IoniaCreateAccountPage(this._ioniaViewModel) : _emailFocus = FocusNode(), _emailController = TextEditingController(), @@ -24,6 +22,8 @@ class IoniaCreateAccountPage extends BasePage { _emailController.addListener(() => _ioniaViewModel.email = _emailController.text); } + final IoniaViewModel _ioniaViewModel; + final GlobalKey _formKey; final FocusNode _emailFocus; @@ -36,6 +36,7 @@ class IoniaCreateAccountPage extends BasePage { style: TextStyle( fontSize: 22, fontFamily: 'Lato', + color: Theme.of(context).accentTextTheme.display4.backgroundColor, fontWeight: FontWeight.w900, ), ); @@ -111,7 +112,7 @@ class IoniaCreateAccountPage extends BasePage { fontWeight: FontWeight.w700, ), ), - TextSpan(text: ' by CakePay'), + TextSpan(text: ' ${S.of(context).by_cake_pay}'), ], ), ), diff --git a/lib/src/screens/ionia/auth/ionia_login_page.dart b/lib/src/screens/ionia/auth/ionia_login_page.dart index 404b43264a..584682341a 100644 --- a/lib/src/screens/ionia/auth/ionia_login_page.dart +++ b/lib/src/screens/ionia/auth/ionia_login_page.dart @@ -1,6 +1,5 @@ import 'package:cake_wallet/core/email_validator.dart'; import 'package:cake_wallet/ionia/ionia_create_state.dart'; -import 'package:cake_wallet/palette.dart'; import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; import 'package:cake_wallet/src/widgets/alert_with_one_action.dart'; @@ -15,20 +14,20 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:mobx/mobx.dart'; class IoniaLoginPage extends BasePage { - final IoniaViewModel _ioniaViewModel; IoniaLoginPage(this._ioniaViewModel) : _formKey = GlobalKey(), - _emailFocus = FocusNode(), _emailController = TextEditingController() { _emailController.text = _ioniaViewModel.email; _emailController.addListener(() => _ioniaViewModel.email = _emailController.text); } final GlobalKey _formKey; + + final IoniaViewModel _ioniaViewModel; + @override Color get titleColor => Colors.black; - final FocusNode _emailFocus; final TextEditingController _emailController; @override diff --git a/lib/src/screens/ionia/auth/ionia_verify_otp_page.dart b/lib/src/screens/ionia/auth/ionia_verify_otp_page.dart index 2907b44723..2af82350a6 100644 --- a/lib/src/screens/ionia/auth/ionia_verify_otp_page.dart +++ b/lib/src/screens/ionia/auth/ionia_verify_otp_page.dart @@ -15,9 +15,7 @@ import 'package:flutter_mobx/flutter_mobx.dart'; import 'package:mobx/mobx.dart'; class IoniaVerifyIoniaOtp extends BasePage { - final IoniaViewModel _ioniaViewModel; - final String _email; - + IoniaVerifyIoniaOtp(this._ioniaViewModel, this._email) : _codeController = TextEditingController(), _codeFocus = FocusNode() { @@ -32,6 +30,10 @@ class IoniaVerifyIoniaOtp extends BasePage { }); } + final IoniaViewModel _ioniaViewModel; + + final String _email; + @override Widget middle(BuildContext context) { return Text( @@ -39,6 +41,7 @@ class IoniaVerifyIoniaOtp extends BasePage { style: TextStyle( fontSize: 22, fontFamily: 'Lato', + color: Theme.of(context).accentTextTheme.display4.backgroundColor, fontWeight: FontWeight.w900, ), ); diff --git a/lib/src/screens/ionia/auth/ionia_welcome_page.dart b/lib/src/screens/ionia/auth/ionia_welcome_page.dart index 4b26b17676..0c4abecabb 100644 --- a/lib/src/screens/ionia/auth/ionia_welcome_page.dart +++ b/lib/src/screens/ionia/auth/ionia_welcome_page.dart @@ -9,13 +9,8 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:mobx/mobx.dart'; class IoniaWelcomePage extends BasePage { - final IoniaViewModel _ioniaViewModel; - IoniaWelcomePage(this._ioniaViewModel); - @override - Color get titleColor => Colors.black; - @override Widget middle(BuildContext context) { return Text( @@ -23,11 +18,14 @@ class IoniaWelcomePage extends BasePage { style: TextStyle( fontSize: 22, fontFamily: 'Lato', + color: Theme.of(context).accentTextTheme.display4.backgroundColor, fontWeight: FontWeight.w900, ), ); } + final IoniaViewModel _ioniaViewModel; + @override Widget body(BuildContext context) { reaction((_) => _ioniaViewModel.isLoggedIn, (bool state) { diff --git a/lib/src/screens/ionia/cards/ionia_activate_debit_card_page.dart b/lib/src/screens/ionia/cards/ionia_activate_debit_card_page.dart index b55152dbc9..91fd8615cc 100644 --- a/lib/src/screens/ionia/cards/ionia_activate_debit_card_page.dart +++ b/lib/src/screens/ionia/cards/ionia_activate_debit_card_page.dart @@ -12,16 +12,18 @@ import 'package:cake_wallet/generated/i18n.dart'; import 'package:mobx/mobx.dart'; class IoniaActivateDebitCardPage extends BasePage { - final IoniaViewModel _ioniaViewModel; IoniaActivateDebitCardPage(this._ioniaViewModel); + final IoniaViewModel _ioniaViewModel; + @override Widget middle(BuildContext context) { return Text( S.current.debit_card, style: TextStyle( fontSize: 22, + color: Theme.of(context).accentTextTheme.display4.backgroundColor, fontFamily: 'Lato', fontWeight: FontWeight.w900, ), diff --git a/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart b/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart index bf794fe428..9f0fa17927 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_card_detail_page.dart @@ -1,6 +1,6 @@ import 'package:cake_wallet/di.dart'; import 'package:cake_wallet/palette.dart'; -import 'package:cake_wallet/routes.dart'; +import 'package:cake_wallet/src/screens/ionia/widgets/confirm_modal.dart'; import 'package:cake_wallet/src/screens/ionia/widgets/text_icon_button.dart'; import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart'; import 'package:cake_wallet/src/widgets/discount_badge.dart'; @@ -11,7 +11,6 @@ import 'package:cake_wallet/themes/theme_base.dart'; import 'package:cake_wallet/typography.dart'; import 'package:cake_wallet/utils/show_pop_up.dart'; import 'package:flutter/material.dart'; -import 'package:flutter/src/widgets/framework.dart'; import 'package:cake_wallet/generated/i18n.dart'; class IoniaBuyGiftCardDetailPage extends StatelessWidget { @@ -95,7 +94,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { child: Column( children: [ Text( - 'Gift Card Amount', + S.of(context).gift_card_amount, style: textSmall(), ), SizedBox(height: 4), @@ -113,7 +112,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Bill Amount', + S.of(context).bill_amount, style: textSmall(), ), SizedBox(height: 4), @@ -127,7 +126,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.end, children: [ Text( - 'Tip', + S.of(context).tip, style: textSmall(), ), SizedBox(height: 4), @@ -144,7 +143,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { Divider(), SizedBox(height: 16), Text( - 'You Pay', + S.of(context).you_pay, style: textSmall(), ), SizedBox(height: 4), @@ -161,7 +160,7 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Tip:', + S.of(context).tip, style: TextStyle( color: Theme.of(context).primaryTextTheme.title.color, fontWeight: FontWeight.w700, @@ -205,25 +204,27 @@ class IoniaBuyGiftCardDetailPage extends StatelessWidget { ), ); } -} -void purchaseCard(BuildContext context) { - showPopUp( - context: context, - builder: (dialogContext) { - return AlertWithTwoActions( - alertTitle: S.of(context).save_backup_password_alert, - alertContent: S.of(context).change_backup_password_alert, - rightButtonText: S.of(context).ok, - leftButtonText: S.of(context).cancel, - leftActionColor: Color(0xffFF6600), - isDividerExist: true, - rightActionColor: Theme.of(context).accentTextTheme.body2.color, - actionRightButton: () async { - Navigator.of(dialogContext)..pop()..pop(); - }, - actionLeftButton: () => Navigator.of(dialogContext).pop()); - }); + void purchaseCard(BuildContext context) { + showPopUp( + context: context, + builder: (_) { + return IoniaConfirmModal( + alertTitle: S.of(context).confirm_sending, + alertContent: SizedBox( + //Todo:: substitute this widget with modal content + height: 200, + ), + rightButtonText: S.of(context).ok, + leftButtonText: S.of(context).cancel, + leftActionColor: Color(0xffFF6600), + rightActionColor: Theme.of(context).accentTextTheme.body2.color, + actionRightButton: () async { + Navigator.of(context).pop(); + }, + actionLeftButton: () => Navigator.of(context).pop()); + }); + } } class TipButtonGroup extends StatefulWidget { @@ -264,7 +265,7 @@ class _TipButtonGroupState extends State { SizedBox(width: 4), TipButton( isSelected: _isSelected('299'), - caption: 'Custom', + caption: S.of(context).custom, ), ], ); diff --git a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart index b282475a14..1677a9e77f 100644 --- a/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart +++ b/lib/src/screens/ionia/cards/ionia_buy_gift_card.dart @@ -1,8 +1,8 @@ import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/src/screens/ionia/widgets/card_item.dart'; import 'package:cake_wallet/src/widgets/base_text_form_field.dart'; import 'package:cake_wallet/src/widgets/keyboard_done_button.dart'; -import 'package:cake_wallet/src/widgets/market_place_item.dart'; import 'package:cake_wallet/src/widgets/primary_button.dart'; import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; import 'package:cake_wallet/themes/theme_base.dart'; @@ -126,12 +126,10 @@ class IoniaBuyGiftCardPage extends BasePage { ), Padding( padding: const EdgeInsets.all(24.0), - child: MarketPlaceItem( + child: CardItem( onTap: () {}, title: 'Applebee’s', hasDiscount: true, - isWhiteBackground: true, - padding: EdgeInsets.all(12), subTitle: 'subTitle', logoUrl: '', ), diff --git a/lib/src/screens/ionia/cards/ionia_debit_card_page.dart b/lib/src/screens/ionia/cards/ionia_debit_card_page.dart index 89fc867a2e..0d2a6294fd 100644 --- a/lib/src/screens/ionia/cards/ionia_debit_card_page.dart +++ b/lib/src/screens/ionia/cards/ionia_debit_card_page.dart @@ -25,6 +25,7 @@ class IoniaDebitCardPage extends BasePage { style: TextStyle( fontSize: 22, fontFamily: 'Lato', + color: Theme.of(context).accentTextTheme.display4.backgroundColor, fontWeight: FontWeight.w900, ), ); @@ -43,12 +44,8 @@ class IoniaDebitCardPage extends BasePage { contentPadding: EdgeInsets.zero, content: Padding( padding: const EdgeInsets.all(16.0), - child: Column( - children: [ - _IoniaDebitCard( - cardInfo: cardState.card, - ) - ], + child: _IoniaDebitCard( + cardInfo: cardState.card, ), ), bottomSection: Column( @@ -252,10 +249,12 @@ class _IoniaDebitCardState extends State<_IoniaDebitCard> { return pan.replaceAllMapped(RegExp(r'.{4}'), (match) => '${match.group(0)} '); } + String get _getLast4 => widget.isCardSample ? '0000' : widget.cardInfo.pan.substring(widget.cardInfo.pan.length - 5); + + String get _getSpendLimit => widget.isCardSample ? '10000' : widget.cardInfo.spendLimit.toStringAsFixed(2); + @override Widget build(BuildContext context) { - final last4 = widget.isCardSample ? '0000' : widget.cardInfo.pan.substring(widget.cardInfo.pan.length - 5); - final spendLimit = widget.isCardSample ? '10000' : widget.cardInfo.spendLimit.toStringAsFixed(2); return Container( padding: EdgeInsets.symmetric(horizontal: 24, vertical: 19), decoration: BoxDecoration( @@ -288,12 +287,12 @@ class _IoniaDebitCardState extends State<_IoniaDebitCard> { ], ), Text( - widget.isCardSample ? S.of(context).upto(spendLimit) : '\$$spendLimit', + widget.isCardSample ? S.of(context).upto(_getSpendLimit) : '\$$_getSpendLimit', style: textXLargeSemiBold(), ), SizedBox(height: 16), Text( - _showDetails ? _formatPan(widget.cardInfo.pan) : '**** **** **** $last4', + _showDetails ? _formatPan(widget.cardInfo.pan) : '**** **** **** $_getLast4', style: textMediumSemiBold(), ), SizedBox(height: 32), @@ -323,12 +322,12 @@ class _IoniaDebitCardState extends State<_IoniaDebitCard> { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - 'Expires', + S.of(context).expires, style: textXSmallSemiBold(), ), SizedBox(height: 4), Text( - '${widget.cardInfo.expirationMonth ?? 'MM'}/${widget.cardInfo.expirationYear ?? 'YY'}', + '${widget.cardInfo.expirationMonth ?? S.of(context).mm}/${widget.cardInfo.expirationYear ?? S.of(context).yy}', style: textMediumSemiBold(), ) ], diff --git a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart index 8fbc7d9a9d..49276307d3 100644 --- a/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart +++ b/lib/src/screens/ionia/cards/ionia_manage_cards_page.dart @@ -1,5 +1,6 @@ import 'package:cake_wallet/routes.dart'; import 'package:cake_wallet/src/screens/base_page.dart'; +import 'package:cake_wallet/src/screens/ionia/widgets/card_item.dart'; import 'package:cake_wallet/src/screens/ionia/widgets/card_menu.dart'; import 'package:cake_wallet/src/widgets/market_place_item.dart'; import 'package:cake_wallet/themes/theme_base.dart'; @@ -9,10 +10,10 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/generated/i18n.dart'; class IoniaManageCardsPage extends BasePage { - final IoniaViewModel _ioniaViewModel; - IoniaManageCardsPage(this._ioniaViewModel); + final IoniaViewModel _ioniaViewModel; + @override Color get backgroundLightColor => currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white; @@ -152,8 +153,7 @@ class IoniaManageCardsPage extends BasePage { itemCount: 20, separatorBuilder: (_, __) => SizedBox(height: 4), itemBuilder: (_, index) { - return MarketPlaceItem( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 12), + return CardItem( logoUrl: '', onTap: () => Navigator.of(context).pushNamed(Routes.ioniaBuyGiftCardPage), title: 'Amazon', diff --git a/lib/src/screens/ionia/widgets/card_item.dart b/lib/src/screens/ionia/widgets/card_item.dart new file mode 100644 index 0000000000..95bf9ee1ec --- /dev/null +++ b/lib/src/screens/ionia/widgets/card_item.dart @@ -0,0 +1,122 @@ +import 'package:cake_wallet/palette.dart'; +import 'package:cake_wallet/src/widgets/discount_badge.dart'; +import 'package:flutter/material.dart'; + +class CardItem extends StatelessWidget { + + CardItem({ + @required this.onTap, + @required this.title, + @required this.subTitle, + this.logoUrl, + this.hasDiscount = false, + }); + + final VoidCallback onTap; + final String title; + final String subTitle; + final String logoUrl; + final bool hasDiscount; + + @override + Widget build(BuildContext context) { + return InkWell( + onTap: onTap, + child: Stack( + children: [ + Container( + padding: EdgeInsets.all(12), + width: double.infinity, + decoration: BoxDecoration( + color: Colors.black.withOpacity(0.1), + borderRadius: BorderRadius.circular(20), + border: Border.all( + color: Colors.white.withOpacity(0.20), + ), + ), + child: Row( + children: [ + if (logoUrl != null) ...[ + ClipOval( + child: Image.network( + logoUrl, + width: 42.0, + height: 42.0, + loadingBuilder: (BuildContext _, Widget child, ImageChunkEvent loadingProgress) { + if (loadingProgress == null) { + return child; + } else { + return _PlaceholderContainer(text: 'Logo'); + } + }, + errorBuilder: (_, __, ___) => _PlaceholderContainer(text: '!'), + ), + ), + SizedBox(width: 5), + ], + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: TextStyle( + color: Palette.stateGray, + fontSize: 24, + fontWeight: FontWeight.w900, + ), + ), + SizedBox(height: 5), + Text( + subTitle, + style: TextStyle( + color: Palette.niagara , + fontWeight: FontWeight.w500, + fontFamily: 'Lato'), + ) + ], + ), + ], + ), + ), + if (hasDiscount) + Align( + alignment: Alignment.topRight, + child: Padding( + padding: const EdgeInsets.only(top: 20.0), + child: DiscountBadge(), + ), + ), + ], + ), + ); + } +} + +class _PlaceholderContainer extends StatelessWidget { + + const _PlaceholderContainer({@required this.text}); + + final String text; + + @override + Widget build(BuildContext context) { + return Container( + height: 42, + width: 42, + child: Center( + child: Text( + text, + style: TextStyle( + color: Colors.black, + fontSize: 12, + fontWeight: FontWeight.w900, + ), + ), + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(100), + ), + ); + } +} diff --git a/lib/src/screens/ionia/widgets/confirm_modal.dart b/lib/src/screens/ionia/widgets/confirm_modal.dart index 33ac0143fd..dd513ffa73 100644 --- a/lib/src/screens/ionia/widgets/confirm_modal.dart +++ b/lib/src/screens/ionia/widgets/confirm_modal.dart @@ -3,8 +3,8 @@ import 'dart:ui'; import 'package:cake_wallet/palette.dart'; import 'package:flutter/material.dart'; -class ConfirmModal extends StatelessWidget { - ConfirmModal({ +class IoniaConfirmModal extends StatelessWidget { + IoniaConfirmModal({ @required this.alertTitle, @required this.alertContent, @required this.leftButtonText, @@ -28,7 +28,7 @@ class ConfirmModal extends StatelessWidget { return Row( mainAxisSize: MainAxisSize.max, children: [ - ActionButton( + IoniaActionButton( buttonText: leftButtonText, action: actionLeftButton, backgoundColor: leftActionColor, @@ -38,7 +38,7 @@ class ConfirmModal extends StatelessWidget { height: 52, color: Theme.of(context).dividerColor, ), - ActionButton( + IoniaActionButton( buttonText: rightButtonText, action: actionRightButton, backgoundColor: rightActionColor, @@ -47,6 +47,20 @@ class ConfirmModal extends StatelessWidget { ); } + Widget title(BuildContext context) { + return Text( + alertTitle, + textAlign: TextAlign.center, + style: TextStyle( + fontSize: 20, + fontFamily: 'Lato', + fontWeight: FontWeight.w600, + color: Theme.of(context).primaryTextTheme.title.color, + decoration: TextDecoration.none, + ), + ); + } + @override Widget build(BuildContext context) { return Container( @@ -61,7 +75,27 @@ class ConfirmModal extends StatelessWidget { child: ClipRRect( borderRadius: BorderRadius.all(Radius.circular(30)), child: Container( - width: 300, color: Theme.of(context).accentTextTheme.title.decorationColor, child: alertContent), + width: 327, + color: Theme.of(context).accentTextTheme.title.decorationColor, + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Padding( + padding: EdgeInsets.fromLTRB(24, 20, 24, 0), + child: title(context), + ), + Padding( + padding: EdgeInsets.only(top: 16, bottom: 8), + child: Container( + height: 1, + color: Theme.of(context).dividerColor, + ), + ), + alertContent, + actionButtons(context), + ], + ), + ), ), ), ), @@ -71,8 +105,8 @@ class ConfirmModal extends StatelessWidget { } } -class ActionButton extends StatelessWidget { - const ActionButton({ +class IoniaActionButton extends StatelessWidget { + const IoniaActionButton({ @required this.buttonText, @required this.action, this.backgoundColor, diff --git a/lib/src/widgets/base_alert_dialog.dart b/lib/src/widgets/base_alert_dialog.dart index 5dce63ca32..d0aaace2f4 100644 --- a/lib/src/widgets/base_alert_dialog.dart +++ b/lib/src/widgets/base_alert_dialog.dart @@ -3,17 +3,13 @@ import 'package:flutter/material.dart'; import 'package:cake_wallet/palette.dart'; class BaseAlertDialog extends StatelessWidget { - String get titleText => ''; + String get titleText => ''; String get contentText => ''; String get leftActionButtonText => ''; String get rightActionButtonText => ''; bool get isDividerExists => false; VoidCallback get actionLeft => () {}; VoidCallback get actionRight => () {}; - EdgeInsets get actionButtonPadding => EdgeInsets.only(left: 6, right: 6); - Color get rightButtonColor => Colors.transparent; - Color get leftButtonColor => Colors.transparent; - bool get barrierDismissible => true; Widget title(BuildContext context) { @@ -51,8 +47,8 @@ class BaseAlertDialog extends StatelessWidget { Flexible( child: Container( height: 52, - padding: actionButtonPadding, - color: leftButtonColor ?? Theme.of(context).accentTextTheme.body2.decorationColor, + padding: EdgeInsets.only(left: 6, right: 6), + color: Theme.of(context).accentTextTheme.body2.decorationColor, child: ButtonTheme( minWidth: double.infinity, child: FlatButton( @@ -66,7 +62,7 @@ class BaseAlertDialog extends StatelessWidget { fontSize: 15, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: leftButtonColor != null ? Colors.white : Theme.of(context).primaryTextTheme.body2.backgroundColor, + color: Theme.of(context).primaryTextTheme.body2.backgroundColor, decoration: TextDecoration.none, ), )), @@ -80,8 +76,8 @@ class BaseAlertDialog extends StatelessWidget { Flexible( child: Container( height: 52, - padding: actionButtonPadding, - color: rightButtonColor ?? Theme.of(context).accentTextTheme.body1.backgroundColor, + padding: EdgeInsets.only(left: 6, right: 6), + color: Theme.of(context).accentTextTheme.body1.backgroundColor, child: ButtonTheme( minWidth: double.infinity, child: FlatButton( @@ -95,7 +91,7 @@ class BaseAlertDialog extends StatelessWidget { fontSize: 15, fontFamily: 'Lato', fontWeight: FontWeight.w600, - color: rightButtonColor != null ? Colors.white : Theme.of(context).primaryTextTheme.body1.backgroundColor, + color: Theme.of(context).primaryTextTheme.body1.backgroundColor, decoration: TextDecoration.none, ), )), @@ -108,9 +104,7 @@ class BaseAlertDialog extends StatelessWidget { @override Widget build(BuildContext context) { return GestureDetector( - onTap: () => barrierDismissible - ? Navigator.of(context).pop() - : null, + onTap: () => barrierDismissible ? Navigator.of(context).pop() : null, child: Container( color: Colors.transparent, child: BackdropFilter( @@ -136,14 +130,14 @@ class BaseAlertDialog extends StatelessWidget { child: title(context), ), isDividerExists - ? Padding( - padding: EdgeInsets.only(top: 16, bottom: 8), - child: Container( - height: 1, - color: Theme.of(context).dividerColor, - ), - ) - : Offstage(), + ? Padding( + padding: EdgeInsets.only(top: 16, bottom: 8), + child: Container( + height: 1, + color: Theme.of(context).dividerColor, + ), + ) + : Offstage(), Padding( padding: EdgeInsets.fromLTRB(24, 8, 24, 32), child: content(context), @@ -166,4 +160,4 @@ class BaseAlertDialog extends StatelessWidget { ), ); } -} \ No newline at end of file +} diff --git a/lib/src/widgets/discount_badge.dart b/lib/src/widgets/discount_badge.dart index 290f5900f4..ad9c4e2ceb 100644 --- a/lib/src/widgets/discount_badge.dart +++ b/lib/src/widgets/discount_badge.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:cake_wallet/generated/i18n.dart'; + class DiscountBadge extends StatelessWidget { const DiscountBadge({ @@ -14,7 +16,7 @@ class DiscountBadge extends StatelessWidget { Padding( padding: const EdgeInsets.only(right: 10.0), child: Text( - 'Save 20%', + S.of(context).discount('20'), style: TextStyle( color: Colors.white, fontSize: 12, diff --git a/lib/src/widgets/market_place_item.dart b/lib/src/widgets/market_place_item.dart index 414866fbbb..0112ea00db 100644 --- a/lib/src/widgets/market_place_item.dart +++ b/lib/src/widgets/market_place_item.dart @@ -1,27 +1,18 @@ -import 'package:cake_wallet/palette.dart'; -import 'package:cake_wallet/src/widgets/discount_badge.dart'; import 'package:flutter/material.dart'; -import 'package:cached_network_image/cached_network_image.dart'; class MarketPlaceItem extends StatelessWidget { - final VoidCallback onTap; - final String title; - final String subTitle; - final String logoUrl; - final EdgeInsets padding; - final bool hasDiscount; - final bool isWhiteBackground; + MarketPlaceItem({ @required this.onTap, @required this.title, @required this.subTitle, - this.logoUrl, - this.padding, - this.hasDiscount = false, - this.isWhiteBackground = false, }); + final VoidCallback onTap; + final String title; + final String subTitle; + @override Widget build(BuildContext context) { return InkWell( @@ -29,36 +20,26 @@ class MarketPlaceItem extends StatelessWidget { child: Stack( children: [ Container( - padding: padding ?? EdgeInsets.all(20), + padding: EdgeInsets.all(20), width: double.infinity, decoration: BoxDecoration( - color: isWhiteBackground ? Colors.black.withOpacity(0.1) : Colors.white.withOpacity(0.20), + color: Theme.of(context).textTheme.title.backgroundColor, borderRadius: BorderRadius.circular(20), border: Border.all( color: Colors.white.withOpacity(0.20), ), ), - child: Row( - children: [ - if (logoUrl != null) ...[ - ClipOval( - child: CachedNetworkImage( - width: 42.0, - height: 42.0, - imageUrl: logoUrl, - placeholder: (context, url) => _PlaceholderContainer(text: 'Logo'), - errorWidget: (context, url, error) => _PlaceholderContainer(text: '!'), - ), - ), - SizedBox(width: 5), - ], + child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( title, style: TextStyle( - color: isWhiteBackground ? Palette.stateGray : Colors.white, + color: Theme.of(context) + .accentTextTheme + .display3 + .backgroundColor, fontSize: 24, fontWeight: FontWeight.w900, ), @@ -67,53 +48,19 @@ class MarketPlaceItem extends StatelessWidget { Text( subTitle, style: TextStyle( - color: isWhiteBackground ? Palette.niagara : Colors.white, + color: Theme.of(context) + .accentTextTheme + .display3 + .backgroundColor, fontWeight: FontWeight.w500, fontFamily: 'Lato'), ) ], ), - ], - ), ), - if (hasDiscount) - Align( - alignment: Alignment.topRight, - child: Padding( - padding: const EdgeInsets.only(top: 20.0), - child: DiscountBadge(), - ), - ), ], ), ); } } -class _PlaceholderContainer extends StatelessWidget { - final String text; - - const _PlaceholderContainer({@required this.text}); - - @override - Widget build(BuildContext context) { - return Container( - height: 42, - width: 42, - child: Center( - child: Text( - text, - style: TextStyle( - color: Colors.black, - fontSize: 12, - fontWeight: FontWeight.w900, - ), - ), - ), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.circular(100), - ), - ); - } -} diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 44f9e0f4e4..62f1292463 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -51,7 +51,6 @@ dependencies: flushbar: ^1.10.4 archive: ^2.0.13 cryptography: ^1.4.0 - cached_network_image: ^2.0.0 file_picker: ^3.0.0-nullsafety.2 unorm_dart: ^0.2.0 permission_handler: ^5.0.1+1 diff --git a/res/values/strings_en.arb b/res/values/strings_en.arb index 4a4d4271a2..7f85e3eb49 100644 --- a/res/values/strings_en.arb +++ b/res/values/strings_en.arb @@ -584,5 +584,15 @@ "optionally_order_card": "Optionally order a physical card.", "hide_details" : "Hide Details", "show_details" : "Show Details", - "upto": "up to ${value}" + "upto": "up to ${value}", + "discount": "Save ${value}%", + "gift_card_amount": "Gift Card Amount", + "bill_amount": "Bill amount", + "you_pay": "You pay", + "tip": "Tip:", + "custom": "custom", + "by_cake_pay": "by CakePay", + "expires": "Expires", + "mm": "MM", + "yy": "YY" }