Hibok
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

2709 řádky
99 KiB

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