chat_room.dart 30 KB

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