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