chat_room copy.dart 31 KB

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