import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:location/data/bean/user_info.dart'; import 'package:location/resource/assets.gen.dart'; import 'package:location/resource/colors.gen.dart'; import 'package:location/resource/string.gen.dart'; import 'package:location/utils/common_expand.dart'; import 'package:location/utils/project_expand.dart'; import 'package:marquee/marquee.dart'; import '../../utils/common_style.dart'; import '../../utils/common_util.dart'; import '../../widget/marquee_text.dart'; Widget mainFriendItem(UserInfo userInfo, bool isSelected, {required VoidCallback onTap}) { return GestureDetector( onTap: onTap, child: Container( margin: EdgeInsets.only(right: 12.w), child: Stack( children: [ Container( decoration: BoxDecoration( color: ColorName.white, shape: BoxShape.circle, border: isSelected ? Border.all(color: ColorName.colorPrimary, width: 2.w) : null), width: 52.w, height: 52.w, child: Center( child: Image.asset( userInfo.isMine == true ? Assets.images.iconDefaultMineAvatar.path : Assets.images.iconDefaultFriendAvatar.path, width: 44.w, height: 44.w))), Positioned( left: 3.w, bottom: 0, right: 3.w, child: Container( height: 16.w, padding: EdgeInsets.symmetric(horizontal: 2.w), decoration: BoxDecoration( color: ColorName.white, borderRadius: BorderRadius.circular(10.w), border: Border.all(color: '#E8E8E8'.color, width: 1.w), ), child: Builder(builder: (context) { String nickName = userNickName( userInfo.remark, userInfo.phoneNumber, !isSelected); TextStyle style = TextStyle(fontSize: 10.sp, color: ColorName.black80); return Center( child: isSelected ? MarqueeText.marquee( text: nickName, containerWidth: 45.w, textStyle: TextStyle( fontSize: 10.sp, color: ColorName.black80)) : Text(nickName, style: style), ); }), ), ) ], ), ), ); } Widget mainSelectedFriendItem(UserInfo userInfo) { return Container( width: 336.w, height: 86.w, decoration: BoxDecoration( color: ColorName.white, borderRadius: BorderRadius.all(Radius.circular(20.w))), child: Row( children: [ SizedBox(width: 7.w), Image( image: userInfo.isMine == true ? Assets.images.iconDefaultMineAvatar.provider() : Assets.images.iconDefaultFriendAvatar.provider(), width: 50.w, height: 50.w), SizedBox(width: 5.w), Expanded( child: Container( margin: EdgeInsets.symmetric(vertical: 15.w), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.start, children: [ Row( children: [ Text( userInfo.getUserNickName(), style: TextStyle( fontWeight: FontWeight.bold, fontSize: 16.sp, color: '#202020'.color), ), SizedBox(width: 7.w), Text(time2TimeDesc(userInfo.timestamp), style: TextStyle( fontSize: 12.sp, color: '#A7A7A7'.color)), Spacer(), Container( margin: EdgeInsets.only(right: 16.w), decoration: getPrimaryBtnDecoration(32.w), padding: EdgeInsets.symmetric( horizontal: 21.w, vertical: 5.w), child: Text(StringName.locationTrace, style: TextStyle( fontSize: 15.sp, color: Colors.white))) ], ), Expanded( child: Container( margin: EdgeInsets.only(right: 17.w), child: MarqueeText.marquee( text: addressCheck(userInfo.lastLocation?.address), textStyle: TextStyle( fontSize: 13.sp, color: ColorName.black50), containerWidth: 244.w), ), ) // Text('广东省广州市天河区XX街街XX街区XX村XX') ], ), ), ) // Column( // children: [ // Row( // children: [ // Text( // userInfo.getUserNickName(), // style: TextStyle( // fontWeight: FontWeight.bold, // fontSize: 16.sp, // color: '#202020'.color), // ), // SizedBox(width: 7.w), // Text('1分钟前', // style: // TextStyle(fontSize: 12.sp, color: '#A7A7A7'.color)), // // Spacer(), // Container( // margin: EdgeInsets.only(right: 17.w), // decoration: getPrimaryBtnDecoration(32.w), // padding: EdgeInsets.symmetric( // horizontal: 21.w, vertical: 5.w), // child: Text(StringName.locationTrace, // style: TextStyle( // fontSize: 15.sp, color: Colors.white))) // ], // ), // SizedBox(height: 10.w), // // Container( // width: 250.w, // height: 50.w, // child: MarqueeText.marquee( // text: '广东省广州市天河区XX街街XX街区XX村XXasdasdadadasdadadad', // containerWidth: 250.w, // textStyle: // TextStyle(fontSize: 13.sp, color: ColorName.black50)), // ) // ], // ) ], )); }