Browse Source

优化样式与交互

ios
王子贤 2 months ago
parent
commit
5e1d3a1428
7 changed files with 106 additions and 85 deletions
  1. 6
      lib/controller/home/home_controller.dart
  2. 64
      lib/model/home/event_list_data.dart
  3. 2
      lib/network/api_urls.dart
  4. 2
      lib/network/home_api.g.dart
  5. 26
      lib/pages/home/event_info.dart
  6. 9
      lib/pages/home/matchmaker_page.dart
  7. 82
      lib/pages/home/recommend_tab.dart

6
lib/controller/home/home_controller.dart

@ -25,7 +25,8 @@ class HomeController extends GetxController {
final nearbyIsLoading = false.obs;
final nearbyPage = 1.obs;
final nearbyHasMore = true.obs;
final marchPage = 1.obs;
//
final selectedTabIndex = 0.obs;
@ -81,7 +82,7 @@ class HomeController extends GetxController {
getMatchmakerList() async {
try{
final response = await _homeApi.userPageDongwoMatchmakerMarriageInformation(
pageNum: 1,
pageNum: marchPage.value,
pageSize: 10
);
if (response.data.isSuccess && response.data.data != null) {
@ -94,6 +95,7 @@ class HomeController extends GetxController {
} else {
listRefreshController.finishLoad(IndicatorResult.noMore);
}
update();
} else {
//

64
lib/model/home/event_list_data.dart

@ -1,9 +1,9 @@
class EventListData {
List<Records>? records;
int? total;
int? size;
int? current;
int? pages;
num? total;
num? size;
num? current;
num? pages;
EventListData(
{this.records, this.total, this.size, this.current, this.pages});
@ -47,43 +47,43 @@ class Records {
String? applyEndTime;
String? beginTime;
String? endTime;
int? provinceCode;
num? provinceCode;
String? provinceName;
int? cityCode;
num? cityCode;
String? cityName;
int? districtCode;
num? districtCode;
String? districtName;
String? detailedAddress;
int? numberParticipants;
int? numberMan;
int? numberWoman;
double? manEntryFee;
double? womanEntryFee;
double? manDiscount;
double? womanDiscount;
num? numberParticipants;
num? numberMan;
num? numberWoman;
num? manEntryFee;
num? womanEntryFee;
num? manDiscount;
num? womanDiscount;
String? depict;
int? status;
int? activityType;
num? status;
num? activityType;
String? communityId;
String? communityName;
String? communityQrCodeUrl;
String? contactPictureUrl;
String? goodsName;
int? chargeType;
int? mutualAssistanceLimit;
num? chargeType;
num? mutualAssistanceLimit;
bool? needRegInfo;
bool? realNameSwitch;
List<ImgList>? imgList;
int? topSerialNumber;
num? topSerialNumber;
String? sharePhotosUrl;
String? contentPic;
int? contentPicHeight;
int? simulationNanNum;
int? simulationWonanNum;
int? registrationPopulation;
int? participantStatus;
int? manNumber;
int? womanNumber;
num? contentPicHeight;
num? simulationNanNum;
num? simulationWonanNum;
num? registrationPopulation;
num? participantStatus;
num? manNumber;
num? womanNumber;
Records(
{this.id,
@ -253,12 +253,12 @@ class Records {
class ImgList {
String? id;
bool? isDelete;
List<int>? createTime;
List<int>? updateTime;
List<num>? createTime;
List<num>? updateTime;
Null? event;
int? siteActivityId;
num? siteActivityId;
String? url;
int? serialNumber;
num? serialNumber;
ImgList(
{this.id,
@ -273,8 +273,8 @@ class ImgList {
ImgList.fromJson(Map<String, dynamic> json) {
id = json['id'];
isDelete = json['isDelete'];
createTime = json['createTime'].cast<int>();
updateTime = json['updateTime'].cast<int>();
createTime = json['createTime'].cast<num>();
updateTime = json['updateTime'].cast<num>();
event = json['event'];
siteActivityId = json['siteActivityId'];
url = json['url'];

2
lib/network/api_urls.dart

@ -141,7 +141,7 @@ class ApiUrls {
'dating-agency-service/user/page/own-post-dynamic';
static const String userParticipateInSiteActivity =
'dating-agency-service/user/participate/in/site/activity';
'dating-agency-service/user/participate/in/site/qulianlian-activity';
static const String userQuitSiteActivity =
'dating-agency-service/user/quit/site/activity';

2
lib/network/home_api.g.dart

@ -435,7 +435,7 @@ class _HomeApi implements HomeApi {
Options(method: 'POST', headers: _headers, extra: _extra)
.compose(
_dio.options,
'dating-agency-service/user/participate/in/site/activity',
'dating-agency-service/user/participate/in/site/qulianlian-activity',
queryParameters: queryParameters,
data: _data,
)

26
lib/pages/home/event_info.dart

@ -105,6 +105,7 @@ class EventInfo extends StatelessWidget {
),
SizedBox(height: 5.w,),
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Icon(
Icons.location_on_outlined,
@ -118,11 +119,13 @@ class EventInfo extends StatelessWidget {
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
Text(
"${controller.item.value.cityName ?? ""}${controller.item.value.districtName ?? ""}${controller.item.value.detailedAddress ?? ""}",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
Expanded(
child: Text(
"${controller.item.value.cityName ?? ""}${controller.item.value.districtName ?? ""}${controller.item.value.detailedAddress ?? ""}",
style: TextStyle(
fontSize: 12.w,
color: const Color.fromRGBO(144, 144, 144, 1)
),
),
)
],
@ -228,10 +231,19 @@ class EventInfo extends StatelessWidget {
],
),
),
CachedNetworkImage(
if(controller.item.value.contentPic != null && controller.item.value.contentPic != "")CachedNetworkImage(
imageUrl: controller.item.value.contentPic ?? "",
width: 345.w,
fit: BoxFit.cover,
),
if(controller.item.value.contentPic == null || controller.item.value.contentPic == "") Row(
children: [
Expanded(child: SizedBox(
child: Text(
controller.item.value.depict ?? ""
),
))
],
)
],
),
@ -239,7 +251,7 @@ class EventInfo extends StatelessWidget {
),
),
),
bottomNavigationBar: (controller.item.value.participantStatus == 0 || controller.item.value.participantStatus == -1) ? Container(
bottomNavigationBar: (controller.item.value.participantStatus == 0) ? Container(
height: 60.w,
color: Colors.white,
child: Center(

9
lib/pages/home/matchmaker_page.dart

@ -50,16 +50,23 @@ class _MatchmakerPageState extends State<MatchmakerPage> with AutomaticKeepAlive
onRefresh: () async {
print('推荐列表下拉刷新被触发');
controller.marchPage.value = 1;
controller.matchmakerList.clear();
await controller.getMatchmakerList();
controller.listRefreshController.finishRefresh(IndicatorResult.success);
controller.listRefreshController.finishLoad(IndicatorResult.none);
setState(() {
});
},
//
onLoad: () async {
print('推荐列表上拉加载被触发, hasMore: ');
controller.marchPage.value += 1;
await controller.getMatchmakerList();
setState(() {
});
},
child: Container(
padding: EdgeInsets.symmetric(

82
lib/pages/home/recommend_tab.dart

@ -116,6 +116,47 @@ class _RecommendTabState extends State<RecommendTab>
child: SingleChildScrollView(
child: Column(
children: [
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
margin: EdgeInsets.only(bottom: 10.w),
height: 90.w,
child: Swiper(
autoplay: true,
itemCount: controller.bannerLint.length,
loop: true,
onTap: (int index){
print(index);
if(controller.bannerLint[index].jumpType == 2){
Get.to(() => OpenWebView(url: controller.bannerLint[index].jumpValue ?? ""));
} else if(controller.bannerLint[index].jumpType == 3){
TDImageViewer.showImageViewer(context: context, images: [controller.bannerLint[index].jumpValue ?? ""]);
}
},
itemBuilder: (BuildContext context, int index) {
return CachedNetworkImage(
imageUrl: controller.bannerLint[index].image ?? "",
height: 90.w,
fit: BoxFit.cover,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
errorWidget: (context, url, error) => Image.asset(
Assets.imagesUserAvatar,
width: 165.w,
height: 165.w,
fit: BoxFit.cover,
),
);
},
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
margin: EdgeInsets.only(bottom: 10.w),
@ -255,47 +296,6 @@ class _RecommendTabState extends State<RecommendTab>
],
),
),
Container(
padding: EdgeInsets.symmetric(horizontal: 12),
margin: EdgeInsets.only(bottom: 10.w),
height: 90.w,
child: Swiper(
autoplay: true,
itemCount: controller.bannerLint.length,
loop: true,
onTap: (int index){
print(index);
if(controller.bannerLint[index].jumpType == 2){
Get.to(() => OpenWebView(url: controller.bannerLint[index].jumpValue ?? ""));
} else if(controller.bannerLint[index].jumpType == 3){
TDImageViewer.showImageViewer(context: context, images: [controller.bannerLint[index].jumpValue ?? ""]);
}
},
itemBuilder: (BuildContext context, int index) {
return CachedNetworkImage(
imageUrl: controller.bannerLint[index].image ?? "",
height: 90.w,
fit: BoxFit.cover,
imageBuilder: (context, imageProvider) => Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
image: DecorationImage(
image: imageProvider,
fit: BoxFit.cover,
),
),
),
errorWidget: (context, url, error) => Image.asset(
Assets.imagesUserAvatar,
width: 165.w,
height: 165.w,
fit: BoxFit.cover,
),
);
},
),
),
ListView.separated(
shrinkWrap: true, // 1
physics: const NeverScrollableScrollPhysics(), // 2

Loading…
Cancel
Save