Hide contact import on web
This commit is contained in:
parent
8062372ac0
commit
ed9bac1e81
|
|
@ -1,3 +1,6 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
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';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
|
@ -331,7 +334,8 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
onSavePressed: (_) => _onDoneContactPressed(),
|
onSavePressed: (_) => _onDoneContactPressed(),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: localization.firstName,
|
labelText: localization.firstName,
|
||||||
suffixIcon: IconButton(
|
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||||
|
? IconButton(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|
@ -351,7 +355,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
),
|
) : null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
||||||
onSavePressed: viewModel.onSavePressed,
|
onSavePressed: viewModel.onSavePressed,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: localization.name,
|
labelText: localization.name,
|
||||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||||
? IconButton(
|
? IconButton(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import 'dart:io';
|
import 'dart:io';
|
||||||
|
|
||||||
|
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';
|
||||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||||
|
|
@ -293,7 +294,7 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
|
||||||
controller: _firstNameController,
|
controller: _firstNameController,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: localization.firstName,
|
labelText: localization.firstName,
|
||||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||||
? IconButton(
|
? IconButton(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,6 @@
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
|
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';
|
||||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||||
|
|
@ -102,8 +105,10 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
||||||
}
|
}
|
||||||
|
|
||||||
void _setContactControllers() {
|
void _setContactControllers() {
|
||||||
_nameController.text = _contact.displayName != null ? _contact.displayName : '';
|
_nameController.text =
|
||||||
_phoneController.text = _contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
_contact.displayName != null ? _contact.displayName : '';
|
||||||
|
_phoneController.text =
|
||||||
|
_contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check contacts permission
|
// Check contacts permission
|
||||||
|
|
@ -139,7 +144,8 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
||||||
: null,
|
: null,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
labelText: localization.firstName,
|
labelText: localization.firstName,
|
||||||
suffixIcon: IconButton(
|
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||||
|
? IconButton(
|
||||||
alignment: Alignment.bottomCenter,
|
alignment: Alignment.bottomCenter,
|
||||||
color: Theme.of(context).cardColor,
|
color: Theme.of(context).cardColor,
|
||||||
icon: Icon(
|
icon: Icon(
|
||||||
|
|
@ -147,10 +153,12 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
||||||
color: Colors.grey,
|
color: Colors.grey,
|
||||||
),
|
),
|
||||||
onPressed: () async {
|
onPressed: () async {
|
||||||
final PermissionStatus permissionStatus = await _getPermission();
|
final PermissionStatus permissionStatus =
|
||||||
|
await _getPermission();
|
||||||
if (permissionStatus == PermissionStatus.granted) {
|
if (permissionStatus == PermissionStatus.granted) {
|
||||||
try {
|
try {
|
||||||
_contact = await ContactsService.openDeviceContactPicker();
|
_contact = await ContactsService
|
||||||
|
.openDeviceContactPicker();
|
||||||
setState(() {
|
setState(() {
|
||||||
_setContactControllers();
|
_setContactControllers();
|
||||||
});
|
});
|
||||||
|
|
@ -158,8 +166,8 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
||||||
print(e.toString());
|
print(e.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
),
|
: null,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
UserPicker(
|
UserPicker(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue