| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178 |
- 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)),
- // )
- // ],
- // )
- ],
- ));
- }
|