CWA-209 | applied new design to account_list_page, account_page and new_subaddress_page; moved header tile from receive_page to a single file; created account tile and base text form field

This commit is contained in:
Oleksandr Sobol
2020-05-06 20:40:36 +03:00
parent 66aebb4d65
commit e1de337ab1
25 changed files with 689 additions and 373 deletions
+131 -98
View File
@@ -1,120 +1,153 @@
import 'dart:ui';
import 'package:provider/provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter_mobx/flutter_mobx.dart';
import 'package:flutter_slidable/flutter_slidable.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/routes.dart';
import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/stores/account_list/account_list_store.dart';
import 'package:cake_wallet/src/screens/accounts/widgets/account_tile.dart';
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
class AccountListPage extends BasePage {
@override
String get title => S.current.accounts;
class AccountListPage extends StatefulWidget {
AccountListPage({@required this.accountListStore});
final AccountListStore accountListStore;
@override
Widget trailing(BuildContext context) {
final accountListStore = Provider.of<AccountListStore>(context);
AccountListPageForm createState() => AccountListPageForm(accountListStore);
}
return Container(
width: 28.0,
height: 28.0,
decoration: BoxDecoration(
shape: BoxShape.circle, color: Theme.of(context).selectedRowColor),
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Icon(Icons.add, color: Palette.violet, size: 22.0),
ButtonTheme(
minWidth: 28.0,
height: 28.0,
child: FlatButton(
shape: CircleBorder(),
onPressed: () async {
await Navigator.of(context)
.pushNamed(Routes.accountCreation);
accountListStore.updateAccountList();
},
child: Offstage()),
)
],
));
}
class AccountListPageForm extends State<AccountListPage> {
AccountListPageForm(this.accountListStore);
final AccountListStore accountListStore;
@override
Widget body(BuildContext context) {
final accountListStore = Provider.of<AccountListStore>(context);
Widget build(BuildContext context) {
final walletStore = Provider.of<WalletStore>(context);
final currentColor = Theme.of(context).selectedRowColor;
final notCurrentColor = Theme.of(context).backgroundColor;
return Container(
padding: EdgeInsets.only(top: 10, bottom: 20),
child: Observer(builder: (_) {
final accounts = accountListStore.accounts;
return ListView.builder(
itemCount: accounts == null ? 0 : accounts.length,
itemBuilder: (BuildContext context, int index) {
final account = accounts[index];
return Observer(builder: (_) {
final isCurrent = walletStore.account.id == account.id;
return Slidable(
key: Key(account.id.toString()),
actionPane: SlidableDrawerActionPane(),
child: Container(
color: isCurrent ? currentColor : notCurrentColor,
child: Column(
children: <Widget>[
ListTile(
title: Text(
account.label,
style: TextStyle(
fontSize: 16.0,
color: Theme.of(context)
.primaryTextTheme
.headline
.color),
),
onTap: () {
if (isCurrent) {
return;
}
walletStore.setAccount(account);
Navigator.of(context).pop();
},
),
Divider(
color: Theme.of(context).dividerTheme.color,
height: 1.0,
)
],
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.historyPanel.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
),
),
),
secondaryActions: <Widget>[
IconSlideAction(
caption: S.of(context).edit,
color: Colors.blue,
icon: Icons.edit,
onTap: () async {
await Navigator.of(context).pushNamed(
Routes.accountCreation,
arguments: account);
// await accountListStore.updateAccountList().then((_) {
// if (isCurrent) walletStore.setAccount(accountListStore.accounts[index]);
// });
},
)
],
);
});
});
}),
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.menuList,
child: Column(
children: <Widget>[
Expanded(
child: Observer(
builder: (_) {
final accounts = accountListStore.accounts;
return ListView.separated(
separatorBuilder: (context, index) => Divider(
color: PaletteDark.mainBackgroundColor,
height: 1,
),
itemCount: accounts == null ? 0 : accounts.length,
itemBuilder: (context, index) {
final account = accounts[index];
return Observer(
builder: (_) {
final isCurrent = walletStore.account.id == account.id;
return AccountTile(
isCurrent: isCurrent,
accountName: account.label,
onTap: () {
if (isCurrent) {
return;
}
walletStore.setAccount(account);
Navigator.of(context).pop();
}
);
}
);
},
);
}
)
),
GestureDetector(
onTap: () async {
await Navigator.of(context)
.pushNamed(Routes.accountCreation);
accountListStore.updateAccountList();
},
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.historyPanel,
),
Padding(
padding: EdgeInsets.only(left: 5),
child: Text(
S.of(context).create_new_account,
style: TextStyle(
fontSize: 15,
fontWeight: FontWeight.w600,
color: PaletteDark.historyPanel,
decoration: TextDecoration.none,
),
),
)
],
),
),
),
)
],
),
),
),
),
)
],
),
),
),
),
),
);
}
}
+26 -23
View File
@@ -8,6 +8,7 @@ import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/domain/monero/account.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class AccountPage extends BasePage {
AccountPage({this.account});
@@ -15,7 +16,10 @@ class AccountPage extends BasePage {
final Account account;
@override
String get title => 'Account';
String get title => S.current.account;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => AccountForm(account);
@@ -50,30 +54,31 @@ class AccountFormState extends State<AccountForm> {
Widget build(BuildContext context) {
final accountListStore = Provider.of<AccountListStore>(context);
_textController.addListener(() {
if (_textController.text.isNotEmpty) {
accountListStore.setDisabledStatus(false);
} else {
accountListStore.setDisabledStatus(true);
}
});
return Form(
key: _formKey,
child: Container(
padding: EdgeInsets.all(20.0),
color: PaletteDark.historyPanel,
padding: EdgeInsets.all(24.0),
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: TextFormField(
decoration: InputDecoration(
hintStyle: TextStyle(color: Theme.of(context).hintColor),
child: BaseTextFormField(
controller: _textController,
hintText: S.of(context).account,
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Palette.cakeGreen, width: 2.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor, width: 1.0))),
controller: _textController,
validator: (value) {
accountListStore.validateAccountName(value);
return accountListStore.errorMessage;
},
),
validator: (value) {
accountListStore.validateAccountName(value);
return accountListStore.errorMessage;
},
)
)),
Observer(
builder: (_) => LoadingPrimaryButton(
@@ -93,13 +98,11 @@ class AccountFormState extends State<AccountForm> {
Navigator.of(context).pop(_textController.text);
},
text:
widget.account != null ? 'Rename' : S.of(context).add,
color: Theme.of(context)
.primaryTextTheme
.button
.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
widget.account != null ? S.of(context).rename : S.of(context).add,
color: Colors.green,
textColor: Colors.white,
isLoading: accountListStore.isAccountCreating,
isDisabled: accountListStore.isDisabledStatus,
))
],
),
@@ -0,0 +1,39 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class AccountTile extends StatelessWidget {
AccountTile({
@required this.isCurrent,
@required this.accountName,
@required this.onTap
});
final bool isCurrent;
final String accountName;
final VoidCallback onTap;
@override
Widget build(BuildContext context) {
final color = isCurrent ? PaletteDark.menuHeader : Colors.transparent;
final textColor = isCurrent ? Colors.blue : Colors.white;
return GestureDetector(
onTap: onTap,
child: Container(
height: 77,
padding: EdgeInsets.only(left: 24, right: 24),
alignment: Alignment.centerLeft,
color: color,
child: Text(
accountName,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: textColor,
decoration: TextDecoration.none,
),
),
),
);
}
}
@@ -433,7 +433,7 @@ class WalletCardState extends State<WalletCard> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
S.current.subaddresses,
S.of(context).accounts_subaddresses,
style: TextStyle(
fontSize: 14,
color: Colors.white
+159 -200
View File
@@ -11,6 +11,10 @@ import 'package:cake_wallet/src/stores/subaddress_list/subaddress_list_store.dar
import 'package:cake_wallet/src/stores/wallet/wallet_store.dart';
import 'package:cake_wallet/src/screens/receive/widgets/qr_image.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/src/screens/accounts/account_list_page.dart';
import 'package:cake_wallet/src/stores/account_list/account_list_store.dart';
import 'package:cake_wallet/src/screens/receive/widgets/header_tile.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class ReceivePage extends BasePage {
@override
@@ -37,7 +41,7 @@ class ReceivePage extends BasePage {
splashColor: Colors.transparent,
padding: EdgeInsets.all(0),
onPressed: () => Share.text(
'Share address', walletStore.subaddress.address, 'text/plain'),
S.current.share_address, walletStore.subaddress.address, 'text/plain'),
child: shareImage),
),
);
@@ -66,6 +70,7 @@ class ReceiveBodyState extends State<ReceiveBody> {
Widget build(BuildContext context) {
final walletStore = Provider.of<WalletStore>(context);
final subaddressListStore = Provider.of<SubaddressListStore>(context);
final accountListStore = Provider.of<AccountListStore>(context);
final copyImage = Image.asset('assets/images/copy_content.png');
@@ -122,231 +127,185 @@ class ReceiveBodyState extends State<ReceiveBody> {
Expanded(
child: Form(
key: _formKey,
child: TextFormField(
keyboardType:
TextInputType.numberWithOptions(decimal: true),
child: BaseTextFormField(
controller: amountController,
keyboardType: TextInputType.numberWithOptions(decimal: true),
inputFormatters: [
BlacklistingTextInputFormatter(
RegExp('[\\-|\\ |\\,]'))
],
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 20.0,
color: Colors.white
),
decoration: InputDecoration(
hintStyle: TextStyle(
fontSize: 20,
color: PaletteDark.walletCardText),
hintText: S.of(context).amount,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.walletCardText, width: 1.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: PaletteDark.walletCardText,
width: 1.0))),
hintText: S.of(context).receive_amount,
borderColor: PaletteDark.walletCardText,
validator: (value) {
walletStore.validateAmount(value);
return walletStore.errorMessage;
},
autovalidate: true,
controller: amountController,
)))
)
)
)
],
),
),
Padding(
padding: EdgeInsets.only(left: 24, right: 24, bottom: 24),
child: Observer(
builder: (_) => GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: walletStore.subaddress.address));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(
S.of(context).copied_to_clipboard,
style: TextStyle(color: Colors.white),
builder: (_) => GestureDetector(
onTap: () {
Clipboard.setData(ClipboardData(
text: walletStore.subaddress.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: 54,
padding: EdgeInsets.only(left: 24, right: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(27)),
color: PaletteDark.walletCardSubAddressField
),
backgroundColor: Colors.green,
duration: Duration(milliseconds: 500),
));
},
child: Container(
height: 54,
padding: EdgeInsets.only(left: 24, right: 24),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(27)),
color: PaletteDark.walletCardSubAddressField
),
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
walletStore.subaddress.address,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white
child: Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Expanded(
child: Text(
walletStore.subaddress.address,
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
),
),
Padding(
padding: EdgeInsets.only(left: 12),
child: copyImage,
)
],
Padding(
padding: EdgeInsets.only(left: 12),
child: copyImage,
)
],
),
),
),
)
)
),
),
Flexible(
flex: 3,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
child: Container(
color: PaletteDark.historyPanel,
child: Observer(
builder: (_) => ListView.separated(
separatorBuilder: (context, index) => Divider(
height: 1,
color: PaletteDark.menuList,
),
itemCount: subaddressListStore.subaddresses.length + 2,
itemBuilder: (context, index) {
if (index == 0) {
return accountTile(
onTap: () {},
title: walletStore.account.label,
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Colors.white,
)
);
}
if (index == 1) {
return accountTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).subaddresses,
icon: Icon(
Icons.add,
size: 20,
color: Colors.white,
)
);
}
index -= 2;
return Observer(
builder: (_) {
final subaddress = subaddressListStore.subaddresses[index];
final isCurrent =
walletStore.subaddress.address == subaddress.address;
final label = subaddress.label;
final address = subaddress.address;
return InkWell(
onTap: () => walletStore.setSubaddress(subaddress),
child: Container(
color: isCurrent ? currentColor : notCurrentColor,
padding: EdgeInsets.only(
left: 24,
right: 24,
top: 32,
bottom: 32
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
label.isNotEmpty
? Text(
label,
style: TextStyle(
fontSize: 14,
color: PaletteDark.walletCardText
),
)
: Offstage(),
Padding(
padding: label.isNotEmpty
? EdgeInsets.only(top: 10)
: EdgeInsets.only(top: 0),
child: Text(
address,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
)
]),
),
);
}
);
}
)
flex: 3,
child: ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(24),
topRight: Radius.circular(24),
),
),
)
child: Container(
color: PaletteDark.historyPanel,
child: Observer(
builder: (_) => ListView.separated(
separatorBuilder: (context, index) => Divider(
height: 1,
color: PaletteDark.menuList,
),
itemCount: subaddressListStore.subaddresses.length + 2,
itemBuilder: (context, index) {
if (index == 0) {
return HeaderTile(
onTap: () async {
await showDialog<void>(
context: context,
builder: (BuildContext context) {
return AccountListPage(accountListStore: accountListStore);
}
);
},
title: walletStore.account.label,
icon: Icon(
Icons.arrow_forward_ios,
size: 14,
color: Colors.white,
)
);
}
if (index == 1) {
return HeaderTile(
onTap: () => Navigator.of(context)
.pushNamed(Routes.newSubaddress),
title: S.of(context).subaddresses,
icon: Icon(
Icons.add,
size: 20,
color: Colors.white,
)
);
}
index -= 2;
return Observer(
builder: (_) {
final subaddress = subaddressListStore.subaddresses[index];
final isCurrent =
walletStore.subaddress.address == subaddress.address;
final label = subaddress.label;
final address = subaddress.address;
return InkWell(
onTap: () => walletStore.setSubaddress(subaddress),
child: Container(
color: isCurrent ? currentColor : notCurrentColor,
padding: EdgeInsets.only(
left: 24,
right: 24,
top: 32,
bottom: 32
),
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
label.isNotEmpty
? Text(
label,
style: TextStyle(
fontSize: 14,
color: PaletteDark.walletCardText
),
)
: Offstage(),
Padding(
padding: label.isNotEmpty
? EdgeInsets.only(top: 10)
: EdgeInsets.only(top: 0),
child: Text(
address,
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
color: Colors.white
),
),
)
]),
),
);
}
);
}
)
),
),
)
)
],
),
);
}
Widget accountTile({
@required VoidCallback onTap,
@required String title,
@required Icon icon
}) => GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.only(
left: 24,
right: 24,
top: 32,
bottom: 32
),
color: Colors.transparent,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white
),
),
Container(
height: 32,
width: 32,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: PaletteDark.menuList
),
child: icon,
)
],
),
),
);
}
}
@@ -0,0 +1,53 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
class HeaderTile extends StatelessWidget {
HeaderTile({
@required this.onTap,
@required this.title,
@required this.icon
});
final VoidCallback onTap;
final String title;
final Icon icon;
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Container(
padding: EdgeInsets.only(
left: 24,
right: 24,
top: 32,
bottom: 32
),
color: Colors.transparent,
child: Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
title,
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Colors.white
),
),
Container(
height: 32,
width: 32,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: PaletteDark.menuList
),
child: icon,
)
],
),
),
);
}
}
@@ -9,11 +9,15 @@ import 'package:cake_wallet/src/stores/subaddress_creation/subaddress_creation_s
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/src/widgets/base_text_form_field.dart';
class NewSubaddressPage extends BasePage {
@override
String get title => S.current.new_subaddress_title;
@override
Color get backgroundColor => PaletteDark.historyPanel;
@override
Widget body(BuildContext context) => NewSubaddressForm();
@@ -42,40 +46,45 @@ class NewSubaddressFormState extends State<NewSubaddressForm> {
final _formKey = GlobalKey<FormState>();
final _labelController = TextEditingController();
@override
void dispose() {
_labelController.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
final subaddressCreationStore =
Provider.of<SubadrressCreationStore>(context);
_labelController.addListener(() {
if (_labelController.text.isNotEmpty) {
subaddressCreationStore.setDisabledStatus(false);
} else {
subaddressCreationStore.setDisabledStatus(true);
}
});
return Form(
key: _formKey,
child: Stack(children: <Widget>[
Center(
child: Padding(
padding: EdgeInsets.only(left: 35, right: 35),
child: TextFormField(
controller: _labelController,
decoration: InputDecoration(
hintStyle: TextStyle(color: Theme.of(context).hintColor),
hintText: S.of(context).new_subaddress_label_name,
focusedBorder: UnderlineInputBorder(
borderSide:
BorderSide(color: Palette.cakeGreen, width: 2.0)),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context).focusColor,
width: 1.0))),
validator: (value) {
subaddressCreationStore.validateSubaddressName(value);
return subaddressCreationStore.errorMessage;
}),
),
),
Positioned(
bottom: 20,
left: 20,
right: 20,
child: Observer(
child: Container(
color: PaletteDark.historyPanel,
padding: EdgeInsets.all(24.0),
child: Column(
children: <Widget>[
Expanded(
child: Center(
child: BaseTextFormField(
controller: _labelController,
hintText: S.of(context).new_subaddress_label_name,
validator: (value) {
subaddressCreationStore.validateSubaddressName(value);
return subaddressCreationStore.errorMessage;
}
)
)
),
Observer(
builder: (_) => LoadingPrimaryButton(
onPressed: () async {
if (_formKey.currentState.validate()) {
@@ -85,14 +94,16 @@ class NewSubaddressFormState extends State<NewSubaddressForm> {
}
},
text: S.of(context).new_subaddress_create,
color: Theme.of(context)
.accentTextTheme
.button
.backgroundColor,
textColor: Theme.of(context).primaryTextTheme.button.color,
color: Colors.green,
textColor: Colors.white,
isLoading:
subaddressCreationStore.state is SubaddressIsCreating),
))
]));
subaddressCreationStore.state is SubaddressIsCreating,
isDisabled: subaddressCreationStore.isDisabledStatus,
),
)
],
),
)
);
}
}
@@ -16,6 +16,7 @@ abstract class AcountListStoreBase with Store {
AcountListStoreBase({@required WalletService walletService}) {
accounts = [];
isAccountCreating = false;
isDisabledStatus = true;
if (walletService.currentWallet != null) {
_onWalletChanged(walletService.currentWallet);
@@ -37,10 +38,18 @@ abstract class AcountListStoreBase with Store {
@observable
bool isAccountCreating;
@observable
bool isDisabledStatus;
AccountList _accountList;
StreamSubscription<Wallet> _onWalletChangeSubscription;
StreamSubscription<List<Account>> _onAccountsChangeSubscription;
@action
void setDisabledStatus(bool isDisabled) {
isDisabledStatus = isDisabled;
}
@override
void dispose() {
_onWalletChangeSubscription.cancel();
@@ -17,6 +17,7 @@ class SubadrressCreationStore = SubadrressCreationStoreBase
abstract class SubadrressCreationStoreBase with Store {
SubadrressCreationStoreBase({@required WalletService walletService}) {
state = SubaddressCreationStateInitial();
isDisabledStatus = true;
if (walletService.currentWallet != null) {
_onWalletChanged(walletService.currentWallet);
@@ -34,11 +35,19 @@ abstract class SubadrressCreationStoreBase with Store {
@observable
String errorMessage;
@observable
bool isDisabledStatus;
SubaddressList _subaddressList;
StreamSubscription<Wallet> _onWalletChangeSubscription;
StreamSubscription<Account> _onAccountChangeSubscription;
Account _account;
@action
void setDisabledStatus(bool isDisabled) {
isDisabledStatus = isDisabled;
}
@override
void dispose() {
_onWalletChangeSubscription.cancel();
+70
View File
@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';
import 'package:cake_wallet/palette.dart';
import 'package:flutter/services.dart';
class BaseTextFormField extends StatelessWidget {
BaseTextFormField({
this.controller,
this.keyboardType = TextInputType.text,
this.textInputAction = TextInputAction.done,
this.textAlign = TextAlign.start,
this.autovalidate = false,
this.hintText = '',
this.maxLines = 1,
this.inputFormatters,
this.textColor = Colors.white,
this.hintColor = PaletteDark.walletCardText,
this.borderColor = PaletteDark.menuList,
this.validator
});
final TextEditingController controller;
final TextInputType keyboardType;
final TextInputAction textInputAction;
final TextAlign textAlign;
final bool autovalidate;
final String hintText;
final int maxLines;
final List<TextInputFormatter> inputFormatters;
final Color textColor;
final Color hintColor;
final Color borderColor;
final FormFieldValidator<String> validator;
@override
Widget build(BuildContext context) {
return TextFormField(
controller: controller,
keyboardType: keyboardType,
textInputAction: textInputAction,
textAlign: textAlign,
autovalidate: autovalidate,
maxLines: maxLines,
inputFormatters: inputFormatters,
style: TextStyle(
fontSize: 16.0,
color: textColor
),
decoration: InputDecoration(
hintStyle: TextStyle(
color: hintColor,
fontSize: 16
),
hintText: hintText,
focusedBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor,
width: 1.0
)
),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: borderColor,
width: 1.0
)
)
),
validator: validator,
);
}
}