|
|
@@ -45,84 +45,84 @@ class AllPage extends BasePage<AllController> {
|
|
|
children: [
|
|
|
!controller.isEdit.value
|
|
|
? Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- Get.back();
|
|
|
- },
|
|
|
- child: Assets.images.iconCommonBack
|
|
|
- .image(width: 28.w, height: 28.w),
|
|
|
- ),
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- controller.isEdit.value = true;
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- width: 71.w,
|
|
|
- height: 30.h,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: "#1F2D3F".color,
|
|
|
- borderRadius: BorderRadius.all(
|
|
|
- Radius.circular(15.h),
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ Get.back();
|
|
|
+ },
|
|
|
+ child: Assets.images.iconCommonBack
|
|
|
+ .image(width: 28.w, height: 28.w),
|
|
|
),
|
|
|
- ),
|
|
|
- child: Center(
|
|
|
- child: Text(
|
|
|
- "Select",
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 14.sp,
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.isEdit.value = true;
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ width: 71.w,
|
|
|
+ height: 30.h,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: "#1F2D3F".color,
|
|
|
+ borderRadius: BorderRadius.all(
|
|
|
+ Radius.circular(15.h),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Text(
|
|
|
+ "Select",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 14.sp,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- )
|
|
|
+ ],
|
|
|
+ )
|
|
|
: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- controller.isEdit.value = false;
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- width: 71.w,
|
|
|
- height: 30.h,
|
|
|
- decoration: BoxDecoration(
|
|
|
- color: "#1F2D3F".color,
|
|
|
- borderRadius: BorderRadius.all(
|
|
|
- Radius.circular(15.h),
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.isEdit.value = false;
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ width: 71.w,
|
|
|
+ height: 30.h,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: "#1F2D3F".color,
|
|
|
+ borderRadius: BorderRadius.all(
|
|
|
+ Radius.circular(15.h),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ child: Center(
|
|
|
+ child: Text(
|
|
|
+ "Cancel",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 14.sp,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- child: Center(
|
|
|
- child: Text(
|
|
|
- "Cancel",
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 14.sp,
|
|
|
+ GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller.toggleSelectAll();
|
|
|
+ },
|
|
|
+ child: Text(
|
|
|
+ controller.isAllSelected.value
|
|
|
+ ? "Deselect all"
|
|
|
+ : "Select All",
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white.withOpacity(0.65),
|
|
|
+ fontSize: 14.sp,
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- GestureDetector(
|
|
|
- onTap: () {
|
|
|
- controller.toggleSelectAll();
|
|
|
- },
|
|
|
- child: Text(
|
|
|
- controller.isAllSelected.value
|
|
|
- ? "Deselect all"
|
|
|
- : "Select All",
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white.withOpacity(0.65),
|
|
|
- fontSize: 14.sp,
|
|
|
- ),
|
|
|
+ ],
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
SizedBox(
|
|
|
height: 12.h,
|
|
|
),
|
|
|
@@ -147,8 +147,8 @@ class AllPage extends BasePage<AllController> {
|
|
|
return ScrollablePositionedList.builder(
|
|
|
itemCount: ContactState.initials.length,
|
|
|
itemScrollController: controller.itemScrollController,
|
|
|
- itemPositionsListener: controller
|
|
|
- .itemPositionsListener,
|
|
|
+ itemPositionsListener:
|
|
|
+ controller.itemPositionsListener,
|
|
|
itemBuilder: (context, index) {
|
|
|
String initial = ContactState.initials[index];
|
|
|
return Column(
|
|
|
@@ -177,93 +177,115 @@ class AllPage extends BasePage<AllController> {
|
|
|
bool isFirst = index == 0; // 是否是第一个
|
|
|
bool isLast = index ==
|
|
|
(ContactState.groupedContacts[initial]
|
|
|
- ?.length ??
|
|
|
- 0) -
|
|
|
+ ?.length ??
|
|
|
+ 0) -
|
|
|
1; // 是否是最后一个
|
|
|
return Container(
|
|
|
- padding: EdgeInsets.all(10.w),
|
|
|
- width: double.infinity,
|
|
|
- // height: 62.h,
|
|
|
- decoration: BoxDecoration(
|
|
|
- borderRadius: BorderRadius.vertical(
|
|
|
- top: isFirst
|
|
|
- ? Radius.circular(12)
|
|
|
- : Radius.zero, // 第一个设置上圆角
|
|
|
- bottom: isLast
|
|
|
- ? Radius.circular(12)
|
|
|
- : Radius.zero, // 最后一个设置下圆角
|
|
|
+ padding: EdgeInsets.only(
|
|
|
+ left: 10.w,
|
|
|
+ top: 10.h,
|
|
|
+ right: 10.w,
|
|
|
),
|
|
|
- color: Colors.white.withOpacity(0.12),
|
|
|
- ),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment:
|
|
|
- MainAxisAlignment.spaceBetween,
|
|
|
- children: [
|
|
|
- Column(
|
|
|
- mainAxisAlignment:
|
|
|
- MainAxisAlignment.start,
|
|
|
- crossAxisAlignment:
|
|
|
- CrossAxisAlignment.start,
|
|
|
- children: [
|
|
|
- Text(
|
|
|
- contact.displayName.isEmpty
|
|
|
- ? 'No contact name'
|
|
|
- : contact.displayName,
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 14.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
- ),
|
|
|
- SizedBox(
|
|
|
- height: 5.h,
|
|
|
- ),
|
|
|
- Text(
|
|
|
- contact.phones.isEmpty
|
|
|
- ? 'No contact number'
|
|
|
- : contact.phones.first.number,
|
|
|
-
|
|
|
- style: TextStyle(
|
|
|
- color: Colors.white,
|
|
|
- fontSize: 14.sp,
|
|
|
- fontWeight: FontWeight.w500,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
+ width: double.infinity,
|
|
|
+ // height: 62.h,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ borderRadius: BorderRadius.vertical(
|
|
|
+ top: isFirst
|
|
|
+ ? Radius.circular(12)
|
|
|
+ : Radius.zero, // 第一个设置上圆角
|
|
|
+ bottom: isLast
|
|
|
+ ? Radius.circular(12)
|
|
|
+ : Radius.zero, // 最后一个设置下圆角
|
|
|
),
|
|
|
- // 删除按钮
|
|
|
- Visibility(
|
|
|
- visible: controller.isEdit.value,
|
|
|
- child: GestureDetector(
|
|
|
- onTap: () {
|
|
|
- controller.toggleSelectContact(
|
|
|
- contact);
|
|
|
- },
|
|
|
- child: Container(
|
|
|
- child: controller.selectedContacts
|
|
|
- .contains(contact.id)
|
|
|
- ? Center(
|
|
|
- child: Assets
|
|
|
- .images.iconSelected
|
|
|
- .image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
- ),
|
|
|
- )
|
|
|
- : Center(
|
|
|
- child: Assets
|
|
|
- .images.iconUnselected
|
|
|
- .image(
|
|
|
- width: 16.w,
|
|
|
- height: 16.h,
|
|
|
+ color: Colors.white.withOpacity(0.12),
|
|
|
+ ),
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ mainAxisAlignment:
|
|
|
+ MainAxisAlignment.spaceBetween,
|
|
|
+ children: [
|
|
|
+ Column(
|
|
|
+ mainAxisAlignment:
|
|
|
+ MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment:
|
|
|
+ CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Text(
|
|
|
+ contact.displayName.isEmpty
|
|
|
+ ? 'No contact name'
|
|
|
+ : contact.displayName,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight:
|
|
|
+ FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(
|
|
|
+ height: 5.h,
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ contact.phones.isEmpty
|
|
|
+ ? 'No contact number'
|
|
|
+ : contact.phones.first
|
|
|
+ .number,
|
|
|
+ style: TextStyle(
|
|
|
+ color: Colors.white,
|
|
|
+ fontSize: 14.sp,
|
|
|
+ fontWeight:
|
|
|
+ FontWeight.w500,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ // 删除按钮
|
|
|
+ Visibility(
|
|
|
+ visible:
|
|
|
+ controller.isEdit.value,
|
|
|
+ child: GestureDetector(
|
|
|
+ onTap: () {
|
|
|
+ controller
|
|
|
+ .toggleSelectContact(
|
|
|
+ contact);
|
|
|
+ },
|
|
|
+ child: Container(
|
|
|
+ child: controller
|
|
|
+ .selectedContacts
|
|
|
+ .contains(
|
|
|
+ contact.id)
|
|
|
+ ? Center(
|
|
|
+ child: Assets.images
|
|
|
+ .iconSelected
|
|
|
+ .image(
|
|
|
+ width: 20.w,
|
|
|
+ height: 20.h,
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ : Center(
|
|
|
+ child: Assets.images
|
|
|
+ .iconUnselected
|
|
|
+ .image(
|
|
|
+ width: 20.w,
|
|
|
+ height: 20.h,
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
),
|
|
|
),
|
|
|
- ),
|
|
|
+ ],
|
|
|
),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- );
|
|
|
+ SizedBox(
|
|
|
+ height: 10.h,
|
|
|
+ ),
|
|
|
+ Visibility(
|
|
|
+ visible: !isLast,
|
|
|
+ child: Container(
|
|
|
+ height: 1.h,
|
|
|
+ color: "#3E3E47".color,
|
|
|
+ )),
|
|
|
+ ],
|
|
|
+ ));
|
|
|
}),
|
|
|
SizedBox(
|
|
|
height: 12.h,
|
|
|
@@ -281,10 +303,8 @@ class AllPage extends BasePage<AllController> {
|
|
|
itemCount: ContactState.initials.length,
|
|
|
itemBuilder: (context, index) {
|
|
|
return GestureDetector(
|
|
|
- onTap: () =>
|
|
|
- controller
|
|
|
- .scrollToInitial(
|
|
|
- ContactState.initials[index]),
|
|
|
+ onTap: () => controller
|
|
|
+ .scrollToInitial(ContactState.initials[index]),
|
|
|
child: Padding(
|
|
|
padding: EdgeInsets.symmetric(vertical: 2),
|
|
|
child: Text(
|