add loan account page

This commit is contained in:
Godwin Asuquo 2022-03-02 21:56:05 +01:00
parent dd47a82a0d
commit 336a0e2fec
21 changed files with 478 additions and 19 deletions

View file

@ -1,6 +1,7 @@
import 'package:cake_wallet/entities/wake_lock.dart';
import 'package:cake_wallet/monero/monero.dart';
import 'package:cake_wallet/bitcoin/bitcoin.dart';
import 'package:cake_wallet/src/screens/loan/loan_account_page.dart';
import 'package:cw_core/unspent_coins_info.dart';
import 'package:cake_wallet/core/backup_service.dart';
import 'package:cw_core/wallet_service.dart';
@ -623,5 +624,7 @@ Future setup(
getIt.registerFactory(() => WakeLock());
getIt.registerFactory(() => LoanAccountPage());
_isSetupFinished = true;
}

View file

@ -5,6 +5,7 @@ import 'package:cake_wallet/src/screens/backup/backup_page.dart';
import 'package:cake_wallet/src/screens/backup/edit_backup_password_page.dart';
import 'package:cake_wallet/src/screens/buy/buy_webview_page.dart';
import 'package:cake_wallet/src/screens/buy/pre_order_page.dart';
import 'package:cake_wallet/src/screens/loan/loan_account_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';
@ -395,6 +396,11 @@ Route<dynamic> createRoute(RouteSettings settings) {
builder: (_) =>
getIt.get<UnspentCoinsDetailsPage>(
param1: args));
case Routes.loanAccount:
return CupertinoPageRoute<void>(
fullscreenDialog: true, builder: (_) => getIt.get<LoanAccountPage>());
default:
return MaterialPageRoute<void>(

View file

@ -59,4 +59,5 @@ class Routes {
static const unspentCoinsDetails = '/unspent_coins_details';
static const moneroRestoreWalletFromWelcome = '/monero_restore_wallet';
static const moneroNewWalletFromWelcome = '/monero_new_wallet';
static const loanAccount = '/loan_account';
}

View file

@ -1,4 +1,5 @@
import 'dart:async';
import 'package:cake_wallet/src/screens/dashboard/widgets/market_place_page.dart';
import 'package:cw_core/wallet_type.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/routes.dart';
@ -169,9 +170,7 @@ class DashboardPage extends BasePage {
return;
}
pages.add(AddressPage(
addressListViewModel: addressListViewModel,
walletViewModel: walletViewModel));
pages.add(MarketPlacePage());
pages.add(BalancePage(dashboardViewModel: walletViewModel));
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
_isEffectsInstalled = true;

View file

@ -0,0 +1,63 @@
import 'package:cake_wallet/routes.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/generated/i18n.dart';
class MarketPlacePage extends StatelessWidget {
const MarketPlacePage({Key key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(height: 50),
Text(
S.of(context).market_place,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w500,
color: Theme.of(context).accentTextTheme.display3.backgroundColor,
),
),
SizedBox(height: 20),
InkWell(
onTap: () => Navigator.of(context).pushNamed(Routes.loanAccount),
child: Container(
padding: EdgeInsets.all(20),
width: double.infinity,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.20),
borderRadius: BorderRadius.circular(20),
border: Border.all(
color: Colors.white.withOpacity(0.20),
),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Manage loans',
style: TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.w900,
),
),
SizedBox(height: 5),
Text(
'Borrow money with collateral or lend to earn interest',
style: TextStyle(
color: Colors.white,
),
)
],
),
),
)
],
),
);
}
}

View file

@ -0,0 +1,371 @@
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/action_button.dart';
import 'package:cake_wallet/src/screens/dashboard/widgets/sync_indicator_icon.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.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/store/settings_store.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
class LoanAccountPage extends BasePage {
LoanAccountPage({Key key});
@override
String get title => 'Loan Account';
@override
Color get titleColor => Colors.white;
@override
bool get resizeToAvoidBottomInset => false;
@override
bool get extendBodyBehindAppBar => true;
@override
AppBarStyle get appBarStyle => AppBarStyle.transparent;
Color get textColor =>
currentTheme.type == ThemeType.dark ? Colors.white : Color(0xff393939);
@override
Widget middle(BuildContext context) => Row(
mainAxisSize: MainAxisSize.min,
children: [
Padding(
padding: const EdgeInsets.only(right: 20.0),
child: SyncIndicatorIcon(isSynced: false),
),
super.middle(context),
],
);
@override
Widget body(BuildContext context) {
return ScrollableWithBottomSection(
contentPadding: EdgeInsets.zero,
content: Column(
children: [
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,
children: [
SizedBox(height: 150),
SizedBox(
height: 40,
child: Row(
children: [
Expanded(
child: BaseTextFormField(
textColor: Colors.white,
hintText: 'Email OR Phone Number',
placeholderTextStyle:
TextStyle(color: Colors.white54),
),
),
SizedBox(
width: 90,
child: PrimaryButton(
onPressed: () {},
text: 'Get code',
color: Colors.white.withOpacity(0.2),
radius: 6,
textColor: Colors.white,
),
),
],
),
),
SizedBox(height: 37),
SizedBox(
height: 40,
child: Row(
children: [
Expanded(
child: BaseTextFormField(
textColor: Colors.white,
hintText: 'SMS / Email Code',
placeholderTextStyle:
TextStyle(color: Colors.white54),
),
),
SizedBox(width: 10),
SizedBox(
width: 70,
child: PrimaryButton(
onPressed: () {},
text: 'Verify',
color: Colors.white.withOpacity(0.2),
radius: 6,
textColor: Colors.white),
),
SizedBox(width: 10)
],
),
),
SizedBox(height: 100),
],
),
),
Column(
children: [
SizedBox(height: 40),
Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent,
hoverColor: Colors.transparent,
),
child: ExpansionTile(
initiallyExpanded: true,
trailing: Icon(
Icons.keyboard_arrow_down,
color: textColor,
size: 30,
),
childrenPadding: EdgeInsets.symmetric(horizontal: 20),
title: Text(
'My Lending/Earning',
style: TextStyle(
fontWeight: FontWeight.w600,
color: textColor,
fontSize: 24,
),
),
children: [
Align(
alignment: Alignment.bottomLeft,
child: Text(
'Log in above to lend',
style: TextStyle(
fontWeight: FontWeight.w400,
color: textColor,
fontSize: 14,
),
),
),
],
),
),
SizedBox(height: 40),
Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent,
hoverColor: Colors.transparent,
),
child: ExpansionTile(
initiallyExpanded: true,
trailing: Icon(
Icons.keyboard_arrow_down,
color: textColor,
size: 30,
),
childrenPadding: EdgeInsets.symmetric(horizontal: 20),
title: Text(
'My Borrowing',
style: TextStyle(
fontWeight: FontWeight.w600,
color: textColor,
fontSize: 24,
),
),
children: [
Align(
alignment: Alignment.bottomLeft,
child: Text(
'Log in above to borrow with collateral',
style: TextStyle(
fontWeight: FontWeight.w400,
color: textColor,
fontSize: 14,
),
),
),
Table(),
],
),
)
],
),
],
),
bottomSection: Column(
children: [
Padding(
padding: EdgeInsets.only(bottom: 12),
child: PrimaryButton(
onPressed: () {},
text: 'Lend and Earn Interest',
color: Theme.of(context).accentTextTheme.body2.color,
textColor: Colors.white,
),
),
SizedBox(height: 20),
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: 'By logging in, you agree to the ',
style: TextStyle(color: Color(0xff7A93BA), fontSize: 12),
children: [
TextSpan(
text: 'Terms and Conditions',
style: TextStyle(decoration: TextDecoration.underline),
),
TextSpan(text: ' and '),
TextSpan(
text: 'Privacy Policy of CoinRabbit',
style: TextStyle(decoration: TextDecoration.underline),
)
],
),
),
SizedBox(height: 10)
],
),
);
}
}
class Table extends StatelessWidget {
const Table({Key key}) : super(key: key);
Color get textColor =>
getIt.get<SettingsStore>().currentTheme.type == ThemeType.dark
? Colors.white
: Color(0xff393939);
@override
Widget build(BuildContext context) {
return Column(
children: [
Padding(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
child: Row(
children: [
Expanded(
child: Text(
'ID',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'Amount',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'Status',
style: TextStyle(color: textColor),
),
),
SizedBox(width: 25),
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xffF1EDFF),
),
child: Row(
children: [
Expanded(
child: Text(
'5395821325',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'10000 USDT',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'Awaiting deposit',
style: TextStyle(color: textColor),
),
),
Icon(Icons.chevron_right)
],
),
),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xffF1EDFF),
),
child: Row(
children: [
Expanded(
child: Text(
'5395821325',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'10000 USDT',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'Awaiting deposit',
style: TextStyle(color: textColor),
),
),
Icon(Icons.chevron_right)
],
),
),
SizedBox(height: 10),
Container(
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 10),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
color: Color(0xffF1EDFF),
),
child: Row(
children: [
Expanded(
child: Text(
'5395821325',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'10000 USDT',
style: TextStyle(color: textColor),
),
),
Expanded(
child: Text(
'Awaiting deposit',
style: TextStyle(color: textColor),
),
),
Icon(Icons.chevron_right)
],
),
),
],
);
}
}

View file

@ -11,6 +11,7 @@ class PrimaryButton extends StatelessWidget {
this.isDisabled = false,
this.isDottedBorder = false,
this.borderColor = Colors.black,
this.radius,
this.onDisabledPressed});
final VoidCallback onPressed;
@ -21,6 +22,7 @@ class PrimaryButton extends StatelessWidget {
final String text;
final bool isDisabled;
final bool isDottedBorder;
final double radius;
@override
Widget build(BuildContext context) {
@ -36,7 +38,7 @@ class PrimaryButton extends StatelessWidget {
highlightColor: Colors.transparent,
disabledColor: color.withOpacity(0.5),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(26.0),
borderRadius: BorderRadius.circular(radius),
),
child: Text(text,
textAlign: TextAlign.center,
@ -54,7 +56,7 @@ class PrimaryButton extends StatelessWidget {
dashPattern: [6, 4],
color: borderColor,
strokeWidth: 2,
radius: Radius.circular(26),
radius: Radius.circular(radius),
child: content)
: content;
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Erfahren Sie mehr",
"new_template" : "neue Vorlage",
"electrum_address_disclaimer": "Wir generieren jedes Mal neue Adressen, wenn Sie eine verwenden, aber vorherige Adressen funktionieren weiterhin"
"electrum_address_disclaimer": "Wir generieren jedes Mal neue Adressen, wenn Sie eine verwenden, aber vorherige Adressen funktionieren weiterhin",
"market_place": "Marktplatz"
}

View file

@ -524,5 +524,6 @@
"learn_more" : "Learn More",
"new_template" : "New Template",
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work"
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work",
"market_place": "Market Place"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Aprende más",
"new_template" : "Nueva plantilla",
"electrum_address_disclaimer": "Generamos nuevas direcciones cada vez que usa una, pero las direcciones anteriores siguen funcionando"
"electrum_address_disclaimer": "Generamos nuevas direcciones cada vez que usa una, pero las direcciones anteriores siguen funcionando",
"market_place": "Mercado"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "और अधिक जानें",
"new_template" : "नया टेम्पलेट",
"electrum_address_disclaimer": "हर बार जब आप एक का उपयोग करते हैं तो हम नए पते उत्पन्न करते हैं, लेकिन पिछले पते काम करना जारी रखते हैं"
"electrum_address_disclaimer": "हर बार जब आप एक का उपयोग करते हैं तो हम नए पते उत्पन्न करते हैं, लेकिन पिछले पते काम करना जारी रखते हैं",
"market_place": "मार्केट प्लेस"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Saznajte više",
"new_template" : "novi predložak",
"electrum_address_disclaimer": "Minden egyes alkalommal új címeket generálunk, de a korábbi címek továbbra is működnek"
"electrum_address_disclaimer": "Minden egyes alkalommal új címeket generálunk, de a korábbi címek továbbra is működnek",
"market_place": "Pijaca"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Impara di più",
"new_template" : "Nuovo modello",
"electrum_address_disclaimer": "Generiamo nuovi indirizzi ogni volta che ne utilizzi uno, ma gli indirizzi precedenti continuano a funzionare"
"electrum_address_disclaimer": "Generiamo nuovi indirizzi ogni volta che ne utilizzi uno, ma gli indirizzi precedenti continuano a funzionare",
"market_place" : "Piazza del mercato"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "もっと詳しく知る",
"new_template" : "新しいテンプレート",
"electrum_address_disclaimer": "使用するたびに新しいアドレスが生成されますが、以前のアドレスは引き続き機能します"
"electrum_address_disclaimer": "使用するたびに新しいアドレスが生成されますが、以前のアドレスは引き続き機能します",
"market_place": "マーケットプレイス"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "더 알아보기",
"new_template" : "새 템플릿",
"electrum_address_disclaimer": "사용할 때마다 새 주소가 생성되지만 이전 주소는 계속 작동합니다."
"electrum_address_disclaimer": "사용할 때마다 새 주소가 생성되지만 이전 주소는 계속 작동합니다.",
"market_place": "마켓 플레이스"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Kom meer te weten",
"new_template" : "Nieuwe sjabloon",
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work"
"electrum_address_disclaimer": "We generate new addresses each time you use one, but previous addresses continue to work",
"market_place": "Marktplaats"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Ucz się więcej",
"new_template" : "Nowy szablon",
"electrum_address_disclaimer": "Za każdym razem, gdy korzystasz z jednego z nich, generujemy nowe adresy, ale poprzednie adresy nadal działają"
"electrum_address_disclaimer": "Za każdym razem, gdy korzystasz z jednego z nich, generujemy nowe adresy, ale poprzednie adresy nadal działają",
"market_place": "Rynek"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Saber mais",
"new_template" : "Novo modelo",
"electrum_address_disclaimer": "Geramos novos endereços cada vez que você usa um, mas os endereços anteriores continuam funcionando"
"electrum_address_disclaimer": "Geramos novos endereços cada vez que você usa um, mas os endereços anteriores continuam funcionando",
"market_place": "Mercado"
}

View file

@ -523,5 +523,6 @@
"learn_more" : "Узнать больше",
"new_template" : "Новый шаблон",
"electrum_address_disclaimer": "Мы генерируем новые адреса каждый раз, когда вы их используете, но предыдущие адреса продолжают работать."
"electrum_address_disclaimer": "Мы генерируем новые адреса каждый раз, когда вы их используете, но предыдущие адреса продолжают работать.",
"market_place": "Рынок"
}

View file

@ -522,5 +522,6 @@
"learn_more" : "Дізнатися більше",
"new_template" : "Новий шаблон",
"electrum_address_disclaimer": "Ми створюємо нові адреси щоразу, коли ви використовуєте їх, але попередні адреси продовжують працювати"
"electrum_address_disclaimer": "Ми створюємо нові адреси щоразу, коли ви використовуєте їх, але попередні адреси продовжують працювати",
"market_place": "Ринок"
}

View file

@ -521,5 +521,6 @@
"learn_more" : "了解更多",
"new_template" : "新模板",
"electrum_address_disclaimer": "每次您使用一个地址时,我们都会生成新地址,但之前的地址仍然有效"
"electrum_address_disclaimer": "每次您使用一个地址时,我们都会生成新地址,但之前的地址仍然有效",
"market_place": "市场"
}