diff --git a/lib/view/directory/directory_view.dart b/lib/view/directory/directory_view.dart index a61fd3d..135da9f 100644 --- a/lib/view/directory/directory_view.dart +++ b/lib/view/directory/directory_view.dart @@ -28,7 +28,7 @@ class DirectoryView extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.white, + backgroundColor: Colors.white, floatingActionButton: FloatingActionButton( backgroundColor: Colors.red, onPressed: () async { @@ -106,17 +106,19 @@ class DirectoryView extends StatelessWidget { child: IconButton( icon: Icon(Icons.filter_alt_outlined, size: 20, - color: - isFilterActive ? Colors.indigo : Colors.black87), + color: isFilterActive + ? Colors.indigo + : Colors.black87), onPressed: () { showModalBottomSheet( context: context, isScrollControlled: true, shape: const RoundedRectangleBorder( - borderRadius: - BorderRadius.vertical(top: Radius.circular(20)), + borderRadius: BorderRadius.vertical( + top: Radius.circular(20)), ), - builder: (_) => const DirectoryFilterBottomSheet(), + builder: (_) => + const DirectoryFilterBottomSheet(), ); }, ), @@ -160,7 +162,8 @@ class DirectoryView extends StatelessWidget { child: Obx(() => Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - MyText.bodySmall('Show Inactive', fontWeight: 600), + MyText.bodySmall('Show Inactive', + fontWeight: 600), Switch.adaptive( value: !controller.isActive.value, activeColor: Colors.indigo, @@ -209,13 +212,9 @@ class DirectoryView extends StatelessWidget { separatorBuilder: (_, __) => MySpacing.height(12), itemBuilder: (_, index) { final contact = controller.filteredContacts[index]; - final phone = contact.contactPhones.isNotEmpty - ? contact.contactPhones.first.phoneNumber - : '-'; final nameParts = contact.name.trim().split(" "); final firstName = nameParts.first; - final lastName = - nameParts.length > 1 ? nameParts.last : ""; + final lastName = nameParts.length > 1 ? nameParts.last : ""; final tags = contact.tags.map((tag) => tag.name).toList(); return InkWell( @@ -242,21 +241,22 @@ class DirectoryView extends StatelessWidget { MyText.bodySmall(contact.organization, color: Colors.grey[700], overflow: TextOverflow.ellipsis), - MySpacing.height(6), + MySpacing.height(8), Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ ...contact.contactEmails.map((e) => GestureDetector( - onTap: () => LauncherUtils - .launchEmail(e.emailAddress), + onTap: () => + LauncherUtils.launchEmail( + e.emailAddress), onLongPress: () => LauncherUtils.copyToClipboard( e.emailAddress, typeLabel: 'Email'), child: Padding( - padding: - const EdgeInsets.only(bottom: 4), + padding: const EdgeInsets.only( + bottom: 4), child: Row( mainAxisSize: MainAxisSize.min, children: [ @@ -281,45 +281,64 @@ class DirectoryView extends StatelessWidget { ), ), )), - ...contact.contactPhones.map((p) => - GestureDetector( - onTap: () => LauncherUtils - .launchPhone(p.phoneNumber), - onLongPress: () => - LauncherUtils.copyToClipboard( - p.phoneNumber, - typeLabel: 'Phone number'), - child: Padding( - padding: - const EdgeInsets.only(bottom: 4), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - const Icon(Icons.phone_outlined, - size: 16, - color: Colors.indigo), - MySpacing.width(4), - ConstrainedBox( - constraints: - const BoxConstraints( - maxWidth: 160), - child: MyText.labelSmall( - p.phoneNumber, - overflow: - TextOverflow.ellipsis, - color: Colors.indigo, - decoration: TextDecoration - .underline, - ), + ...contact.contactPhones.map((p) => Padding( + padding: + const EdgeInsets.only(bottom: 8,top: 4), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + GestureDetector( + onTap: () => + LauncherUtils.launchPhone( + p.phoneNumber), + onLongPress: () => LauncherUtils + .copyToClipboard( + p.phoneNumber, + typeLabel: + 'Phone number'), + child: Row( + mainAxisSize: + MainAxisSize.min, + children: [ + const Icon( + Icons.phone_outlined, + size: 16, + color: Colors.indigo), + MySpacing.width(4), + ConstrainedBox( + constraints: + const BoxConstraints( + maxWidth: 140), + child: MyText.labelSmall( + p.phoneNumber, + overflow: TextOverflow + .ellipsis, + color: Colors.indigo, + decoration: + TextDecoration + .underline, + ), + ), + ], ), - ], - ), + ), + MySpacing.width(8), + GestureDetector( + onTap: () => LauncherUtils + .launchWhatsApp( + p.phoneNumber), + child: const FaIcon( + FontAwesomeIcons.whatsapp, + color: Colors.green, + size: 16), + ), + ], ), - )), + )) ], ), if (tags.isNotEmpty) ...[ - MySpacing.height(4), + MySpacing.height(2), MyText.labelSmall(tags.join(', '), color: Colors.grey[500], maxLines: 1, @@ -333,14 +352,7 @@ class DirectoryView extends StatelessWidget { children: [ const Icon(Icons.arrow_forward_ios, color: Colors.grey, size: 16), - MySpacing.height(12), - if (phone != '-') - GestureDetector( - onTap: () => - LauncherUtils.launchWhatsApp(phone), - child: const FaIcon(FontAwesomeIcons.whatsapp, - color: Colors.green, size: 20), - ), + MySpacing.height(8), ], ), ],