Hibok
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

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