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/services.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
|
|
@ -331,7 +334,8 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
onSavePressed: (_) => _onDoneContactPressed(),
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.firstName,
|
||||
suffixIcon: IconButton(
|
||||
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||
? IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
icon: Icon(
|
||||
|
|
@ -351,7 +355,7 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
|
|||
}
|
||||
}
|
||||
}
|
||||
),
|
||||
) : null,
|
||||
),
|
||||
),
|
||||
DecoratedFormField(
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class ClientEditDetailsState extends State<ClientEditDetails> {
|
|||
onSavePressed: viewModel.onSavePressed,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.name,
|
||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
||||
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||
? IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
color: Theme.of(context).cardColor,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/models.dart';
|
||||
|
|
@ -293,7 +294,7 @@ class VendorContactEditDetailsState extends State<VendorContactEditDetails> {
|
|||
controller: _firstNameController,
|
||||
decoration: InputDecoration(
|
||||
labelText: localization.firstName,
|
||||
suffixIcon: Platform.isIOS || Platform.isAndroid
|
||||
suffixIcon: !kIsWeb && (Platform.isIOS || Platform.isAndroid)
|
||||
? IconButton(
|
||||
alignment: Alignment.bottomCenter,
|
||||
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/services.dart';
|
||||
import 'package:invoiceninja_flutter/data/models/entities.dart';
|
||||
|
|
@ -101,9 +104,11 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
|||
});
|
||||
}
|
||||
|
||||
void _setContactControllers(){
|
||||
_nameController.text = _contact.displayName != null ? _contact.displayName : '';
|
||||
_phoneController.text = _contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
||||
void _setContactControllers() {
|
||||
_nameController.text =
|
||||
_contact.displayName != null ? _contact.displayName : '';
|
||||
_phoneController.text =
|
||||
_contact.phones.isNotEmpty ? _contact.phones.first.value : '';
|
||||
}
|
||||
|
||||
// Check contacts permission
|
||||
|
|
@ -139,27 +144,30 @@ class VendorEditDetailsState extends State<VendorEditDetails> {
|
|||
: null,
|
||||
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: !kIsWeb && (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,
|
||||
),
|
||||
),
|
||||
UserPicker(
|
||||
|
|
|
|||
Loading…
Reference in New Issue