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