Show “Blank contact” on client view page

This commit is contained in:
Hillel Coren 2020-10-03 22:18:39 +03:00
parent 797bb7b6a9
commit b44613540d
2 changed files with 20 additions and 5 deletions

View File

@ -31,15 +31,19 @@ class AppListTile extends StatelessWidget {
title: Text(title),
subtitle: buttons != null
? Padding(
padding: const EdgeInsets.only(top: 8),
child: Row(
padding: const EdgeInsets.only(top: 8),
child: Row(
children: buttons,
),
)
)
: (subtitle == null ? Container() : Text(subtitle)),
dense: dense,
onTap: onTap,
onLongPress: () {
if ((copyValue ?? title ?? '').isEmpty) {
return;
}
Clipboard.setData(ClipboardData(text: copyValue ?? title));
Scaffold.of(context).showSnackBar(SnackBar(
content: Text(AppLocalization.of(context)

View File

@ -77,9 +77,16 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
)),
],
icon: Icons.email,
title: contact.fullName + '\n' + contact.email,
title: (contact.fullName.isEmpty
? localization.blankContact
: contact.fullName) +
('\n' + contact.email).trim(),
copyValue: contact.email,
onTap: () => setState(() {
if ((contact.email ?? '').isEmpty) {
return;
}
_launched = _launchURL(context, 'mailto:' + contact.email);
}),
));
@ -87,7 +94,11 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
if ((contact.phone ?? '').isNotEmpty) {
listTiles.add(AppListTile(
icon: Icons.phone,
title: contact.fullName + '\n' + contact.phone,
title: (contact.fullName.isEmpty
? localization.blankContact
: contact.fullName) +
'\n' +
contact.phone,
copyValue: contact.phone,
subtitle: localization.phone,
onTap: () => setState(() {