main_friend_item.dart 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. import 'package:flutter/cupertino.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:location/data/bean/user_info.dart';
  5. import 'package:location/resource/assets.gen.dart';
  6. import 'package:location/resource/colors.gen.dart';
  7. import 'package:location/resource/string.gen.dart';
  8. import 'package:location/utils/common_expand.dart';
  9. import 'package:location/utils/project_expand.dart';
  10. import 'package:marquee/marquee.dart';
  11. import '../../utils/common_style.dart';
  12. import '../../utils/common_util.dart';
  13. import '../../widget/marquee_text.dart';
  14. Widget mainFriendItem(UserInfo userInfo, bool isSelected,
  15. {required VoidCallback onTap}) {
  16. return GestureDetector(
  17. onTap: onTap,
  18. child: Container(
  19. margin: EdgeInsets.only(right: 12.w),
  20. child: Stack(
  21. children: [
  22. Container(
  23. decoration: BoxDecoration(
  24. color: ColorName.white,
  25. shape: BoxShape.circle,
  26. border: isSelected
  27. ? Border.all(color: ColorName.colorPrimary, width: 2.w)
  28. : null),
  29. width: 52.w,
  30. height: 52.w,
  31. child: Center(
  32. child: Image.asset(
  33. userInfo.isMine == true
  34. ? Assets.images.iconDefaultMineAvatar.path
  35. : Assets.images.iconDefaultFriendAvatar.path,
  36. width: 44.w,
  37. height: 44.w))),
  38. Positioned(
  39. left: 3.w,
  40. bottom: 0,
  41. right: 3.w,
  42. child: Container(
  43. height: 16.w,
  44. padding: EdgeInsets.symmetric(horizontal: 2.w),
  45. decoration: BoxDecoration(
  46. color: ColorName.white,
  47. borderRadius: BorderRadius.circular(10.w),
  48. border: Border.all(color: '#E8E8E8'.color, width: 1.w),
  49. ),
  50. child: Builder(builder: (context) {
  51. String nickName = userNickName(
  52. userInfo.remark, userInfo.phoneNumber, !isSelected);
  53. TextStyle style =
  54. TextStyle(fontSize: 10.sp, color: ColorName.black80);
  55. return Center(
  56. child: isSelected
  57. ? MarqueeText.marquee(
  58. text: nickName,
  59. containerWidth: 45.w,
  60. textStyle: TextStyle(
  61. fontSize: 10.sp, color: ColorName.black80))
  62. : Text(nickName, style: style),
  63. );
  64. }),
  65. ),
  66. )
  67. ],
  68. ),
  69. ),
  70. );
  71. }
  72. Widget mainSelectedFriendItem(UserInfo userInfo) {
  73. return Container(
  74. width: 336.w,
  75. height: 86.w,
  76. decoration: BoxDecoration(
  77. color: ColorName.white,
  78. borderRadius: BorderRadius.all(Radius.circular(20.w))),
  79. child: Row(
  80. children: [
  81. SizedBox(width: 7.w),
  82. Image(
  83. image: userInfo.isMine == true
  84. ? Assets.images.iconDefaultMineAvatar.provider()
  85. : Assets.images.iconDefaultFriendAvatar.provider(),
  86. width: 50.w,
  87. height: 50.w),
  88. SizedBox(width: 5.w),
  89. Expanded(
  90. child: Container(
  91. margin: EdgeInsets.symmetric(vertical: 15.w),
  92. child: Column(
  93. mainAxisAlignment: MainAxisAlignment.center,
  94. crossAxisAlignment: CrossAxisAlignment.start,
  95. children: [
  96. Row(
  97. children: [
  98. Text(
  99. userInfo.getUserNickName(),
  100. style: TextStyle(
  101. fontWeight: FontWeight.bold,
  102. fontSize: 16.sp,
  103. color: '#202020'.color),
  104. ),
  105. SizedBox(width: 7.w),
  106. Text(time2TimeDesc(userInfo.timestamp),
  107. style: TextStyle(
  108. fontSize: 12.sp, color: '#A7A7A7'.color)),
  109. Spacer(),
  110. Container(
  111. margin: EdgeInsets.only(right: 16.w),
  112. decoration: getPrimaryBtnDecoration(32.w),
  113. padding: EdgeInsets.symmetric(
  114. horizontal: 21.w, vertical: 5.w),
  115. child: Text(StringName.locationTrace,
  116. style: TextStyle(
  117. fontSize: 15.sp, color: Colors.white)))
  118. ],
  119. ),
  120. Expanded(
  121. child: Container(
  122. margin: EdgeInsets.only(right: 17.w),
  123. child: MarqueeText.marquee(
  124. text: addressCheck(userInfo.lastLocation?.address),
  125. textStyle: TextStyle(
  126. fontSize: 13.sp, color: ColorName.black50),
  127. containerWidth: 244.w),
  128. ),
  129. )
  130. // Text('广东省广州市天河区XX街街XX街区XX村XX')
  131. ],
  132. ),
  133. ),
  134. )
  135. // Column(
  136. // children: [
  137. // Row(
  138. // children: [
  139. // Text(
  140. // userInfo.getUserNickName(),
  141. // style: TextStyle(
  142. // fontWeight: FontWeight.bold,
  143. // fontSize: 16.sp,
  144. // color: '#202020'.color),
  145. // ),
  146. // SizedBox(width: 7.w),
  147. // Text('1分钟前',
  148. // style:
  149. // TextStyle(fontSize: 12.sp, color: '#A7A7A7'.color)),
  150. // // Spacer(),
  151. // Container(
  152. // margin: EdgeInsets.only(right: 17.w),
  153. // decoration: getPrimaryBtnDecoration(32.w),
  154. // padding: EdgeInsets.symmetric(
  155. // horizontal: 21.w, vertical: 5.w),
  156. // child: Text(StringName.locationTrace,
  157. // style: TextStyle(
  158. // fontSize: 15.sp, color: Colors.white)))
  159. // ],
  160. // ),
  161. // SizedBox(height: 10.w),
  162. //
  163. // Container(
  164. // width: 250.w,
  165. // height: 50.w,
  166. // child: MarqueeText.marquee(
  167. // text: '广东省广州市天河区XX街街XX街区XX村XXasdasdadadasdadadad',
  168. // containerWidth: 250.w,
  169. // textStyle:
  170. // TextStyle(fontSize: 13.sp, color: ColorName.black50)),
  171. // )
  172. // ],
  173. // )
  174. ],
  175. ));
  176. }