main_friend_item.dart 6.9 KB

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