From 05c4b4e3e4b44780f72649aa8b434bd251c42689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=AD=90=E8=B4=A4?= Date: Mon, 5 Jan 2026 16:59:43 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=B9=E6=8E=A5=E5=8A=A8=E6=80=81=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../home/timeline_trend_controller.dart | 67 +++ lib/model/home/trend_data.dart | 91 +++ lib/network/api_urls.dart | 3 + lib/network/home_api.dart | 7 + lib/network/home_api.g.dart | 37 ++ lib/pages/home/event_info.dart | 24 + lib/pages/home/timeline_page.dart | 12 + lib/pages/home/timeline_trend.dart | 243 ++++++++ lib/pages/home/user_information_page.dart | 523 ++++++++++-------- lib/pages/mine/edit_info_page.dart | 16 +- lib/pages/mine/mine_page.dart | 19 +- 11 files changed, 780 insertions(+), 262 deletions(-) create mode 100644 lib/controller/home/timeline_trend_controller.dart create mode 100644 lib/model/home/trend_data.dart create mode 100644 lib/pages/home/timeline_trend.dart diff --git a/lib/controller/home/timeline_trend_controller.dart b/lib/controller/home/timeline_trend_controller.dart new file mode 100644 index 0000000..fad7335 --- /dev/null +++ b/lib/controller/home/timeline_trend_controller.dart @@ -0,0 +1,67 @@ +import 'package:dating_touchme_app/network/home_api.dart'; +import 'package:easy_refresh/easy_refresh.dart'; +import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; +import 'package:get/get.dart'; + +import '../../model/home/trend_data.dart'; + +class TimelineTrendController extends GetxController { + + final trendList = [].obs; + + final page = 1.obs; + final size = 10.obs; + + late final EasyRefreshController listRefreshController; + + late final HomeApi _homeApi; + + @override + void onInit() { + super.onInit(); + listRefreshController = EasyRefreshController( + controlFinishRefresh: true, + controlFinishLoad: true, + ); + // 从全局依赖中获取HomeApi + _homeApi = Get.find(); + + getTrendData(); + + } + + + + getTrendData() async { + try { + final response = await _homeApi.userPageOwnPostDynamic( + pageNum: page.value, + pageSize: size.value + ); + if (response.data.isSuccess && response.data.data != null) { + final data = response.data.data?.records ?? []; + + trendList.addAll(data); + + if((data.length ?? 0) == size.value){ + + listRefreshController.finishLoad(IndicatorResult.success); + } else { + listRefreshController.finishLoad(IndicatorResult.noMore); + } + + } else { + + // 响应失败,抛出异常 + throw Exception(response.data.message ?? '获取数据失败'); + } + } catch(e){ + print('详情获取失败: $e'); + SmartDialog.showToast('动态失败'); + rethrow; + + } + } + + +} \ No newline at end of file diff --git a/lib/model/home/trend_data.dart b/lib/model/home/trend_data.dart new file mode 100644 index 0000000..1fdd47d --- /dev/null +++ b/lib/model/home/trend_data.dart @@ -0,0 +1,91 @@ +class TrendData { + List? records; + int? total; + int? size; + int? current; + int? pages; + + TrendData({this.records, this.total, this.size, this.current, this.pages}); + + TrendData.fromJson(Map json) { + if (json['records'] != null) { + records = []; + json['records'].forEach((v) { + records!.add(new Records.fromJson(v)); + }); + } + total = json['total']; + size = json['size']; + current = json['current']; + pages = json['pages']; + } + + Map toJson() { + final Map data = new Map(); + if (this.records != null) { + data['records'] = this.records!.map((v) => v.toJson()).toList(); + } + data['total'] = this.total; + data['size'] = this.size; + data['current'] = this.current; + data['pages'] = this.pages; + return data; + } +} + +class Records { + String? postId; + int? operationType; + String? postCommentContent; + String? userId; + String? miId; + String? nickName; + String? profilePhoto; + String? content; + String? mediaUrls; + String? topicTags; + String? createTime; + + Records( + {this.postId, + this.operationType, + this.postCommentContent, + this.userId, + this.miId, + this.nickName, + this.profilePhoto, + this.content, + this.mediaUrls, + this.topicTags, + this.createTime}); + + Records.fromJson(Map json) { + postId = json['postId']; + operationType = json['operationType']; + postCommentContent = json['postCommentContent']; + userId = json['userId']; + miId = json['miId']; + nickName = json['nickName']; + profilePhoto = json['profilePhoto']; + content = json['content']; + mediaUrls = json['mediaUrls']; + topicTags = json['topicTags']; + createTime = json['createTime']; + } + + Map toJson() { + final Map data = new Map(); + data['postId'] = this.postId; + data['operationType'] = this.operationType; + data['postCommentContent'] = this.postCommentContent; + data['userId'] = this.userId; + data['miId'] = this.miId; + data['nickName'] = this.nickName; + data['profilePhoto'] = this.profilePhoto; + data['content'] = this.content; + data['mediaUrls'] = this.mediaUrls; + data['topicTags'] = this.topicTags; + data['createTime'] = this.createTime; + return data; + } +} diff --git a/lib/network/api_urls.dart b/lib/network/api_urls.dart index bde5101..b792c44 100644 --- a/lib/network/api_urls.dart +++ b/lib/network/api_urls.dart @@ -137,6 +137,9 @@ class ApiUrls { static const String userPageAuthorPost = 'dating-agency-service/user/page/author-post'; + static const String userPageOwnPostDynamic = + 'dating-agency-service/user/page/own-post-dynamic'; + // 后续可以在此添加更多API端点 static const String listMatchmakerProduct = 'dating-agency-mall/user/page/product/by/matchmaker'; diff --git a/lib/network/home_api.dart b/lib/network/home_api.dart index 966fb98..77df532 100644 --- a/lib/network/home_api.dart +++ b/lib/network/home_api.dart @@ -2,6 +2,7 @@ import 'package:dating_touchme_app/model/home/event_data.dart'; import 'package:dating_touchme_app/model/home/event_list_data.dart' hide Records; import 'package:dating_touchme_app/model/home/post_comment_data.dart' hide Records; import 'package:dating_touchme_app/model/home/post_data.dart'; +import 'package:dating_touchme_app/model/home/trend_data.dart' hide Records; import 'package:dating_touchme_app/network/api_urls.dart'; import 'package:dating_touchme_app/network/response_model.dart'; import 'package:retrofit/retrofit.dart'; @@ -74,4 +75,10 @@ abstract class HomeApi { Future>> userGetSiteActivityDetails({ @Query('id') required String id, }); + + @GET(ApiUrls.userPageOwnPostDynamic) + Future>> userPageOwnPostDynamic({ + @Query('pageNum') required int pageNum, + @Query('pageSize') required int pageSize, + }); } \ No newline at end of file diff --git a/lib/network/home_api.g.dart b/lib/network/home_api.g.dart index 46a38f2..bd9bfb0 100644 --- a/lib/network/home_api.g.dart +++ b/lib/network/home_api.g.dart @@ -385,6 +385,43 @@ class _HomeApi implements HomeApi { return httpResponse; } + @override + Future>> userPageOwnPostDynamic({ + required int pageNum, + required int pageSize, + }) async { + final _extra = {}; + final queryParameters = { + r'pageNum': pageNum, + r'pageSize': pageSize, + }; + final _headers = {}; + const Map? _data = null; + final _options = _setStreamType>>( + Options(method: 'GET', headers: _headers, extra: _extra) + .compose( + _dio.options, + 'dating-agency-service/user/page/own-post-dynamic', + queryParameters: queryParameters, + data: _data, + ) + .copyWith(baseUrl: _combineBaseUrls(_dio.options.baseUrl, baseUrl)), + ); + final _result = await _dio.fetch>(_options); + late BaseResponse _value; + try { + _value = BaseResponse.fromJson( + _result.data!, + (json) => TrendData.fromJson(json as Map), + ); + } on Object catch (e, s) { + errorLogger?.logError(e, s, _options); + rethrow; + } + final httpResponse = HttpResponse(_value, _result); + return httpResponse; + } + RequestOptions _setStreamType(RequestOptions requestOptions) { if (T != dynamic && !(requestOptions.responseType == ResponseType.bytes || diff --git a/lib/pages/home/event_info.dart b/lib/pages/home/event_info.dart index 2f1cc09..5cca8e8 100644 --- a/lib/pages/home/event_info.dart +++ b/lib/pages/home/event_info.dart @@ -281,6 +281,30 @@ class EventInfo extends StatelessWidget { ), ), ), + bottomNavigationBar: Container( + height: 60.w, + color: Colors.white, + child: Center( + child: Container( + width: 350.w, + height: 45.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(45.w)), + color: Colors.grey, + ), + child: Center( + child: Text( + "活动已结束", + style: TextStyle( + fontSize: 18.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ), + ), + ), + ), ) : Container(); }, ); diff --git a/lib/pages/home/timeline_page.dart b/lib/pages/home/timeline_page.dart index 16bd9ac..83d9f42 100644 --- a/lib/pages/home/timeline_page.dart +++ b/lib/pages/home/timeline_page.dart @@ -3,6 +3,7 @@ import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/pages/home/recommend_window.dart'; import 'package:dating_touchme_app/pages/home/send_timeline.dart'; +import 'package:dating_touchme_app/pages/home/timeline_trend.dart'; import 'package:dating_touchme_app/pages/home/timeline_window.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -99,6 +100,17 @@ class _TimelinePageState extends State preferredSize: Size.fromHeight(4), child: SizedBox(height: 4), ), + actions: [ + Container( + margin: EdgeInsets.only(right: 15), + child: Icon( + Icons.email_outlined, + size: 19, + ), + ).onTap((){ + Get.to(() => TimelineTrend()); + }) + ], ); } diff --git a/lib/pages/home/timeline_trend.dart b/lib/pages/home/timeline_trend.dart new file mode 100644 index 0000000..a509961 --- /dev/null +++ b/lib/pages/home/timeline_trend.dart @@ -0,0 +1,243 @@ +import 'package:cached_network_image/cached_network_image.dart'; +import 'package:dating_touchme_app/components/page_appbar.dart'; +import 'package:dating_touchme_app/config/emoji_config.dart'; +import 'package:dating_touchme_app/controller/home/timeline_trend_controller.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; +import 'package:dating_touchme_app/generated/assets.dart'; +import 'package:dating_touchme_app/model/home/trend_data.dart'; +import 'package:dating_touchme_app/pages/home/timeline_info.dart'; +import 'package:easy_refresh/easy_refresh.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/get.dart'; + +class TimelineTrend extends StatelessWidget { + const TimelineTrend({super.key}); + + @override + Widget build(BuildContext context) { + return GetX( + init: TimelineTrendController(), + builder: (controller){ + return Scaffold( + appBar: PageAppbar(title: "互动通知"), + body: EasyRefresh( + header: const ClassicHeader( + dragText: '下拉刷新', + armedText: '释放刷新', + readyText: '刷新中...', + processingText: '刷新中...', + processedText: '刷新完成', + failedText: '刷新失败', + noMoreText: '没有更多数据', + showMessage: false + ), + footer: ClassicFooter( + dragText: '上拉加载', + armedText: '释放加载', + readyText: '加载中...', + processingText: '加载中...', + processedText: '加载完成', + failedText: '加载失败', + noMoreText: '没有更多数据', + showMessage: false + ), + // 下拉刷新 + onRefresh: () async { + print('推荐列表下拉刷新被触发'); + controller.page.value = 1; + controller.trendList.clear(); + await controller.getTrendData(); + controller.listRefreshController.finishRefresh(IndicatorResult.success); + controller.listRefreshController.finishLoad(IndicatorResult.none); + }, + // 上拉加载更多 + onLoad: () async { + print('推荐列表上拉加载被触发, hasMore: '); + controller.page.value += 1; + controller.getTrendData(); + }, + child: ListView.separated( + // 关键:始终允许滚动,即使内容不足 + // 移除顶部 padding,让刷新指示器可以正确显示在 AppBar 下方 + padding: EdgeInsets.only(left: 12, right: 12), + itemBuilder: (context, index){ + + if (controller.trendList.isEmpty) { + return Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text('暂无数据'), + ], + ), + ); + } + + return TrendItem(item: controller.trendList[index]); + }, + + separatorBuilder: (context, index) { + // 空状态或加载状态时不显示分隔符 + // if (controller.postList.isEmpty) { + // return const SizedBox.shrink(); + // } + return const SizedBox(height: 12); + }, + itemCount: controller.trendList.isEmpty ? 1 : controller.trendList.length, + ), + ), + ); + }, + ); + } +} + +class TrendItem extends StatefulWidget { + final Records item; + const TrendItem({super.key, required this.item}); + + @override + State createState() => _TrendItemState(); +} + +class _TrendItemState extends State { + + /// 构建输入框内容(文本+表情) + List buildInputContentWidgets() { + final List widgets = []; + final text = widget.item.content ?? ""; + final RegExp emojiRegex = RegExp(r'\[emoji:(\d+)\]'); + + int lastMatchEnd = 0; + final matches = emojiRegex.allMatches(text); + + for (final match in matches) { + // 添加表情之前的文本 + if (match.start > lastMatchEnd) { + final textPart = text.substring(lastMatchEnd, match.start); + widgets.add( + Text( + textPart, + style: TextStyle(fontSize: 14.sp, color: Colors.black), + ), + ); + } + + // 添加表情图片 + final emojiId = match.group(1); + if (emojiId != null) { + final emoji = EmojiConfig.getEmojiById(emojiId); + if (emoji != null) { + widgets.add( + Padding( + padding: EdgeInsets.symmetric(horizontal: 0), + child: Image.asset( + emoji.path, + width: 24.w, + height: 24.w, + fit: BoxFit.contain, + ), + ), + ); + } + } + + lastMatchEnd = match.end; + } + + // 添加剩余的文本 + if (lastMatchEnd < text.length) { + final textPart = text.substring(lastMatchEnd); + widgets.add( + Text( + textPart, + style: TextStyle(fontSize: 14.sp, color: Colors.black), + ), + ); + } + + return widgets; + } + + @override + Widget build(BuildContext context) { + return Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(40.w)), + child: CachedNetworkImage( + imageUrl: widget.item.profilePhoto ?? "", + width: 40.w, + height: 40.w, + fit: BoxFit.cover, + ), + ), + SizedBox(width: 15.w,), + Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + widget.item.nickName ?? "", + style: TextStyle( + fontSize: 13.w, + fontWeight: FontWeight.w500 + ), + ), + if(widget.item.operationType == 1)Text( + "赞了你的动态", + style: TextStyle( + fontSize: 11.w, + fontWeight: FontWeight.w500 + ), + ), + if(widget.item.operationType == 2)Text( + widget.item.postCommentContent ?? "", + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: TextStyle( + fontSize: 11.w, + fontWeight: FontWeight.w500 + ), + ), + Text( + widget.item.createTime ?? "", + style: TextStyle( + fontSize: 11.w, + color: const Color.fromRGBO(51, 51, 51, .6), + fontWeight: FontWeight.w500 + ), + ) + ], + ) + ], + ), + Container( + width: 80.w, + height: 80.w, + padding: EdgeInsets.all(10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(8.w)), + color: const Color.fromRGBO(0, 0, 0, .2) + ), + child: !widget.item.content!.contains('[emoji:') ? Text( + widget.item.content ?? "", + overflow: TextOverflow.ellipsis, + maxLines: 3, + ) : ClipRect( + child: Wrap( + crossAxisAlignment: WrapCrossAlignment.center, + children: buildInputContentWidgets(), + ), + ), + ) + ], + ).onTap((){ + Get.to(() => TimelineInfo(id: widget.item.postId ?? "")); + }); + } +} + diff --git a/lib/pages/home/user_information_page.dart b/lib/pages/home/user_information_page.dart index b0f31ee..e4bed01 100644 --- a/lib/pages/home/user_information_page.dart +++ b/lib/pages/home/user_information_page.dart @@ -1,11 +1,13 @@ import 'package:cached_network_image/cached_network_image.dart'; import 'package:dating_touchme_app/controller/global.dart'; import 'package:dating_touchme_app/controller/home/user_information_controller.dart'; +import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/generated/assets.dart'; import 'package:dating_touchme_app/model/home/marriage_data.dart'; import 'package:dating_touchme_app/pages/home/report_page.dart'; import 'package:dating_touchme_app/pages/home/timeline_item.dart'; import 'package:dating_touchme_app/pages/message/chat_page.dart'; +import 'package:dating_touchme_app/pages/mine/edit_info_page.dart'; import 'package:easy_refresh/easy_refresh.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -99,9 +101,9 @@ class UserInformationPage extends StatelessWidget { fit: BoxFit.cover, ), Positioned( - left: 15.w, + left: 120.w, top: 310.w, - width: 345.w, + width: 240.w, child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Row( @@ -180,259 +182,273 @@ class UserInformationPage extends StatelessWidget { controller.page.value += 1; await controller.getPostList(); }, - child: SingleChildScrollView( - child: Stack( - clipBehavior: Clip.none, - children: [ - Container( - padding: EdgeInsets.only(top: 361.w), - child: Container( - width: 375.w, - padding: EdgeInsets.only( - top: 31.w, - left: 15.w, - right: 24.w - ), - decoration: BoxDecoration( - borderRadius: BorderRadius.vertical( - top: Radius.circular(23.w) - ), - color: Colors.white - ), - child: Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Row( - children: [ - Text( - controller.userData.value.nickName ?? "", - style: TextStyle( - fontSize: 22.w, - color: const Color.fromRGBO(51, 51, 51, 1), - fontWeight: FontWeight.w600 + child: DraggableScrollableSheet( + initialChildSize: 0.57, // 初始露出高度(占屏幕比例) + minChildSize: 0.57, // 最小(不想下滑回去就设成一样) + maxChildSize: 1, + builder: (context, scrollController) { + return SingleChildScrollView( + clipBehavior: Clip.none, + controller: scrollController, + child: Stack( + clipBehavior: Clip.none, + children: [ + Container( + width: 375.w, + padding: EdgeInsets.only( + top: 31.w, + left: 15.w, + right: 24.w + ), + decoration: BoxDecoration( + borderRadius: BorderRadius.vertical( + top: Radius.circular(23.w) + ), + color: Colors.white + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Row( + children: [ + Text( + controller.userData.value.nickName ?? "", + style: TextStyle( + fontSize: 22.w, + color: const Color.fromRGBO(51, 51, 51, 1), + fontWeight: FontWeight.w600 + ), ), - ), - SizedBox(width: 13.w,), - if(controller.myUserData.value?.genderCode == 0) Container( - width: 33.w, - height: 13.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(255, 237, 255, 1) + SizedBox(width: 13.w,), + if(controller.myUserData.value?.genderCode == 0) Container( + width: 33.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(255, 237, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesFemale, + width: 8.w, + height: 8.w, + ), + SizedBox(width: 2.w,), + Text( + "${ + controller.calculateAge( + (controller.userData.value.birthDate != null && controller.userData.value.birthDate!.isNotEmpty) ? + (controller.userData.value.birthDate ?? "") : controller.userData.value.birthYear != null && controller.userData.value.birthYear!.isNotEmpty ? + "${controller.userData.value.birthYear}-01-01" : "") + }", + style: TextStyle( + fontSize: 11.w, + color: const Color.fromRGBO(255, 66, 236, 1) + ), + ) + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesFemale, - width: 8.w, - height: 8.w, - ), - SizedBox(width: 2.w,), - Text( - "${ - controller.calculateAge( - (controller.userData.value.birthDate != null && controller.userData.value.birthDate!.isNotEmpty) ? - (controller.userData.value.birthDate ?? "") : controller.userData.value.birthYear != null && controller.userData.value.birthYear!.isNotEmpty ? - "${controller.userData.value.birthYear}-01-01" : "") - }", + SizedBox(width: 3.w,), + Container( + width: 33.w, + height: 13.w, + margin: EdgeInsets.only(right: 2.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(234, 255, 219, 1) + ), + child: Center( + child: Text( + "在线", style: TextStyle( fontSize: 11.w, - color: const Color.fromRGBO(255, 66, 236, 1) + color: const Color.fromRGBO(38, 199, 124, 1) ), - ) - ], - ), - ), - SizedBox(width: 3.w,), - Container( - width: 33.w, - height: 13.w, - margin: EdgeInsets.only(right: 2.w), - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(234, 255, 219, 1) - ), - child: Center( - child: Text( - "在线", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(38, 199, 124, 1) ), ), ), - ), - SizedBox(width: 4.w,), - if (controller.userData.value.identityCard != "" && controller.userData.value.identityCard != null) Container( - width: 43.w, - height: 13.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(246, 237, 255, 1) - ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesRealName, - width: 8.w, - height: 7.w, - ), - SizedBox(width: 2.w,), - Text( - "实名", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(160, 92, 255, 1) + SizedBox(width: 4.w,), + if (controller.userData.value.identityCard != "" && controller.userData.value.identityCard != null) Container( + width: 43.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(246, 237, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesRealName, + width: 8.w, + height: 7.w, ), - ) - ], - ), - ), - SizedBox(width: 4.w,), - if(controller.myUserData.value?.genderCode == 1) Container( - width: 33.w, - height: 13.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(13.w)), - color: const Color.fromRGBO(237, 245, 255, 1) + SizedBox(width: 2.w,), + Text( + "实名", + style: TextStyle( + fontSize: 11.w, + color: const Color.fromRGBO(160, 92, 255, 1) + ), + ) + ], + ), ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Image.asset( - Assets.imagesMale, - width: 8.w, - height: 8.w, - ), - SizedBox(width: 2.w,), - Text( - "${controller.calculateAge(controller.userData.value.birthDate ?? (controller.userData.value.birthYear != null && controller.userData.value.birthYear!.isNotEmpty ? "${controller.userData.value.birthYear}-01-01" : ""))}", - style: TextStyle( - fontSize: 11.w, - color: const Color.fromRGBO(120, 140, 255, 1) + SizedBox(width: 4.w,), + if(controller.myUserData.value?.genderCode == 1) Container( + width: 33.w, + height: 13.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(13.w)), + color: const Color.fromRGBO(237, 245, 255, 1) + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + Assets.imagesMale, + width: 8.w, + height: 8.w, ), - ) - ], + SizedBox(width: 2.w,), + Text( + "${controller.calculateAge(controller.userData.value.birthDate ?? (controller.userData.value.birthYear != null && controller.userData.value.birthYear!.isNotEmpty ? "${controller.userData.value.birthYear}-01-01" : ""))}", + style: TextStyle( + fontSize: 11.w, + color: const Color.fromRGBO(120, 140, 255, 1) + ), + ) + ], + ), ), - ), - ], + ], + ), + // 语音介绍功能暂时隐藏(为了通过苹果审核) + // Container( + // width: 63.w, + // height: 27.w, + // decoration: BoxDecoration( + // borderRadius: BorderRadius.all(Radius.circular(27.w)), + // color: const Color.fromRGBO(117, 98, 249, .1) + // ), + // child: Row( + // mainAxisAlignment: MainAxisAlignment.center, + // children: [ + // Image.asset( + // Assets.imagesPlayer, + // width: 15.w, + // height: 15.w, + // ), + // SizedBox(width: 4.w,), + // Image.asset( + // Assets.imagesVoice, + // width: 15.w, + // height: 13.w, + // ), + // SizedBox(width: 4.w,), + // Text( + // "6'", + // style: TextStyle( + // fontSize: 11.w, + // color: const Color.fromRGBO(117, 98, 249, 1) + // ), + // ) + // ], + // ), + // ) + ], + ), + SizedBox(height: 8.w,), + Text( + controller.userData.value.describeInfo ?? "我想找一个有缘的异性,快来联系我吧。", + style: TextStyle( + fontSize: 14.w, + color: const Color.fromRGBO(144, 144, 144, 1) ), - // 语音介绍功能暂时隐藏(为了通过苹果审核) - // Container( - // width: 63.w, - // height: 27.w, - // decoration: BoxDecoration( - // borderRadius: BorderRadius.all(Radius.circular(27.w)), - // color: const Color.fromRGBO(117, 98, 249, .1) - // ), - // child: Row( - // mainAxisAlignment: MainAxisAlignment.center, - // children: [ - // Image.asset( - // Assets.imagesPlayer, - // width: 15.w, - // height: 15.w, - // ), - // SizedBox(width: 4.w,), - // Image.asset( - // Assets.imagesVoice, - // width: 15.w, - // height: 13.w, - // ), - // SizedBox(width: 4.w,), - // Text( - // "6'", - // style: TextStyle( - // fontSize: 11.w, - // color: const Color.fromRGBO(117, 98, 249, 1) - // ), - // ) - // ], - // ), - // ) - ], - ), - SizedBox(height: 8.w,), - Text( - controller.userData.value.describeInfo ?? "我想找一个有缘的异性,快来联系我吧。", - style: TextStyle( - fontSize: 14.w, - color: const Color.fromRGBO(144, 144, 144, 1) ), - ), - SizedBox(height: 11.w,), - Wrap( - spacing: 12.w, - runSpacing: 12.w, - children: [ - ...controller.tagList.map((e){ - return TagItem(label: e); - }), - ], - ), - SizedBox(height: 16.w,), - if ((controller.userData.value.provinceName?.isNotEmpty ?? false)) Text( - "IP属地:${controller.userData.value.provinceName}", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(144, 144, 144, 1) + SizedBox(height: 11.w,), + Wrap( + spacing: 12.w, + runSpacing: 12.w, + children: [ + ...controller.tagList.map((e){ + return TagItem(label: e); + }), + ], ), - ), - Text( - "趣恋恋ID:${userId}", - style: TextStyle( - fontSize: 12.w, - color: const Color.fromRGBO(144, 144, 144, 1) + SizedBox(height: 16.w,), + if ((controller.userData.value.provinceName?.isNotEmpty ?? false)) Text( + "IP属地:${controller.userData.value.provinceName}", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), ), - ), - SizedBox(height: 10.w,), - if(controller.postList.isNotEmpty) Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - "动态", - style: TextStyle( - fontSize: 18.w - ), - ) - ], - ), - SizedBox(height: 10.w,), - ...controller.postList.map((e){ - return TimelineItem(item: e); - }) - ], - ), - ), - ), - Positioned( - left: 15.w, - top: 301.w, - child: ClipRRect( - borderRadius: BorderRadius.all(Radius.circular(90.w)), - child: Container( - width: 90.w, - height: 90.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.all(Radius.circular(90.w)), - border: Border.all(width: 3.w, color: Colors.white) - ), - child: CachedNetworkImage( - imageUrl: "${controller.userData.value.profilePhoto}?x-oss-process=image/format,webp", - width: 84.w, - height: 84.w, - fit: BoxFit.cover, + Text( + "趣恋恋ID:${userId}", + style: TextStyle( + fontSize: 12.w, + color: const Color.fromRGBO(144, 144, 144, 1) + ), + ), + Container( + height: 1, + color: const Color.fromRGBO(144, 144, 144, 1), + margin: EdgeInsets.symmetric(vertical: 15.w), + ), + if(controller.postList.isNotEmpty) Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + "动态", + style: TextStyle( + fontSize: 18.w + ), + ) + ], + ), + SizedBox(height: 10.w,), + ...controller.postList.map((e){ + return TimelineItem(item: e); + }) + ], ), ), - ), - ) - ], - ), + + Positioned( + left: 15.w, + top: -60.w, + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(90.w)), + child: Container( + width: 90.w, + height: 90.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(90.w)), + border: Border.all(width: 3.w, color: Colors.white) + ), + child: ClipRRect( + borderRadius: BorderRadius.all(Radius.circular(84.w)), + child: CachedNetworkImage( + imageUrl: "${controller.userData.value.profilePhoto}?x-oss-process=image/format,webp", + width: 84.w, + height: 84.w, + fit: BoxFit.cover, + ), + ), + ), + ), + ) + ], + ), + ); + }, ), ), Positioned( @@ -465,7 +481,7 @@ class UserInformationPage extends StatelessWidget { ), ), ), - PopupMenuButton( + if(miId != GlobalData().userData!.id) PopupMenuButton( tooltip: "", padding: EdgeInsets.zero, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(14)), @@ -500,6 +516,37 @@ class UserInformationPage extends StatelessWidget { ), ), // 你的小圆按钮 ), + if(miId == GlobalData().userData!.id) Container( + height: 31.w, + padding: EdgeInsets.symmetric(horizontal: 10.w), + decoration: BoxDecoration( + borderRadius: BorderRadius.all(Radius.circular(62.w)), + color: const Color.fromRGBO(51, 51, 51, .5) + ), + child: Row( + children: [ + Image.asset( + Assets.imagesEdit, + width: 10.w, + height: 10.w, + color: Colors.white, + ), + SizedBox(width: 4.w,), + Text( + "修改资料", + style: TextStyle( + fontSize: 12.w, + color: Colors.white, + fontWeight: FontWeight.w500 + ), + ), + ], + ), + ).onTap((){ + Get.to(() => EditInfoPage())?.then((e){ + controller.getUserData(); + }); + }) ], ), ), diff --git a/lib/pages/mine/edit_info_page.dart b/lib/pages/mine/edit_info_page.dart index 7925321..f30b9e0 100644 --- a/lib/pages/mine/edit_info_page.dart +++ b/lib/pages/mine/edit_info_page.dart @@ -226,21 +226,7 @@ class _EditInfoPageState extends State { init: EditInfoController(), builder: (controller) { return Scaffold( - appBar: PageAppbar(title: "编辑资料", right: Container( - margin: EdgeInsets.only(right: 14.w), - child: InkWell( - onTap: (){ - controller.goPreview(); - }, - child: Text( - "预览", - style: TextStyle( - fontSize: 13.w, - color: const Color.fromRGBO(144, 144, 144, 1), - ), - ), - ), - ),), + appBar: PageAppbar(title: "编辑资料"), backgroundColor: const Color.fromRGBO(243, 243, 243, 1.0), body: SingleChildScrollView( diff --git a/lib/pages/mine/mine_page.dart b/lib/pages/mine/mine_page.dart index 7506adf..76dee8d 100644 --- a/lib/pages/mine/mine_page.dart +++ b/lib/pages/mine/mine_page.dart @@ -4,6 +4,7 @@ import 'package:dating_touchme_app/controller/mine/mine_controller.dart'; import 'package:dating_touchme_app/extension/ex_widget.dart'; import 'package:dating_touchme_app/model/mine/user_count_data.dart'; import 'package:dating_touchme_app/network/user_api.dart'; +import 'package:dating_touchme_app/pages/home/user_information_page.dart'; import 'package:dating_touchme_app/pages/mine/edit_info_page.dart'; import 'package:dating_touchme_app/pages/mine/my_friend_page.dart'; import 'package:dating_touchme_app/pages/mine/vip_page.dart'; @@ -198,24 +199,24 @@ class _MinePageState extends State with AutomaticKeepAliveClientMixin{ ), InkWell( onTap: (){ - Get.to(() => EditInfoPage()); + Get.to(() => UserInformationPage(miId: controller.userData.value?.id ?? "", userId: GlobalData().userId ?? "")); }, child: Row( children: [ - Image.asset( - Assets.imagesEdit, - width: 10.w, - height: 10.w, - ), - SizedBox(width: 4.w,), Text( - "编辑资料", + "查看", style: TextStyle( fontSize: 12.w, color: const Color.fromRGBO(55, 57, 72, 1), fontWeight: FontWeight.w500 ), - ) + ), + SizedBox(width: 4.w,), + Image.asset( + Assets.imagesArrow, + width: 10.w, + height: 10.w, + ), ], ), )