CAKE-19 | created page view store, alert background, alert close button, cake scrollbar; applied new design to monero_account_edit_or_create_page, monero_account_list_page, address_edit_or_create_page; added scrollOffsetFromTop to monero_account_list_view_model; added string resources to arb files and colors to palette

This commit is contained in:
Oleksandr Sobol 2020-07-28 19:03:34 +03:00
parent 706d16b346
commit 153673d418
40 changed files with 447 additions and 304 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 378 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 802 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 B

After

Width:  |  Height:  |  Size: 798 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 498 B

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
assets/images/close.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 277 B

After

Width:  |  Height:  |  Size: 392 B

View file

@ -57,6 +57,7 @@ import 'package:cake_wallet/store/dashboard/trades_store.dart';
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
import 'package:cake_wallet/store/dashboard/fiat_convertation_store.dart';
import 'package:cake_wallet/store/dashboard/page_view_store.dart';
final getIt = GetIt.instance;
@ -110,6 +111,7 @@ Future setup(
TradeFilterStore(wallet: getIt.get<AppStore>().wallet));
getIt.registerSingleton<TransactionFilterStore>(TransactionFilterStore());
getIt.registerSingleton<FiatConvertationStore>(FiatConvertationStore());
getIt.registerSingleton<PageViewStore>(PageViewStore());
getIt.registerFactory<KeyService>(
() => KeyService(getIt.get<FlutterSecureStorage>()));
@ -153,7 +155,8 @@ Future setup(
appStore: getIt.get<AppStore>(),
tradesStore: getIt.get<TradesStore>(),
tradeFilterStore: getIt.get<TradeFilterStore>(),
transactionFilterStore: getIt.get<TransactionFilterStore>()
transactionFilterStore: getIt.get<TransactionFilterStore>(),
pageViewStore: getIt.get<PageViewStore>()
));
getIt.registerFactory<AuthService>(() => AuthService(

View file

@ -162,6 +162,7 @@ class S implements WidgetsLocalizations {
String get restore_wallet_restore_description => "Wallet restore description";
String get save => "Save";
String get saved_the_trade_id => "I've saved the trade ID";
String get scan_qr_code => "Scan the QR code to get the address";
String get seed_choose => "Choose seed language";
String get seed_language_chinese => "Chinese";
String get seed_language_choose => "Please choose seed language:";
@ -623,6 +624,8 @@ class $de extends S {
@override
String get xmr_available_balance => "XMR verfügbares Guthaben";
@override
String get scan_qr_code => "Scannen Sie den QR-Code, um die Adresse zu erhalten";
@override
String get trade_state_paid => "Bezahlt";
@override
String get node_new => "Neuer Knoten";
@ -749,6 +752,8 @@ class $de extends S {
@override
String get error_text_fiat => "Der Wert des Betrags darf den verfügbaren Kontostand nicht überschreiten.\nDie Anzahl der Nachkommastellen muss kleiner oder gleich 2 sein";
@override
String get addresses => "Adressen";
@override
String get transactions_by_date => "Transaktionen nach Datum";
@override
String get restore_from_seed_placeholder => "Bitte geben Sie hier Ihren Code ein";
@ -1243,6 +1248,8 @@ class $hi extends S {
@override
String get xmr_available_balance => "XMR उपलब्ध शेष राशि";
@override
String get scan_qr_code => "पता प्राप्त करने के लिए QR कोड स्कैन करें";
@override
String get trade_state_paid => "भुगतान किया है";
@override
String get node_new => "नया नोड";
@ -1369,6 +1376,8 @@ class $hi extends S {
@override
String get error_text_fiat => "राशि का मूल्य उपलब्ध शेष राशि से अधिक नहीं हो सकता.\nअंश अंकों की संख्या कम या 2 के बराबर होनी चाहिए";
@override
String get addresses => "पतों";
@override
String get transactions_by_date => "तारीख से लेन-देन";
@override
String get restore_from_seed_placeholder => "कृपया अपना कोड वाक्यांश यहां दर्ज करें या पेस्ट करें";
@ -1863,6 +1872,8 @@ class $ru extends S {
@override
String get xmr_available_balance => "Доступный XMR баланс";
@override
String get scan_qr_code => "Отсканируйте QR-код для получения адреса";
@override
String get trade_state_paid => "Оплаченная";
@override
String get node_new => "Новая нода";
@ -1989,6 +2000,8 @@ class $ru extends S {
@override
String get error_text_fiat => "Значение суммы не может превышать доступный баланс.\nКоличество цифр после запятой должно быть меньше или равно 2";
@override
String get addresses => "Адреса";
@override
String get transactions_by_date => "Сортировать по дате";
@override
String get restore_from_seed_placeholder => "Введите или вставьте мнемоническую фразу вашего кошелька";
@ -2483,6 +2496,8 @@ class $ko extends S {
@override
String get xmr_available_balance => "XMR 사용 가능한 잔액";
@override
String get scan_qr_code => "QR 코드를 스캔하여 주소를 얻습니다.";
@override
String get trade_state_paid => "유료";
@override
String get node_new => "새로운 노드";
@ -2609,6 +2624,8 @@ class $ko extends S {
@override
String get error_text_fiat => "금액은 사용 가능한 잔액을 초과 할 수 없습니다.\n소수 자릿수는 2보다 작거나 같아야합니다";
@override
String get addresses => "구애";
@override
String get transactions_by_date => "날짜 별 거래";
@override
String get restore_from_seed_placeholder => "여기에 코드 문구를 입력하거나 붙여 넣으십시오.";
@ -3103,6 +3120,8 @@ class $pt extends S {
@override
String get xmr_available_balance => "Saldo XMR disponível";
@override
String get scan_qr_code => "Digitalize o código QR para obter o endereço";
@override
String get trade_state_paid => "Paga";
@override
String get node_new => "Novo nó";
@ -3229,6 +3248,8 @@ class $pt extends S {
@override
String get error_text_fiat => "O valor do valor não pode exceder o saldo disponível.\nO número de dígitos decimais deve ser menor ou igual a 2";
@override
String get addresses => "Endereços";
@override
String get transactions_by_date => "Transações por data";
@override
String get restore_from_seed_placeholder => "Digite ou cole sua frase de código aqui";
@ -3723,6 +3744,8 @@ class $uk extends S {
@override
String get xmr_available_balance => "Доступний XMR баланс";
@override
String get scan_qr_code => "Скануйте QR-код для одержання адреси";
@override
String get trade_state_paid => "Оплачена";
@override
String get node_new => "Новий вузол";
@ -3849,6 +3872,8 @@ class $uk extends S {
@override
String get error_text_fiat => "Значення суми не може перевищувати доступний баланс.\nКількість цифр після коми повинно бути меншим або дорівнювати 2";
@override
String get addresses => "Адреси";
@override
String get transactions_by_date => "Сортувати по даті";
@override
String get restore_from_seed_placeholder => "Введіть або вставте мнемонічну фразу вашого гаманця";
@ -4343,6 +4368,8 @@ class $ja extends S {
@override
String get xmr_available_balance => "XMR利用可能残高";
@override
String get scan_qr_code => "QRコードをスキャンして住所を取得します";
@override
String get trade_state_paid => "有料";
@override
String get node_new => "新しいノード";
@ -4469,6 +4496,8 @@ class $ja extends S {
@override
String get error_text_fiat => "金額は利用可能な残高を超えることはできません.\n小数桁の数は2以下でなければなりません";
@override
String get addresses => "住所";
@override
String get transactions_by_date => "日付ごとの取引";
@override
String get restore_from_seed_placeholder => "ここにコードフレーズを入力または貼り付けてください";
@ -4967,6 +4996,8 @@ class $pl extends S {
@override
String get xmr_available_balance => "XMR Dostępne saldo";
@override
String get scan_qr_code => "Zeskanuj kod QR, aby uzyskać adres";
@override
String get trade_state_paid => "Płatny";
@override
String get node_new => "Nowy węzeł";
@ -5093,6 +5124,8 @@ class $pl extends S {
@override
String get error_text_fiat => "Wartość kwoty nie może przekroczyć dostępnego salda.\nLiczba cyfr ułamkowych musi być mniejsza lub równa 2";
@override
String get addresses => "Adresy";
@override
String get transactions_by_date => "Transakcje według daty";
@override
String get restore_from_seed_placeholder => "Wpisz lub wklej tutaj swoją frazę kodową";
@ -5587,6 +5620,8 @@ class $es extends S {
@override
String get xmr_available_balance => "XMR Available Balance";
@override
String get scan_qr_code => "Escanee el código QR para obtener la dirección";
@override
String get trade_state_paid => "Pagado";
@override
String get node_new => "Nuevo nodo";
@ -5713,6 +5748,8 @@ class $es extends S {
@override
String get error_text_fiat => "El valor de la cantidad no puede exceder el saldo disponible.\nEl número de dígitos de fracción debe ser menor o igual a 2";
@override
String get addresses => "Direcciones";
@override
String get transactions_by_date => "Transacciones por fecha";
@override
String get restore_from_seed_placeholder => "Ingrese o pegue su frase de código aquí";
@ -6207,6 +6244,8 @@ class $nl extends S {
@override
String get xmr_available_balance => "XMR Beschikbaar saldo";
@override
String get scan_qr_code => "Scan de QR-code om het adres te krijgen";
@override
String get trade_state_paid => "Betaald";
@override
String get node_new => "Nieuw knooppunt";
@ -6333,6 +6372,8 @@ class $nl extends S {
@override
String get error_text_fiat => "Waarde van bedrag kan het beschikbare saldo niet overschrijden.\nHet aantal breukcijfers moet kleiner zijn dan of gelijk zijn aan 2";
@override
String get addresses => "Adressen";
@override
String get transactions_by_date => "Transacties op datum";
@override
String get restore_from_seed_placeholder => "Voer hier uw codefrase in of plak deze";
@ -6827,6 +6868,8 @@ class $zh extends S {
@override
String get xmr_available_balance => "XMR 可用余额 ";
@override
String get scan_qr_code => "掃描二維碼獲取地址";
@override
String get trade_state_paid => "已付费";
@override
String get node_new => "新节点";
@ -6953,6 +6996,8 @@ class $zh extends S {
@override
String get error_text_fiat => "金额不能超过可用余额.\n小数位数必须小于或等于2";
@override
String get addresses => "地址";
@override
String get transactions_by_date => "按日期交易";
@override
String get restore_from_seed_placeholder => "请在此处输入或粘贴您的代码短语";

View file

@ -18,10 +18,9 @@ class Palette {
}
class PaletteDark {
static const Color distantBlue = Color.fromRGBO(70, 85, 133, 1.0); // mainBackgroundColor
//static const Color distantBlue = Color.fromRGBO(70, 85, 133, 1.0); // mainBackgroundColor
static const Color lightDistantBlue = Color.fromRGBO(81, 96, 147, 1.0); // borderCardColor
static const Color gray = Color.fromRGBO(140, 153, 201, 1.0); // walletCardText
static const Color violetBlue = Color.fromRGBO(51, 63, 104, 1.0); // walletCardAddressField
static const Color moderateBlue = Color.fromRGBO(63, 77, 122, 1.0); // walletCardSubAddressField
static const Color darkNightBlue = Color.fromRGBO(33, 43, 73, 1.0); // historyPanel
static const Color pigeonBlue = Color.fromRGBO(91, 112, 146, 1.0); // historyPanelText
@ -40,11 +39,16 @@ class PaletteDark {
static const Color orangeYellow = Color.fromRGBO(243, 166, 50, 1.0);
static const Color brightGreen = Color.fromRGBO(88, 243, 50, 1.0);
static const Color oceanBlue = Color.fromRGBO(27, 39, 71, 1.0);
static const Color lightOceanBlue = Color.fromRGBO(32, 45, 80, 1.0);
static const Color lightNightBlue = Color.fromRGBO(39, 52, 89, 1.0);
static const Color wildBlue = Color.fromRGBO(165, 176, 205, 1.0);
static const Color lightBlueGrey = Color.fromRGBO(125, 141, 183, 1.0);
static const Color wildBlueGrey = Color.fromRGBO(125, 137, 182, 1.0);
static const Color darkGrey = Color.fromRGBO(118, 131, 169, 1.0);
static const Color dividerColor = Color.fromRGBO(48, 59, 95, 1.0);
static const Color violetBlue = Color.fromRGBO(59, 72, 119, 1.0);
static const Color deepPurpleBlue = Color.fromRGBO(19, 29, 56, 1.0);
static const Color distantBlue = Color.fromRGBO(72, 85, 131, 1.0);
// FIXME: Rename.
static const Color eee = Color.fromRGBO(236, 239, 245, 1.0);

View file

@ -23,9 +23,9 @@ abstract class BasePage extends StatelessWidget {
Widget Function(BuildContext, Widget) get rootWrapper => null;
final _backArrowImage = Image.asset('assets/images/back_arrow.png');
final _backArrowImage = Image.asset('assets/images/back_arrow.png', color: Colors.white);
final _backArrowImageDarkTheme =
Image.asset('assets/images/back_arrow_dark_theme.png');
Image.asset('assets/images/back_arrow_dark_theme.png', color: Colors.white);
final _closeButtonImage = Image.asset('assets/images/close_button.png');
final _closeButtonImageDarkTheme =
Image.asset('assets/images/close_button_dark_theme.png');
@ -71,7 +71,9 @@ abstract class BasePage extends StatelessWidget {
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color),
//color: Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
),
);
}

View file

@ -28,6 +28,9 @@ class DashboardPage extends BasePage {
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
@override
bool get resizeToAvoidBottomPadding => false;
@override
Widget middle(BuildContext context) {
return SyncIndicator(dashboardViewModel: walletViewModel);
@ -158,7 +161,7 @@ class DashboardPage extends BasePage {
pages.add(TransactionsPage(dashboardViewModel: walletViewModel));
controller.addListener(() {
walletViewModel.currentPage = controller.page;
walletViewModel.pageViewStore.setCurrentPage(controller.page);
});
reaction((_) => walletViewModel.currentPage, (double currentPage) {

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/view_model/monero_account_list/monero_account_edit_o
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/palette.dart';
class MoneroAccountEditOrCreatePage extends BasePage {
MoneroAccountEditOrCreatePage({@required this.moneroAccountCreationViewModel})
@ -23,6 +24,12 @@ class MoneroAccountEditOrCreatePage extends BasePage {
@override
String get title => S.current.account;
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
final GlobalKey<FormState> _formKey;
final TextEditingController _textController;
@ -31,7 +38,6 @@ class MoneroAccountEditOrCreatePage extends BasePage {
Form(
key: _formKey,
child: Container(
color: Theme.of(context).backgroundColor,
padding: EdgeInsets.all(24.0),
child: Column(
children: <Widget>[
@ -39,6 +45,7 @@ class MoneroAccountEditOrCreatePage extends BasePage {
child: Center(
child: BaseTextFormField(
controller: _textController,
textColor: Colors.white,
hintText: S.of(context).account,
validator: MoneroLabelValidator(),
))),

View file

@ -7,133 +7,157 @@ import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/view_model/monero_account_list/monero_account_list_view_model.dart';
import 'package:cake_wallet/src/screens/monero_accounts/widgets/account_tile.dart';
import 'package:cake_wallet/src/widgets/alert_background.dart';
import 'package:cake_wallet/src/widgets/cake_scrollbar.dart';
import 'package:cake_wallet/src/widgets/alert_close_button.dart';
class MoneroAccountListPage extends StatefulWidget {
MoneroAccountListPage({@required this.accountListViewModel});
class MoneroAccountListPage extends StatelessWidget {
MoneroAccountListPage({@required this.accountListViewModel}) {
backgroundHeight = 194;
thumbHeight = 72;
isAlwaysShowScrollThumb = false;
controller = ScrollController();
controller.addListener(() {
final scrollOffsetFromTop = controller.hasClients
? (controller.offset / controller.position.maxScrollExtent * (backgroundHeight - thumbHeight))
: 0.0;
accountListViewModel.setScrollOffsetFromTop(scrollOffsetFromTop);
});
}
final MoneroAccountListViewModel accountListViewModel;
final closeIcon = Image.asset('assets/images/close.png');
@override
MoneroAccountListPageForm createState() =>
MoneroAccountListPageForm(accountListViewModel);
}
class MoneroAccountListPageForm extends State<MoneroAccountListPage> {
MoneroAccountListPageForm(this.accountListViewModel);
final MoneroAccountListViewModel accountListViewModel;
ScrollController controller;
double backgroundHeight;
double thumbHeight;
bool isAlwaysShowScrollThumb;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
color: Colors.transparent,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(
color: PaletteDark.darkNightBlue.withOpacity(0.75)),
child: Center(
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: Text(
S.of(context).choose_account,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.white),
),
return AlertBackground(
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Container(
padding: EdgeInsets.only(left: 24, right: 24),
child: Text(
S.of(context).choose_account,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
decoration: TextDecoration.none,
color: Colors.white
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: GestureDetector(
onTap: () => null,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
height: 296,
color: Theme.of(context)
.accentTextTheme
.title
.backgroundColor,
child: Column(
children: <Widget>[
Expanded(child: Observer(builder: (_) {
final accounts =
widget.accountListViewModel.accounts;
),
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, top: 24),
child: GestureDetector(
onTap: () => null,
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(14)),
child: Container(
height: 296,
color: PaletteDark.deepPurpleBlue,
child: Column(
children: <Widget>[
Expanded(
child: Observer(
builder: (_) {
final accounts = accountListViewModel.accounts;
isAlwaysShowScrollThumb = accounts == null
? false
: accounts.length > 3;
return ListView.separated(
separatorBuilder: (context, index) => Divider(
color: Theme.of(context).dividerColor,
height: 1),
itemCount: accounts.length ?? 0,
itemBuilder: (context, index) {
final account = accounts[index];
return AccountTile(
isCurrent: account.isSelected,
accountName: account.label,
onTap: () {
if (account.isSelected) {
return;
}
widget.accountListViewModel
.select(account);
Navigator.of(context).pop();
});
},
);
})),
GestureDetector(
onTap: () async => await Navigator.of(context)
.pushNamed(Routes.accountCreation),
child: Container(
height: 62,
color: Colors.white,
padding: EdgeInsets.only(left: 24, right: 24),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
return Stack(
alignment: Alignment.center,
children: <Widget>[
Icon(
Icons.add,
color: PaletteDark.darkNightBlue,
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
S.of(context).create_new_account,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: PaletteDark.darkNightBlue,
decoration: TextDecoration.none,
),
ListView.separated(
controller: controller,
separatorBuilder: (context, index) =>
Container(
height: 1,
color: PaletteDark.dividerColor,
),
itemCount: accounts.length ?? 0,
itemBuilder: (context, index) {
final account = accounts[index];
return AccountTile(
isCurrent: account.isSelected,
accountName: account.label,
onTap: () {
if (account.isSelected) {
return;
}
accountListViewModel
.select(account);
Navigator.of(context).pop();
});
},
),
isAlwaysShowScrollThumb
? CakeScrollbar(
backgroundHeight: backgroundHeight,
thumbHeight: thumbHeight,
fromTop: accountListViewModel
.scrollOffsetFromTop
)
: Offstage(),
],
),
),
),
);
}
)
],
),
),
GestureDetector(
onTap: () async => await Navigator.of(context)
.pushNamed(Routes.accountCreation),
child: Container(
height: 62,
color: Colors.white,
padding: EdgeInsets.only(left: 24, right: 24),
child: Center(
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Icon(
Icons.add,
color: PaletteDark.darkNightBlue,
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
S.of(context).create_new_account,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: PaletteDark.darkNightBlue,
decoration: TextDecoration.none,
),
),
)
],
),
),
),
)
],
),
),
)
],
),
),
),
),
)
],
),
),
AlertCloseButton(image: closeIcon)
],
),
);
}

View file

@ -1,4 +1,5 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AccountTile extends StatelessWidget {
AccountTile({
@ -13,8 +14,8 @@ class AccountTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
final color = isCurrent ? Theme.of(context).accentTextTheme.subtitle.decorationColor : Colors.transparent;
final textColor = isCurrent ? Colors.blue : Theme.of(context).primaryTextTheme.title.color;
final color = isCurrent ? PaletteDark.lightOceanBlue : Colors.transparent;
final textColor = isCurrent ? Colors.blue : Colors.white;
return GestureDetector(
onTap: onTap,

View file

@ -1,199 +1,72 @@
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/services.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:esys_flutter_share/esys_flutter_share.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/di.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
import 'package:cake_wallet/src/screens/monero_accounts/monero_account_list_page.dart';
import 'package:cake_wallet/src/screens/receive/widgets/header_tile.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/core/amount_validator.dart';
import 'package:cake_wallet/src/screens/receive/widgets/address_cell.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_account_list_header.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_header.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_view_model.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_widget.dart';
import 'package:cake_wallet/palette.dart';
class ReceivePage extends BasePage {
ReceivePage({this.addressListViewModel})
: amountController = TextEditingController(),
_formKey = GlobalKey<FormState>() {
amountController.addListener(() => addressListViewModel.amount =
_formKey.currentState.validate() ? amountController.text : '');
}
ReceivePage({this.addressListViewModel});
final WalletAddressListViewModel addressListViewModel;
final TextEditingController amountController;
final GlobalKey<FormState> _formKey;
@override
Color get backgroundLightColor => Colors.transparent;
String get title => S.current.receive;
@override
Color get backgroundDarkColor => Colors.transparent;
Color get backgroundLightColor => PaletteDark.backgroundColor;
@override
Widget Function(BuildContext, Widget) get rootWrapper =>
(BuildContext context, Widget scaffold) => Container(
decoration: BoxDecoration(
gradient: LinearGradient(colors: [
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).primaryColor
], begin: Alignment.topLeft, end: Alignment.bottomRight)),
child: scaffold);
@override
Widget middle(BuildContext context) => Text(
S.of(context).receive,
style: TextStyle(
fontSize: 18.0,
fontWeight: FontWeight.bold,
color: Theme.of(context).primaryTextTheme.title.color),
);
Color get backgroundDarkColor => PaletteDark.backgroundColor;
@override
Widget trailing(BuildContext context) {
final shareImage = Image.asset('assets/images/share.png',
color: Theme.of(context).primaryTextTheme.title.color);
color: Colors.white);
return SizedBox(
height: 20.0,
width: 14.0,
width: 20.0,
child: ButtonTheme(
minWidth: double.minPositive,
child: FlatButton(
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => Share.text(S.current.share_address,
addressListViewModel.address.address, 'text/plain'),
child: shareImage),
highlightColor: Colors.transparent,
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => Share.text(S.current.share_address,
addressListViewModel.address.address, 'text/plain'),
child: shareImage),
),
);
}
@override
Widget body(BuildContext context) {
final copyImage = Image.asset('assets/images/copy_content.png',
color: Theme.of(context).primaryTextTheme.title.color);
return SingleChildScrollView(
child: Column(
children: <Widget>[
SizedBox(height: 25),
Row(children: <Widget>[
Spacer(flex: 4),
Observer(
builder: (_) => Flexible(
flex: 6,
child: Center(
child: AspectRatio(
aspectRatio: 1.0,
child: QrImage(
data: addressListViewModel.uri.toString(),
backgroundColor: Colors.transparent,
foregroundColor: Theme.of(context)
.primaryTextTheme
.display4
.color,
))))),
Spacer(flex: 4)
]),
Padding(
padding: EdgeInsets.fromLTRB(24, 40, 24, 0),
child: Row(
children: <Widget>[
Expanded(
child: Form(
key: _formKey,
child: BaseTextFormField(
controller: amountController,
keyboardType:
TextInputType.numberWithOptions(decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
textAlign: TextAlign.center,
hintText: S.of(context).receive_amount,
borderColor: Theme.of(context)
.primaryTextTheme
.headline5
.color
.withOpacity(0.4),
validator: AmountValidator(),
autovalidate: true,
placeholderTextStyle: TextStyle(
color: Theme.of(context)
.primaryTextTheme
.headline5
.color,
fontSize: 20,
fontWeight: FontWeight.w600))))
],
padding: EdgeInsets.fromLTRB(24, 80, 24, 40),
child: QRWidget(
addressListViewModel: addressListViewModel,
isAmountFieldShow: true,
),
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, bottom: 40, top: 40),
child: Builder(
builder: (context) => Observer(
builder: (context) => GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: addressListViewModel.address.address));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
S.of(context).copied_to_clipboard,
style: TextStyle(color: Colors.white),
),
backgroundColor: Colors.green,
duration: Duration(milliseconds: 500),
));
},
child: Container(
height: 48,
padding: EdgeInsets.only(left: 24, right: 24),
decoration: BoxDecoration(
borderRadius:
BorderRadius.all(Radius.circular(24)),
color: Theme.of(context)
.primaryTextTheme
.overline
.color),
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
addressListViewModel.address.address,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context)
.primaryTextTheme
.title
.color),
),
),
Padding(
padding: EdgeInsets.only(left: 12),
child: copyImage,
)
],
),
),
))),
),
Observer(
builder: (_) => ListView.separated(
separatorBuilder: (context, _) =>
Divider(height: 1, color: Theme.of(context).dividerColor),
Container(height: 1, color: PaletteDark.dividerColor),
shrinkWrap: true,
physics: NeverScrollableScrollPhysics(),
itemCount: addressListViewModel.items.length,
@ -210,8 +83,7 @@ class ReceivePage extends BasePage {
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color:
Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
));
}
@ -223,28 +95,40 @@ class ReceivePage extends BasePage {
icon: Icon(
Icons.add,
size: 20,
color:
Theme.of(context).primaryTextTheme.title.color,
color: Colors.white,
));
}
if (item is WalletAddressListItem) {
cell = Observer(
builder: (_) => AddressCell.fromItem(item,
isCurrent: item.address ==
addressListViewModel.address.address,
onTap: (_) => addressListViewModel.address = item,
onEdit: () => Navigator.of(context).pushNamed(
Routes.newSubaddress,
arguments: item)));
builder: (_) {
final isCurrent = item.address ==
addressListViewModel.address.address;
final backgroundColor = isCurrent
? PaletteDark.lightOceanBlue
: PaletteDark.nightBlue;
final textColor = isCurrent
? Colors.blue
: Colors.white;
return AddressCell.fromItem(item,
isCurrent: isCurrent,
backgroundColor: backgroundColor,
textColor: textColor,
onTap: (_) => addressListViewModel.address = item,
onEdit: () => Navigator.of(context).pushNamed(
Routes.newSubaddress,
arguments: item));
}
);
}
return index != 0
? cell
: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24)),
topLeft: Radius.circular(30),
topRight: Radius.circular(30)),
child: cell,
);
})),

View file

@ -6,12 +6,16 @@ import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_i
class AddressCell extends StatelessWidget {
factory AddressCell.fromItem(WalletAddressListItem item,
{@required bool isCurrent,
@required Color backgroundColor,
@required Color textColor,
Function(String) onTap,
Function() onEdit}) =>
AddressCell(
address: item.address,
name: item.name,
isCurrent: isCurrent,
backgroundColor: backgroundColor,
textColor: textColor,
onTap: onTap,
onEdit: onEdit);
@ -19,12 +23,16 @@ class AddressCell extends StatelessWidget {
{@required this.address,
@required this.name,
@required this.isCurrent,
@required this.backgroundColor,
@required this.textColor,
this.onTap,
this.onEdit});
final String address;
final String name;
final bool isCurrent;
final Color backgroundColor;
final Color textColor;
final Function(String) onTap;
final Function() onEdit;
@ -32,23 +40,19 @@ class AddressCell extends StatelessWidget {
@override
Widget build(BuildContext context) {
const currentTextColor = Colors.blue; // FIXME: Why it's defined here ?
final currentColor =
Theme.of(context).accentTextTheme.subtitle.decorationColor;
final notCurrentColor = Theme.of(context).backgroundColor;
final notCurrentTextColor =
Theme.of(context).primaryTextTheme.caption.color;
final Widget cell = InkWell(
onTap: () => onTap(address),
child: Container(
color: isCurrent ? currentColor : notCurrentColor,
color: backgroundColor,
padding: EdgeInsets.only(left: 24, right: 24, top: 28, bottom: 28),
child: Text(
name ?? address,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: name?.isNotEmpty ?? false ? 18 : 10,
fontSize: 18,
fontWeight: FontWeight.w600,
color: isCurrent ? currentTextColor : notCurrentTextColor,
color: textColor,
),
),
));
@ -62,7 +66,7 @@ class AddressCell extends StatelessWidget {
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).edit,
color: Theme.of(context).primaryTextTheme.overline.color,
color: Colors.blue,
icon: Icons.edit,
onTap: () => onEdit?.call())
]);

View file

@ -23,7 +23,7 @@ class HeaderTile extends StatelessWidget {
top: 24,
bottom: 24
),
color: Theme.of(context).backgroundColor,
color: PaletteDark.nightBlue,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
@ -33,7 +33,7 @@ class HeaderTile extends StatelessWidget {
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w500,
color: Theme.of(context).primaryTextTheme.title.color
color: Colors.white
),
),
Container(
@ -41,7 +41,7 @@ class HeaderTile extends StatelessWidget {
width: 32,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Theme.of(context).primaryTextTheme.overline.color
color: PaletteDark.distantNightBlue
),
child: icon,
)

View file

@ -35,10 +35,10 @@ class QRWidget extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Row(children: <Widget>[
Spacer(flex: 2),
Spacer(flex: 3),
Observer(
builder: (_) => Flexible(
flex: 3,
flex: 5,
child: Center(
child: AspectRatio(
aspectRatio: 1.0,
@ -47,12 +47,12 @@ class QRWidget extends StatelessWidget {
backgroundColor: Colors.transparent,
foregroundColor: PaletteDark.lightBlueGrey,
))))),
Spacer(flex: 2)
Spacer(flex: 3)
]),
Padding(
padding: EdgeInsets.only(top: 20),
child: Text(
'Scan the QR code to get the address',
S.of(context).scan_qr_code,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w500,
@ -62,7 +62,7 @@ class QRWidget extends StatelessWidget {
),
isAmountFieldShow
? Padding(
padding: EdgeInsets.only(top: 60),
padding: EdgeInsets.only(top: 40),
child: Row(
children: <Widget>[
Expanded(
@ -78,8 +78,11 @@ class QRWidget extends StatelessWidget {
],
textAlign: TextAlign.center,
hintText: S.of(context).receive_amount,
textColor: Colors.white,
borderColor: PaletteDark.darkGrey,
validator: AmountValidator(),
validator: AmountValidator(
type: addressListViewModel.type
),
autovalidate: true,
placeholderTextStyle: TextStyle(
color: PaletteDark.cyanBlue,

View file

@ -8,6 +8,7 @@ import 'package:cake_wallet/core/address_label_validator.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/palette.dart';
class AddressEditOrCreatePage extends BasePage {
AddressEditOrCreatePage({@required this.addressEditOrCreateViewModel})
@ -28,6 +29,12 @@ class AddressEditOrCreatePage extends BasePage {
@override
String get title => S.current.new_subaddress_title;
@override
Color get backgroundLightColor => PaletteDark.backgroundColor;
@override
Color get backgroundDarkColor => PaletteDark.backgroundColor;
@override
Widget body(BuildContext context) {
reaction((_) => addressEditOrCreateViewModel.state,
@ -48,6 +55,7 @@ class AddressEditOrCreatePage extends BasePage {
child: Center(
child: BaseTextFormField(
controller: _labelController,
textColor: Colors.white,
hintText: S.of(context).new_subaddress_label_name,
validator: AddressLabelValidator()))),
Observer(

View file

@ -0,0 +1,26 @@
import 'dart:ui';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AlertBackground extends StatelessWidget {
AlertBackground({@required this.child});
final Widget child;
@override
Widget build(BuildContext context) {
return Container(
height: double.infinity,
width: double.infinity,
color: Colors.transparent,
child: BackdropFilter(
filter: ImageFilter.blur(sigmaX: 3.0, sigmaY: 3.0),
child: Container(
decoration: BoxDecoration(color: PaletteDark.darkNightBlue.withOpacity(0.75)),
child: child,
),
),
);
}
}

View file

@ -0,0 +1,28 @@
import 'package:flutter/material.dart';
class AlertCloseButton extends StatelessWidget {
AlertCloseButton({@required this.image});
final Image image;
@override
Widget build(BuildContext context) {
return Positioned(
bottom: 24,
child: GestureDetector(
onTap: () => Navigator.of(context).pop(),
child: Container(
height: 42,
width: 42,
decoration: BoxDecoration(
color: Colors.white,
shape: BoxShape.circle
),
child: Center(
child: image,
),
),
)
);
}
}

View file

@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class CakeScrollbar extends StatelessWidget {
CakeScrollbar({
@required this.backgroundHeight,
@required this.thumbHeight,
@required this.fromTop
});
final double backgroundHeight;
final double thumbHeight;
final double fromTop;
@override
Widget build(BuildContext context) {
return Positioned(
right: 6,
child: Container(
height: backgroundHeight,
width: 6,
decoration: BoxDecoration(
color: PaletteDark.violetBlue,
borderRadius: BorderRadius.all(Radius.circular(3))
),
child: Stack(
children: <Widget>[
AnimatedPositioned(
duration: Duration(milliseconds: 0),
top: fromTop,
child: Container(
height: thumbHeight,
width: 6.0,
decoration: BoxDecoration(
color: PaletteDark.wildBlueGrey,
borderRadius: BorderRadius.all(Radius.circular(3))
),
),
)
],
),
)
);
}
}

View file

@ -0,0 +1,19 @@
import 'package:mobx/mobx.dart';
part 'page_view_store.g.dart';
class PageViewStore = PageViewStoreBase with _$PageViewStore;
abstract class PageViewStoreBase with Store {
PageViewStoreBase() {
setCurrentPage(1);
}
@observable
double currentPage;
@action
void setCurrentPage(double currentPage) {
this.currentPage = currentPage;
}
}

View file

@ -22,6 +22,7 @@ import 'package:cake_wallet/store/dashboard/trades_store.dart';
import 'package:cake_wallet/store/dashboard/trade_filter_store.dart';
import 'package:cake_wallet/store/dashboard/transaction_filter_store.dart';
import 'package:cake_wallet/view_model/dashboard/formatted_item_list.dart';
import 'package:cake_wallet/store/dashboard/page_view_store.dart';
part 'dashboard_view_model.g.dart';
@ -33,7 +34,8 @@ abstract class DashboardViewModelBase with Store {
this.appStore,
this.tradesStore,
this.tradeFilterStore,
this.transactionFilterStore}) {
this.transactionFilterStore,
this.pageViewStore}) {
name = appStore.wallet?.name;
wallet ??= appStore.wallet;
@ -53,8 +55,6 @@ abstract class DashboardViewModelBase with Store {
if (_wallet is MoneroWallet) {
subname = _wallet.account?.label;
}
currentPage = 1;
}
@observable
@ -63,15 +63,15 @@ abstract class DashboardViewModelBase with Store {
@observable
String name;
@observable
double currentPage;
@observable
ObservableList<TransactionListItem> transactions;
@observable
String subname;
@computed
double get currentPage => pageViewStore.currentPage;
@computed
String get address => wallet.address;
@ -130,6 +130,8 @@ abstract class DashboardViewModelBase with Store {
TransactionFilterStore transactionFilterStore;
PageViewStore pageViewStore;
ReactionDisposer _reaction;
void _onWalletChange(WalletBase wallet) {

View file

@ -9,7 +9,15 @@ class MoneroAccountListViewModel = MoneroAccountListViewModelBase
with _$MoneroAccountListViewModel;
abstract class MoneroAccountListViewModelBase with Store {
MoneroAccountListViewModelBase(this._moneroWallet);
MoneroAccountListViewModelBase(this._moneroWallet) : scrollOffsetFromTop = 0;
@observable
double scrollOffsetFromTop;
@action
void setScrollOffsetFromTop(double scrollOffsetFromTop) {
this.scrollOffsetFromTop = scrollOffsetFromTop;
}
@computed
List<AccountListItem> get accounts => _moneroWallet.accountList.accounts

View file

@ -7,6 +7,7 @@ import 'package:cake_wallet/utils/list_item.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_account_list_header.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_header.dart';
import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_list_item.dart';
import 'package:cake_wallet/src/domain/common/wallet_type.dart';
part 'wallet_address_list_view_model.g.dart';
@ -62,6 +63,9 @@ abstract class WalletAddressListViewModelBase with Store {
@observable
String amount;
@computed
WalletType get type => _wallet.type;
@computed
WalletAddressListItem get address => WalletAddressListItem(address: _wallet.address);

View file

@ -137,6 +137,8 @@
"share_address" : "Adresse teilen ",
"receive_amount" : "Menge",
"subaddresses" : "Unteradressen",
"addresses" : "Adressen",
"scan_qr_code" : "Scannen Sie den QR-Code, um die Adresse zu erhalten",
"rename" : "Umbenennen",
"choose_account" : "Konto auswählen",
"create_new_account" : "Neues Konto erstellen",

View file

@ -138,6 +138,7 @@
"receive_amount" : "Amount",
"subaddresses" : "Subaddresses",
"addresses" : "Addresses",
"scan_qr_code" : "Scan the QR code to get the address",
"rename" : "Rename",
"choose_account" : "Choose account",
"create_new_account" : "Create new account",

View file

@ -137,6 +137,8 @@
"share_address" : "Compartir dirección",
"receive_amount" : "Cantidad",
"subaddresses" : "Subdirecciones",
"addresses" : "Direcciones",
"scan_qr_code" : "Escanee el código QR para obtener la dirección",
"rename" : "Rebautizar",
"choose_account" : "Elegir cuenta",
"create_new_account" : "Crear una nueva cuenta",

View file

@ -137,6 +137,8 @@
"share_address" : "पता साझा करें",
"receive_amount" : "रकम",
"subaddresses" : "उप पते",
"addresses" : "पतों",
"scan_qr_code" : "पता प्राप्त करने के लिए QR कोड स्कैन करें",
"rename" : "नाम बदलें",
"choose_account" : "खाता चुनें",
"create_new_account" : "नया खाता बनाएँ",

View file

@ -137,6 +137,8 @@
"share_address" : "住所を共有する",
"receive_amount" : "量",
"subaddresses" : "サブアドレス",
"addresses" : "住所",
"scan_qr_code" : "QRコードをスキャンして住所を取得します",
"rename" : "リネーム",
"choose_account" : "アカウントを選択",
"create_new_account" : "新しいアカウントを作成する",

View file

@ -137,6 +137,8 @@
"share_address" : "주소 공유",
"receive_amount" : "양",
"subaddresses" : "하위 주소",
"addresses" : "구애",
"scan_qr_code" : "QR 코드를 스캔하여 주소를 얻습니다.",
"rename" : "이름 바꾸기",
"choose_account" : "계정을 선택하십시오",
"create_new_account" : "새 계정을 만들",

View file

@ -138,6 +138,8 @@
"receive_amount" : "Bedrag",
"subaddresses" : "Subadressen",
"rename" : "Hernoemen",
"addresses" : "Adressen",
"scan_qr_code" : "Scan de QR-code om het adres te krijgen",
"choose_account" : "Kies account",
"create_new_account" : "Creëer een nieuw account",
"accounts_subaddresses" : "Accounts en subadressen",

View file

@ -137,6 +137,8 @@
"share_address" : "Udostępnij adres",
"receive_amount" : "Ilość",
"subaddresses" : "Podadresy",
"addresses" : "Adresy",
"scan_qr_code" : "Zeskanuj kod QR, aby uzyskać adres",
"rename" : "Przemianować",
"choose_account" : "Wybierz konto",
"create_new_account" : "Stwórz nowe konto",

View file

@ -137,6 +137,8 @@
"share_address" : "Compartilhar endereço",
"receive_amount" : "Quantia",
"subaddresses" : "Sub-endereços",
"addresses" : "Endereços",
"scan_qr_code" : "Digitalize o código QR para obter o endereço",
"rename" : "Renomear",
"choose_account" : "Escolha uma conta",
"create_new_account" : "Criar nova conta",

View file

@ -137,6 +137,8 @@
"share_address" : "Поделиться адресом",
"receive_amount" : "Сумма",
"subaddresses" : "Субадреса",
"addresses" : "Адреса",
"scan_qr_code" : "Отсканируйте QR-код для получения адреса",
"rename" : "Переименовать",
"choose_account" : "Выберите аккаунт",
"create_new_account" : "Создать новый аккаунт",

View file

@ -137,6 +137,8 @@
"share_address" : "Поділитися адресою",
"receive_amount" : "Сума",
"subaddresses" : "Субадреси",
"addresses" : "Адреси",
"scan_qr_code" : "Скануйте QR-код для одержання адреси",
"rename" : "Перейменувати",
"choose_account" : "Оберіть акаунт",
"create_new_account" : "Створити новий акаунт",

View file

@ -137,6 +137,8 @@
"share_address" : "分享地址",
"receive_amount" : "量",
"subaddresses" : "子地址",
"addresses" : "地址",
"scan_qr_code" : "掃描二維碼獲取地址",
"rename" : "改名",
"choose_account" : "選擇帳號",
"create_new_account" : "建立新帳戶",