import 'dart:ui'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:location/resource/colors.gen.dart'; import 'package:location/utils/common_expand.dart'; import '../../../data/bean/user_info.dart'; typedef SelectAcceptCallback = void Function(UserInfo itemInfo); Widget createUserItem(UserInfo itemInfo,bool isSelect,{required SelectAcceptCallback onSelectItem}) { return GestureDetector( onTap: () { onSelectItem(itemInfo); }, child: Container( decoration: isSelect ? BoxDecoration( color: "#EAEAFF".color, borderRadius: BorderRadius.circular(10.w), border: Border.all(color: "#EAEAFF".color, width: 1.w), ) : BoxDecoration( color: ColorName.white, borderRadius: BorderRadius.circular(10.w), border: Border.all(color: Color(0xFFE3E3FF), width: 1.w), ), margin: EdgeInsets.only(bottom: 8.w), padding: EdgeInsets.symmetric(horizontal: 8.w, vertical: 8.w), child: Row( children: [ ClipOval( child: Container( width: 40.w, height: 40.w, child: CachedNetworkImage(imageUrl: itemInfo.avatar ?? "", fit: BoxFit.cover), ), ), SizedBox(width: 8.w), Expanded( child: Text( (itemInfo.name ?? "").length > 11 ? '${(itemInfo.name ?? "").substring(0,11)}...' : (itemInfo.name ?? itemInfo.phoneNumber ?? ""), style: TextStyle( fontSize: 12.sp, color: "#333333".color, fontWeight: FontWeight.bold)), ), ], ), ), ); }