Contacts
This commit is contained in:
parent
75e39b89c1
commit
27ba5a8a07
|
|
@ -33,9 +33,6 @@ class ClientEditContactsState extends State<ClientEditContacts>
|
||||||
contactKeys = client.contacts
|
contactKeys = client.contacts
|
||||||
.map((contact) => GlobalKey<ContactEditDetailsState>())
|
.map((contact) => GlobalKey<ContactEditDetailsState>())
|
||||||
.toList();
|
.toList();
|
||||||
|
|
||||||
// Add initial blank contact
|
|
||||||
_onAddPressed();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ContactEntity> getContacts() {
|
List<ContactEntity> getContacts() {
|
||||||
|
|
@ -47,13 +44,16 @@ class ClientEditContactsState extends State<ClientEditContacts>
|
||||||
}
|
}
|
||||||
|
|
||||||
_onAddPressed() {
|
_onAddPressed() {
|
||||||
print('onAddPressed..');
|
|
||||||
setState(() {
|
setState(() {
|
||||||
contacts.add(ContactEntity());
|
contacts.add(ContactEntity());
|
||||||
contactKeys.add(GlobalKey<ContactEditDetailsState>());
|
contactKeys.add(GlobalKey<ContactEditDetailsState>());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_onRemovePressed() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var localization = AppLocalization.of(context);
|
var localization = AppLocalization.of(context);
|
||||||
|
|
@ -66,13 +66,19 @@ class ClientEditContactsState extends State<ClientEditContacts>
|
||||||
items.add(ContactEditDetails(
|
items.add(ContactEditDetails(
|
||||||
contact: contact,
|
contact: contact,
|
||||||
key: contactKey,
|
key: contactKey,
|
||||||
|
onRemovePressed: _onRemovePressed(),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
items.add(RaisedButton(
|
items.add(Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: RaisedButton(
|
||||||
elevation: 4.0,
|
elevation: 4.0,
|
||||||
child: Text(localization.add),
|
color: Theme.of(context).primaryColor,
|
||||||
|
textColor: Theme.of(context).secondaryHeaderColor,
|
||||||
|
child: Text(localization.addContact.toUpperCase()),
|
||||||
onPressed: _onAddPressed,
|
onPressed: _onAddPressed,
|
||||||
|
),
|
||||||
));
|
));
|
||||||
|
|
||||||
return ListView(
|
return ListView(
|
||||||
|
|
@ -85,9 +91,11 @@ class ContactEditDetails extends StatefulWidget {
|
||||||
ContactEditDetails({
|
ContactEditDetails({
|
||||||
Key key,
|
Key key,
|
||||||
@required this.contact,
|
@required this.contact,
|
||||||
|
@required this.onRemovePressed,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
final ContactEntity contact;
|
final ContactEntity contact;
|
||||||
|
final Function onRemovePressed;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
ContactEditDetailsState createState() => ContactEditDetailsState();
|
ContactEditDetailsState createState() => ContactEditDetailsState();
|
||||||
|
|
@ -106,7 +114,13 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 8.0),
|
padding: const EdgeInsets.only(bottom: 8.0),
|
||||||
child: Card(
|
child: Stack(
|
||||||
|
children: [
|
||||||
|
IconButton(
|
||||||
|
icon: Icon(Icons.close),
|
||||||
|
onPressed: widget.onRemovePressed,
|
||||||
|
),
|
||||||
|
Card(
|
||||||
elevation: 2.0,
|
elevation: 2.0,
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding: const EdgeInsets.only(
|
padding: const EdgeInsets.only(
|
||||||
|
|
@ -124,6 +138,8 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ class AppLocalization {
|
||||||
'additional': 'Additional',
|
'additional': 'Additional',
|
||||||
'first_name': 'First Name',
|
'first_name': 'First Name',
|
||||||
'last_name': 'Last Name',
|
'last_name': 'Last Name',
|
||||||
'add': 'Add',
|
'add_contact': 'Add Contact',
|
||||||
|
|
||||||
'product': 'Product',
|
'product': 'Product',
|
||||||
'products': 'Products',
|
'products': 'Products',
|
||||||
|
|
@ -149,7 +149,7 @@ class AppLocalization {
|
||||||
String get additional => _localizedValues[locale.languageCode]['additional'];
|
String get additional => _localizedValues[locale.languageCode]['additional'];
|
||||||
String get firstName => _localizedValues[locale.languageCode]['first_name'];
|
String get firstName => _localizedValues[locale.languageCode]['first_name'];
|
||||||
String get lastName => _localizedValues[locale.languageCode]['last_name'];
|
String get lastName => _localizedValues[locale.languageCode]['last_name'];
|
||||||
String get add => _localizedValues[locale.languageCode]['add'];
|
String get addContact => _localizedValues[locale.languageCode]['add_contact'];
|
||||||
|
|
||||||
String get product => _localizedValues[locale.languageCode]['product'];
|
String get product => _localizedValues[locale.languageCode]['product'];
|
||||||
String get products => _localizedValues[locale.languageCode]['products'];
|
String get products => _localizedValues[locale.languageCode]['products'];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue