|
...
|
...
|
@@ -128,23 +128,15 @@ class _ContantRightPageState extends State<ContantRightPage> { |
|
|
|
});
|
|
|
|
|
|
|
|
// Lazy load thumbnails after rendering initial contacts.
|
|
|
|
for (final contact in contacts) {
|
|
|
|
ContactsService.getAvatar(contact).then((avatar) {
|
|
|
|
if (avatar == null) return; // Don't redraw if no change.
|
|
|
|
setState(() => contact.avatar = avatar);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
// for (final contact in contacts) {
|
|
|
|
// ContactsService.getAvatar(contact).then((avatar) {
|
|
|
|
// if (avatar == null) return; // Don't redraw if no change.
|
|
|
|
// setState(() => contact.avatar = avatar);
|
|
|
|
// });
|
|
|
|
// }
|
|
|
|
}
|
|
|
|
|
|
|
|
void updateContact() async {
|
|
|
|
Contact ninja = _contacts
|
|
|
|
.toList()
|
|
|
|
.firstWhere((contact) => contact.familyName.startsWith("Ninja"));
|
|
|
|
ninja.avatar = null;
|
|
|
|
await ContactsService.updateContact(ninja);
|
|
|
|
|
|
|
|
refreshContacts();
|
|
|
|
}
|
|
|
|
|
|
|
|
_openContactForm() async {
|
|
|
|
try {
|
|
...
|
...
|
@@ -220,7 +212,6 @@ class _ContantRightPageState extends State<ContantRightPage> { |
|
|
|
goSetting = true;
|
|
|
|
openSetting();
|
|
|
|
}
|
|
|
|
;
|
|
|
|
},
|
|
|
|
emptyMsg: "暂时没有联系人哦",
|
|
|
|
emptyImg: "empty_search",
|
|
...
|
...
|
@@ -230,49 +221,56 @@ class _ContantRightPageState extends State<ContantRightPage> { |
|
|
|
itemCount: _contacts?.length ?? 0,
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
Contact c = _contacts?.elementAt(index);
|
|
|
|
return Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
index == 0
|
|
|
|
? MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
color: MyColours.color_f5f5f5,
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
height: ScreenUtil().setWidth(74 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
top: index == 0
|
|
|
|
? BorderSide(
|
|
|
|
return InkWell(
|
|
|
|
onTap: () {
|
|
|
|
if (c.phones.first.value != null &&
|
|
|
|
c.phones.first.value != '') {
|
|
|
|
DialogUtil.goPhone(c.phones.first.value);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
index == 0
|
|
|
|
? MyDivider(
|
|
|
|
double.infinity,
|
|
|
|
ScreenUtil().setWidth(20),
|
|
|
|
color: MyColours.color_f5f5f5,
|
|
|
|
)
|
|
|
|
: Container(),
|
|
|
|
Container(
|
|
|
|
width: double.infinity,
|
|
|
|
padding: EdgeInsets.symmetric(
|
|
|
|
horizontal: ScreenUtil().setWidth(40),
|
|
|
|
vertical: ScreenUtil().setWidth(30)),
|
|
|
|
height: ScreenUtil().setWidth(74 * 2),
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
border: Border(
|
|
|
|
top: index == 0
|
|
|
|
? BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E0E0E0)
|
|
|
|
: BorderSide(
|
|
|
|
width: 0, color: Colors.transparent),
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E0E0E0)
|
|
|
|
: BorderSide(
|
|
|
|
width: 0, color: Colors.transparent),
|
|
|
|
bottom: BorderSide(
|
|
|
|
width: ScreenUtil().setWidth(2),
|
|
|
|
color: MyColours.color_E0E0E0))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(c.displayName,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(32))),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(c.phones.first.value,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]);
|
|
|
|
color: MyColours.color_E0E0E0))),
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
Text(c.displayName,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_333333,
|
|
|
|
fontSize: ScreenUtil().setSp(32))),
|
|
|
|
VEmptyView(10),
|
|
|
|
Text(c.phones.first.value,
|
|
|
|
style: TextStyle(
|
|
|
|
color: MyColours.color_999999,
|
|
|
|
fontSize: ScreenUtil().setSp(30)))
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
]));
|
|
|
|
});
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|