chat_room.dart 30 KB

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