Contact import changes
This commit is contained in:
parent
27b71bdec3
commit
50f68075fb
|
|
@ -40,11 +40,13 @@ class _PasswordFormFieldState extends State<PasswordFormField> {
|
|||
decoration: InputDecoration(
|
||||
labelText: localization.password,
|
||||
suffixIcon: IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
tooltip: _isPasswordObscured
|
||||
? localization.showPassword
|
||||
: localization.hidePassword,
|
||||
icon: Icon(
|
||||
_isPasswordObscured ? Icons.visibility : Icons.visibility_off,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
|
@ -118,7 +120,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
}
|
||||
}
|
||||
|
||||
void _setContactControllers(){
|
||||
void _setContactControllers() {
|
||||
_nameController.text = _contact.displayName;
|
||||
_phoneController.text = _contact.phones.first.value;
|
||||
}
|
||||
|
|
@ -136,7 +138,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
FormCard(
|
||||
children: <Widget>[
|
||||
DecoratedFormField(
|
||||
autofocus: true,
|
||||
autofocus: true,
|
||||
controller: _nameController,
|
||||
validator: (String val) => !viewModel.client.hasNameSet
|
||||
? AppLocalization.of(context).pleaseEnterAClientOrContactName
|
||||
|
|
@ -144,27 +146,30 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
onSavePressed: viewModel.onSavePressed,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.name,
|
||||
suffixIcon: IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () async {
|
||||
final PermissionStatus permissionStatus = await _getPermission();
|
||||
if (permissionStatus == PermissionStatus.granted) {
|
||||
try {
|
||||
_contact = await ContactsService.openDeviceContactPicker();
|
||||
setState(() {
|
||||
_setContactControllers();
|
||||
});
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
||||
? IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () async {
|
||||
final PermissionStatus permissionStatus =
|
||||
await _getPermission();
|
||||
if (permissionStatus == PermissionStatus.granted) {
|
||||
try {
|
||||
_contact = await ContactsService
|
||||
.openDeviceContactPicker();
|
||||
setState(() {
|
||||
_setContactControllers();
|
||||
});
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
: null,
|
||||
),
|
||||
),
|
||||
DynamicSelector(
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
|
|
@ -214,11 +216,15 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
|
|||
});
|
||||
}
|
||||
|
||||
void _setContactControllers(){
|
||||
_firstNameController.text = _contact.givenName != null ? _contact.givenName: '';
|
||||
_lastNameController.text = _contact.familyName != null ? _contact.familyName: '';
|
||||
_emailController.text = _contact.emails.isNotEmpty ? _contact.emails.first.value : '';
|
||||
_phoneController.text = _contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
||||
void _setContactControllers() {
|
||||
_firstNameController.text =
|
||||
_contact.givenName != null ? _contact.givenName : '';
|
||||
_lastNameController.text =
|
||||
_contact.familyName != null ? _contact.familyName : '';
|
||||
_emailController.text =
|
||||
_contact.emails.isNotEmpty ? _contact.emails.first.value : '';
|
||||
_phoneController.text =
|
||||
_contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
||||
}
|
||||
|
||||
// Check contacts permission
|
||||
|
|
@ -287,27 +293,30 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
|
|||
controller: _firstNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.firstName,
|
||||
suffixIcon: IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () async {
|
||||
final PermissionStatus permissionStatus = await _getPermission();
|
||||
if (permissionStatus == PermissionStatus.granted) {
|
||||
try {
|
||||
_contact = await ContactsService.openDeviceContactPicker();
|
||||
setState(() {
|
||||
_setContactControllers();
|
||||
});
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
||||
? IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () async {
|
||||
final PermissionStatus permissionStatus =
|
||||
await _getPermission();
|
||||
if (permissionStatus == PermissionStatus.granted) {
|
||||
try {
|
||||
_contact = await ContactsService
|
||||
.openDeviceContactPicker();
|
||||
setState(() {
|
||||
_setContactControllers();
|
||||
});
|
||||
} catch (e) {
|
||||
print(e.toString());
|
||||
}
|
||||
}
|
||||
})
|
||||
: null,
|
||||
),
|
||||
),
|
||||
DecoratedFormField(
|
||||
|
|
|
|||
|
|
@ -115,8 +115,10 @@ class _PasswordConfirmationState extends State<PasswordConfirmation> {
|
|||
decoration: InputDecoration(
|
||||
labelText: localization.password,
|
||||
suffixIcon: IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
icon: Icon(
|
||||
_isPasswordObscured ? Icons.visibility : Icons.visibility_off,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
|
|
|
|||
46
pubspec.lock
46
pubspec.lock
|
|
@ -35,14 +35,14 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety.1"
|
||||
version: "2.5.0-nullsafety"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0-nullsafety"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -119,14 +119,14 @@ packages:
|
|||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.3"
|
||||
version: "1.1.0-nullsafety.2"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0-nullsafety"
|
||||
charts_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -161,7 +161,7 @@ packages:
|
|||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0-nullsafety"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -175,7 +175,7 @@ packages:
|
|||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.3"
|
||||
version: "1.15.0-nullsafety.2"
|
||||
contacts_service:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -259,7 +259,7 @@ packages:
|
|||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.1.0-nullsafety"
|
||||
faker:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -280,7 +280,7 @@ packages:
|
|||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.0-nullsafety.2"
|
||||
version: "6.0.0-nullsafety.1"
|
||||
firebase:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -606,7 +606,7 @@ packages:
|
|||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10-nullsafety.1"
|
||||
version: "0.12.10-nullsafety"
|
||||
material_design_icons_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -627,7 +627,7 @@ packages:
|
|||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.4"
|
||||
version: "1.3.0-nullsafety.2"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -704,7 +704,7 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.1"
|
||||
version: "1.8.0-nullsafety"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -774,7 +774,7 @@ packages:
|
|||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0-nullsafety.2"
|
||||
version: "3.0.0-nullsafety.1"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -795,7 +795,7 @@ packages:
|
|||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-nullsafety.2"
|
||||
version: "4.0.0-nullsafety.1"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -961,7 +961,7 @@ packages:
|
|||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety.2"
|
||||
version: "1.8.0-nullsafety"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -982,14 +982,14 @@ packages:
|
|||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety.2"
|
||||
version: "1.10.0-nullsafety"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.1"
|
||||
version: "2.1.0-nullsafety"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1003,7 +1003,7 @@ packages:
|
|||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.1"
|
||||
version: "1.1.0-nullsafety"
|
||||
sync_http:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -1024,28 +1024,28 @@ packages:
|
|||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety.1"
|
||||
version: "1.2.0-nullsafety"
|
||||
test:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.16.0-nullsafety.5"
|
||||
version: "1.16.0-nullsafety.4"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety.2"
|
||||
version: "0.2.19-nullsafety"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.12-nullsafety.5"
|
||||
version: "0.3.12-nullsafety.4"
|
||||
timeago:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1066,7 +1066,7 @@ packages:
|
|||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.3"
|
||||
version: "1.3.0-nullsafety.2"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1136,7 +1136,7 @@ packages:
|
|||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version: "2.1.0-nullsafety.2"
|
||||
version:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
|||
Loading…
Reference in New Issue