mirror of
https://github.com/cake-tech/cake_wallet.git
synced 2024-12-23 12:09:43 +00:00
Merge branch 'CAKE-29-remake-node-screen-and-contact-book' of github.com:cake-tech/cake_wallet_private into btc
This commit is contained in:
commit
2627945e00
10 changed files with 200 additions and 268 deletions
|
@ -9,6 +9,7 @@ import 'package:cake_wallet/src/domain/common/crypto_currency.dart';
|
||||||
import 'package:cake_wallet/src/screens/base_page.dart';
|
import 'package:cake_wallet/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
|
||||||
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
import 'package:cake_wallet/view_model/contact_list/contact_list_view_model.dart';
|
||||||
|
import 'package:cake_wallet/src/widgets/standard_list.dart';
|
||||||
|
|
||||||
class ContactListPage extends BasePage {
|
class ContactListPage extends BasePage {
|
||||||
ContactListPage(this.contactListViewModel, {this.isEditable = true});
|
ContactListPage(this.contactListViewModel, {this.isEditable = true});
|
||||||
|
@ -30,7 +31,7 @@ class ContactListPage extends BasePage {
|
||||||
height: 32.0,
|
height: 32.0,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
color: Theme.of(context).accentTextTheme.title.backgroundColor),
|
color: Theme.of(context).accentTextTheme.caption.color),
|
||||||
child: Stack(
|
child: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
|
@ -54,30 +55,30 @@ class ContactListPage extends BasePage {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
|
final shortDivider = Container(
|
||||||
|
height: 1,
|
||||||
|
padding: EdgeInsets.only(left: 24),
|
||||||
|
color: Theme.of(context).backgroundColor,
|
||||||
|
child: Container(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
return Container(
|
return Container(
|
||||||
color: Theme.of(context).backgroundColor,
|
|
||||||
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
padding: EdgeInsets.only(top: 20.0, bottom: 20.0),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (_) {
|
builder: (_) {
|
||||||
return contactListViewModel.contacts.isNotEmpty
|
return contactListViewModel.contacts.isNotEmpty
|
||||||
? ListView.separated(
|
? SectionStandardList(
|
||||||
separatorBuilder: (_, __) => Container(
|
sectionCount: 1,
|
||||||
height: 1,
|
context: context,
|
||||||
padding: EdgeInsets.only(left: 24),
|
itemCounter: (int sectionIndex) => contactListViewModel.contacts.length,
|
||||||
color: Theme.of(context)
|
itemBuilder: (_, sectionIndex, index) {
|
||||||
.accentTextTheme
|
final contact = contactListViewModel.contacts[index];
|
||||||
.title
|
final image = _getCurrencyImage(contact.type);
|
||||||
.backgroundColor,
|
final content = Builder(
|
||||||
child: Container(
|
builder: (context) => GestureDetector(
|
||||||
height: 1,
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
itemCount: contactListViewModel.contacts.length,
|
|
||||||
itemBuilder: (BuildContext context, int index) {
|
|
||||||
final contact = contactListViewModel.contacts[index];
|
|
||||||
final image = _getCurrencyImage(contact.type);
|
|
||||||
final content = GestureDetector(
|
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
if (!isEditable) {
|
if (!isEditable) {
|
||||||
Navigator.of(context).pop(contact);
|
Navigator.of(context).pop(contact);
|
||||||
|
@ -106,10 +107,6 @@ class ContactListPage extends BasePage {
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Container(
|
Container(
|
||||||
width: double.infinity,
|
width: double.infinity,
|
||||||
color: Theme.of(context)
|
|
||||||
.accentTextTheme
|
|
||||||
.title
|
|
||||||
.backgroundColor,
|
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
left: 24, top: 16, bottom: 16, right: 24),
|
left: 24, top: 16, bottom: 16, right: 24),
|
||||||
|
@ -117,7 +114,7 @@ class ContactListPage extends BasePage {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.center,
|
CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
image ?? Offstage(),
|
image ?? Offstage(),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -128,6 +125,7 @@ class ContactListPage extends BasePage {
|
||||||
contact.name,
|
contact.name,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
fontWeight: FontWeight.normal,
|
||||||
color: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.primaryTextTheme
|
.primaryTextTheme
|
||||||
.title
|
.title
|
||||||
|
@ -139,57 +137,55 @@ class ContactListPage extends BasePage {
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
|
||||||
return !isEditable
|
return !isEditable
|
||||||
? content
|
? content
|
||||||
: Slidable(
|
: Slidable(
|
||||||
key: Key('${contact.key}'),
|
key: Key('${contact.key}'),
|
||||||
actionPane: SlidableDrawerActionPane(),
|
actionPane: SlidableDrawerActionPane(),
|
||||||
child: content,
|
child: content,
|
||||||
secondaryActions: <Widget>[
|
secondaryActions: <Widget>[
|
||||||
IconSlideAction(
|
IconSlideAction(
|
||||||
caption: S.of(context).edit,
|
caption: S.of(context).edit,
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
icon: Icons.edit,
|
icon: Icons.edit,
|
||||||
onTap: () async => await Navigator.of(context)
|
onTap: () async => await Navigator.of(context)
|
||||||
.pushNamed(Routes.addressBookAddContact,
|
.pushNamed(Routes.addressBookAddContact,
|
||||||
arguments: contact),
|
arguments: contact),
|
||||||
),
|
),
|
||||||
IconSlideAction(
|
IconSlideAction(
|
||||||
caption: S.of(context).delete,
|
caption: S.of(context).delete,
|
||||||
color: Colors.red,
|
color: Colors.red,
|
||||||
icon: CupertinoIcons.delete,
|
icon: CupertinoIcons.delete,
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
final isDelete =
|
final isDelete =
|
||||||
await showAlertDialog(context) ?? false;
|
await showAlertDialog(context) ?? false;
|
||||||
|
|
||||||
if (isDelete) {
|
if (isDelete) {
|
||||||
await contactListViewModel
|
await contactListViewModel
|
||||||
.delete(contact);
|
.delete(contact);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
dismissal: SlidableDismissal(
|
dismissal: SlidableDismissal(
|
||||||
child: SlidableDrawerDismissal(),
|
child: SlidableDrawerDismissal(),
|
||||||
onDismissed: (actionType) async =>
|
onDismissed: (actionType) async =>
|
||||||
await contactListViewModel.delete(contact),
|
await contactListViewModel.delete(contact),
|
||||||
onWillDismiss: (actionType) async =>
|
onWillDismiss: (actionType) async =>
|
||||||
showAlertDialog(context),
|
showAlertDialog(context),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
})
|
},
|
||||||
|
)
|
||||||
: Center(
|
: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
S.of(context).placeholder_contacts,
|
S.of(context).placeholder_contacts,
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Theme.of(context)
|
color: Colors.grey,
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color
|
|
||||||
.withOpacity(0.5),
|
|
||||||
fontSize: 14),
|
fontSize: 14),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
@ -30,7 +31,7 @@ class ContactPage extends BasePage {
|
||||||
.addListener(() => contactViewModel.address = _addressController.text);
|
.addListener(() => contactViewModel.address = _addressController.text);
|
||||||
|
|
||||||
autorun((_) =>
|
autorun((_) =>
|
||||||
_currencyTypeController.text = contactViewModel.currency.toString());
|
_currencyTypeController.text = contactViewModel.currency?.toString()??'');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -45,7 +46,7 @@ class ContactPage extends BasePage {
|
||||||
@override
|
@override
|
||||||
Widget body(BuildContext context) {
|
Widget body(BuildContext context) {
|
||||||
final downArrow = Image.asset('assets/images/arrow_bottom_purple_icon.png',
|
final downArrow = Image.asset('assets/images/arrow_bottom_purple_icon.png',
|
||||||
color: Theme.of(context).dividerColor, height: 8);
|
color: Theme.of(context).primaryTextTheme.overline.color, height: 8);
|
||||||
|
|
||||||
reaction((_) => contactViewModel.state, (ContactViewModelState state) {
|
reaction((_) => contactViewModel.state, (ContactViewModelState state) {
|
||||||
if (state is ContactCreationFailure) {
|
if (state is ContactCreationFailure) {
|
||||||
|
@ -57,79 +58,83 @@ class ContactPage extends BasePage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
return Container(
|
return ScrollableWithBottomSection(
|
||||||
color: Theme.of(context).backgroundColor,
|
contentPadding: EdgeInsets.all(24),
|
||||||
child: ScrollableWithBottomSection(
|
content: Form(
|
||||||
contentPadding: EdgeInsets.all(24),
|
key: _formKey,
|
||||||
content: Form(
|
child: Column(
|
||||||
key: _formKey,
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
mainAxisSize: MainAxisSize.min,
|
BaseTextFormField(
|
||||||
children: <Widget>[
|
controller: _nameController,
|
||||||
BaseTextFormField(
|
hintText: S.of(context).contact_name,
|
||||||
controller: _nameController,
|
validator: ContactNameValidator()),
|
||||||
hintText: S.of(context).contact_name,
|
Padding(
|
||||||
validator: ContactNameValidator()),
|
padding: EdgeInsets.only(top: 20),
|
||||||
Padding(
|
child: Container(
|
||||||
padding: EdgeInsets.only(top: 20),
|
child: InkWell(
|
||||||
child: Container(
|
onTap: () => _presentCurrencyPicker(context),
|
||||||
child: InkWell(
|
child: IgnorePointer(
|
||||||
onTap: () => _presentCurrencyPicker(context),
|
child: BaseTextFormField(
|
||||||
child: IgnorePointer(
|
controller: _currencyTypeController,
|
||||||
child: BaseTextFormField(
|
hintText: S.of(context).settings_currency,
|
||||||
controller: _currencyTypeController,
|
suffixIcon: Row(
|
||||||
hintText: S.of(context).settings_currency,
|
mainAxisSize: MainAxisSize.min,
|
||||||
suffixIcon: Row(
|
mainAxisAlignment: MainAxisAlignment.end,
|
||||||
mainAxisSize: MainAxisSize.min,
|
children: <Widget>[downArrow],
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
),
|
||||||
children: <Widget>[downArrow],
|
)),
|
||||||
),
|
|
||||||
)),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.only(top: 20),
|
|
||||||
child: Observer(
|
|
||||||
builder: (_) => AddressTextField(
|
|
||||||
controller: _addressController,
|
|
||||||
options: [AddressTextFieldOption.qrCode],
|
|
||||||
validator: AddressValidator(
|
|
||||||
type: contactViewModel.currency),
|
|
||||||
)),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
bottomSectionPadding:
|
|
||||||
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
|
||||||
bottomSection: Row(
|
|
||||||
children: <Widget>[
|
|
||||||
Expanded(
|
|
||||||
child: PrimaryButton(
|
|
||||||
onPressed: () => contactViewModel.reset(),
|
|
||||||
text: S.of(context).reset,
|
|
||||||
color: Colors.red,
|
|
||||||
textColor: Colors.white),
|
|
||||||
),
|
),
|
||||||
SizedBox(width: 20),
|
Padding(
|
||||||
Expanded(
|
padding: EdgeInsets.only(top: 20),
|
||||||
child: Observer(
|
child: Observer(
|
||||||
builder: (_) => PrimaryButton(
|
builder: (_) => AddressTextField(
|
||||||
onPressed: () async {
|
controller: _addressController,
|
||||||
if (!_formKey.currentState.validate()) {
|
options: [AddressTextFieldOption.qrCode],
|
||||||
return;
|
buttonColor: Theme.of(context).accentTextTheme.display2.color,
|
||||||
}
|
iconColor: PaletteDark.gray,
|
||||||
|
borderColor: Theme.of(context).primaryTextTheme.title.backgroundColor,
|
||||||
await contactViewModel.save();
|
validator: AddressValidator(
|
||||||
},
|
type: contactViewModel.currency),
|
||||||
text: S.of(context).save,
|
)),
|
||||||
color: Colors.green,
|
)
|
||||||
textColor: Colors.white,
|
|
||||||
isDisabled: !contactViewModel.isReady)))
|
|
||||||
],
|
],
|
||||||
)),
|
),
|
||||||
);
|
),
|
||||||
|
bottomSectionPadding:
|
||||||
|
EdgeInsets.only(left: 24, right: 24, bottom: 24),
|
||||||
|
bottomSection: Row(
|
||||||
|
children: <Widget>[
|
||||||
|
Expanded(
|
||||||
|
child: PrimaryButton(
|
||||||
|
onPressed: () {
|
||||||
|
contactViewModel.reset();
|
||||||
|
_nameController.text = '';
|
||||||
|
_addressController.text = '';
|
||||||
|
},
|
||||||
|
text: S.of(context).reset,
|
||||||
|
color: Colors.red,
|
||||||
|
textColor: Colors.white),
|
||||||
|
),
|
||||||
|
SizedBox(width: 20),
|
||||||
|
Expanded(
|
||||||
|
child: Observer(
|
||||||
|
builder: (_) => PrimaryButton(
|
||||||
|
onPressed: () async {
|
||||||
|
if (!_formKey.currentState.validate()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
await contactViewModel.save();
|
||||||
|
},
|
||||||
|
text: S.of(context).save,
|
||||||
|
color: Palette.blueCraiola,
|
||||||
|
textColor: Colors.white,
|
||||||
|
isDisabled: !contactViewModel.isReady)))
|
||||||
|
],
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void _presentCurrencyPicker(BuildContext context) {
|
void _presentCurrencyPicker(BuildContext context) {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_mobx/flutter_mobx.dart';
|
import 'package:flutter_mobx/flutter_mobx.dart';
|
||||||
|
@ -6,6 +7,7 @@ import 'package:cake_wallet/generated/i18n.dart';
|
||||||
import 'package:cake_wallet/core/node_address_validator.dart';
|
import 'package:cake_wallet/core/node_address_validator.dart';
|
||||||
import 'package:cake_wallet/core/node_port_validator.dart';
|
import 'package:cake_wallet/core/node_port_validator.dart';
|
||||||
import 'package:cake_wallet/src/widgets/primary_button.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/src/screens/base_page.dart';
|
||||||
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
import 'package:cake_wallet/src/widgets/scollable_with_bottom_section.dart';
|
||||||
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
|
import 'package:cake_wallet/view_model/node_list/node_create_or_edit_view_model.dart';
|
||||||
|
@ -77,32 +79,11 @@ class NodeCreateOrEditPage extends BasePage {
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: BaseTextFormField(
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.title
|
|
||||||
.color),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color,
|
|
||||||
fontSize: 16),
|
|
||||||
hintText: S.of(context).node_address,
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0)),
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0))),
|
|
||||||
controller: _addressController,
|
controller: _addressController,
|
||||||
|
hintText: S.of(context).node_address,
|
||||||
validator: NodeAddressValidator(),
|
validator: NodeAddressValidator(),
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -110,34 +91,13 @@ class NodeCreateOrEditPage extends BasePage {
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: BaseTextFormField(
|
||||||
style: TextStyle(
|
controller: _portController,
|
||||||
fontSize: 16.0,
|
hintText: S.of(context).node_port,
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.title
|
|
||||||
.color),
|
|
||||||
keyboardType: TextInputType.numberWithOptions(
|
keyboardType: TextInputType.numberWithOptions(
|
||||||
signed: false, decimal: false),
|
signed: false, decimal: false),
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color,
|
|
||||||
fontSize: 16),
|
|
||||||
hintText: S.of(context).node_port,
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0)),
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0))),
|
|
||||||
controller: _portController,
|
|
||||||
validator: NodePortValidator(),
|
validator: NodePortValidator(),
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -146,32 +106,10 @@ class NodeCreateOrEditPage extends BasePage {
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: BaseTextFormField(
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.title
|
|
||||||
.color),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color,
|
|
||||||
fontSize: 16),
|
|
||||||
hintText: S.of(context).login,
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0)),
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0))),
|
|
||||||
controller: _loginController,
|
controller: _loginController,
|
||||||
validator: (value) => null,
|
hintText: S.of(context).login,
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -179,32 +117,10 @@ class NodeCreateOrEditPage extends BasePage {
|
||||||
Row(
|
Row(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Expanded(
|
Expanded(
|
||||||
child: TextFormField(
|
child: BaseTextFormField(
|
||||||
style: TextStyle(
|
|
||||||
fontSize: 16.0,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.title
|
|
||||||
.color),
|
|
||||||
decoration: InputDecoration(
|
|
||||||
hintStyle: TextStyle(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.primaryTextTheme
|
|
||||||
.caption
|
|
||||||
.color,
|
|
||||||
fontSize: 16),
|
|
||||||
hintText: S.of(context).password,
|
|
||||||
focusedBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0)),
|
|
||||||
enabledBorder: UnderlineInputBorder(
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1.0))),
|
|
||||||
controller: _passwordController,
|
controller: _passwordController,
|
||||||
validator: (value) => null,
|
hintText: S.of(context).password,
|
||||||
),
|
)
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
@ -237,7 +153,7 @@ class NodeCreateOrEditPage extends BasePage {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
text: S.of(context).save,
|
text: S.of(context).save,
|
||||||
color: Colors.green,
|
color: Palette.blueCraiola,
|
||||||
textColor: Colors.white,
|
textColor: Colors.white,
|
||||||
isDisabled: !nodeCreateOrEditViewModel.isReady,
|
isDisabled: !nodeCreateOrEditViewModel.isReady,
|
||||||
),
|
),
|
||||||
|
|
|
@ -24,7 +24,7 @@ class NodeListPage extends BasePage {
|
||||||
height: 32,
|
height: 32,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||||
color: Theme.of(context).accentTextTheme.title.backgroundColor),
|
color: Theme.of(context).accentTextTheme.caption.color),
|
||||||
child: ButtonTheme(
|
child: ButtonTheme(
|
||||||
minWidth: double.minPositive,
|
minWidth: double.minPositive,
|
||||||
child: FlatButton(
|
child: FlatButton(
|
||||||
|
@ -51,7 +51,7 @@ class NodeListPage extends BasePage {
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14.0,
|
fontSize: 14.0,
|
||||||
fontWeight: FontWeight.w600,
|
fontWeight: FontWeight.w600,
|
||||||
color: Colors.blue),
|
color: Palette.blueCraiola),
|
||||||
)),
|
)),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,9 +23,9 @@ class NodeListRow extends StandardListRow {
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
switch (snapshot.connectionState) {
|
switch (snapshot.connectionState) {
|
||||||
case ConnectionState.done:
|
case ConnectionState.done:
|
||||||
return NodeIndicator(isLive: snapshot.data as bool);
|
return NodeIndicator(isLive: (snapshot.data as bool)??false);
|
||||||
default:
|
default:
|
||||||
return NodeIndicator();
|
return NodeIndicator(isLive: false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -38,6 +38,6 @@ class NodeHeaderListRow extends StandardListRow {
|
||||||
@override
|
@override
|
||||||
Widget buildTrailing(BuildContext context) {
|
Widget buildTrailing(BuildContext context) {
|
||||||
return Icon(Icons.add,
|
return Icon(Icons.add,
|
||||||
color: Theme.of(context).primaryTextTheme.title.color, size: 24.0);
|
color: Theme.of(context).accentTextTheme.subhead.color, size: 24.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
import 'package:cake_wallet/palette.dart';
|
|
||||||
import 'package:cake_wallet/routes.dart';
|
import 'package:cake_wallet/routes.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:cake_wallet/generated/i18n.dart';
|
import 'package:cake_wallet/generated/i18n.dart';
|
||||||
|
@ -23,6 +22,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
this.isBorderExist = true,
|
this.isBorderExist = true,
|
||||||
this.buttonColor,
|
this.buttonColor,
|
||||||
this.borderColor,
|
this.borderColor,
|
||||||
|
this.iconColor,
|
||||||
this.textStyle,
|
this.textStyle,
|
||||||
this.hintStyle,
|
this.hintStyle,
|
||||||
this.validator});
|
this.validator});
|
||||||
|
@ -40,6 +40,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
final bool isBorderExist;
|
final bool isBorderExist;
|
||||||
final Color buttonColor;
|
final Color buttonColor;
|
||||||
final Color borderColor;
|
final Color borderColor;
|
||||||
|
final Color iconColor;
|
||||||
final TextStyle textStyle;
|
final TextStyle textStyle;
|
||||||
final TextStyle hintStyle;
|
final TextStyle hintStyle;
|
||||||
FocusNode focusNode;
|
FocusNode focusNode;
|
||||||
|
@ -55,7 +56,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
focusNode: focusNode,
|
focusNode: focusNode,
|
||||||
style: textStyle ?? TextStyle(
|
style: textStyle ?? TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: Colors.white
|
color: Theme.of(context).primaryTextTheme.title.color
|
||||||
),
|
),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
suffixIcon: SizedBox(
|
suffixIcon: SizedBox(
|
||||||
|
@ -64,7 +65,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
),
|
),
|
||||||
hintStyle: hintStyle ?? TextStyle(
|
hintStyle: hintStyle ?? TextStyle(
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: PaletteDark.darkCyanBlue
|
color: Theme.of(context).hintColor
|
||||||
),
|
),
|
||||||
hintText: placeholder ?? S.current.widgets_address,
|
hintText: placeholder ?? S.current.widgets_address,
|
||||||
focusedBorder: isBorderExist
|
focusedBorder: isBorderExist
|
||||||
|
@ -113,7 +114,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
BorderRadius.all(Radius.circular(6))),
|
BorderRadius.all(Radius.circular(6))),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/duplicate.png',
|
'assets/images/duplicate.png',
|
||||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
color: iconColor ?? Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
@ -131,7 +132,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
borderRadius:
|
borderRadius:
|
||||||
BorderRadius.all(Radius.circular(6))),
|
BorderRadius.all(Radius.circular(6))),
|
||||||
child: Image.asset('assets/images/qr_code_icon.png',
|
child: Image.asset('assets/images/qr_code_icon.png',
|
||||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
color: iconColor ?? Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||||
)),
|
)),
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
|
@ -152,7 +153,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
BorderRadius.all(Radius.circular(6))),
|
BorderRadius.all(Radius.circular(6))),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/open_book.png',
|
'assets/images/open_book.png',
|
||||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
color: iconColor ?? Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||||
)),
|
)),
|
||||||
))
|
))
|
||||||
],
|
],
|
||||||
|
@ -173,7 +174,7 @@ class AddressTextField extends StatelessWidget {
|
||||||
BorderRadius.all(Radius.circular(6))),
|
BorderRadius.all(Radius.circular(6))),
|
||||||
child: Image.asset(
|
child: Image.asset(
|
||||||
'assets/images/receive_icon_raw.png',
|
'assets/images/receive_icon_raw.png',
|
||||||
color: Theme.of(context).primaryTextTheme.display1.decorationColor,
|
color: iconColor ?? Theme.of(context).primaryTextTheme.display1.decorationColor,
|
||||||
)),
|
)),
|
||||||
)),
|
)),
|
||||||
],
|
],
|
||||||
|
|
|
@ -45,7 +45,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 52,
|
height: 52,
|
||||||
padding: EdgeInsets.only(left: 12, right: 12),
|
padding: EdgeInsets.only(left: 6, right: 6),
|
||||||
color: Palette.blueCraiola,
|
color: Palette.blueCraiola,
|
||||||
child: ButtonTheme(
|
child: ButtonTheme(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
|
@ -70,7 +70,7 @@ class BaseAlertDialog extends StatelessWidget {
|
||||||
Flexible(
|
Flexible(
|
||||||
child: Container(
|
child: Container(
|
||||||
height: 52,
|
height: 52,
|
||||||
padding: EdgeInsets.only(left: 12, right: 12),
|
padding: EdgeInsets.only(left: 6, right: 6),
|
||||||
color: Palette.alizarinRed,
|
color: Palette.alizarinRed,
|
||||||
child: ButtonTheme(
|
child: ButtonTheme(
|
||||||
minWidth: double.infinity,
|
minWidth: double.infinity,
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import 'package:cake_wallet/palette.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
@ -39,7 +40,7 @@ class StandardListRow extends StatelessWidget {
|
||||||
Text(title,
|
Text(title,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
fontWeight: FontWeight.w500,
|
fontWeight: FontWeight.normal,
|
||||||
color: _titleColor(context)))
|
color: _titleColor(context)))
|
||||||
]));
|
]));
|
||||||
}
|
}
|
||||||
|
@ -47,21 +48,24 @@ class StandardListRow extends StatelessWidget {
|
||||||
Widget buildTrailing(BuildContext context) => null;
|
Widget buildTrailing(BuildContext context) => null;
|
||||||
|
|
||||||
Color _titleColor(BuildContext context) => isSelected
|
Color _titleColor(BuildContext context) => isSelected
|
||||||
? Color.fromRGBO(20, 200, 71, 1)
|
? Palette.blueCraiola
|
||||||
: Theme.of(context).primaryTextTheme.title.color;
|
: Theme.of(context).primaryTextTheme.title.color;
|
||||||
|
|
||||||
Color _backgroundColor(BuildContext context) {
|
Color _backgroundColor(BuildContext context) {
|
||||||
// return Theme.of(context).accentTextTheme.subtitle.decorationColor;
|
// return Theme.of(context).accentTextTheme.subtitle.decorationColor;
|
||||||
return Theme.of(context).accentTextTheme.title.backgroundColor;
|
return Theme.of(context).backgroundColor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class SectionHeaderListRow extends StatelessWidget {
|
class SectionHeaderListRow extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) => Column(children: [
|
Widget build(BuildContext context) => Column(children: [
|
||||||
StandardListSeparator(),
|
StandardListSeparator(padding: EdgeInsets.only(left: 24)),
|
||||||
Container(width: double.infinity, height: 40, color: Colors.white),
|
Container(
|
||||||
StandardListSeparator()
|
width: double.infinity,
|
||||||
|
height: 40,
|
||||||
|
color: Theme.of(context).backgroundColor),
|
||||||
|
//StandardListSeparator(padding: EdgeInsets.only(left: 24))
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,8 +79,10 @@ class StandardListSeparator extends StatelessWidget {
|
||||||
return Container(
|
return Container(
|
||||||
height: 1,
|
height: 1,
|
||||||
padding: padding,
|
padding: padding,
|
||||||
color: Theme.of(context).accentTextTheme.title.backgroundColor,
|
color: Theme.of(context).backgroundColor,
|
||||||
child: Container(height: 1, color: Color.fromRGBO(219, 227, 243, 1)));
|
child: Container(
|
||||||
|
height: 1,
|
||||||
|
color: Theme.of(context).primaryTextTheme.title.backgroundColor));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,9 +132,9 @@ class SectionStandardList extends StatelessWidget {
|
||||||
final items = <Widget>[];
|
final items = <Widget>[];
|
||||||
|
|
||||||
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
for (var sectionIndex = 0; sectionIndex < sectionCount; sectionIndex++) {
|
||||||
if (sectionIndex == 0) {
|
/*if (sectionIndex == 0) {
|
||||||
items.add(StandardListSeparator());
|
items.add(StandardListSeparator());
|
||||||
}
|
}*/
|
||||||
|
|
||||||
final itemCount = itemCounter(sectionIndex);
|
final itemCount = itemCounter(sectionIndex);
|
||||||
|
|
||||||
|
@ -140,7 +146,7 @@ class SectionStandardList extends StatelessWidget {
|
||||||
|
|
||||||
items.add(sectionIndex + 1 != sectionCount
|
items.add(sectionIndex + 1 != sectionCount
|
||||||
? SectionHeaderListRow()
|
? SectionHeaderListRow()
|
||||||
: StandardListSeparator());
|
: StandardListSeparator(padding: EdgeInsets.only(left: 24)));
|
||||||
}
|
}
|
||||||
|
|
||||||
return items;
|
return items;
|
||||||
|
|
|
@ -152,6 +152,9 @@ class Themes {
|
||||||
color: Palette.blueCraiola, // first gradient color (menu header)
|
color: Palette.blueCraiola, // first gradient color (menu header)
|
||||||
decorationColor: Palette.pinkFlamingo // second gradient color(menu header)
|
decorationColor: Palette.pinkFlamingo // second gradient color(menu header)
|
||||||
),
|
),
|
||||||
|
display2: TextStyle(
|
||||||
|
color: Palette.shadowWhite, // action button color (address text field)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
@ -315,6 +318,9 @@ class Themes {
|
||||||
color: PaletteDark.deepPurpleBlue, // first gradient color (menu header)
|
color: PaletteDark.deepPurpleBlue, // first gradient color (menu header)
|
||||||
decorationColor: PaletteDark.deepPurpleBlue // second gradient color(menu header)
|
decorationColor: PaletteDark.deepPurpleBlue // second gradient color(menu header)
|
||||||
),
|
),
|
||||||
|
display2: TextStyle(
|
||||||
|
color: PaletteDark.nightBlue, // action button color (address text field)
|
||||||
|
),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ abstract class ContactViewModelBase with Store {
|
||||||
_contact = contact {
|
_contact = contact {
|
||||||
name = _contact?.name;
|
name = _contact?.name;
|
||||||
address = _contact?.address;
|
address = _contact?.address;
|
||||||
currency = _contact?.type ?? _wallet.currency;
|
currency = _contact?.type; //_wallet.currency;
|
||||||
}
|
}
|
||||||
|
|
||||||
@observable
|
@observable
|
||||||
|
@ -33,7 +33,8 @@ abstract class ContactViewModelBase with Store {
|
||||||
|
|
||||||
@computed
|
@computed
|
||||||
bool get isReady =>
|
bool get isReady =>
|
||||||
(name?.isNotEmpty ?? false) && (address?.isNotEmpty ?? false);
|
(name?.isNotEmpty ?? false) && (currency?.toString()?.isNotEmpty ?? false)
|
||||||
|
&& (address?.isNotEmpty ?? false);
|
||||||
|
|
||||||
final List<CryptoCurrency> currencies;
|
final List<CryptoCurrency> currencies;
|
||||||
final ContactService _contactService;
|
final ContactService _contactService;
|
||||||
|
@ -44,7 +45,8 @@ abstract class ContactViewModelBase with Store {
|
||||||
void reset() {
|
void reset() {
|
||||||
address = '';
|
address = '';
|
||||||
name = '';
|
name = '';
|
||||||
currency = _wallet.currency;
|
//currency = _wallet.currency;
|
||||||
|
currency = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
Future save() async {
|
Future save() async {
|
||||||
|
|
Loading…
Reference in a new issue