chat_room.dart 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725
  1. import 'package:flutter/material.dart';
  2. import 'package:liftmanager/widgets/app_bar.dart';
  3. import '../provide/websocket.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import '../common/style/style.dart';
  6. import './chat_detail/chat_content_view.dart';
  7. import '../model/conversation.dart';
  8. import 'package:provider/provider.dart';
  9. import 'package:liftmanager/widgets/load_image.dart';
  10. import 'package:liftmanager/internal/bbs/model/talk_model.dart';
  11. import 'package:liftmanager/utils/url.dart';
  12. import 'package:liftmanager/utils/log_util.dart';
  13. import 'dart:convert';
  14. import 'package:dart_notification_center/dart_notification_center.dart';
  15. import 'package:liftmanager/utils/fast_notification.dart';
  16. import 'package:liftmanager/routers/fluro_navigator.dart';
  17. import 'package:liftmanager/internal/friends/friends_router.dart';
  18. import 'package:liftmanager/routers/routers.dart';
  19. import 'package:liftmanager/common/common.dart';
  20. import 'package:flustars/flustars.dart' as flustars;
  21. import 'package:shared_preferences/shared_preferences.dart';
  22. import 'package:liftmanager/utils/toast.dart';
  23. import 'package:image_picker/image_picker.dart';
  24. import 'package:liftmanager/net/api_service.dart';
  25. import 'package:liftmanager/utils/theme_utils.dart';
  26. class ChatDetailPage extends StatefulWidget {
  27. ChatDetailPage(this.id, this.type,this.toUserId);
  28. final String id;
  29. final String type;
  30. final String toUserId;
  31. @override
  32. _ChatDetailPageState createState() => _ChatDetailPageState();
  33. // _ChatDetailPageState createState() => _ChatDetailPageState(type,index);
  34. }
  35. class _ChatDetailPageState extends State<ChatDetailPage> {
  36. bool hasText = false;
  37. // String type0;
  38. // String index0;
  39. int type = 0;
  40. int index = 1;
  41. List<dynamic> msgList = [];
  42. bool showEmoji = false;
  43. // int index = int.parse("3");
  44. Conversation data;
  45. // _ChatDetailPageState(this.type0,this.index0);
  46. WebSocketProvide provider = WebSocketProvide();
  47. ScrollController _scrollController;
  48. List<dynamic> userList;
  49. List<dynamic> storyList = [];
  50. List<dynamic> storyListUserOnline = [];
  51. //避免从附近的人打招呼重复的initRoom
  52. bool isTrim = false;
  53. int dataTable;
  54. final controller = TextEditingController();
  55. void _handleSubmitted(context, String text) {
  56. FocusScope.of(context).requestFocus(FocusNode());
  57. if (controller.text.length > 0) {
  58. FocusScope.of(context).requestFocus(FocusNode());
  59. print('发送${text}');
  60. print(type);
  61. // if(type == 1){
  62. print(666);
  63. Provider.of<WebSocketProvide>(context, listen: false)
  64. .sendMessage(context, text, widget.id,1,dataTable,widget.toUserId);
  65. showEmoji = false;
  66. // }
  67. // new Future.delayed(Duration(milliseconds: 1000),(){
  68. // setState(() {
  69. // hasText = false;
  70. // // messageList.add({'type':1,'text':text,});
  71. // msgList = Provider.of<WebSocketProvide>(context,listen: false).historyMessageqqq;
  72. // });
  73. // });
  74. controller.clear(); //清空输入框
  75. FocusScope.of(context).requestFocus(FocusNode());
  76. _jumpBottom();
  77. } else {
  78. toasts("请输入");
  79. }
  80. }
  81. void _jumpBottom() {
  82. //滚动到底部
  83. _scrollController.animateTo(9999999999,
  84. curve: Curves.easeOut, duration: Duration(milliseconds: 200));
  85. }
  86. String emoji = "😀,😁,😂,😃,😄,😅,😆,😉,😊,😋,😎,😍,😘,😗,😙,😚,😇,😐,😑,😶,😏,😣,😥,😮,😯,😪,😫,😴,😌,😛,😜,😝,😒,😓,😔,😕,😲,😷,😖,😞,😟,😤,😢,😭,😦,😧,😨,😬,😰,😱,😳,😵,😡,😠";
  87. List<String>emojiList = [];
  88. void setWebSocket() async {
  89. SharedPreferences prefs = await SharedPreferences.getInstance();
  90. // Map<String,dynamic> sessionIdObjToGet = flustars.SpUtil.getObj("sessionIdObj", (v){
  91. // return v;
  92. // });
  93. // LogUtil.d(sessionIdObjToGet);
  94. // if(sessionIdObjToGet==null){
  95. // print(111);
  96. // Map<String,dynamic> nowObj = {
  97. // widget.id:"hasSocket"
  98. // };
  99. // flustars.SpUtil.putObject("sessionIdObj", nowObj);
  100. // new Future.delayed(Duration(milliseconds: 500),(){
  101. // Provider.of<WebSocketProvide>(context,listen: false).incomeRoom(widget.id);
  102. // // getMsgList();
  103. // });
  104. // }else {
  105. // if(sessionIdObjToGet[widget.id]==null){
  106. // print(112);
  107. // Map<String,dynamic> thisItem = {
  108. // widget.id:"hasSocket"
  109. // };
  110. // sessionIdObjToGet.addAll(thisItem);
  111. // flustars.SpUtil.putObject("sessionIdObj", sessionIdObjToGet);
  112. // new Future.delayed(Duration(milliseconds: 500),(){
  113. // Provider.of<WebSocketProvide>(context,listen: false).incomeRoom(widget.id);
  114. // // getMsgList();
  115. // });
  116. // }
  117. // }
  118. // if ((widget.type == "someToOne")&& isTrim==false) {
  119. // if ((widget.type == "someToOne" || widget.type == "nearToOne")&& isTrim==false) {
  120. // new Future.delayed(Duration(milliseconds: 500), () {
  121. // Provider.of<WebSocketProvide>(context, listen: false)
  122. // .incomeRoom(widget.id);
  123. // getStringEvent(widget.id);
  124. // });
  125. // }
  126. // // else if (widget.type == "nearToOne"){
  127. // // new Future.delayed(Duration(milliseconds: 500), () {
  128. // // Provider.of<WebSocketProvide>(context, listen: false)
  129. // // .loginAllSeconds(widget.id);
  130. // // getStringEvent(widget.id);
  131. // // });
  132. // else {
  133. // // }
  134. // // else if (widget.type == "oneToOne") {
  135. // new Future.delayed(Duration(milliseconds: 500), () {
  136. // Provider.of<WebSocketProvide>(context, listen: false)
  137. // .incomeFriend(widget.id);
  138. // getStringEvent(widget.id);
  139. // });
  140. // }
  141. // isTrim = false;
  142. new Future.delayed(Duration(milliseconds: 500), () {
  143. Provider.of<WebSocketProvide>(context, listen: false)
  144. .incomeRoom(widget.id);
  145. getStringEvent(widget.id);
  146. });
  147. }
  148. void initJump() async {
  149. new Future.delayed(Duration(milliseconds: 500), () {
  150. FocusScope.of(context).requestFocus(FocusNode());
  151. _jumpBottom();
  152. });
  153. }
  154. void disposeJump() async {
  155. new Future.delayed(Duration(milliseconds: 500), () {
  156. Provider.of<WebSocketProvide>(context, listen: false).closeWebSocket();
  157. });
  158. }
  159. void getMsgList() async {
  160. new Future.delayed(Duration(milliseconds: 2000), () {
  161. setState(() {
  162. // msgList = storyList;
  163. msgList = Provider.of<WebSocketProvide>(context, listen: false)
  164. .historyMessageqqq;
  165. print(JsonEncoder().convert(msgList));
  166. print(444443);
  167. _jumpBottom();
  168. });
  169. // LogUtil.d(msgList);
  170. // print(44444484444);
  171. });
  172. }
  173. @override
  174. void initState() {
  175. emojiList = emoji.split(',');
  176. print(emojiList);
  177. if(widget.type == "nearToOne"){
  178. dataTable = 3;
  179. }else {
  180. dataTable = null;
  181. }
  182. print(JsonEncoder().convert(emojiList));
  183. print(66669999);
  184. // DartNotificationCenter.registerChannel(channel: 'socket_event');
  185. // DartNotificationCenter.post(
  186. // channel: "socket_event",
  187. // options: 'with options!!',
  188. // );
  189. FastNotification.addListener("chat_room", (historyMessageqqq) {
  190. if (mounted) {
  191. setState(() {
  192. msgList = historyMessageqqq;
  193. print(JsonEncoder().convert(msgList));
  194. print(4444499);
  195. });
  196. _jumpBottom();
  197. }
  198. });
  199. FastNotification.addListener("set_user", (setUserList) {
  200. if (mounted) {
  201. new Future.delayed(Duration(milliseconds: 1000), () {
  202. setState(() {
  203. userList = setUserList;
  204. });
  205. });
  206. }
  207. });
  208. FastNotification.addListener("initSocket", (initThisSocket) {
  209. if (mounted) {
  210. isTrim = true;
  211. setWebSocket();
  212. _jumpBottom();
  213. FocusScope.of(context).requestFocus(FocusNode());
  214. toasts("聊天室已重连!");
  215. }
  216. });
  217. print("开启123");
  218. super.initState();
  219. _scrollController = new ScrollController();
  220. setWebSocket();
  221. // getStringEvent(widget.id);
  222. initJump();
  223. }
  224. @override
  225. void didChangeDependencies() {
  226. super.didChangeDependencies();
  227. }
  228. void getStringEvent(roomId) async {
  229. SharedPreferences prefs = await SharedPreferences.getInstance();
  230. List<dynamic> storyList = [];
  231. List<dynamic> storyListUserOnline = [];
  232. if (prefs.getStringList(roomId) != null) {
  233. List<String> hisString = prefs.getStringList(roomId);
  234. storyList = hisString.map((item) => jsonDecode(item)).toList();
  235. // new Future.delayed(Duration(milliseconds: 1000),(){
  236. // setState(() {
  237. // msgList = storyList;
  238. // userList = storyListUserOnline;
  239. // print(JsonEncoder().convert(msgList));
  240. // print(444447);
  241. // _jumpBottom();
  242. // });
  243. // // LogUtil.d(msgList);
  244. // // print(44444484444);
  245. // });
  246. } else {
  247. prefs.setStringList(roomId, []);
  248. }
  249. // if (flustars.SpUtil.getString(roomId + "userOnline") != null &&
  250. // flustars.SpUtil.getString(roomId + "userOnline") != "") {
  251. // // if(prefs.getString(roomId+"userOnline")!=null){
  252. // // String hisStringUserOnline = prefs.getString(roomId+"userOnline");
  253. // // flustars.SpUtil.putString(roomId+"userOnline", res.token);
  254. // String hisStringUserOnline =
  255. // flustars.SpUtil.getString(roomId + "userOnline");
  256. // for (var value in JsonDecoder().convert(hisStringUserOnline)) {
  257. // print(value);
  258. // storyListUserOnline.add(value);
  259. // }
  260. // ;
  261. // // storyListUserOnline = JsonDecoder().convert(hisStringUserOnline);
  262. // // storyListUserOnline = hisStringUserOnline.map((item)=>jsonDecode(item)).toList();
  263. // } else {
  264. // // prefs.setString(roomId+"userOnline",'');
  265. // }
  266. // print(JsonEncoder().convert(storyList));
  267. // print(JsonEncoder().convert(storyListUserOnline));
  268. new Future.delayed(Duration(milliseconds: 1000), () {
  269. setState(() {
  270. if (storyList.length > 0) {
  271. msgList = storyList;
  272. }
  273. if (storyListUserOnline.length > 0) {
  274. userList = storyListUserOnline;
  275. }
  276. print(JsonEncoder().convert(msgList));
  277. print(444447);
  278. _jumpBottom();
  279. });
  280. // LogUtil.d(msgList);
  281. // print(44444484444);
  282. });
  283. }
  284. // @override
  285. // void didChangeDependencies() {
  286. // // Provider.of<WebSocketProvide>(context).closeWebSocket();
  287. // Provider.of<WebSocketProvide>(context,listen: false).closeWebSocket();
  288. // super.didChangeDependencies();
  289. // }
  290. FocusNode blankNode = FocusNode();
  291. ///选择图片
  292. void selectPicker() {
  293. showDialog(
  294. context: context,
  295. builder: (BuildContext context) {
  296. return SimpleDialog(
  297. title: Text("选择方式"),
  298. children: ["拍照", '从手机相册选择'].map((String value) {
  299. print("$value");
  300. return SimpleDialogOption(
  301. child: Text(
  302. "${value}",
  303. style: TextStyle(fontSize: 16, fontWeight: FontWeight.w500),
  304. ),
  305. onPressed: () {
  306. _getImage(value == '拍照' ? 1 : 0);
  307. Navigator.of(context).pop();
  308. },
  309. );
  310. }).toList());
  311. });
  312. }
  313. List<String>imagesList = [];
  314. List<String>imagesListLast = [];
  315. void _getImage(int key) async {
  316. try {
  317. var _imageFile = await ImagePicker.pickImage(
  318. source: key == 1 ? ImageSource.camera : ImageSource.gallery,
  319. maxWidth: 800,
  320. imageQuality: 95);
  321. print(_imageFile);
  322. print(3333);
  323. if (_imageFile != null) {
  324. // images.add(_imageFile);
  325. upLoadFileOnce(_imageFile.path);
  326. // setState(() {});
  327. }
  328. } catch (e) {
  329. toasts("没有权限,无法打开相册!");
  330. }
  331. }
  332. upLoadFileOnce(path) {
  333. showLoading(context, "正在发送...");
  334. NewApiService().upload(path, onSuccess: (res) {
  335. // imagesUrl.add(res.path);
  336. dismissLoading(context);
  337. String imagesUrl;
  338. imagesUrl = (res.pathUrl);
  339. Provider.of<WebSocketProvide>(context, listen: false)
  340. .sendMessage(context, imagesUrl, widget.id,2,dataTable,widget.toUserId);
  341. }, onError: (code, msg) {
  342. dismissLoading(context);
  343. toasts(msg);
  344. });
  345. }
  346. @override
  347. Widget build(BuildContext context) {
  348. double width = MediaQuery.of(context).size.width;
  349. // print(JsonEncoder().convert(msgList));
  350. imagesList = [];
  351. msgList.forEach((element) {
  352. if(element["type"]==2){
  353. imagesList.add(element["msg"]);
  354. }
  355. });
  356. // print(1234567980);
  357. return ChangeNotifierProvider<WebSocketProvide>(
  358. create: (_) => provider,
  359. child: Scaffold(
  360. appBar: MyAppBar(
  361. centerTitle: "聊天室",
  362. // onPressed:(){
  363. // NavigatorUtils.push(context, FriendsRouter.friendsList);
  364. // }
  365. isFun: true,
  366. fun: () {
  367. // Provider.of<WebSocketProvide>(context,listen: false).closeWebSocket();
  368. // NavigatorUtils.push(context, FriendsRouter.friendsList);
  369. Navigator.popUntil(context, ModalRoute.withName('/home'));
  370. // NavigatorUtils.push(context, FriendsRouter.friendsList, clearStack: true);
  371. // NavigatorUtils.push(context, Routers.home, clearStack: true);
  372. },
  373. ),
  374. body: GestureDetector(
  375. onTap: () {
  376. // 点击空白页面关闭键盘
  377. FocusScope.of(context).requestFocus(blankNode);
  378. },
  379. child: Stack(
  380. children: <Widget>[
  381. GestureDetector(
  382. onTap: (){
  383. setState(() {
  384. showEmoji = false;
  385. });
  386. },
  387. child: Container(
  388. padding: widget.type == "someToOne"
  389. ? EdgeInsets.only(top: ScreenUtil().setWidth(10))
  390. : EdgeInsets.only(top: ScreenUtil().setWidth(10)),
  391. // color: Colors.red,
  392. color: ThemeUtils.getTabsBg(context),
  393. child: Column(
  394. children: <Widget>[
  395. Consumer<WebSocketProvide>(builder: (context, child, val) {
  396. return Expanded(
  397. child: ListView.builder(
  398. controller: _scrollController,
  399. physics: ClampingScrollPhysics(),
  400. itemBuilder: (BuildContext context, int index) {
  401. int typeUser;
  402. // print(msgList[index]["fromUser"]);
  403. // print(msgList[index]["msg"]);
  404. // print(jsonDecode(msgList[index])["fromUser"]);
  405. // print(1234567890);
  406. if (msgList[index]["fromUser"] ==
  407. flustars.SpUtil.getString(Constant.userId)) {
  408. typeUser = 1;
  409. } else {
  410. typeUser = 0;
  411. }
  412. // if(msgList[index]["type"]==2){
  413. // imagesList.add(msgList[index]["msg"]);
  414. // print(msgList[index]["msg"]);
  415. // }
  416. // print("///////////////////////////////////////////");
  417. // LogUtil.d(imagesList);
  418. // print("///////////////////////////////////////////");
  419. return ChatContentView(
  420. contentIndex:index,
  421. urlList:imagesList,
  422. type: typeUser,
  423. text: msgList[index]["msg"],
  424. msgType: msgList[index]["type"],
  425. avatar: msgList[index]["avatarUrl"],
  426. username: msgList[index]["name"],
  427. isNetwork: msgList[index]["avatarUrl"] != null
  428. ? true
  429. : false);
  430. // return ChatContentView(type:typeUser,text:msgList[index]["msg"],avatar:imgFontUrl+msgList[index]["avatarUrl"],username:msgList[index]["name"],isNetwork:msgList[index]["avatarUrl"]!=null?true:false);
  431. },
  432. itemCount: msgList.length,
  433. // itemCount:type == 1 ? list.length : messageList.length ,
  434. ));
  435. }),
  436. showEmoji?Container(
  437. padding: EdgeInsets.only(left:ScreenUtil().setWidth(6),top:ScreenUtil().setWidth(10),bottom:ScreenUtil().setWidth(10),right: ScreenUtil().setWidth(6)),
  438. color: Colors.white,
  439. height: ScreenUtil().setWidth(200),
  440. child: GridView.extent(
  441. //横轴的最大长度
  442. maxCrossAxisExtent: 35,
  443. //内边距
  444. padding: EdgeInsets.all(4.0),
  445. //垂直方向的间距
  446. mainAxisSpacing: 4.0,
  447. //水平方向的间距
  448. crossAxisSpacing: 4.0,
  449. children: emojiList.map((element) {
  450. return GestureDetector(
  451. onTap: (){
  452. controller.text += element;
  453. },
  454. child: Text(
  455. element,
  456. style: TextStyle(
  457. color: Color(0xff000000),
  458. fontSize: ScreenUtil().setSp(22)),
  459. textAlign: TextAlign.center,
  460. ),
  461. );
  462. }).toList(),
  463. )
  464. ):Container(child: null,),
  465. Container(
  466. padding: EdgeInsets.only(
  467. top: ScreenUtil().setHeight(2.0),
  468. bottom: ScreenUtil().setHeight(2.0),
  469. left: 0,
  470. right: 0),
  471. color: ThemeUtils.getDialogTextFieldColor(context),
  472. child: Row(
  473. children: <Widget>[
  474. Container(
  475. width: ScreenUtil().setWidth(30.0),
  476. margin: EdgeInsets.only(
  477. right: ScreenUtil().setWidth(10.0)),
  478. child: IconButton(
  479. icon: Icon(ICons.ADD),
  480. onPressed: () {
  481. selectPicker();
  482. FocusScope.of(context).requestFocus(FocusNode());
  483. }),
  484. ),
  485. Expanded(
  486. child: Container(
  487. // padding: EdgeInsets.only(top: ScreenUtil().setHeight(8.0), bottom: ScreenUtil().setHeight(8.0)),
  488. height: ScreenUtil().setHeight(30.0),
  489. decoration: BoxDecoration(
  490. borderRadius:
  491. BorderRadius.all(Radius.circular(5.0)),
  492. color: Colors.white),
  493. child: TextField(
  494. controller: controller,
  495. // decoration: InputDecoration.collapsed(hintText: null),
  496. decoration: InputDecoration(
  497. border: InputBorder.none,
  498. ),
  499. maxLines: 1,
  500. autocorrect: true,
  501. autofocus: false,
  502. textAlign: TextAlign.start,
  503. style: TextStyle(color: Colors.black),
  504. cursorColor: Colors.green,
  505. onChanged: (text) {
  506. setState(() {
  507. hasText = text.length > 0 ? true : false;
  508. });
  509. // print('change=================== $text');
  510. },
  511. // onSubmitted:_handleSubmitted,
  512. enabled: true, //bu禁用
  513. ),
  514. )),
  515. Container(
  516. width: ScreenUtil().setWidth(30.0),
  517. child: IconButton(
  518. icon: Icon(ICons.FACES), //发送按钮图标
  519. onPressed: () {
  520. print('打开表情面板');
  521. setState(() {
  522. showEmoji = !showEmoji;
  523. });
  524. }),
  525. ),
  526. Container(
  527. width: ScreenUtil().setWidth(30.0),
  528. margin: EdgeInsets.only(
  529. right: ScreenUtil().setWidth(10.0)),
  530. child: IconButton(
  531. //发送按钮或者+按钮
  532. icon: Icon(Icons.send),
  533. onPressed: () {
  534. if (controller.text == null || controller.text == '') {
  535. toasts("请输入内容");
  536. } else {
  537. _handleSubmitted(context, controller.text);
  538. }
  539. }),
  540. )
  541. ],
  542. ),
  543. )
  544. ],
  545. ),
  546. ),
  547. ),
  548. // widget.type == "someToOne"
  549. // ? Positioned(
  550. // top: 0,
  551. // left: 0,
  552. // child: userList != null && userList != []
  553. // ? Container(
  554. // width: width,
  555. // height: ScreenUtil().setWidth(100),
  556. // padding: EdgeInsets.only(
  557. // top: ScreenUtil().setWidth(15),
  558. // bottom: ScreenUtil().setWidth(10)),
  559. // color: Colors.white,
  560. // child: ListView(
  561. // scrollDirection: Axis.horizontal,
  562. // children: userList.asMap().keys.map((i) {
  563. // if (i == 0) {
  564. // return userList[i]["flag"]
  565. // ? Container(
  566. // padding: EdgeInsets.only(
  567. // right:
  568. // ScreenUtil().setWidth(15),
  569. // left: ScreenUtil()
  570. // .setWidth(15)),
  571. // child: Column(children: <Widget>[
  572. // ClipRRect(
  573. // borderRadius:
  574. // BorderRadius.all(
  575. // Radius.circular(
  576. // 22)),
  577. // child: LoadNetworkImage(
  578. // userList[i]["avatarUrl"],
  579. // width: ScreenUtil()
  580. // .setWidth(43),
  581. // height: ScreenUtil()
  582. // .setWidth(43),
  583. // )
  584. // // userList[i]["avatarUrl"]!=null&&userList[i]["avatarUrl"]!=null ?
  585. // // FadeInImage.assetNetwork(
  586. // // placeholder: 'assets/images/temporary/avator2.png',
  587. // // //预览图
  588. // // fit: BoxFit.fitWidth,
  589. // // image: imgFontUrl+userList[i]["avatarUrl"],
  590. // // width: ScreenUtil().setWidth(43),
  591. // // height:ScreenUtil().setWidth(43),
  592. // // )
  593. // // :Image.asset(
  594. // // 'assets/images/temporary/avator2.png',
  595. // // fit: BoxFit.cover,
  596. // // width: ScreenUtil().setWidth(43),
  597. // // height:ScreenUtil().setWidth(43),
  598. // // ),
  599. // ),
  600. // Container(
  601. // height: 5, child: null),
  602. // Text(
  603. // userList[i]["name"],
  604. // style: TextStyle(
  605. // color: Color(0xff000000),
  606. // fontSize: ScreenUtil()
  607. // .setSp(14)),
  608. // textAlign: TextAlign.start,
  609. // ),
  610. // ]),
  611. // )
  612. // : Container(child: null);
  613. // } else {
  614. // return userList[i]["flag"]
  615. // ? Container(
  616. // padding: EdgeInsets.only(
  617. // right: ScreenUtil()
  618. // .setWidth(15)),
  619. // child: Column(children: <Widget>[
  620. // ClipRRect(
  621. // borderRadius:
  622. // BorderRadius.all(
  623. // Radius.circular(22)),
  624. // child: LoadNetworkImage(
  625. // userList[i]["avatarUrl"],
  626. // width: ScreenUtil()
  627. // .setWidth(43),
  628. // height: ScreenUtil()
  629. // .setWidth(43),
  630. // ),
  631. // // userList[i]["avatarUrl"]!=null&&userList[i]["avatarUrl"]!=null ?
  632. // // FadeInImage.assetNetwork(
  633. // // placeholder: 'assets/images/temporary/avator2.png',
  634. // // //预览图
  635. // // fit: BoxFit.fitWidth,
  636. // // image: imgFontUrl+userList[i]["avatarUrl"],
  637. // // width: ScreenUtil().setWidth(43),
  638. // // height:ScreenUtil().setWidth(43),
  639. // // )
  640. // // :Image.asset(
  641. // // 'assets/images/temporary/avator2.png',
  642. // // fit: BoxFit.cover,
  643. // // width: ScreenUtil().setWidth(43),
  644. // // height:ScreenUtil().setWidth(43),
  645. // // ),
  646. // ),
  647. // Container(
  648. // height: 5, child: null),
  649. // Text(
  650. // userList[i]["name"],
  651. // style: TextStyle(
  652. // color: Color(0xff000000),
  653. // fontSize: ScreenUtil()
  654. // .setSp(14)),
  655. // textAlign: TextAlign.start,
  656. // ),
  657. // ]),
  658. // )
  659. // : Container(child: null);
  660. // }
  661. // }).toList()))
  662. // : Container(
  663. // child: null,
  664. // ))
  665. // : Container(child: null)
  666. ],
  667. ),
  668. ),
  669. ),
  670. );
  671. }
  672. // @override
  673. // void dispose() {
  674. // Provider.of<WebSocketProvide>(context,listen: false).closeWebSocket();
  675. // // disposeJump();
  676. // super.dispose();
  677. // }
  678. }