|
|
@@ -0,0 +1,134 @@
|
|
|
+import 'package:flutter/cupertino.dart';
|
|
|
+import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
|
+import 'package:location/resource/string.gen.dart';
|
|
|
+import 'package:location/utils/common_expand.dart';
|
|
|
+
|
|
|
+import '../../data/bean/user_info.dart';
|
|
|
+import '../../resource/assets.gen.dart';
|
|
|
+import '../../resource/colors.gen.dart';
|
|
|
+import '../../utils/date_util.dart';
|
|
|
+
|
|
|
+Widget buildFriendItem(UserInfo userInfo) {
|
|
|
+ return Container(
|
|
|
+ margin: EdgeInsets.only(left: 12.w, right: 12.w, bottom: 10.w),
|
|
|
+ width: double.infinity,
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.white, borderRadius: BorderRadius.circular(14.w)),
|
|
|
+ child: Stack(
|
|
|
+ children: [
|
|
|
+ Positioned(
|
|
|
+ top: 0,
|
|
|
+ right: 0,
|
|
|
+ child: Assets.images.bgFriendItem.image(width: 190.w)),
|
|
|
+ Column(
|
|
|
+ children: [
|
|
|
+ SizedBox(height: 14.w),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 12.w),
|
|
|
+ Image.asset(
|
|
|
+ userInfo.isMine == true
|
|
|
+ ? Assets.images.iconDefaultMineAvatar.path
|
|
|
+ : Assets.images.iconDefaultFriendAvatar.path,
|
|
|
+ width: 48.w,
|
|
|
+ height: 48.w),
|
|
|
+ SizedBox(width: 8.w),
|
|
|
+ Expanded(
|
|
|
+ child: Column(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
+ children: [
|
|
|
+ Row(
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Text((userInfo.getUserNickName()),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 16.sp,
|
|
|
+ color: '#202020'.color,
|
|
|
+ fontWeight: FontWeight.bold)),
|
|
|
+ SizedBox(width: 6.w),
|
|
|
+ Visibility(
|
|
|
+ visible: userInfo.virtual == true,
|
|
|
+ child: Container(
|
|
|
+ padding: EdgeInsets.symmetric(
|
|
|
+ horizontal: 5.w, vertical: 2.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ gradient: LinearGradient(colors: [
|
|
|
+ '#FF4A4F'.color,
|
|
|
+ '#FF554A'.color
|
|
|
+ ]),
|
|
|
+ borderRadius: BorderRadius.only(
|
|
|
+ topLeft: Radius.circular(8.w),
|
|
|
+ bottomRight: Radius.circular(10.w),
|
|
|
+ topRight: Radius.circular(10.w),
|
|
|
+ bottomLeft: Radius.circular(2.w))),
|
|
|
+ child: Text(StringName.traceFreeExperience,
|
|
|
+ style: TextStyle(
|
|
|
+ height: 1,
|
|
|
+ fontSize: 12.sp,
|
|
|
+ color: ColorName.white,
|
|
|
+ )),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ Spacer(),
|
|
|
+ Visibility(
|
|
|
+ visible: userInfo.isMine != true &&
|
|
|
+ userInfo.virtual != true,
|
|
|
+ child: Assets.images.iconFriendEdit
|
|
|
+ .image(width: 22.w, height: 22.w),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 16.w),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ Text(
|
|
|
+ userInfo.lastLocation.value?.lastUpdateTime == null
|
|
|
+ ? StringName.friendLocationTimeUnknown
|
|
|
+ : DateUtil.fromMillisecondsSinceEpoch(
|
|
|
+ "yyyy-MM-dd HH:mm",
|
|
|
+ userInfo.lastLocation.value?.lastUpdateTime ??
|
|
|
+ 0),
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 13.sp, color: '#A7A7A7'.color)),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 12.w),
|
|
|
+ Row(
|
|
|
+ children: [
|
|
|
+ SizedBox(width: 12.w),
|
|
|
+ Expanded(
|
|
|
+ child: Container(
|
|
|
+ constraints: BoxConstraints(minHeight: 34.w),
|
|
|
+ child: Align(
|
|
|
+ alignment: Alignment.centerLeft,
|
|
|
+ child: Text(
|
|
|
+ userInfo.lastLocation.value?.address ??
|
|
|
+ StringName.unopenedPositioning,
|
|
|
+ style: TextStyle(
|
|
|
+ fontSize: 13.sp, color: '#404040'.color)),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ SizedBox(width: 20.w),
|
|
|
+ Container(
|
|
|
+ margin: EdgeInsets.only(right: 12.w),
|
|
|
+ decoration: BoxDecoration(
|
|
|
+ color: ColorName.colorPrimary,
|
|
|
+ borderRadius: BorderRadius.circular(36.w)),
|
|
|
+ padding:
|
|
|
+ EdgeInsets.symmetric(horizontal: 14.w, vertical: 8.w),
|
|
|
+ child: Text(
|
|
|
+ StringName.examineTrace,
|
|
|
+ style: TextStyle(fontSize: 12.sp, color: ColorName.white),
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ SizedBox(height: 16.w)
|
|
|
+ ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ );
|
|
|
+}
|