Hibok
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

2576 righe
92 KiB

  1. import 'dart:convert';
  2. import 'dart:io';
  3. import 'package:chat/home/fans_page.dart';
  4. import 'package:chat/home/goddess_hot.dart';
  5. import 'package:chat/home/rich_title.dart';
  6. import 'package:chat/models/ChatMsg.dart';
  7. import 'package:chat/models/money_change.dart';
  8. import 'package:chat/models/ref_name_provider.dart';
  9. import 'package:chat/models/voucher_change.dart';
  10. import 'package:chat/proto/all.pbserver.dart';
  11. import 'package:chat/utils/ChargeMoney.dart';
  12. import 'package:chat/utils/app_navigator.dart';
  13. import 'package:chat/utils/blacklist_mgr.dart';
  14. import 'package:chat/utils/conversation_table.dart';
  15. import 'package:chat/utils/file_cache_mgr.dart';
  16. import 'package:chat/utils/friend_list_mgr.dart';
  17. import 'package:chat/utils/msgHandler.dart';
  18. import 'package:chat/utils/screen.dart';
  19. import 'package:chat/utils/sp_utils.dart';
  20. import 'package:flutter/material.dart';
  21. import 'package:flutter/rendering.dart';
  22. import 'package:chat/data/WebData.dart';
  23. import 'package:chat/data/constants.dart';
  24. import 'package:chat/generated/i18n.dart';
  25. import 'package:chat/home/InformUser.dart';
  26. import 'package:chat/home/MoneyPage.dart';
  27. import 'package:chat/home/Myprogram.dart';
  28. import 'package:chat/home/VideoPage.dart';
  29. import 'package:chat/home/VipPage.dart';
  30. import 'package:chat/models/UserInfo.dart';
  31. import 'package:chat/utils/CustomUI.dart';
  32. import 'package:chat/utils/LoadingDialog.dart';
  33. import 'package:chat/utils/MessageMgr.dart';
  34. import 'package:chat/utils/TutorialOverlay.dart';
  35. import 'package:chat/utils/UserCard.dart';
  36. import 'package:chat/utils/UserChips.dart';
  37. import 'package:cached_network_image/cached_network_image.dart';
  38. import 'package:flutter/services.dart';
  39. import 'package:image_cropper/image_cropper.dart';
  40. import 'package:image_picker/image_picker.dart';
  41. import 'package:multi_image_picker/multi_image_picker.dart';
  42. import 'package:oktoast/oktoast.dart';
  43. import 'package:permission_handler/permission_handler.dart';
  44. import 'package:provider/provider.dart';
  45. import 'package:share/share.dart';
  46. import '../utils/FullWithButton.dart';
  47. import '../home/EditData.dart';
  48. import '../home/SystemEditPage.dart';
  49. import '../data/UserData.dart';
  50. import '../utils/TokenMgr.dart';
  51. import 'package:dio/dio.dart';
  52. import 'package:chat/utils/HttpUtil.dart';
  53. import 'VerificationCenter.dart';
  54. import 'WhiteAndBlackList.dart';
  55. import "package:chat/utils/PicSwiper.dart";
  56. import 'add_friend.dart';
  57. import 'apply_content_view.dart';
  58. import 'daily_bonus_page.dart';
  59. import 'money_picture_view.dart';
  60. var cardWidth;
  61. var greyColor = const Color(0xFFB2B2B2);
  62. const MaxImgSize = 20;
  63. class ProfilePage extends StatefulWidget {
  64. @required
  65. final userId;
  66. final int fromWhere;
  67. final int addMode;
  68. final int applyId; //好友申请id
  69. ProfilePage(
  70. {Key key,
  71. this.userId,
  72. this.fromWhere,
  73. this.addMode = 0,
  74. this.applyId = 0})
  75. : super(key: key);
  76. _ProfilePageState createState() => _ProfilePageState();
  77. }
  78. class _ProfilePageState extends State<ProfilePage>
  79. with TickerProviderStateMixin {
  80. static const Separate_Size = 10.0;
  81. GlobalKey<ScaffoldState> registKey = new GlobalKey();
  82. UserInfo userInfo = new UserInfo();
  83. TextEditingController nickNameController = new TextEditingController();
  84. // AnimationController animationController;
  85. // Animation movement;
  86. bool isMyself = false;
  87. List imgList = [];
  88. bool isCanWatch = false;
  89. bool isMan = true;
  90. bool isAttestation = false;
  91. bool isBuyPicture = false;
  92. bool isVip = false;
  93. bool isSvip = false;
  94. bool isApplying = false; //是否申请中
  95. //约会节目
  96. String dateItem = '';
  97. //期待对象
  98. String lovePeople = '';
  99. //约会范围
  100. String dateRange = '';
  101. //生日
  102. String birthday = '';
  103. //身高数据
  104. String heightStr = '';
  105. //体重数据
  106. String weightStr = '';
  107. //个人介绍
  108. String myMsg = '';
  109. Map wealthData = {
  110. 'CoinValue': 0,
  111. 'IsMember': 0,
  112. };
  113. int myselfImg = 0;
  114. String endTime = '';
  115. bool isLoadingFish = false;
  116. String firstDyImg = ''; //第一条动态的图片
  117. int programId = 0; //是否有一条活跃的节目
  118. bool isblack = false;
  119. bool isAuthority = false; //是否有聊天和查看用户资料的权限
  120. getUserInfo({mymsg = ''}) async {
  121. if (mymsg != '' && mymsg != null) {
  122. UserData().basicInfo.ownMsg = mymsg;
  123. }
  124. HttpUtil().getUserInfo(
  125. widget.userId,
  126. (data) async {
  127. print('getUserInfo $data');
  128. if (isMyself) {
  129. saveLocalData(data);
  130. }
  131. userInfo = UserInfo.fromJson(data);
  132. initValues();
  133. isLoadingFish = true;
  134. showMyMsgDialog();
  135. if (mounted) {
  136. setState(() {});
  137. }
  138. },
  139. _buildJoinVip,
  140. () {
  141. if (!isMyself) {
  142. Future.delayed(Duration(milliseconds: 500), () {
  143. Navigator.of(context).pop();
  144. });
  145. }
  146. });
  147. getImg();
  148. if (isMyself) {
  149. HttpUtil().getWealth(context, (data) {
  150. wealthData = data;
  151. endTime = data['MemberEnd'];
  152. if (mounted) {
  153. Provider.of<MoneyChangeProvider>(context)
  154. .initMoney(data['CoinValue']);
  155. Provider.of<VoucherChangeProvider>(context)
  156. .initVoucher(data['Voucher']);
  157. }
  158. });
  159. } else {
  160. // getFirstDy();
  161. // getFirstProgram();
  162. }
  163. }
  164. saveLocalData(data) {
  165. UserData().basicInfo = UserInfo.fromJson(data);
  166. SPUtils.saveString(
  167. Constants.LocalUsrInfo, jsonEncode(UserData().toJson()).toString());
  168. }
  169. initLocalData() async {
  170. if (isMyself && await SPUtils.get(Constants.LocalUsrInfo) != null) {
  171. isLoadingFish = true;
  172. userInfo = UserData().basicInfo;
  173. initValues();
  174. showMyMsgDialog();
  175. }
  176. }
  177. showMyMsgDialog() {
  178. if (!UserData().isFirstTip &&
  179. (UserData().basicInfo.ownMsg == '' ||
  180. UserData().basicInfo.ownMsg == null) &&
  181. UserData().homemainIndex == 4) {
  182. UserData().isFirstTip = true;
  183. CustomUI.buildOneConfirm(
  184. context, I18n.of(context).personal, I18n.of(context).white_now, () {
  185. Navigator.pop(context);
  186. Navigator.of(context).push(
  187. new MaterialPageRoute(
  188. builder: (context) {
  189. return EditPage(
  190. isEditPage: true,
  191. );
  192. },
  193. ),
  194. );
  195. });
  196. }
  197. }
  198. initValues() {
  199. isMan = userInfo.sex == 1;
  200. isAttestation = userInfo.isAttestation == null || userInfo.isAttestation;
  201. isVip = userInfo.isMember > 0;
  202. isSvip = userInfo.isMember == 2;
  203. isCanWatch = userInfo.infoAut == 0 || userInfo.applyStatus == 1;
  204. isApplying = userInfo.applyStatus == 0;
  205. isblack = userInfo.isBlackList;
  206. isBuyPicture =
  207. (isMyself || userInfo.photoAut == 0 || userInfo.payStatus == 1);
  208. dateItem =
  209. userInfo.program == null ? "" : WebData().getProgram(userInfo.program);
  210. lovePeople = userInfo.hopeObject == null
  211. ? ""
  212. : WebData().getLovePeople(userInfo.hopeObject);
  213. dateRange = WebData().getDateRange(userInfo.meetPlace);
  214. birthday = userInfo.birthday == null ? '' : userInfo.birthday;
  215. isAuthority = userInfo.isAuthority ||
  216. (!UserData().isMan() && UserData().basicInfo.isAttestation) ||
  217. userInfo.distince < 200;
  218. myMsg = userInfo.ownMsg;
  219. }
  220. @override
  221. void initState() {
  222. super.initState();
  223. print('ProfilePage initState');
  224. isMyself = widget.userId == UserData().basicInfo.userId;
  225. messageOn();
  226. initLocalData();
  227. getUserInfo();
  228. }
  229. void initMyController() {}
  230. void _buildJoinVip() {
  231. isLoadingFish = true;
  232. CustomUI.buildOneConfirm(
  233. context, I18n.of(context).only_see, I18n.of(context).joinvip, () {
  234. Navigator.of(context).push(
  235. new MaterialPageRoute(
  236. builder: (context) {
  237. return VipPage();
  238. },
  239. ),
  240. );
  241. }, failcallbak: () {
  242. Navigator.of(context).pop();
  243. });
  244. }
  245. msgBuyVip(data) {
  246. HttpUtil().getWealth(context, (data) {
  247. wealthData = data;
  248. endTime = data['MemberEnd'];
  249. if (mounted) {
  250. Provider.of<MoneyChangeProvider>(context).initMoney(data['CoinValue']);
  251. }
  252. });
  253. }
  254. msgRefreshPhoto(data) {
  255. getImg();
  256. }
  257. msgUpdateData(data) {
  258. print('msgUpdateData $data');
  259. getUserInfo(mymsg: data);
  260. }
  261. msgInformSucess(data) {
  262. if (!isMyself)
  263. CustomUI.buildOneConfirm(
  264. context, I18n.of(context).waiting_results, I18n.of(context).ok, () {
  265. Navigator.of(context).pop();
  266. });
  267. }
  268. msgListDelete(data) {
  269. if (userInfo.dynamicNum > 0) {
  270. if (mounted) {
  271. setState(() {
  272. userInfo.dynamicNum--;
  273. });
  274. }
  275. }
  276. }
  277. void messageOn() {
  278. MessageMgr().on('inform_sucess', msgInformSucess);
  279. MessageMgr().on('refresh_money', msgBuyVip);
  280. MessageMgr().on('refresh_photo', msgRefreshPhoto);
  281. MessageMgr().on('update_data', msgUpdateData);
  282. MessageMgr().on('delete_program', msgListDelete);
  283. MessageMgr().on('post_add_friend', msgAddFriend);
  284. MessageMgr().on('refresh_love_list', msgRefreshLoveList);
  285. MessageMgr().on('refresh_fans_num', msgRefreshFansNum);
  286. }
  287. void messageOff() {
  288. MessageMgr().off('inform_sucess', msgInformSucess);
  289. MessageMgr().off('refresh_money', msgBuyVip);
  290. MessageMgr().off('refresh_photo', msgRefreshPhoto);
  291. MessageMgr().off('update_data', msgUpdateData);
  292. MessageMgr().off('delete_program', msgListDelete);
  293. MessageMgr().off('post_add_friend', msgAddFriend);
  294. MessageMgr().off('refresh_love_list', msgRefreshLoveList);
  295. MessageMgr().off('refresh_fans_num', msgRefreshFansNum);
  296. }
  297. msgRefreshFansNum(data) {
  298. setState(() {
  299. if (data['UserId'] == userInfo.userId && userInfo.fans < data['nums']) {
  300. userInfo.fans = data['nums'];
  301. }
  302. });
  303. }
  304. msgRefreshLoveList(data) {
  305. setState(() {
  306. if (data['flag'] == 0) {
  307. isMyself ? userInfo.followNum++ : userInfo.fans++;
  308. } else {
  309. isMyself ? userInfo.followNum-- : userInfo.fans--;
  310. }
  311. });
  312. }
  313. msgAddFriend(data) {
  314. setState(() {
  315. userInfo.isAddFriends = 0;
  316. });
  317. }
  318. @override
  319. void dispose() {
  320. messageOff();
  321. registKey = null;
  322. //animationController?.dispose();
  323. nickNameController.dispose();
  324. super.dispose();
  325. }
  326. void getImg() async {
  327. var data = {
  328. "visitUserId": UserData().basicInfo.userId,
  329. "userId": widget.userId,
  330. };
  331. data['sign'] = TokenMgr().getSign(data);
  332. Response res = await HttpUtil().post('user/personal/album', data: data);
  333. if (res == null) {
  334. return;
  335. }
  336. Map resData = res.data;
  337. if (resData['code'] == 0) {
  338. imgList = resData['data'] == null ? [] : resData['data'];
  339. if (isMyself) {
  340. UserData().picNum = 0;
  341. for (int i = 0; i < imgList.length; i++) {
  342. if (imgList[i]['Status'] == 1) {
  343. UserData().picNum++;
  344. }
  345. if (imgList[i]['Status'] == 0 || imgList[i]['Status'] == 2) {
  346. UserData().haveReview = true;
  347. }
  348. }
  349. }
  350. if (mounted) {
  351. setState(() {});
  352. }
  353. }
  354. }
  355. //上传相册
  356. void _uploadPhoto() async {
  357. // if (await CustomUI.showPhotoPermissionSetting(context)) {
  358. // var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  359. // if (tempFile != null) {
  360. // //选择焚烧
  361. // Navigator.of(context).push(
  362. // new MaterialPageRoute(
  363. // builder: (context) {
  364. // return UploadPicture(
  365. // img: tempFile,
  366. // );
  367. // },
  368. // ),
  369. // );
  370. // }
  371. // }
  372. int leftLength = MaxImgSize - imgList.length;
  373. if (leftLength <= 0) {
  374. showToast(I18n.of(context)
  375. .max_upload_size
  376. .replaceFirst('/s1', MaxImgSize.toString()));
  377. return;
  378. }
  379. List<Asset> resultList = List<Asset>();
  380. resultList = await MultiImagePicker.pickImages(
  381. maxImages: leftLength > 9 ? 9 : leftLength,
  382. enableCamera: false,
  383. selectedAssets: [],
  384. cupertinoOptions: CupertinoOptions(takePhotoIcon: "chat"),
  385. materialOptions: MaterialOptions(
  386. actionBarColor: "#50A7F9",
  387. actionBarTitle: "Hibok",
  388. allViewTitle: "",
  389. useDetailsView: false,
  390. selectCircleStrokeColor: "#000000",
  391. ),
  392. );
  393. if (resultList != null && resultList.length > 0) {
  394. List<File> fileList = [];
  395. for (var i = 0; i < resultList.length; i++) {
  396. Asset photoEntity = resultList[i];
  397. print('名字:${photoEntity.name}');
  398. ByteData byteData = await photoEntity.getByteData();
  399. File file = await FileCacheMgr().writeFile(
  400. 'temp-photo-${DateTime.now().millisecondsSinceEpoch}.png',
  401. byteData.buffer.asInt8List(0));
  402. fileList.add(file);
  403. }
  404. print('文件列表${fileList.length}');
  405. Map data = {"type": 2, "userId": UserData().basicInfo.userId};
  406. data['sign'] = TokenMgr().getSign(data);
  407. data['sex'] = UserData().basicInfo.sex;
  408. data['isBurn'] = 0;
  409. Response res = await HttpUtil().uploadFiles(
  410. fileList, data, 'upload/post/postfiles', 'image',
  411. isShowLoading: true);
  412. var resData = res.data;
  413. if (resData['code'] == 0) {
  414. if (resData['data']['msg'] != '' && resData['data']['msg'] != null) {
  415. showToast(resData['data']['msg']);
  416. }
  417. if (resData['msg'].split('|').length != fileList.length) {
  418. showToast(I18n.of(context).hava_error_photo);
  419. }
  420. MessageMgr().emit('refresh_photo');
  421. } else {
  422. showToast(resData['msg']);
  423. }
  424. }
  425. // var photos = await PhotoPicker.pickAsset(
  426. // context: context,
  427. // themeColor: Color(0xFFF0F0F0),
  428. // textColor: Color(0xFF3F3F3F),
  429. // pickType: PickType.onlyImage);
  430. // if (photos != null && photos.length > 0) {
  431. // List<File> fileList = [];
  432. // for (var i = 0; i < photos.length; i++) {
  433. // AssetEntity photoEntity = photos[i];
  434. // fileList.add(await photoEntity.file);
  435. // }
  436. // Map data = {"type": 2, "userId": UserData().basicInfo.userId};
  437. // data['sign'] = TokenMgr().getSign(data);
  438. // data['sex'] = UserData().basicInfo.sex;
  439. // data['isBurn'] = 0;
  440. // Response res = await HttpUtil().uploadFiles(
  441. // fileList, data, 'upload/post/postfiles', 'image',
  442. // isShowLoading: true);
  443. // var resData = res.data;
  444. // if (resData['code'] == 0) {
  445. // if (resData['data']['msg'] != '' && resData['data']['msg'] != null) {
  446. // showToast(resData['data']['msg']);
  447. // }
  448. // if(resData['msg'].split('|').length !=photos.length){
  449. // showToast(I18n.of(context).hava_error_photo);
  450. // }
  451. // MessageMgr().emit('refresh_photo');
  452. // }
  453. // }
  454. }
  455. void _sendPicture() async {
  456. if (await CustomUI.showPhotoPermissionSetting(context)) {
  457. showDialog(
  458. context: context,
  459. barrierDismissible: false,
  460. builder: (BuildContext context) {
  461. return LoadingDialog(
  462. text: "",
  463. );
  464. });
  465. var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  466. Navigator.of(context).pop();
  467. if (tempFile != null) {
  468. _cropPicture(tempFile);
  469. }
  470. }
  471. }
  472. void _cropPicture(tempFile) async {
  473. File croppedFile = await ImageCropper.cropImage(
  474. sourcePath: tempFile.path,
  475. aspectRatio: CropAspectRatio(ratioX: 1, ratioY: 1),
  476. );
  477. if (croppedFile != null) {
  478. Map data = {"type": 1, "userId": userInfo.userId};
  479. data['sign'] = TokenMgr().getSign(data);
  480. Response res = await HttpUtil()
  481. .uploadFile(croppedFile, data, 'upload/file/postflie', 'image');
  482. var resData = res.data;
  483. if (resData['code'] == 0) {
  484. userInfo.headimgurl = resData['msg'];
  485. if (mounted) {
  486. setState(() {});
  487. }
  488. }
  489. }
  490. }
  491. Widget _buildHeadView() {
  492. cardWidth = MediaQuery.of(context).size.width;
  493. Color buttonColor = Colors.grey;
  494. return Container(
  495. decoration: BoxDecoration(
  496. color: Colors.white,
  497. border: Border(bottom: Constants.GreyBorderSide)),
  498. child: Stack(
  499. children: <Widget>[
  500. Container(
  501. decoration: BoxDecoration(
  502. color: Colors.white,
  503. ),
  504. width: MediaQuery.of(context).size.width,
  505. padding: EdgeInsets.only(top: 20),
  506. child: Column(
  507. children: <Widget>[
  508. _buildHeadImg(),
  509. _buildUserName(),
  510. _buildUserChips(),
  511. _buildResientCity(),
  512. //_buildProgram(),
  513. _buildAttestation(),
  514. _buildFans(),
  515. ],
  516. ),
  517. ),
  518. _buildLoveButton(buttonColor),
  519. ],
  520. ));
  521. }
  522. //认证相关
  523. Widget _buildAttestation() {
  524. return Container(
  525. margin: EdgeInsets.only(top: 7, bottom: 7),
  526. alignment: Alignment.center,
  527. child: Row(
  528. mainAxisAlignment: MainAxisAlignment.center,
  529. children: <Widget>[
  530. isAttestation
  531. ? Icon(Icons.check_circle_outline,
  532. size: 12, color: Constants.BlueTextColor)
  533. : Padding(
  534. padding: EdgeInsets.only(bottom: 0.5),
  535. child: Icon(IconData(0xe63a, fontFamily: 'iconfont'),
  536. size: 16, color: const Color(0xFFA9A9A9))),
  537. SizedBox(width: 3),
  538. Text(
  539. isAttestation
  540. ? isMyself
  541. ? (isMan
  542. ? (userInfo.isVipAttestation
  543. ? I18n.of(context).by_paying
  544. : I18n.of(context).incode_passed)
  545. : I18n.of(context).certified)
  546. : (isMan
  547. ? (userInfo.isVipAttestation
  548. ? I18n.of(context).pay_join
  549. : I18n.of(context).passed_review)
  550. : I18n.of(context).passed_video)
  551. : isMyself
  552. ? I18n.of(context).not_certified
  553. : (isMan ? '' : I18n.of(context).not_video),
  554. textScaleFactor: 1.0,
  555. style: TextStyle(fontSize: 11, color: Constants.GreyTextColor))
  556. ],
  557. ));
  558. // return Stack(
  559. // children: <Widget>[
  560. // Container(
  561. // margin: EdgeInsets.only(top: 3),
  562. // alignment: Alignment.center,
  563. // child: Row(
  564. // mainAxisAlignment: MainAxisAlignment.center,
  565. // children: <Widget>[
  566. // isAttestation
  567. // ? Icon(Icons.check_circle_outline,
  568. // size: 12, color: Constants.BlueTextColor)
  569. // : Padding(
  570. // padding: EdgeInsets.only(bottom: 0.5),
  571. // child: Icon(IconData(0xe63a, fontFamily: 'iconfont'),
  572. // size: 16, color: const Color(0xFFA9A9A9))),
  573. // SizedBox(width: 3),
  574. // Text(
  575. // isAttestation
  576. // ? isMyself
  577. // ? (isMan
  578. // ? (userInfo.isVipAttestation
  579. // ? I18n.of(context).by_paying
  580. // : I18n.of(context).incode_passed)
  581. // : I18n.of(context).certified)
  582. // : (isMan
  583. // ? (userInfo.isVipAttestation
  584. // ? I18n.of(context).pay_join
  585. // : I18n.of(context).passed_review)
  586. // : I18n.of(context).passed_video)
  587. // : isMyself
  588. // ? I18n.of(context).not_certified
  589. // : (isMan ? '' : I18n.of(context).not_video),
  590. // textScaleFactor: 1.0,
  591. // style:
  592. // TextStyle(fontSize: 11, color: Constants.GreyTextColor))
  593. // ],
  594. // )),
  595. // !isMan && isAttestation
  596. // ? Container(
  597. // padding: EdgeInsets.only(top: 17),
  598. // alignment: Alignment.centerRight,
  599. // child: InkWell(
  600. // onTap: () {
  601. // Navigator.of(context).push(
  602. // new MaterialPageRoute(
  603. // builder: (context) {
  604. // return VideoPage(
  605. // userId: userInfo.userId,
  606. // );
  607. // },
  608. // ),
  609. // );
  610. // },
  611. // child: Padding(
  612. // padding: EdgeInsets.only(right: 17),
  613. // child: Row(
  614. // mainAxisAlignment: MainAxisAlignment.end,
  615. // children: <Widget>[
  616. // Text('${I18n.of(context).certified_video}',
  617. // textScaleFactor: 1.0,
  618. // style: TextStyle(
  619. // fontSize: 11, color: Colors.grey)),
  620. // Icon(
  621. // IconData(0xe63c, fontFamily: 'iconfont'),
  622. // size: 18.0,
  623. // color: Color(AppColors.TabIconNormal),
  624. // ),
  625. // ],
  626. // ))))
  627. // : Container(),
  628. // ],
  629. // );
  630. }
  631. Widget _buildFansButton(int nums, String text, callback,
  632. {bool isShowDot = false}) {
  633. return InkWell(
  634. onTap: callback,
  635. child: Container(
  636. width: Screen.width / 3,
  637. child: Column(
  638. children: <Widget>[
  639. SizedBox(height: 8),
  640. Stack(
  641. children: <Widget>[
  642. Padding(
  643. padding: EdgeInsets.only(left: 4, right: 4),
  644. child: Text(
  645. nums < 0 ? "0" : nums.toString(),
  646. style: TextStyle(
  647. fontSize: 13,
  648. //color: isMyself ? Constants.BlackTextColor : greyColor),
  649. color: Constants.BlackTextColor),
  650. )),
  651. isShowDot
  652. ? Positioned(
  653. top: 2,
  654. right: 0,
  655. child: CircleAvatar(
  656. radius: 2,
  657. backgroundColor: const Color(0xFFE50000),
  658. ),
  659. )
  660. : Container(
  661. width: 0,
  662. )
  663. ],
  664. ),
  665. SizedBox(height: 4),
  666. Text(
  667. text,
  668. style: TextStyle(
  669. fontSize: 11,
  670. //color: isMyself ? Constants.BlackTextColor : greyColor),
  671. color: greyColor),
  672. ),
  673. SizedBox(height: 8),
  674. ],
  675. )),
  676. );
  677. }
  678. //关注列表
  679. Widget _buildFans() {
  680. return Container(
  681. decoration:
  682. BoxDecoration(border: Border(top: Constants.GreyBorderSide)),
  683. child: Row(
  684. //mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  685. children: <Widget>[
  686. _buildFansButton(
  687. userInfo.fans,
  688. I18n.of(context).fans,
  689. isMyself
  690. ? () {
  691. Navigator.of(context).push(
  692. new MaterialPageRoute(
  693. builder: (context) {
  694. return FansPage();
  695. },
  696. ),
  697. );
  698. }
  699. : null),
  700. _buildFansButton(
  701. userInfo.followNum,
  702. I18n.of(context).attention,
  703. isMyself
  704. ? () {
  705. Navigator.of(context).push(
  706. new MaterialPageRoute(
  707. builder: (context) {
  708. return WhiteAndBlackPage(
  709. isWhite: true,
  710. );
  711. },
  712. ),
  713. );
  714. }
  715. : null),
  716. _buildFansButton(userInfo.dynamicNum, I18n.of(context).dynamics,
  717. () {
  718. Navigator.of(context).push(
  719. new MaterialPageRoute(
  720. builder: (context) {
  721. return MyProgramPage(
  722. userId: userInfo.userId,
  723. isMan: isMan,
  724. );
  725. },
  726. ),
  727. );
  728. }, isShowDot: userInfo.dynamicNum > 0),
  729. ],
  730. ));
  731. }
  732. // //约会节目按钮
  733. // Widget _buildProgram() {
  734. // return programId != 0
  735. // ? InkWell(
  736. // onTap: () {
  737. // Navigator.of(context).push(
  738. // new MaterialPageRoute(
  739. // builder: (context) {
  740. // return ProgramDetailPage(
  741. // programId: programId,
  742. // );
  743. // },
  744. // ),
  745. // );
  746. // },
  747. // child: Container(
  748. // decoration: BoxDecoration(
  749. // borderRadius: BorderRadius.all(
  750. // Radius.circular(Constants.LittleButtonRadius)),
  751. // gradient: LinearGradient(colors: <Color>[
  752. // const Color(0xFF6D6AEC),
  753. // const Color(0xFF1795FF),
  754. // ])),
  755. // height: 31,
  756. // alignment: Alignment.center,
  757. // width: Screen.width,
  758. // margin:
  759. // EdgeInsets.only(left: 32.5, right: 32.5, top: 5, bottom: 3),
  760. // child: Stack(
  761. // alignment: Alignment.center,
  762. // children: <Widget>[
  763. // Container(
  764. // alignment: Alignment.center,
  765. // height: 31,
  766. // child: Text(
  767. // isMan
  768. // ? I18n.of(context).his_appointment
  769. // : I18n.of(context).her_appointment,
  770. // style: TextStyle(color: Colors.white, fontSize: 14),
  771. // )),
  772. // Positioned(
  773. // right: 30,
  774. // child: Container(
  775. // //padding: movement.value,
  776. // child: Image.asset(
  777. // 'assets/images/hand.png',
  778. // width: 20,
  779. // )),
  780. // )
  781. // ],
  782. // )))
  783. // : Container();
  784. // }
  785. //常驻城市
  786. Widget _buildResientCity() {
  787. return isMyself
  788. ? Container(
  789. padding: EdgeInsets.only(top: 5),
  790. child: Text(
  791. userInfo.userId == null
  792. ? ''
  793. : '${I18n.of(context).Resident_city}:${UserData().hasLocationPermission ? WebData().getDateRange(userInfo.meetPlace) : I18n.of(context).unknown}',
  794. textScaleFactor: 1.0,
  795. textAlign: TextAlign.center,
  796. style: TextStyle(fontSize: 12),
  797. ))
  798. : userInfo.userId == null
  799. ? Container()
  800. : Padding(
  801. padding: EdgeInsets.only(top: 5),
  802. child: Row(
  803. mainAxisAlignment: MainAxisAlignment.center,
  804. children: <Widget>[
  805. InfoTile(
  806. icon: IconData(0xe630,
  807. fontFamily: Constants.IconFontFamily),
  808. title: WebData()
  809. .getDistanceString(userInfo.distince.toDouble()),
  810. titleColor: greyColor,
  811. isDivider: true),
  812. InfoTile(
  813. title: userInfo.onlineStatus == 1
  814. ? I18n.of(context).online
  815. : WebData()
  816. .getLoginTime(context, userInfo.loginDate),
  817. titleColor: greyColor,
  818. isDivider:
  819. userInfo.photoAut == 1 || userInfo.infoAut == 1),
  820. userInfo.infoAut == 1
  821. ? InfoTile(
  822. icon: IconData(0xe645, fontFamily: 'iconfont'),
  823. iconHeight: 22,
  824. title: I18n.of(context).application_view,
  825. titleColor: greyColor,
  826. isDivider: false,
  827. onTap: () {})
  828. : Container(),
  829. userInfo.photoAut == 1
  830. ? InfoTile(
  831. icon: IconData(0xe632,
  832. fontFamily: Constants.IconFontFamily),
  833. title: I18n.of(context).paid_photo,
  834. titleColor: greyColor,
  835. isDivider: false,
  836. onTap: () {})
  837. : Container(),
  838. ],
  839. ));
  840. }
  841. //用户chips
  842. Widget _buildUserChips() {
  843. var age = 0;
  844. if (userInfo.birthday != null) {
  845. age = DateTime.now().year - int.parse(userInfo.birthday.split('-')[0]);
  846. }
  847. return Container(
  848. margin: EdgeInsets.only(top: 10),
  849. alignment: Alignment.center,
  850. width: cardWidth,
  851. child: userInfo.userId == null
  852. ? Container()
  853. : UserChips(
  854. bgColor: const Color(0xFFF2F2F2),
  855. fontStyle:
  856. TextStyle(fontSize: 12, color: const Color(0xFF807B95)),
  857. isCenter: true,
  858. city: UserData().hasLocationPermission
  859. ? WebData().getCity(userInfo.city)
  860. : I18n.of(context).unknown,
  861. age: age,
  862. constellation:
  863. WebData().getConstellation(context, userInfo.constellation),
  864. professional: userInfo.occupation == null
  865. ? ''
  866. : WebData().getProffesionName(userInfo.occupation)));
  867. }
  868. //用户姓名
  869. Widget _buildUserName() {
  870. return isMyself
  871. ? InkWell(
  872. onTap: () {
  873. Navigator.of(context).push(
  874. new MaterialPageRoute(
  875. builder: (context) {
  876. return EditPage(isEditPage: true);
  877. },
  878. ),
  879. );
  880. },
  881. child: Container(
  882. margin: EdgeInsets.only(top: 10),
  883. alignment: Alignment.center,
  884. child: Row(
  885. mainAxisAlignment: MainAxisAlignment.center,
  886. children: <Widget>[
  887. Text(
  888. Provider.of<RefNameProvider>(context)
  889. .getRefName(userInfo.userId, userInfo.nickName),
  890. textScaleFactor: 1.0,
  891. style: TextStyle(
  892. color: Constants.BlackTextColor,
  893. fontWeight: FontWeight.w500,
  894. fontSize: 16)),
  895. isAttestation && !isMan
  896. ? Container(
  897. height: 13,
  898. margin: EdgeInsets.only(left: 5),
  899. padding: EdgeInsets.only(left: 5, right: 5),
  900. alignment: Alignment.center,
  901. decoration: BoxDecoration(
  902. borderRadius: BorderRadius.circular(10),
  903. color: Constants.PurpleBackgroundColor,
  904. ),
  905. child: Text(
  906. 'Real',
  907. textScaleFactor: 1.0,
  908. style:
  909. TextStyle(fontSize: 9, color: Colors.white),
  910. ))
  911. : Text(''),
  912. isVip && isMan
  913. ? Container(
  914. margin: EdgeInsets.only(left: 5),
  915. child:
  916. isSvip ? Constants.svipIcon : Constants.vipIcon)
  917. : Text(''),
  918. Container(
  919. padding: EdgeInsets.only(left: 5),
  920. alignment: Alignment.center,
  921. child: new InkWell(
  922. child: Icon(
  923. IconData(0xe6e5, fontFamily: 'iconfont'),
  924. color: Colors.grey,
  925. size: 16,
  926. ),
  927. onTap: () {
  928. Navigator.of(context).push(
  929. new MaterialPageRoute(
  930. builder: (context) {
  931. return EditPage(isEditPage: true);
  932. },
  933. ),
  934. );
  935. },
  936. ),
  937. )
  938. ],
  939. )))
  940. : Container();
  941. }
  942. //用户头像
  943. Widget _buildHeadImg() {
  944. bool needSign = UserData().sign == 1 && isMyself;
  945. return Container(
  946. width: MediaQuery.of(context).size.width,
  947. child: Stack(
  948. children: <Widget>[
  949. Center(
  950. child: InkWell(
  951. onTap: isMyself
  952. ? _sendPicture
  953. : () {
  954. Navigator.of(context).push(
  955. new MaterialPageRoute(
  956. builder: (context) {
  957. return PicSwiper(
  958. id: 0,
  959. pics: [
  960. PicSwiperItem(userInfo.headimgurl, id: 0)
  961. ],
  962. );
  963. },
  964. ),
  965. );
  966. },
  967. child: Container(
  968. decoration: BoxDecoration(
  969. borderRadius: BorderRadius.circular(2.0),
  970. boxShadow: [
  971. BoxShadow(
  972. color: Colors.grey[200],
  973. offset: Offset(0, 6),
  974. blurRadius: 5,
  975. )
  976. ]),
  977. width: 110,
  978. height: 110,
  979. child: ClipRRect(
  980. borderRadius: BorderRadius.circular(10),
  981. child: userInfo.headimgurl == null ||
  982. userInfo.headimgurl == ''
  983. ? Image.asset(Constants.DefaultHeadImgUrl,
  984. height: 110, width: 110)
  985. : CachedNetworkImage(
  986. imageUrl: userInfo.headimgurl,
  987. placeholder: (context, url) => Image.asset(
  988. Constants.DefaultHeadImgUrl,
  989. height: 110,
  990. width: 110,
  991. ),
  992. fit: BoxFit.cover,
  993. ),
  994. ))),
  995. ),
  996. ///签到功能入口
  997. needSign
  998. ? Positioned.fill(
  999. child: GestureDetector(
  1000. onTap: () {
  1001. Navigator.of(context).push(MaterialPageRoute(
  1002. builder: (context) {
  1003. return DailyBonusPage();
  1004. },
  1005. ));
  1006. },
  1007. child: Container(
  1008. alignment: Alignment.centerRight,
  1009. child: Container(
  1010. margin: EdgeInsets.only(right: 23),
  1011. width: 48,
  1012. height: 48,
  1013. decoration: BoxDecoration(
  1014. borderRadius: BorderRadius.all(Radius.circular(30)),
  1015. boxShadow: [
  1016. BoxShadow(
  1017. color: Color(0x739f9f9f),
  1018. offset: Offset(0.3, 0.5),
  1019. blurRadius: 2.0,
  1020. spreadRadius: 1.0),
  1021. // BoxShadow(
  1022. // color: Color(0x9900FF00), offset: Offset(1.0, 1.0)),
  1023. // BoxShadow(color: Color(0xFF0000FF))
  1024. ]),
  1025. child: ClipOval(
  1026. child: Container(
  1027. color: Colors.white,
  1028. child: Column(
  1029. children: <Widget>[
  1030. SizedBox(
  1031. height: 8,
  1032. ),
  1033. Icon(
  1034. IconData(0xe65c,
  1035. fontFamily: Constants.IconFontFamily),
  1036. size: 20,
  1037. color: Color(0xFF0D68FF),
  1038. ),
  1039. SizedBox(
  1040. height: 2,
  1041. ),
  1042. Text(
  1043. I18n.of(context).signin,
  1044. style: TextStyle(
  1045. color: Color(0xFF0D68FF), fontSize: 10),
  1046. )
  1047. ],
  1048. ),
  1049. ),
  1050. ),
  1051. ),
  1052. ),
  1053. ),
  1054. )
  1055. : Container()
  1056. ],
  1057. ),
  1058. );
  1059. }
  1060. //收藏按钮
  1061. Widget _buildLoveButton(Color buttonColor) {
  1062. return isMyself || userInfo.sex == UserData().basicInfo.sex
  1063. ? Container()
  1064. : Positioned(
  1065. right: 10,
  1066. top: 20,
  1067. child: InkWell(
  1068. onTap: () async {
  1069. if (!userInfo.isLike) {
  1070. HttpUtil().setLove(userInfo.userId, () {
  1071. MessageMgr().emit('refresh_love_list',
  1072. {'UserId': userInfo.userId, 'flag': 0});
  1073. setState(() {
  1074. userInfo.isLike = true;
  1075. });
  1076. });
  1077. } else {
  1078. HttpUtil().cancleLove(userInfo.userId, () {
  1079. MessageMgr().emit('refresh_love_list',
  1080. {'UserId': userInfo.userId, 'flag': 2});
  1081. setState(() {
  1082. userInfo.isLike = false;
  1083. });
  1084. });
  1085. }
  1086. },
  1087. child: Container(
  1088. child: Row(
  1089. children: <Widget>[
  1090. Icon(
  1091. IconData(userInfo.isLike ? 0xe623 : 0xe625,
  1092. fontFamily: Constants.IconFontFamily),
  1093. size: 14,
  1094. color: userInfo.isLike
  1095. ? const Color(0xFFFF7777)
  1096. : buttonColor,
  1097. ),
  1098. SizedBox(width: 2),
  1099. Text(
  1100. I18n.of(context).like,
  1101. style: TextStyle(color: buttonColor, fontSize: 11),
  1102. )
  1103. ],
  1104. ),
  1105. padding: EdgeInsets.symmetric(horizontal: 8, vertical: 5),
  1106. decoration: BoxDecoration(
  1107. border: Border.all(color: Colors.grey[300]),
  1108. borderRadius: BorderRadius.circular(5)))));
  1109. }
  1110. Widget _buildMyPicture() {
  1111. var pisc = imgList
  1112. .map((f) => PicSwiperItem(
  1113. f['ImgUrl'],
  1114. id: f['Id'],
  1115. type: f['Type'],
  1116. isWatch: f['IsCheck'] == 1,
  1117. userId: userInfo.userId,
  1118. isBuy: f['PayStatus'] == 1,
  1119. isCheck: f['Status'] == 0,
  1120. ))
  1121. .toList();
  1122. var list = imgList.map((data) {
  1123. var width = MediaQuery.of(context).size.width / 4 - 15;
  1124. bool isWatch = data['IsCheck'] == 1;
  1125. double raduis = 10;
  1126. return CustomUI.buildImgCover(data['Id'], pisc, data['ImgUrl'], width,
  1127. raduis, isWatch, context, data['Type'],
  1128. isMyself: isMyself,
  1129. payStatus: data['PayStatus'],
  1130. state: isMan ? 1 : data['Status']);
  1131. }).toList();
  1132. if (!isBuyPicture && list.length > 4) {
  1133. list.length = 4;
  1134. }
  1135. TitleItem title;
  1136. if (!isMan) {
  1137. title = UserData().isVip
  1138. ? TitleItem(
  1139. title: I18n.of(context).unlock_user,
  1140. name: Provider.of<RefNameProvider>(context)
  1141. .getRefName(userInfo.userId, userInfo.nickName),
  1142. )
  1143. : TitleItem(
  1144. title: I18n.of(context).free_unlock,
  1145. name: userInfo.price.toString() + I18n.of(context).mask_coin);
  1146. } else {
  1147. title = TitleItem(
  1148. title: I18n.of(context).pay_unlock, name: userInfo.price.toString());
  1149. }
  1150. //我的相册
  1151. return Container(
  1152. alignment: Alignment.center,
  1153. margin: EdgeInsets.only(top: Separate_Size),
  1154. padding: EdgeInsets.symmetric(horizontal: 10),
  1155. width: isMyself ? Screen.width : cardWidth,
  1156. child: Column(
  1157. crossAxisAlignment: CrossAxisAlignment.start,
  1158. children: <Widget>[
  1159. FullWidthButton(
  1160. title: (isMyself
  1161. ? I18n.of(context).my_album
  1162. : (isMan
  1163. ? I18n.of(context).his_photo
  1164. : I18n.of(context).her_photo)),
  1165. //+'(${I18n.of(context).visit_you.replaceFirst('/s1', userInfo.accessNum.toString())})',
  1166. description: isMyself
  1167. ? '${I18n.of(context).upload}(${imgList.length}/$MaxImgSize)'
  1168. : '',
  1169. descriptionColor: Constants.BlueTextColor,
  1170. showDivider: true,
  1171. showRightIcon: false,
  1172. onPressed: isMyself ? _uploadPhoto : () {},
  1173. ),
  1174. list.length == 0
  1175. ? (isMyself
  1176. ? InkWell(
  1177. onTap: _uploadPhoto,
  1178. child: Container(
  1179. height: 100,
  1180. alignment: Alignment.center,
  1181. child: Column(
  1182. mainAxisAlignment: MainAxisAlignment.center,
  1183. children: <Widget>[
  1184. Text(I18n.of(context).first_photo,
  1185. textScaleFactor: 1.0),
  1186. Text(
  1187. isMan
  1188. ? I18n.of(context).have_picture
  1189. : I18n.of(context).no_photo,
  1190. textScaleFactor: 1.0,
  1191. style: TextStyle(
  1192. fontSize: 12, color: Colors.grey))
  1193. ],
  1194. )))
  1195. : Container(
  1196. alignment: Alignment.center,
  1197. height: 120,
  1198. child: Text(
  1199. isMan
  1200. ? I18n.of(context).not_up_man
  1201. : I18n.of(context).not_up_women,
  1202. textScaleFactor: 1.0,
  1203. style: TextStyle(fontSize: 14),
  1204. ),
  1205. ))
  1206. : (isBuyPicture
  1207. ? Container(
  1208. //alignment: Alignment.center,
  1209. child: Wrap(
  1210. crossAxisAlignment: WrapCrossAlignment.start,
  1211. children: list,
  1212. ))
  1213. : Container(
  1214. alignment: Alignment.center,
  1215. child: Stack(
  1216. //alignment: Alignment.center,
  1217. children: <Widget>[
  1218. Wrap(
  1219. crossAxisAlignment: WrapCrossAlignment.start,
  1220. children: list,
  1221. ),
  1222. Opacity(
  1223. opacity: 0.96,
  1224. child: Container(
  1225. decoration: BoxDecoration(color: Colors.white),
  1226. height: 200,
  1227. ),
  1228. ),
  1229. Container(
  1230. height: 200,
  1231. alignment: Alignment.center,
  1232. child: Column(
  1233. mainAxisAlignment: MainAxisAlignment.center,
  1234. children: <Widget>[
  1235. Image.asset(
  1236. 'assets/images/suo.png',
  1237. width: 35,
  1238. color: Colors.grey[700],
  1239. ),
  1240. Container(
  1241. margin: EdgeInsets.only(top: 10),
  1242. alignment: Alignment.center,
  1243. child: Text(
  1244. isMan
  1245. ? I18n.of(context).set_lock
  1246. : I18n.of(context).set_lock2,
  1247. textScaleFactor: 1.0,
  1248. style: TextStyle(
  1249. color: Colors.grey[700],
  1250. fontSize: 15),
  1251. ),
  1252. ),
  1253. Container(
  1254. margin: EdgeInsets.only(top: 8),
  1255. alignment: Alignment.center,
  1256. child: RichText(
  1257. text: TextSpan(
  1258. children: RichTitle.getRichText(title,
  1259. titleStyle: TextStyle(
  1260. color: Colors.grey[700],
  1261. fontSize: 13),
  1262. nameStyle: TextStyle(
  1263. color: Colors.red,
  1264. fontSize: 13))),
  1265. ),
  1266. ),
  1267. InkWell(
  1268. onTap: buyPhoto,
  1269. child: Container(
  1270. margin: EdgeInsets.only(top: 10),
  1271. padding:
  1272. EdgeInsets.only(top: 6, bottom: 6),
  1273. width: 100,
  1274. alignment: Alignment.center,
  1275. decoration: Constants
  1276. .ConfirmBUttonBoxDecoration,
  1277. child: Text(
  1278. I18n.of(context).unlock,
  1279. textScaleFactor: 1.0,
  1280. style: TextStyle(color: Colors.white),
  1281. ),
  1282. )),
  1283. ],
  1284. ))
  1285. ],
  1286. ))),
  1287. !isMan && isMyself
  1288. ? InkWell(
  1289. onTap: () {
  1290. if (!userInfo.isAttestation) {
  1291. _buildNotTrue();
  1292. return;
  1293. }
  1294. if (imgList.length == 0) {
  1295. showToast(I18n.of(context).no_photos);
  1296. return;
  1297. }
  1298. var moneyList = [];
  1299. for (int i = 0; i < imgList.length; i++) {
  1300. if (imgList[i]['Status'] == 1) {
  1301. moneyList.add(imgList[i]);
  1302. }
  1303. }
  1304. Navigator.of(context)
  1305. .push(new MaterialPageRoute(builder: (context) {
  1306. return MoneyPicture(
  1307. imageList: moneyList,
  1308. );
  1309. }));
  1310. },
  1311. child: Container(
  1312. alignment: Alignment.centerRight,
  1313. // decoration: BoxDecoration(
  1314. // border:
  1315. // Border(top: BorderSide(color: Colors.grey[50]))),
  1316. margin: EdgeInsets.only(top: 10, right: 10, bottom: 10),
  1317. padding: EdgeInsets.only(top: 10),
  1318. child: Text(
  1319. I18n.of(context).set_photo,
  1320. textScaleFactor: 1.0,
  1321. style: TextStyle(color: Colors.red),
  1322. ),
  1323. ))
  1324. : Container(),
  1325. _buildRset(),
  1326. ],
  1327. ),
  1328. decoration: BoxDecoration(
  1329. color: Colors.white,
  1330. border: Border(
  1331. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1332. );
  1333. }
  1334. void _buildNotTrue() {
  1335. CustomUI.buildOneConfirm(context, I18n.of(context).moneyPageTip,
  1336. I18n.of(context).authenticate_now, () {
  1337. Navigator.pop(context);
  1338. Navigator.of(context).push(
  1339. new MaterialPageRoute(
  1340. builder: (context) {
  1341. return VerificationCenterPage();
  1342. },
  1343. ),
  1344. );
  1345. });
  1346. }
  1347. void _buildConfirmBlack() {
  1348. Navigator.of(context).pop();
  1349. CustomUI.buildOneConfirm(
  1350. context, I18n.of(context).blacklist_choose, I18n.of(context).determine,
  1351. () async {
  1352. Navigator.pop(context);
  1353. HttpUtil().blackUser(userInfo.userId, () {
  1354. isblack = true;
  1355. });
  1356. });
  1357. }
  1358. void _sendMySelfPicture() async {
  1359. if (await CustomUI.showPhotoPermissionSetting(context)) {
  1360. var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  1361. if (tempFile != null) {
  1362. Map data = {"type": 6, "userId": UserData().basicInfo.userId};
  1363. data['sign'] = TokenMgr().getSign(data);
  1364. data['isBurn'] = 1;
  1365. Response res = await HttpUtil().uploadFile(
  1366. tempFile, data, 'upload/file/postflie', 'image',
  1367. isShowLoading: true);
  1368. var resData = res.data;
  1369. if (resData['code'] == 0) {
  1370. showToast(I18n.of(context).successfully_submit);
  1371. myselfImg = resData['data']['photoId'];
  1372. Navigator.of(context).pop();
  1373. _postApply();
  1374. }
  1375. }
  1376. }
  1377. }
  1378. void _postApply() async {
  1379. Map data = {
  1380. "userId": userInfo.userId,
  1381. "imgUrl": myselfImg,
  1382. "applyUserId": UserData().basicInfo.userId
  1383. };
  1384. data['sign'] = TokenMgr().getSign(data);
  1385. Response res = await HttpUtil()
  1386. .post('user/apply/checkcords', data: data, isShowLoading: true);
  1387. Map resData = res.data;
  1388. if (resData['code'] == 0) {
  1389. isApplying = true;
  1390. setState(() {});
  1391. }
  1392. }
  1393. Widget _buildBody() {
  1394. Widget hidden = Container(
  1395. alignment: Alignment.center,
  1396. width: Screen.width,
  1397. height: Screen.height - 372,
  1398. color: Colors.white,
  1399. margin: EdgeInsets.only(top: 10),
  1400. child: Column(
  1401. mainAxisAlignment: MainAxisAlignment.center,
  1402. children: <Widget>[
  1403. Container(
  1404. margin: EdgeInsets.only(bottom: 10),
  1405. child: Image.asset('assets/images/login/lock.png',
  1406. height: 45, width: 45),
  1407. ),
  1408. Text(
  1409. isMan ? I18n.of(context).view_user : I18n.of(context).view_user2,
  1410. textScaleFactor: 1.0,
  1411. textAlign: TextAlign.center,
  1412. style: TextStyle(color: Constants.GreyTextColor, fontSize: 13.5),
  1413. ),
  1414. InkWell(
  1415. onTap: isApplying
  1416. ? null
  1417. : () async {
  1418. CustomUI.buildOneConfirm(
  1419. context,
  1420. I18n.of(context).need_photo,
  1421. I18n.of(context).choose_photo,
  1422. _sendMySelfPicture);
  1423. },
  1424. child: Container(
  1425. margin: EdgeInsets.only(top: 10, left: 100, right: 100),
  1426. padding: EdgeInsets.only(top: 10, bottom: 10),
  1427. alignment: Alignment.center,
  1428. decoration: BoxDecoration(
  1429. color: Constants.ConfrimButtonColor,
  1430. borderRadius: BorderRadius.all(
  1431. Radius.circular(Constants.LittleButtonRadius))),
  1432. child: Text(
  1433. isApplying
  1434. ? I18n.of(context).already_applied
  1435. : I18n.of(context).apply_now,
  1436. textScaleFactor: 1.0,
  1437. style: TextStyle(color: Colors.white),
  1438. ),
  1439. )),
  1440. ],
  1441. ),
  1442. );
  1443. List<Widget> child = [];
  1444. if (isMyself) {
  1445. child.addAll([
  1446. _buildHeadView(),
  1447. _buildGoldnessHot(),
  1448. _buildMoneyBox(),
  1449. _buildMyPicture(),
  1450. _buildTips(),
  1451. _buildHistory(),
  1452. //_buildApplyCode(),
  1453. _buildShare(),
  1454. ]);
  1455. } else if (isCanWatch) {
  1456. child.addAll([
  1457. _buildHeadView(),
  1458. _buildMyPicture(),
  1459. _buildBasicInfo(),
  1460. _buildBottomTips(),
  1461. ]);
  1462. } else if (userInfo.userId != null) {
  1463. child.addAll([
  1464. _buildHeadView(),
  1465. hidden,
  1466. ]);
  1467. } else {
  1468. child.addAll([
  1469. _buildHeadView(),
  1470. ]);
  1471. }
  1472. return Column(
  1473. children: child,
  1474. );
  1475. }
  1476. _inviteFdBtn() {
  1477. return Container(
  1478. width: Screen.width,
  1479. child: FlatButton(
  1480. child: fixedText(I18n.of(context).add_friends,
  1481. fontSize: 16,
  1482. color: Colors.blueAccent,
  1483. fontWeight: FontWeight.w500),
  1484. onPressed: () async {
  1485. //已经是好友
  1486. if (FriendListMgr().isMyFriend(userInfo.userId)) {
  1487. showToast(I18n.of(context).added);
  1488. return;
  1489. }
  1490. //已申请
  1491. if (userInfo.isAddFriends == 0) {
  1492. showToast(I18n.of(context).add_friends_tips);
  1493. return;
  1494. }
  1495. if (widget.addMode != 3 &&
  1496. UserData().addFdDistanceSwitch > 0 &&
  1497. userInfo.distince > 200) {
  1498. showToast(I18n.of(context).distance_long);
  1499. return;
  1500. }
  1501. Navigator.of(context).push(
  1502. new MaterialPageRoute(
  1503. builder: (context) {
  1504. return AddFriendPage(
  1505. userId: userInfo.userId,
  1506. pageType: SendMessagePageType.AddFriends,
  1507. originalName: I18n.of(context)
  1508. .i_am
  1509. .replaceFirst('/s1', UserData().basicInfo.nickName),
  1510. );
  1511. },
  1512. ),
  1513. );
  1514. }),
  1515. );
  1516. }
  1517. void doFriendApply(state, callback) async {
  1518. Map data = {
  1519. "id": widget.applyId,
  1520. "userId": UserData().basicInfo.userId,
  1521. "status": state,
  1522. };
  1523. data['sign'] = TokenMgr().getSign(data);
  1524. Response res =
  1525. await HttpUtil().post('friendship/handler/apply', data: data);
  1526. if (res == null) {
  1527. return;
  1528. }
  1529. var resData = res.data;
  1530. if (resData['code'] == 0) {
  1531. callback(resData['msg']);
  1532. } else {}
  1533. }
  1534. _dealInvite() {
  1535. return Container(
  1536. width: Screen.width,
  1537. child: Row(
  1538. children: <Widget>[
  1539. Expanded(
  1540. child: InkWell(
  1541. onTap: () {
  1542. doFriendApply(1, (msg) {
  1543. showToast(msg);
  1544. Navigator.of(context).pop();
  1545. var friendModel = FriendModel.fromServerJson({
  1546. 'UserId': userInfo.userId,
  1547. 'ImgUrl': userInfo.headimgurl,
  1548. 'UserName': userInfo.nickName
  1549. });
  1550. FriendListMgr().addFriend(friendModel);
  1551. FriendListMgr().deleteLocalUserId();
  1552. MessageMgr().emit('do_friend_apply',
  1553. {'userId': userInfo.userId, 'state': 1});
  1554. MessageMgr().emit('Add friend');
  1555. //同意好友后发送打招呼
  1556. MsgModel msgModel = MsgHandler.createSendMsg(
  1557. ChatType.TextChatType, I18n.of(context).new_friends_tips,
  1558. friendId: userInfo.userId,
  1559. refMsg: null,
  1560. refShortTxt: null,
  1561. altUsers: null,
  1562. channelType: ChatChannelType.Session);
  1563. int sessionId = UserData().getSessionId(userInfo.userId);
  1564. MsgHandler.updateActiveSesstion(sessionId);
  1565. AppNavigator.pushChatPage(context, userInfo.userId,
  1566. enterType: 3, enterContent: msgModel);
  1567. });
  1568. },
  1569. child: Container(
  1570. color: const Color(0xFF3875E9),
  1571. alignment: Alignment.center,
  1572. child: Text(
  1573. I18n.of(context).agree,
  1574. style: TextStyle(fontSize: 18, color: Colors.white),
  1575. ),
  1576. ),
  1577. )),
  1578. InkWell(
  1579. onTap: () {
  1580. doFriendApply(2, (msg) {
  1581. showToast(msg);
  1582. Navigator.of(context).pop();
  1583. MessageMgr().emit('do_friend_apply',
  1584. {'userId': userInfo.userId, 'state': 2});
  1585. });
  1586. },
  1587. child: Container(
  1588. alignment: Alignment.center,
  1589. color: const Color(0xFFA8D3FF),
  1590. width: Screen.width * 0.33,
  1591. child: Text(
  1592. I18n.of(context).refuse,
  1593. style:
  1594. TextStyle(fontSize: 18, color: const Color(0xFF007EFF)),
  1595. ),
  1596. ))
  1597. ],
  1598. ));
  1599. }
  1600. //自定义item
  1601. Widget _bottomBorderBox(
  1602. String textLeft, String textRight, bool showBorder, callback,
  1603. {showIcon: false}) {
  1604. Widget left = new Container(
  1605. margin: EdgeInsets.only(right: 20),
  1606. width: 90,
  1607. child: new Text(
  1608. textLeft,
  1609. textScaleFactor: 1.0,
  1610. style: TextStyle(fontSize: 14),
  1611. ));
  1612. Widget right = new Expanded(
  1613. child: Text(
  1614. textRight,
  1615. textScaleFactor: 1.0,
  1616. style: TextStyle(fontSize: 13, color: Constants.GreyTextColor),
  1617. ),
  1618. );
  1619. return InkWell(
  1620. highlightColor: Colors.transparent,
  1621. radius: 0.0,
  1622. onTap: callback,
  1623. child: Container(
  1624. decoration: showBorder
  1625. ? BoxDecoration(border: Border(bottom: Constants.GreyBorderSide))
  1626. : null,
  1627. alignment: Alignment.center,
  1628. padding: EdgeInsets.only(
  1629. top: 17,
  1630. bottom: 17,
  1631. ),
  1632. margin: EdgeInsets.only(left: 20, bottom: 0, right: 10),
  1633. child: Row(
  1634. crossAxisAlignment: CrossAxisAlignment.start,
  1635. children: <Widget>[
  1636. left,
  1637. right,
  1638. showIcon
  1639. ? Padding(
  1640. padding: EdgeInsets.only(right: 10),
  1641. child: Icon(
  1642. IconData(0xe63c, fontFamily: 'iconfont'),
  1643. size: 22.0,
  1644. color: Color(AppColors.TabIconNormal),
  1645. ))
  1646. : Container()
  1647. ],
  1648. ),
  1649. ));
  1650. }
  1651. testChatPermission(callback) {
  1652. becomeVip() {
  1653. Navigator.of(context).push(
  1654. new MaterialPageRoute(
  1655. builder: (context) {
  1656. return VipPage();
  1657. },
  1658. ),
  1659. );
  1660. }
  1661. payCallback() {
  1662. if (Provider.of<MoneyChangeProvider>(context).money <
  1663. UserData().accountPrice) {
  1664. Navigator.of(context).pop();
  1665. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1666. I18n.of(context).recharge, () {
  1667. Navigator.of(context).pop();
  1668. ChargeMoney.showChargeSheet(context, () {
  1669. setState(() {});
  1670. });
  1671. });
  1672. return;
  1673. }
  1674. Navigator.of(context).pop();
  1675. HttpUtil().buyChatAccount(
  1676. UserData().accountPrice, userInfo.userId, context, () {
  1677. setState(() {
  1678. isAuthority = true;
  1679. });
  1680. });
  1681. }
  1682. freeTime() {
  1683. HttpUtil().userFreeTime(context, userInfo.userId, 2, () {
  1684. UserData().basicInfo.usedNum++;
  1685. Navigator.of(context).pop();
  1686. setState(() {
  1687. isAuthority = true;
  1688. });
  1689. });
  1690. }
  1691. // //对方是女性用户,且未认证提示未认证
  1692. // if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1693. // showToast(I18n.of(context).not_video);
  1694. // return;
  1695. // }
  1696. //自己是女性,且未认证,提示去认证(好友除外)
  1697. if (!UserData().isMan() &&
  1698. !UserData().basicInfo.isAttestation &&
  1699. !FriendListMgr().isMyFriend(userInfo.userId)) {
  1700. CustomUI.buildNotTrue(context);
  1701. return;
  1702. }
  1703. print('isAuthority $isAuthority');
  1704. var tipStr = '';
  1705. //没有解锁账号,并且对方禁止陌生人聊天
  1706. if (!isAuthority && !userInfo.isCanStrangerNews) {
  1707. tipStr = I18n.of(context).stranger_close;
  1708. } else {
  1709. tipStr = I18n.of(context).unlock_information;
  1710. if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1711. tipStr += '(${I18n.of(context).not_true_woman})';
  1712. }
  1713. }
  1714. if (isAuthority) {
  1715. if (callback != null) callback();
  1716. } else {
  1717. //如果自己是男性,vip提示免费次数,次数用完或者非vip提示购买
  1718. if (UserData().isMan()) {
  1719. if (UserData().isVip) {
  1720. UserData().basicInfo.freeNum < UserData().basicInfo.usedNum
  1721. ? CustomUI.buildOneConfirm(
  1722. context,
  1723. tipStr,
  1724. I18n.of(context)
  1725. .pay_unlock
  1726. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1727. payCallback)
  1728. : CustomUI.buildOneConfirm(
  1729. context,
  1730. tipStr,
  1731. I18n.of(context).unlock_choose,
  1732. freeTime,
  1733. );
  1734. } else {
  1735. CustomUI.buildTowConfirm(
  1736. context,
  1737. tipStr,
  1738. I18n.of(context).become_member,
  1739. becomeVip,
  1740. I18n.of(context)
  1741. .pay_unlock
  1742. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1743. payCallback);
  1744. }
  1745. }
  1746. }
  1747. }
  1748. buyChatAccount() {
  1749. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1750. ///如果是聊天界面跳转过来的,直接返回
  1751. Navigator.of(context).pop();
  1752. } else {
  1753. testChatPermission(() {
  1754. int fdId = userInfo.userId;
  1755. int sessionId = UserData().getSessionId(fdId);
  1756. MsgHandler.updateActiveSesstion(sessionId);
  1757. AppNavigator.pushChatPage(context, fdId);
  1758. });
  1759. }
  1760. }
  1761. clickChatAccout() {
  1762. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1763. ///如果是聊天界面跳转过来的,直接返回
  1764. Navigator.of(context).pop();
  1765. } else {
  1766. testChatPermission(() {});
  1767. }
  1768. }
  1769. buyPhoto() {
  1770. //女性用户付费,男性用户会员的话免费解锁,非会员付费解锁
  1771. becomeVip() {
  1772. Navigator.of(context).push(
  1773. new MaterialPageRoute(
  1774. builder: (context) {
  1775. return VipPage();
  1776. },
  1777. ),
  1778. );
  1779. }
  1780. payCallback() {
  1781. if (Provider.of<MoneyChangeProvider>(context).money < userInfo.price) {
  1782. Navigator.of(context).pop();
  1783. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1784. I18n.of(context).recharge, () {
  1785. Navigator.of(context).pop();
  1786. ChargeMoney.showChargeSheet(context, () {
  1787. setState(() {});
  1788. });
  1789. });
  1790. return;
  1791. }
  1792. Navigator.of(context).pop();
  1793. HttpUtil().buyPictures(userInfo.price, userInfo.userId, context, () {
  1794. setState(() {
  1795. isBuyPicture = true;
  1796. });
  1797. });
  1798. }
  1799. freeTime() {
  1800. HttpUtil().userFreeTime(context, userInfo.userId, 1, () {
  1801. UserData().basicInfo.usedNum++;
  1802. Navigator.of(context).pop();
  1803. setState(() {
  1804. isBuyPicture = true;
  1805. });
  1806. });
  1807. }
  1808. String title = I18n.of(context).unlock_user.replaceFirst(
  1809. '/s1',
  1810. Provider.of<RefNameProvider>(context)
  1811. .getRefName(userInfo.userId, userInfo.nickName),
  1812. );
  1813. if (!UserData().isMan()) {
  1814. CustomUI.buildOneConfirm(
  1815. context,
  1816. title,
  1817. I18n.of(context)
  1818. .pay_unlock
  1819. .replaceFirst('/s1', userInfo.price.toString()),
  1820. payCallback);
  1821. } else if (UserData().isVip) {
  1822. if (UserData().basicInfo.freeNum < UserData().basicInfo.usedNum) {
  1823. CustomUI.buildOneConfirm(
  1824. context,
  1825. title,
  1826. I18n.of(context)
  1827. .pay_unlock
  1828. .replaceFirst('/s1', userInfo.price.toString()),
  1829. payCallback);
  1830. } else {
  1831. CustomUI.buildOneConfirm(
  1832. context, title, I18n.of(context).unlock_choose, freeTime);
  1833. }
  1834. } else {
  1835. CustomUI.buildTowConfirm(
  1836. context,
  1837. title,
  1838. I18n.of(context).become_member,
  1839. becomeVip,
  1840. I18n.of(context)
  1841. .pay_unlock
  1842. .replaceFirst('/s1', userInfo.price.toString()),
  1843. payCallback);
  1844. }
  1845. }
  1846. Widget _buildBasicInfo() {
  1847. String wechat = '';
  1848. String facebook = '';
  1849. bool isHidden = userInfo.accountStatus == 1;
  1850. //隐藏社交账号
  1851. if (isHidden) {
  1852. wechat = I18n.of(context).ask_me;
  1853. facebook = I18n.of(context).ask_me;
  1854. } else {
  1855. wechat = isAuthority ? userInfo.wechat : I18n.of(context).filled_in;
  1856. facebook = isAuthority ? userInfo.facebook : I18n.of(context).filled_in;
  1857. }
  1858. heightStr = (userInfo.height == 0.0 || userInfo.height == null)
  1859. ? I18n.of(context).not_show
  1860. : '${userInfo.height.toInt()}CM';
  1861. weightStr = (userInfo.weight == 0.0 || userInfo.weight == null)
  1862. ? I18n.of(context).not_show
  1863. : '${userInfo.weight.toInt()}KG';
  1864. List<Widget> basicList = [
  1865. userInfo.height != null && userInfo.height != 0
  1866. ? _bottomBorderBox(I18n.of(context).height, heightStr, true, () {})
  1867. : Container(),
  1868. userInfo.weight != null && userInfo.weight != 0
  1869. ? _bottomBorderBox(I18n.of(context).weight, weightStr, true, () {})
  1870. : Container(),
  1871. _bottomBorderBox(I18n.of(context).Resident_city, dateRange, true, () {}),
  1872. //_bottomBorderBox(I18n.of(context).program, dateItem, true, () {}),
  1873. _bottomBorderBox(I18n.of(context).expect_lover, lovePeople, true, () {}),
  1874. (userInfo.wechat != null && userInfo.wechat != '')
  1875. ? _bottomBorderBox(
  1876. I18n.of(context).wechat_number, wechat, true, clickChatAccout,
  1877. showIcon: !isAuthority)
  1878. : Container(),
  1879. (userInfo.facebook != null && userInfo.facebook != '')
  1880. ? _bottomBorderBox(
  1881. I18n.of(context).facebook, facebook, true, clickChatAccout,
  1882. showIcon: !isAuthority)
  1883. : Container(),
  1884. userInfo.ownMsg != null && userInfo.ownMsg != ''
  1885. ? _bottomBorderBox(
  1886. I18n.of(context).self_introduction, myMsg, false, () {})
  1887. : Container(),
  1888. ];
  1889. return Container(
  1890. width: cardWidth,
  1891. margin: EdgeInsets.only(top: Separate_Size),
  1892. decoration: BoxDecoration(
  1893. color: Colors.white,
  1894. border: Border(
  1895. top: Constants.GreyBorderSide,
  1896. bottom: Constants.GreyBorderSide)),
  1897. child: new Column(
  1898. children: basicList,
  1899. ));
  1900. }
  1901. Widget _buildTips() {
  1902. return Container(
  1903. margin: EdgeInsets.only(top: 10, bottom: 10, left: 20, right: 20),
  1904. child: Text(I18n.of(context).dont,
  1905. textScaleFactor: 1.0,
  1906. style: TextStyle(
  1907. fontSize: 12,
  1908. color: Colors.grey,
  1909. )));
  1910. }
  1911. Widget _buildBottomTips() {
  1912. return Container(
  1913. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 10),
  1914. width: cardWidth,
  1915. alignment: Alignment.center,
  1916. child: Text(I18n.of(context).not_illage,
  1917. textScaleFactor: 1.0,
  1918. textAlign: TextAlign.center,
  1919. style: TextStyle(fontSize: 12, color: Colors.grey)),
  1920. );
  1921. }
  1922. Widget _buildGoldnessHot() {
  1923. //女神热度
  1924. return isMan
  1925. ? Container()
  1926. : Container(
  1927. margin: EdgeInsets.only(top: Separate_Size),
  1928. padding: EdgeInsets.symmetric(horizontal: 10),
  1929. child: FullWidthButton(
  1930. title: I18n.of(context).Goddess_heat,
  1931. showDivider: false,
  1932. showRightIcon: true,
  1933. onPressed: () {
  1934. Navigator.of(context).push(
  1935. new MaterialPageRoute(
  1936. builder: (context) {
  1937. return GoddessHotPage(
  1938. userId: userInfo.userId,
  1939. );
  1940. },
  1941. ),
  1942. );
  1943. },
  1944. ),
  1945. decoration: BoxDecoration(
  1946. color: Colors.white,
  1947. border: Border(
  1948. top: Constants.GreyBorderSide,
  1949. bottom: Constants.GreyBorderSide)),
  1950. );
  1951. }
  1952. Widget _buildMoneyBox() {
  1953. //认证、钱包、隐私连麦设置
  1954. return Container(
  1955. margin: EdgeInsets.only(top: Separate_Size),
  1956. decoration: BoxDecoration(
  1957. color: Colors.white,
  1958. border: Border(
  1959. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1960. padding: EdgeInsets.all(10),
  1961. child: Column(
  1962. children: <Widget>[
  1963. isMan
  1964. ? FullWidthButton(
  1965. title: I18n.of(context).member,
  1966. description: UserData().isVip
  1967. ? I18n.of(context)
  1968. .expires
  1969. .replaceFirst('/s1', endTime.split(' ')[0])
  1970. : I18n.of(context).enjoy_privileges,
  1971. showDivider: true,
  1972. onPressed: () {
  1973. Navigator.of(context).push(
  1974. new MaterialPageRoute(
  1975. builder: (context) {
  1976. return VipPage();
  1977. },
  1978. ),
  1979. );
  1980. },
  1981. )
  1982. : FullWidthButton(
  1983. title: isAttestation
  1984. ? I18n.of(context).certified_video
  1985. : I18n.of(context).authenticate,
  1986. showDivider: true,
  1987. onPressed: () {
  1988. Navigator.of(context).push(
  1989. new MaterialPageRoute(
  1990. builder: (context) {
  1991. return isAttestation
  1992. ? VideoPage(
  1993. userId: userInfo.userId,
  1994. )
  1995. : VerificationCenterPage();
  1996. },
  1997. ),
  1998. );
  1999. },
  2000. ),
  2001. FullWidthButton(
  2002. title: I18n.of(context).wallet,
  2003. description:
  2004. '${Provider.of<MoneyChangeProvider>(context).money}${I18n.of(context).mask_coin}',
  2005. showDivider: false,
  2006. onPressed: () {
  2007. Navigator.of(context).push(
  2008. new MaterialPageRoute(
  2009. builder: (context) {
  2010. return MoneyPage();
  2011. },
  2012. ),
  2013. );
  2014. },
  2015. ),
  2016. ],
  2017. ),
  2018. );
  2019. }
  2020. Widget _buildHistory() {
  2021. //历史访客
  2022. return Container(
  2023. margin: EdgeInsets.only(top: Separate_Size),
  2024. padding: EdgeInsets.symmetric(horizontal: 10),
  2025. child: FullWidthButton(
  2026. title: I18n.of(context).historical_visitor,
  2027. description: I18n.of(context)
  2028. .visit_you
  2029. .replaceFirst('/s1', userInfo.accessNum.toString()),
  2030. showDivider: false,
  2031. showRightIcon: false,
  2032. onPressed: () {},
  2033. ),
  2034. decoration: BoxDecoration(
  2035. color: Colors.white,
  2036. border: Border(
  2037. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  2038. );
  2039. }
  2040. //恢复焚阅照片
  2041. Widget _buildRset() {
  2042. //历史访客
  2043. return isMyself
  2044. ? Container(
  2045. margin: EdgeInsets.only(top: Separate_Size),
  2046. //padding: EdgeInsets.symmetric(horizontal: 10),
  2047. child: FullWidthButton(
  2048. title: I18n.of(context)
  2049. .visit_photo
  2050. .replaceFirst('/s1', userInfo.burnNum.toString()),
  2051. description: I18n.of(context).recovery_photo,
  2052. showDivider: false,
  2053. showRightIcon: false,
  2054. onPressed: () async {
  2055. CustomUI.buildOneConfirm(
  2056. context,
  2057. I18n.of(context).confrim_recovery,
  2058. I18n.of(context).determine, () async {
  2059. HttpUtil().resetPhoto(() {
  2060. Navigator.of(context).pop();
  2061. userInfo.burnNum = 0;
  2062. setState(() {});
  2063. });
  2064. });
  2065. },
  2066. ),
  2067. decoration: BoxDecoration(
  2068. color: Colors.white,
  2069. border: Border(top: Constants.GreyBorderSide)),
  2070. )
  2071. : Container();
  2072. }
  2073. Widget _buildShare() {
  2074. //分享
  2075. return Container(
  2076. margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size),
  2077. padding: EdgeInsets.symmetric(horizontal: 10),
  2078. child: FullWidthButton(
  2079. showRightIcon: false,
  2080. title: I18n.of(context).share_app,
  2081. showDivider: false,
  2082. onPressed: () {
  2083. Share.share('https://henho.jphgames.com/');
  2084. },
  2085. ),
  2086. decoration: BoxDecoration(
  2087. color: Colors.white,
  2088. border: Border(
  2089. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  2090. );
  2091. }
  2092. Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 28.0}) {
  2093. var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor;
  2094. return InkWell(
  2095. onTap: isCanHit
  2096. ? callback
  2097. : () {
  2098. showToast(isMan
  2099. ? I18n.of(context).view_user
  2100. : I18n.of(context).view_user2);
  2101. },
  2102. child: Row(
  2103. children: <Widget>[
  2104. Icon(
  2105. IconData(
  2106. code,
  2107. fontFamily: 'iconfont',
  2108. ),
  2109. color: color,
  2110. size: iconSize,
  2111. ),
  2112. Padding(
  2113. child: Text(
  2114. str,
  2115. textScaleFactor: 1.0,
  2116. style: TextStyle(color: color, fontSize: 12),
  2117. ),
  2118. padding: EdgeInsets.only(left: 5))
  2119. ],
  2120. ));
  2121. }
  2122. @override
  2123. Widget build(BuildContext context) {
  2124. Size screenSize = MediaQuery.of(context).size;
  2125. cardWidth = screenSize.width;
  2126. Widget appBar = AppBar(
  2127. leading: isMyself ? Container() : CustomUI.buildCustomLeading(context),
  2128. titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing,
  2129. title: isMyself
  2130. ? Text(
  2131. I18n.of(context).me,
  2132. textScaleFactor: 1.0,
  2133. style: Constants.MainTitleStyle,
  2134. )
  2135. : Container(
  2136. alignment: Alignment.center,
  2137. child: Row(
  2138. mainAxisAlignment: MainAxisAlignment.center,
  2139. children: <Widget>[
  2140. Text(
  2141. WebData().subUserName(
  2142. Provider.of<RefNameProvider>(context)
  2143. .getRefName(userInfo.userId, userInfo.nickName)),
  2144. textScaleFactor: 1.0,
  2145. style: TextStyle(color: Constants.BlackTextColor)),
  2146. isAttestation && !isMan
  2147. ? Container(
  2148. height: 13,
  2149. margin: EdgeInsets.only(left: 5),
  2150. padding: EdgeInsets.only(left: 5, right: 5),
  2151. alignment: Alignment.center,
  2152. decoration: BoxDecoration(
  2153. borderRadius: BorderRadius.circular(10),
  2154. color: Constants.PurpleBackgroundColor,
  2155. ),
  2156. child: Text(
  2157. 'Real',
  2158. textScaleFactor: 1.0,
  2159. style: TextStyle(fontSize: 10, color: Colors.white),
  2160. ))
  2161. : Text(''),
  2162. isVip && isMan
  2163. ? Container(
  2164. margin: EdgeInsets.only(left: 5),
  2165. child:
  2166. isSvip ? Constants.svipIcon : Constants.vipIcon)
  2167. : Text(''),
  2168. ],
  2169. )),
  2170. centerTitle: !isMyself,
  2171. elevation: 1,
  2172. actions: <Widget>[
  2173. isMyself
  2174. ? Container(
  2175. padding: EdgeInsets.only(right: 15),
  2176. alignment: Alignment.center,
  2177. child: new InkWell(
  2178. child: CircleAvatar(
  2179. backgroundColor: Constants.GreyBackgroundColor,
  2180. radius: 15.75,
  2181. child: Icon(
  2182. IconData(0xe658, fontFamily: 'iconfont'),
  2183. color: Constants.BlackTextColor,
  2184. size: 20,
  2185. )),
  2186. onTap: () {
  2187. AppNavigator.pushQrPage(context);
  2188. },
  2189. ),
  2190. )
  2191. : Container(),
  2192. isMyself
  2193. ? Container(
  2194. padding: EdgeInsets.only(right: 15),
  2195. alignment: Alignment.center,
  2196. child: new InkWell(
  2197. child: CircleAvatar(
  2198. backgroundColor: Constants.GreyBackgroundColor,
  2199. radius: 15.75,
  2200. child: Icon(
  2201. Icons.settings,
  2202. //IconData(0xe6e5, fontFamily: 'iconfont'),
  2203. color: Constants.BlackTextColor,
  2204. size: 22,
  2205. )),
  2206. onTap: () {
  2207. Navigator.of(context).push(
  2208. new MaterialPageRoute(
  2209. builder: (context) {
  2210. return SystemEditPage();
  2211. },
  2212. ),
  2213. );
  2214. },
  2215. ),
  2216. )
  2217. : Container(),
  2218. isMyself
  2219. ? Container(
  2220. // padding: EdgeInsets.only(right: 10),
  2221. // alignment: Alignment.center,
  2222. // child: new InkWell(
  2223. // child: CircleAvatar(
  2224. // backgroundColor: Constants.GreyBackgroundColor,
  2225. // radius: 15.75,
  2226. // child: Icon(
  2227. // IconData(0xe6e5, fontFamily: 'iconfont'),
  2228. // color: Constants.BlackTextColor,
  2229. // size: 25,
  2230. // )),
  2231. // onTap: () {
  2232. // Navigator.of(context).push(
  2233. // new MaterialPageRoute(
  2234. // builder: (context) {
  2235. // return EditPage(isEditPage: true);
  2236. // },
  2237. // ),
  2238. // );
  2239. // },
  2240. // ),
  2241. )
  2242. : Container(
  2243. alignment: Alignment.center,
  2244. child: new InkWell(
  2245. child: new Padding(
  2246. padding: EdgeInsets.only(
  2247. right: 15, left: 15, top: 10, bottom: 10),
  2248. child: Icon(
  2249. IconData(
  2250. 0xe621,
  2251. fontFamily: 'iconfont',
  2252. ),
  2253. color: Constants.BlackTextColor,
  2254. size: 20,
  2255. ),
  2256. ),
  2257. onTap: () {
  2258. showModalBottomSheet(
  2259. context: registKey.currentContext,
  2260. builder: (BuildContext context) {
  2261. return SafeArea(
  2262. child: Container(
  2263. height: 137,
  2264. child: Column(
  2265. children: <Widget>[
  2266. InkWell(
  2267. onTap: () async {
  2268. Navigator.of(context).pop();
  2269. Navigator.of(context).push(
  2270. new MaterialPageRoute(
  2271. builder: (context) {
  2272. return AddFriendPage(
  2273. userId: userInfo.userId,
  2274. pageType:
  2275. SendMessagePageType.Remark,
  2276. originalName: Provider.of<
  2277. RefNameProvider>(
  2278. context)
  2279. .getRefName(userInfo.userId,
  2280. userInfo.nickName));
  2281. },
  2282. ),
  2283. );
  2284. },
  2285. child: Container(
  2286. alignment: Alignment.center,
  2287. height: 45,
  2288. child: Text(I18n.of(context).Remark,
  2289. textScaleFactor: 1.0,
  2290. style: TextStyle(
  2291. fontSize: 18,
  2292. color: Constants
  2293. .BlackTextColor)))),
  2294. Divider(height: 1),
  2295. InkWell(
  2296. child: Container(
  2297. height: 45,
  2298. alignment: Alignment.center,
  2299. child: Text(
  2300. isblack
  2301. ? I18n.of(context).remove_blacklist
  2302. : I18n.of(context).blacklist,
  2303. textScaleFactor: 1.0,
  2304. style: TextStyle(
  2305. fontSize: 18,
  2306. color: Constants.BlackTextColor),
  2307. ),
  2308. ),
  2309. onTap: isblack
  2310. ? () async {
  2311. HttpUtil().cancleBlackUser(
  2312. userInfo.userId, () {
  2313. Navigator.of(context).pop();
  2314. isblack = false;
  2315. });
  2316. }
  2317. : _buildConfirmBlack,
  2318. ),
  2319. Divider(height: 1),
  2320. InkWell(
  2321. onTap: () async {
  2322. Navigator.of(context).pop();
  2323. Navigator.of(context).push(
  2324. new MaterialPageRoute(
  2325. builder: (context) {
  2326. return InformUserPage(
  2327. isMan: isMan,
  2328. userId: userInfo.userId,
  2329. );
  2330. },
  2331. ),
  2332. );
  2333. },
  2334. child: Container(
  2335. alignment: Alignment.center,
  2336. height: 45,
  2337. child: Text(
  2338. I18n.of(context).anonymous_report,
  2339. textScaleFactor: 1.0,
  2340. style: TextStyle(
  2341. fontSize: 18,
  2342. color: Constants
  2343. .BlackTextColor)))),
  2344. ],
  2345. ),
  2346. ),
  2347. );
  2348. },
  2349. ).then((val) {});
  2350. },
  2351. ),
  2352. ),
  2353. ],
  2354. );
  2355. var bottomWidget = Container(
  2356. height: 55,
  2357. decoration: BoxDecoration(
  2358. border: Border(top: BorderSide(color: Color(0xffeaeaea))),
  2359. color: Constants.LightGreyBackgroundColor,
  2360. ),
  2361. child: Row(
  2362. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  2363. children: widget.addMode == 1 || widget.addMode == 3
  2364. ? <Widget>[_inviteFdBtn()]
  2365. : (widget.addMode == 2
  2366. ? [_dealInvite()]
  2367. : <Widget>[
  2368. _buildIcon(0xe633, I18n.of(context).evaluate, true,
  2369. () async {
  2370. Map data = {
  2371. "userid": userInfo.userId,
  2372. 'evaluateuserid': UserData().basicInfo.userId,
  2373. };
  2374. data['sign'] = TokenMgr().getSign(data);
  2375. Response res = await HttpUtil().post('evaluate/user/info',
  2376. data: data, isShowLoading: true);
  2377. Map resData = res.data;
  2378. print(resData);
  2379. if (resData['code'] == 0) {
  2380. Navigator.of(context).push(TutorialOverlay(
  2381. child: ApplyContent(
  2382. userId: userInfo.userId,
  2383. isMan: isMan,
  2384. userInfo: resData['data'])));
  2385. } else {
  2386. showToast(resData['msg']);
  2387. }
  2388. }),
  2389. _buildIcon(0xe637, I18n.of(context).private_chat,
  2390. isCanWatch, isCanWatch ? buyChatAccount : null,
  2391. iconSize: 24.0),
  2392. _buildIcon(
  2393. 0xe62f, I18n.of(context).chat, isCanWatch, onAudio)
  2394. ]),
  2395. ),
  2396. );
  2397. Widget content = Container(
  2398. color: Colors.white,
  2399. child: SafeArea(
  2400. child: Scaffold(
  2401. bottomNavigationBar: !isMyself ? bottomWidget : null,
  2402. appBar: appBar,
  2403. key: registKey,
  2404. body: SafeArea(
  2405. child: Container(
  2406. height: MediaQuery.of(context).size.height,
  2407. width: MediaQuery.of(context).size.width,
  2408. color: AppColors.BackgroundColor,
  2409. child: SingleChildScrollView(
  2410. child: _buildBody(),
  2411. ),
  2412. )))),
  2413. );
  2414. return CustomUI.buildPageLoading(context, content, !isLoadingFish);
  2415. }
  2416. //连麦
  2417. onAudio() async {
  2418. testChatPermission(() async {
  2419. if (userInfo.chatStatus == 0) {
  2420. showToast(I18n.of(context).cantt_voice);
  2421. return;
  2422. }
  2423. if (BlacklistMgr.isBlack(userInfo.userId)) {
  2424. return;
  2425. }
  2426. //对方关闭陌生人消息,则提示
  2427. if (!userInfo.isCanStrangerNews) {
  2428. showToast(I18n.of(context).stranger_close_tips);
  2429. return;
  2430. }
  2431. if (await CustomUI.showPermissionSetting(context,
  2432. PermissionGroup.microphone, I18n.of(context).video_permission)) {
  2433. AppNavigator.pushAudioChatPage(context, userInfo);
  2434. } else {
  2435. showToast(I18n.of(context).need_record);
  2436. }
  2437. });
  2438. }
  2439. }