You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
109 lines
3.4 KiB
109 lines
3.4 KiB
|
|
|
|
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:dating_touchme_app/controller/global.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/matchmaker_data.dart';
|
|
import 'package:dating_touchme_app/pages/home/user_information_page.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class MatchmakerCard extends StatelessWidget {
|
|
final Records visitor;
|
|
|
|
const MatchmakerCard({Key? key, required this.visitor}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Stack(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.all(Radius.circular(10.w)),
|
|
child: CachedNetworkImage(
|
|
imageUrl: "${visitor.profilePhoto}?x-oss-process=image/format,webp/resize,w_240",
|
|
width: 173.w,
|
|
height: 173.w,
|
|
fit: BoxFit.cover,
|
|
placeholder: (context, url) => Container(
|
|
color: Colors.white38,
|
|
child: Center(
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 1.w,
|
|
color: Colors.grey,
|
|
),
|
|
),
|
|
),
|
|
errorWidget: (context, url, error) =>
|
|
Image.asset(
|
|
Assets.imagesUserAvatar,
|
|
width: 173.w,
|
|
height: 173.w,
|
|
fit: BoxFit.cover,
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
left: 8.w,
|
|
bottom: 12.w,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
if(visitor.nickName != "")SizedBox(
|
|
width: 156.w,
|
|
child: Text(visitor.nickName ?? "",
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
fontSize: 12.w,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
),
|
|
SizedBox(height: 2.w),
|
|
SizedBox(
|
|
width: 156.w,
|
|
child: Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
"${visitor.age}岁",
|
|
style: TextStyle(
|
|
fontSize: 14.w,
|
|
color: Colors.white,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
)
|
|
],
|
|
),
|
|
)
|
|
],
|
|
).onTap((){
|
|
Get.to(() => UserInformationPage(miId: visitor.miId ?? "", userId: visitor.userId!));
|
|
});
|
|
}
|
|
|
|
// String _formatTime(String timestamp) {
|
|
// var time = DateTime.parse(timestamp);
|
|
// final now = DateTime.now();
|
|
// final difference = now.difference(time);
|
|
//
|
|
// if (difference.inMinutes < 1) {
|
|
// return '刚刚';
|
|
// } else if (difference.inHours < 1) {
|
|
// return '${difference.inMinutes}分钟前';
|
|
// } else if (difference.inDays < 1) {
|
|
// return '${difference.inHours}小时前';
|
|
// } else if (difference.inDays < 7) {
|
|
// return '${difference.inDays}天前';
|
|
// } else {
|
|
// return '${time.month}/${time.day}';
|
|
// }
|
|
// }
|
|
|
|
}
|