adding Contact list button to phone textformfield in client form
This commit is contained in:
parent
ffd6fc2c83
commit
3af8e99fd5
|
|
@ -1,3 +1,4 @@
|
|||
import 'package:contact_picker/contact_picker.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
|
@ -108,6 +109,8 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
final state = viewModel.state;
|
||||
final client = viewModel.client;
|
||||
|
||||
final ContactPicker _contactPicker = ContactPicker();
|
||||
|
||||
return ListView(
|
||||
shrinkWrap: true,
|
||||
children: <Widget>[
|
||||
|
|
@ -150,11 +153,38 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
keyboardType: TextInputType.url,
|
||||
onSavePressed: viewModel.onSavePressed,
|
||||
),
|
||||
DecoratedFormField(
|
||||
label: localization.phone,
|
||||
controller: _phoneController,
|
||||
keyboardType: TextInputType.phone,
|
||||
onSavePressed: viewModel.onSavePressed,
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
DecoratedFormField(
|
||||
label: localization.phone,
|
||||
controller: _phoneController,
|
||||
keyboardType: TextInputType.phone,
|
||||
onSavePressed: viewModel.onSavePressed,
|
||||
),
|
||||
Container(
|
||||
margin: EdgeInsets.fromLTRB(10, 10, 0, 0),
|
||||
alignment: Alignment.centerRight,
|
||||
child: IconButton(
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
Icons.person,
|
||||
color: Colors.grey,
|
||||
),
|
||||
onPressed: () async {
|
||||
Contact contact = await _contactPicker.selectContact();
|
||||
setState(() {
|
||||
if(contact != null)
|
||||
{
|
||||
_phoneController.text = contact.phoneNumber.number;
|
||||
}
|
||||
else {
|
||||
_phoneController.text = "";
|
||||
}
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
CustomField(
|
||||
controller: _custom1Controller,
|
||||
|
|
|
|||
55
pubspec.lock
55
pubspec.lock
|
|
@ -35,14 +35,14 @@ packages:
|
|||
name: async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.5.0-nullsafety"
|
||||
version: "2.5.0-nullsafety.1"
|
||||
boolean_selector:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: boolean_selector
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety"
|
||||
version: "2.1.0-nullsafety.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -119,14 +119,14 @@ packages:
|
|||
name: characters
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety.2"
|
||||
version: "1.1.0-nullsafety.3"
|
||||
charcode:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: charcode
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
charts_common:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -161,7 +161,7 @@ packages:
|
|||
name: clock
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety"
|
||||
version: "1.1.0-nullsafety.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -175,7 +175,14 @@ packages:
|
|||
name: collection
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.15.0-nullsafety.2"
|
||||
version: "1.15.0-nullsafety.3"
|
||||
contact_picker:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: contact_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.0.2"
|
||||
convert:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -252,7 +259,7 @@ packages:
|
|||
name: fake_async
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
faker:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
|
|
@ -273,7 +280,7 @@ packages:
|
|||
name: file
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.0-nullsafety.1"
|
||||
version: "6.0.0-nullsafety.2"
|
||||
firebase:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -592,7 +599,7 @@ packages:
|
|||
name: matcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.12.10-nullsafety"
|
||||
version: "0.12.10-nullsafety.1"
|
||||
material_design_icons_flutter:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -613,7 +620,7 @@ packages:
|
|||
name: meta
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.2"
|
||||
version: "1.3.0-nullsafety.4"
|
||||
mime:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -690,7 +697,7 @@ packages:
|
|||
name: path
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety"
|
||||
version: "1.8.0-nullsafety.1"
|
||||
path_provider:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -746,7 +753,7 @@ packages:
|
|||
name: platform
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0-nullsafety.1"
|
||||
version: "3.0.0-nullsafety.2"
|
||||
plugin_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -767,7 +774,7 @@ packages:
|
|||
name: process
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "4.0.0-nullsafety.1"
|
||||
version: "4.0.0-nullsafety.2"
|
||||
pub_semver:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -933,7 +940,7 @@ packages:
|
|||
name: source_span
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.8.0-nullsafety"
|
||||
version: "1.8.0-nullsafety.2"
|
||||
sqflite:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -954,14 +961,14 @@ packages:
|
|||
name: stack_trace
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.10.0-nullsafety"
|
||||
version: "1.10.0-nullsafety.2"
|
||||
stream_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: stream_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety"
|
||||
version: "2.1.0-nullsafety.1"
|
||||
stream_transform:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -975,7 +982,7 @@ packages:
|
|||
name: string_scanner
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.1.0-nullsafety"
|
||||
version: "1.1.0-nullsafety.1"
|
||||
sync_http:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
@ -996,28 +1003,28 @@ packages:
|
|||
name: term_glyph
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.2.0-nullsafety"
|
||||
version: "1.2.0-nullsafety.1"
|
||||
test:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: test
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.16.0-nullsafety.4"
|
||||
version: "1.16.0-nullsafety.5"
|
||||
test_api:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_api
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.2.19-nullsafety"
|
||||
version: "0.2.19-nullsafety.2"
|
||||
test_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: test_core
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.3.12-nullsafety.4"
|
||||
version: "0.3.12-nullsafety.5"
|
||||
timeago:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1038,7 +1045,7 @@ packages:
|
|||
name: typed_data
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.3.0-nullsafety.2"
|
||||
version: "1.3.0-nullsafety.3"
|
||||
url_launcher:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1108,7 +1115,7 @@ packages:
|
|||
name: vector_math
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0-nullsafety.2"
|
||||
version: "2.1.0-nullsafety.3"
|
||||
version:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
@ -1194,5 +1201,5 @@ packages:
|
|||
source: hosted
|
||||
version: "2.2.1"
|
||||
sdks:
|
||||
dart: ">=2.10.0-4.0.dev <2.10.0"
|
||||
dart: ">=2.10.0-110 <=2.11.0-213.1.beta"
|
||||
flutter: ">=1.20.0 <2.0.0"
|
||||
|
|
|
|||
|
|
@ -57,6 +57,7 @@ dependencies:
|
|||
#idb_shim: ^1.11.1+1
|
||||
flutter_launcher_icons: ^0.8.0
|
||||
overflow_view: ^0.2.1
|
||||
contact_picker: ^0.0.2
|
||||
|
||||
dev_dependencies:
|
||||
flutter_driver:
|
||||
|
|
|
|||
Loading…
Reference in New Issue