From 4e6a90fac34b7ce48914b12e63d67f8b1d5a1564 Mon Sep 17 00:00:00 2001 From: Godwin Asuquo Date: Wed, 25 May 2022 11:30:01 +0200 Subject: [PATCH] create auth ui for ionia --- lib/di.dart | 6 - lib/router.dart | 8 - lib/routes.dart | 2 - .../screens/cake_pay/cards/buy_gift_card.dart | 96 -------- .../cake_pay/cards/manage_cards_page.dart | 219 ------------------ .../dashboard/widgets/market_place_page.dart | 2 +- 6 files changed, 1 insertion(+), 332 deletions(-) delete mode 100644 lib/src/screens/cake_pay/cards/buy_gift_card.dart delete mode 100644 lib/src/screens/cake_pay/cards/manage_cards_page.dart diff --git a/lib/di.dart b/lib/di.dart index 27923cfa4..86321ce88 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -9,8 +9,6 @@ import 'package:cake_wallet/src/screens/cake_pay/auth/create_account_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/auth/forgot_password_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/auth/login_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/cake_pay.dart'; -import 'package:cake_wallet/src/screens/cake_pay/cards/buy_gift_card.dart'; -import 'package:cake_wallet/src/screens/cake_pay/cards/manage_cards_page.dart'; import 'package:cake_wallet/src/screens/dashboard/widgets/balance_page.dart'; import 'package:cw_core/unspent_coins_info.dart'; import 'package:cake_wallet/core/backup_service.dart'; @@ -653,9 +651,5 @@ Future setup( getIt.registerFactory(() => ForgotPassword()); - getIt.registerFactory(() => ManageCardsPage()); - - getIt.registerFactory(() => BuyGiftCardPage()); - _isSetupFinished = true; } diff --git a/lib/router.dart b/lib/router.dart index b2ef23d6c..d9de19ef1 100644 --- a/lib/router.dart +++ b/lib/router.dart @@ -9,8 +9,6 @@ import 'package:cake_wallet/src/screens/cake_pay/auth/create_account_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/auth/forgot_password_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/auth/login_page.dart'; import 'package:cake_wallet/src/screens/cake_pay/cake_pay.dart'; -import 'package:cake_wallet/src/screens/cake_pay/cards/buy_gift_card.dart'; -import 'package:cake_wallet/src/screens/cake_pay/cards/manage_cards_page.dart'; import 'package:cake_wallet/src/screens/order_details/order_details_page.dart'; import 'package:cake_wallet/src/screens/pin_code/pin_code_widget.dart'; import 'package:cake_wallet/src/screens/restore/restore_from_backup_page.dart'; @@ -419,12 +417,6 @@ Route createRoute(RouteSettings settings) { case Routes.cakePayForgotPasswordPage: return CupertinoPageRoute(builder: (_) => getIt.get()); - - case Routes.manageCardsPage: - return CupertinoPageRoute(builder: (_) => getIt.get()); - - case Routes.buyGiftCardPage: - return CupertinoPageRoute(builder: (_) => getIt.get()); default: return MaterialPageRoute( diff --git a/lib/routes.dart b/lib/routes.dart index 0ec0efd0d..f604b6df4 100644 --- a/lib/routes.dart +++ b/lib/routes.dart @@ -64,6 +64,4 @@ class Routes { static const cakePayCreateAccountPage = '/cake_pay_create_account_page'; static const cakePayLoginPage = '/cake_pay_login_page'; static const cakePayForgotPasswordPage = '/cake_pay_forgot_password_page'; - static const manageCardsPage = '/manage_cards_page'; - static const buyGiftCardPage = '/buy_gift_card_page'; } diff --git a/lib/src/screens/cake_pay/cards/buy_gift_card.dart b/lib/src/screens/cake_pay/cards/buy_gift_card.dart deleted file mode 100644 index a3f611067..000000000 --- a/lib/src/screens/cake_pay/cards/buy_gift_card.dart +++ /dev/null @@ -1,96 +0,0 @@ -import 'package:cake_wallet/src/screens/base_page.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/primary_button.dart'; -import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart'; -import 'package:cake_wallet/themes/theme_base.dart'; -import 'package:flutter/material.dart'; -import 'package:keyboard_actions/keyboard_actions.dart'; -import 'package:cake_wallet/generated/i18n.dart'; - - -class BuyGiftCardPage extends BasePage { - BuyGiftCardPage(): _amountFieldFocus = FocusNode(), - _amountController = TextEditingController(); - @override - String get title => 'Enter Amount'; - - @override - Color get titleColor => Colors.white; - - @override - bool get extendBodyBehindAppBar => true; - - @override - AppBarStyle get appBarStyle => AppBarStyle.transparent; - - Color get textColor => - currentTheme.type == ThemeType.dark ? Colors.white : Color(0xff393939); - - final TextEditingController _amountController; - final FocusNode _amountFieldFocus; - - - - @override - Widget body(BuildContext context) { - return KeyboardActions( - disableScroll: true, - config: KeyboardActionsConfig( - keyboardActionsPlatform: KeyboardActionsPlatform.IOS, - keyboardBarColor: Theme.of(context).accentTextTheme.body2.backgroundColor, - nextFocus: false, - actions: [ - KeyboardActionsItem( - focusNode: _amountFieldFocus, - toolbarButtons: [(_) => KeyboardDoneButton()], - ), - ]), - child: Container( - color: Theme.of(context).backgroundColor, - child: ScrollableWithBottomSection( - contentPadding: EdgeInsets.zero, - content: - Container( - padding: EdgeInsets.symmetric(horizontal: 14), - decoration: BoxDecoration( - borderRadius: BorderRadius.only( - bottomLeft: Radius.circular(24), - bottomRight: Radius.circular(24)), - gradient: LinearGradient(colors: [ - Theme.of(context).primaryTextTheme.subhead.color, - Theme.of(context).primaryTextTheme.subhead.decorationColor, - ], begin: Alignment.topLeft, end: Alignment.bottomRight), - ), - child: Column( - mainAxisSize: MainAxisSize.min, - crossAxisAlignment: CrossAxisAlignment.stretch, - children: [ - SizedBox(height: 200), - - BaseTextFormField(controller: _amountController, focusNode: _amountFieldFocus, ) - ], - ), - ), - bottomSection: - Column( - children: [ - - Padding( - padding: EdgeInsets.only(bottom: 12), - child: PrimaryButton( - onPressed: () {}, - text: S.of(context).continue_text, - color: Theme.of(context).accentTextTheme.body2.color, - textColor: Colors.white, - ), - ), - SizedBox(height: 20), - - SizedBox(height: 10) - ], - ) , - ) ,), - ); - } -} diff --git a/lib/src/screens/cake_pay/cards/manage_cards_page.dart b/lib/src/screens/cake_pay/cards/manage_cards_page.dart deleted file mode 100644 index 5e14cd703..000000000 --- a/lib/src/screens/cake_pay/cards/manage_cards_page.dart +++ /dev/null @@ -1,219 +0,0 @@ -import 'package:cake_wallet/routes.dart'; -import 'package:cake_wallet/src/screens/base_page.dart'; -import 'package:cake_wallet/src/screens/cake_pay/widgets/card_menu.dart'; -import 'package:cake_wallet/src/widgets/market_place_item.dart'; -import 'package:cake_wallet/themes/theme_base.dart'; -import 'package:flutter/cupertino.dart'; -import 'package:flutter/material.dart'; -import 'package:cake_wallet/generated/i18n.dart'; - -class ManageCardsPage extends BasePage { - @override - Color get backgroundLightColor => currentTheme.type == ThemeType.bright ? Colors.transparent : Colors.white; - - @override - Color get backgroundDarkColor => Colors.transparent; - - @override - Color get titleColor => currentTheme.type == ThemeType.bright ? Colors.white : Colors.black; - - @override - Widget Function(BuildContext, Widget) get rootWrapper => (BuildContext context, Widget scaffold) => Container( - decoration: BoxDecoration( - gradient: LinearGradient( - colors: [ - Theme.of(context).accentColor, - Theme.of(context).scaffoldBackgroundColor, - Theme.of(context).primaryColor, - ], - begin: Alignment.topRight, - end: Alignment.bottomLeft, - ), - ), - child: scaffold, - ); - - @override - bool get resizeToAvoidBottomInset => false; - - @override - Widget get endDrawer => CardMenu(); - - @override - Widget middle(BuildContext context) { - return Text( - S.of(context).manage_cards, - style: TextStyle( - fontSize: 24, - fontWeight: FontWeight.w500, - color: Theme.of(context).accentTextTheme.display3.backgroundColor, - ), - ); - } - - final ScrollController _scrollController = ScrollController(); - - @override - Widget trailing(BuildContext context) { - return Row( - mainAxisSize: MainAxisSize.min, - children: [ - _TrailingIcon( - asset: 'assets/images/card.png', - onPressed: () {}, - ), - SizedBox(width: 16), - _TrailingIcon( - asset: 'assets/images/profile.png', - onPressed: () {}, - ), - ], - ); - } - - @override - Widget body(BuildContext context) { - final filterIcon = Image.asset( - 'assets/images/filter.png', - color: Theme.of(context).textTheme.caption.decorationColor, - ); - - return Padding( - padding: const EdgeInsets.all(14.0), - child: Column( - children: [ - MarketPlaceItem( - onTap: () {}, - title: S.of(context).setup_your_debit_card, - subTitle: S.of(context).no_id_required, - ), - SizedBox(height: 48), - Container( - padding: EdgeInsets.only(left: 2, right: 22), - height: 32, - child: Row( - children: [ - Expanded(child: _SearchWidget()), - SizedBox(width: 10), - Container( - width: 32, - padding: EdgeInsets.all(8), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.15), - border: Border.all( - color: Colors.white.withOpacity(0.2), - ), - borderRadius: BorderRadius.circular(10), - ), - child: filterIcon, - ) - ], - ), - ), - SizedBox(height: 8), - Expanded( - child: RawScrollbar( - thumbColor: Colors.white.withOpacity(0.15), - radius: Radius.circular(20), - isAlwaysShown: true, - thickness: 2, - controller: _scrollController, - child: ListView.separated( - padding: EdgeInsets.only(left: 2, right: 22), - controller: _scrollController, - itemCount: 20, - separatorBuilder: (_, __) => SizedBox(height: 4), - itemBuilder: (_, index) { - return MarketPlaceItem( - padding: EdgeInsets.symmetric(horizontal: 12, vertical: 12), - logoUrl: '', - onTap: ()=>Navigator.of(context).pushNamed(Routes.buyGiftCardPage), - title: 'Amazon', - subTitle: 'Online', - hasDiscount: true, - ); - }, - ), - ), - ), - ], - ), - ); - } -} - -class _SearchWidget extends StatelessWidget { - const _SearchWidget({ - Key key, - }) : super(key: key); - - @override - Widget build(BuildContext context) { - final searchIcon = Padding( - padding: EdgeInsets.all(8), - child: Image.asset( - 'assets/images/search_icon.png', - color: Theme.of(context).textTheme.caption.decorationColor, - ), - ); - - return TextField( - style: TextStyle(color: Colors.white), - decoration: InputDecoration( - filled: true, - contentPadding: EdgeInsets.only( - top: 10, - left: 10, - ), - fillColor: Colors.white.withOpacity(0.15), - hintText: 'Search', - hintStyle: TextStyle( - color: Colors.white.withOpacity(0.6), - ), - alignLabelWithHint: true, - floatingLabelBehavior: FloatingLabelBehavior.never, - suffixIcon: searchIcon, - border: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.white.withOpacity(0.2), - ), - borderRadius: BorderRadius.circular(10), - ), - enabledBorder: OutlineInputBorder( - borderSide: BorderSide( - color: Colors.white.withOpacity(0.2), - ), - borderRadius: BorderRadius.circular(10), - ), - focusedBorder: OutlineInputBorder( - borderSide: BorderSide(color: Colors.white.withOpacity(0.2)), - borderRadius: BorderRadius.circular(10), - )), - ); - } -} - -class _TrailingIcon extends StatelessWidget { - final String asset; - final VoidCallback onPressed; - - const _TrailingIcon({this.asset, this.onPressed}); - - @override - Widget build(BuildContext context) { - return Container( - alignment: Alignment.centerRight, - width: 25, - child: FlatButton( - highlightColor: Colors.transparent, - splashColor: Colors.transparent, - padding: EdgeInsets.all(0), - onPressed: onPressed, - child: Image.asset( - asset, - color: Theme.of(context).accentTextTheme.display3.backgroundColor, - ), - ), - ); - } -} diff --git a/lib/src/screens/dashboard/widgets/market_place_page.dart b/lib/src/screens/dashboard/widgets/market_place_page.dart index cd67eb20d..40d51cbac 100644 --- a/lib/src/screens/dashboard/widgets/market_place_page.dart +++ b/lib/src/screens/dashboard/widgets/market_place_page.dart @@ -35,7 +35,7 @@ class MarketPlacePage extends StatelessWidget { children: [ SizedBox(height: 20), MarketPlaceItem( - onTap: () => Navigator.of(context).pushNamed(Routes.manageCardsPage), + onTap: () => Navigator.of(context).pushNamed(Routes.cakePayWelcomePage), title: S.of(context).cake_pay_title, subTitle: S.of(context).cake_pay_subtitle, ),