Hibok
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2683 lines
97 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/home/rich_title.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/photo/entity/options.dart';
  11. import 'package:chat/photo/photo.dart';
  12. import 'package:chat/utils/ChargeMoney.dart';
  13. import 'package:chat/utils/app_navigator.dart';
  14. import 'package:chat/utils/blacklist_mgr.dart';
  15. import 'package:chat/utils/conversation_table.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:oktoast/oktoast.dart';
  42. import 'package:permission_handler/permission_handler.dart';
  43. import 'package:photo_manager/photo_manager.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. class ProfilePage extends StatefulWidget {
  63. @required
  64. final userId;
  65. final int fromWhere;
  66. final int addMode;
  67. final int applyId; //好友申请id
  68. ProfilePage(
  69. {Key key,
  70. this.userId,
  71. this.fromWhere,
  72. this.addMode = 0,
  73. this.applyId = 0})
  74. : super(key: key);
  75. _ProfilePageState createState() => _ProfilePageState();
  76. }
  77. class _ProfilePageState extends State<ProfilePage>
  78. with TickerProviderStateMixin {
  79. static const Separate_Size = 10.0;
  80. GlobalKey<ScaffoldState> registKey = new GlobalKey();
  81. UserInfo userInfo = new UserInfo();
  82. TextEditingController nickNameController = new TextEditingController();
  83. // AnimationController animationController;
  84. // Animation movement;
  85. bool isMyself = false;
  86. List imgList = [];
  87. bool isCanWatch = false;
  88. bool isMan = true;
  89. bool isAttestation = false;
  90. bool isBuyPicture = false;
  91. bool isVip = false;
  92. bool isSvip = false;
  93. bool isApplying = false; //是否申请中
  94. //约会节目
  95. String dateItem = '';
  96. //期待对象
  97. String lovePeople = '';
  98. //约会范围
  99. String dateRange = '';
  100. //生日
  101. String birthday = '';
  102. //身高数据
  103. String heightStr = '';
  104. //体重数据
  105. String weightStr = '';
  106. //个人介绍
  107. String myMsg = '';
  108. Map wealthData = {
  109. 'CoinValue': 0,
  110. 'IsMember': 0,
  111. };
  112. int myselfImg = 0;
  113. String endTime = '';
  114. bool isLoadingFish = false;
  115. String firstDyImg = ''; //第一条动态的图片
  116. int programId = 0; //是否有一条活跃的节目
  117. bool isblack = false;
  118. bool isAuthority = false; //是否有聊天和查看用户资料的权限
  119. getUserInfo({mymsg = ''}) async {
  120. if (mymsg != '' && mymsg != null) {
  121. UserData().basicInfo.ownMsg = mymsg;
  122. }
  123. HttpUtil().getUserInfo(
  124. widget.userId,
  125. (data) async {
  126. print('getUserInfo $data');
  127. if (isMyself) {
  128. saveLocalData(data);
  129. }
  130. userInfo = UserInfo.fromJson(data);
  131. initValues();
  132. isLoadingFish = true;
  133. showMyMsgDialog();
  134. if (mounted) {
  135. setState(() {});
  136. }
  137. },
  138. _buildJoinVip,
  139. () {
  140. if (!isMyself) {
  141. Future.delayed(Duration(milliseconds: 500), () {
  142. Navigator.of(context).pop();
  143. });
  144. }
  145. });
  146. getImg();
  147. if (isMyself) {
  148. HttpUtil().getWealth(context, (data) {
  149. wealthData = data;
  150. endTime = data['MemberEnd'];
  151. if (mounted) {
  152. Provider.of<MoneyChangeProvider>(context)
  153. .initMoney(data['CoinValue']);
  154. Provider.of<VoucherChangeProvider>(context)
  155. .initVoucher(data['Voucher']);
  156. }
  157. });
  158. } else {
  159. // getFirstDy();
  160. // getFirstProgram();
  161. }
  162. }
  163. saveLocalData(data) {
  164. UserData().basicInfo = UserInfo.fromJson(data);
  165. SPUtils.saveString(
  166. Constants.LocalUsrInfo, jsonEncode(UserData().toJson()).toString());
  167. }
  168. initLocalData() async {
  169. if (isMyself && await SPUtils.get(Constants.LocalUsrInfo) != null) {
  170. isLoadingFish = true;
  171. userInfo = UserData().basicInfo;
  172. initValues();
  173. showMyMsgDialog();
  174. }
  175. }
  176. showMyMsgDialog() {
  177. if (!UserData().isFirstTip &&
  178. (UserData().basicInfo.ownMsg == '' ||
  179. UserData().basicInfo.ownMsg == null) &&
  180. UserData().homemainIndex == 4) {
  181. UserData().isFirstTip = true;
  182. CustomUI.buildOneConfirm(
  183. context, I18n.of(context).personal, I18n.of(context).white_now, () {
  184. Navigator.pop(context);
  185. Navigator.of(context).push(
  186. new MaterialPageRoute(
  187. builder: (context) {
  188. return EditPage(
  189. isEditPage: true,
  190. );
  191. },
  192. ),
  193. );
  194. });
  195. }
  196. }
  197. initValues() {
  198. isMan = userInfo.sex == 1;
  199. isAttestation = userInfo.isAttestation == null || userInfo.isAttestation;
  200. isVip = userInfo.isMember > 0;
  201. isSvip = userInfo.isMember == 2;
  202. isCanWatch = userInfo.infoAut == 0 || userInfo.applyStatus == 1;
  203. isApplying = userInfo.applyStatus == 0;
  204. isblack = userInfo.isBlackList;
  205. isBuyPicture =
  206. (isMyself || userInfo.photoAut == 0 || userInfo.payStatus == 1);
  207. dateItem =
  208. userInfo.program == null ? "" : WebData().getProgram(userInfo.program);
  209. lovePeople = userInfo.hopeObject == null
  210. ? ""
  211. : WebData().getLovePeople(userInfo.hopeObject);
  212. dateRange = WebData().getDateRange(userInfo.meetPlace);
  213. birthday = userInfo.birthday == null ? '' : userInfo.birthday;
  214. isAuthority = userInfo.isAuthority ||
  215. (!UserData().isMan() && UserData().basicInfo.isAttestation) ||
  216. userInfo.distince < 200;
  217. myMsg = userInfo.ownMsg;
  218. }
  219. // getFirstDy() async {
  220. // var data = {
  221. // "userId": UserData().basicInfo.userId,
  222. // "visitUserId": widget.userId,
  223. // "type": 2,
  224. // };
  225. // data['sign'] = TokenMgr().getSign(data);
  226. // data['page'] = 1;
  227. // data['rows'] = 1;
  228. // Response res = await HttpUtil().post('station/gain/program', data: data);
  229. // var resData = res.data;
  230. // if (resData['code'] == 0 && resData['data'] != null) {
  231. // var imgUrl = resData['data'][0]['ImgUrl'];
  232. // if (imgUrl != '') {
  233. // firstDyImg = imgUrl.split('|')[0];
  234. // if (mounted) {
  235. // setState(() {});
  236. // }
  237. // }
  238. // }
  239. // }
  240. // getFirstProgram() async {
  241. // var data = {
  242. // "userId": UserData().basicInfo.userId,
  243. // "visitUserId": widget.userId,
  244. // //"type": 1,
  245. // };
  246. // data['sign'] = TokenMgr().getSign(data);
  247. // data['page'] = 1;
  248. // data['rows'] = 1;
  249. // Response res = await HttpUtil().post('station/gain/program', data: data);
  250. // var resData = res.data;
  251. // if (resData['code'] == 0 &&
  252. // resData['data'] != null &&
  253. // resData['data'][0]['Status'] == 0) {
  254. // if (mounted) {
  255. // setState(() {
  256. // programId = resData['data'][0]['Id'];
  257. // });
  258. // }
  259. // }
  260. // }
  261. @override
  262. void initState() {
  263. super.initState();
  264. print('ProfilePage initState');
  265. isMyself = widget.userId == UserData().basicInfo.userId;
  266. messageOn();
  267. initLocalData();
  268. getUserInfo();
  269. initAnimation();
  270. }
  271. initAnimation() {
  272. // animationController = AnimationController(
  273. // duration: Duration(milliseconds: 600),
  274. // vsync: this,
  275. // );
  276. // movement =
  277. // Tween(begin: EdgeInsets.only(right: 0), end: EdgeInsets.only(right: 10))
  278. // .animate(animationController)
  279. // ..addListener(() {
  280. // setState(() {});
  281. // });
  282. // animationController.repeat();
  283. }
  284. void initMyController() {}
  285. void _buildJoinVip() {
  286. isLoadingFish = true;
  287. CustomUI.buildOneConfirm(
  288. context, I18n.of(context).only_see, I18n.of(context).joinvip, () {
  289. Navigator.of(context).push(
  290. new MaterialPageRoute(
  291. builder: (context) {
  292. return VipPage();
  293. },
  294. ),
  295. );
  296. }, failcallbak: () {
  297. Navigator.of(context).pop();
  298. });
  299. }
  300. msgBuyVip(data) {
  301. HttpUtil().getWealth(context, (data) {
  302. wealthData = data;
  303. endTime = data['MemberEnd'];
  304. if (mounted) {
  305. Provider.of<MoneyChangeProvider>(context).initMoney(data['CoinValue']);
  306. }
  307. });
  308. }
  309. msgRefreshPhoto(data) {
  310. getImg();
  311. }
  312. msgUpdateData(data) {
  313. print('msgUpdateData $data');
  314. getUserInfo(mymsg: data);
  315. }
  316. msgInformSucess(data) {
  317. if (!isMyself)
  318. CustomUI.buildOneConfirm(
  319. context, I18n.of(context).waiting_results, I18n.of(context).ok, () {
  320. Navigator.of(context).pop();
  321. });
  322. }
  323. msgListDelete(data) {
  324. if (userInfo.dynamicNum > 0) {
  325. if (mounted) {
  326. setState(() {
  327. userInfo.dynamicNum--;
  328. });
  329. }
  330. }
  331. }
  332. void messageOn() {
  333. MessageMgr().on('inform_sucess', msgInformSucess);
  334. MessageMgr().on('refresh_money', msgBuyVip);
  335. MessageMgr().on('refresh_photo', msgRefreshPhoto);
  336. MessageMgr().on('update_data', msgUpdateData);
  337. MessageMgr().on('delete_program', msgListDelete);
  338. MessageMgr().on('post_add_friend', msgAddFriend);
  339. MessageMgr().on('refresh_love_list', msgRefreshLoveList);
  340. MessageMgr().on('refresh_fans_num', msgRefreshFansNum);
  341. }
  342. void messageOff() {
  343. MessageMgr().off('inform_sucess', msgInformSucess);
  344. MessageMgr().off('refresh_money', msgBuyVip);
  345. MessageMgr().off('refresh_photo', msgRefreshPhoto);
  346. MessageMgr().off('update_data', msgUpdateData);
  347. MessageMgr().off('delete_program', msgListDelete);
  348. MessageMgr().off('post_add_friend', msgAddFriend);
  349. MessageMgr().off('refresh_love_list', msgRefreshLoveList);
  350. MessageMgr().off('refresh_fans_num', msgRefreshFansNum);
  351. }
  352. msgRefreshFansNum(data) {
  353. setState(() {
  354. if (data['UserId'] == userInfo.userId && userInfo.fans < data['nums']) {
  355. userInfo.fans = data['nums'];
  356. }
  357. });
  358. }
  359. msgRefreshLoveList(data) {
  360. setState(() {
  361. if (data['flag'] == 0) {
  362. isMyself ? userInfo.followNum++ : userInfo.fans++;
  363. } else {
  364. isMyself ? userInfo.followNum-- : userInfo.fans--;
  365. }
  366. });
  367. }
  368. msgAddFriend(data) {
  369. setState(() {
  370. userInfo.isAddFriends = 0;
  371. });
  372. }
  373. @override
  374. void dispose() {
  375. messageOff();
  376. registKey = null;
  377. //animationController?.dispose();
  378. nickNameController.dispose();
  379. super.dispose();
  380. }
  381. void getImg() async {
  382. var data = {
  383. "visitUserId": UserData().basicInfo.userId,
  384. "userId": widget.userId,
  385. };
  386. data['sign'] = TokenMgr().getSign(data);
  387. Response res = await HttpUtil().post('user/personal/album', data: data);
  388. Map resData = res.data;
  389. if (resData['code'] == 0) {
  390. imgList = resData['data'] == null ? [] : resData['data'];
  391. if (isMyself) {
  392. UserData().picNum = 0;
  393. for (int i = 0; i < imgList.length; i++) {
  394. if (imgList[i]['Status'] == 1) {
  395. UserData().picNum++;
  396. }
  397. if (imgList[i]['Status'] == 0 || imgList[i]['Status'] == 2) {
  398. UserData().haveReview = true;
  399. }
  400. }
  401. }
  402. if (mounted) {
  403. setState(() {});
  404. }
  405. }
  406. }
  407. //上传相册
  408. void _uploadPhoto() async {
  409. // if (await CustomUI.showPhotoPermissionSetting(context)) {
  410. // var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  411. // if (tempFile != null) {
  412. // //选择焚烧
  413. // Navigator.of(context).push(
  414. // new MaterialPageRoute(
  415. // builder: (context) {
  416. // return UploadPicture(
  417. // img: tempFile,
  418. // );
  419. // },
  420. // ),
  421. // );
  422. // }
  423. // }
  424. var photos = await PhotoPicker.pickAsset(
  425. context: context,
  426. themeColor: Color(0xFFF0F0F0),
  427. textColor: Color(0xFF3F3F3F),
  428. pickType: PickType.onlyImage);
  429. if (photos != null && photos.length > 0) {
  430. List<File> fileList = [];
  431. for (var i = 0; i < photos.length; i++) {
  432. AssetEntity photoEntity = photos[i];
  433. fileList.add(await photoEntity.file);
  434. }
  435. Map data = {"type": 2, "userId": UserData().basicInfo.userId};
  436. data['sign'] = TokenMgr().getSign(data);
  437. data['sex'] = UserData().basicInfo.sex;
  438. data['isBurn'] = 0;
  439. Response res = await HttpUtil().uploadFiles(
  440. fileList, data, 'upload/post/postfiles', 'image',
  441. isShowLoading: true);
  442. var resData = res.data;
  443. if (resData['code'] == 0) {
  444. if (resData['data']['msg'] != '' && resData['data']['msg'] != null) {
  445. showToast(resData['data']['msg']);
  446. }
  447. resData['Type'] = 0;
  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. ))
  1117. .toList();
  1118. var list = imgList.map((data) {
  1119. var width = MediaQuery.of(context).size.width / 4 - 15;
  1120. bool isWatch = data['IsCheck'] == 1;
  1121. double raduis = 10;
  1122. return CustomUI.buildImgCover(data['Id'], pisc, data['ImgUrl'], width,
  1123. raduis, isWatch, context, data['Type'],
  1124. isMyself: isMyself,
  1125. payStatus: data['PayStatus'],
  1126. state: isMan ? 1 : data['Status']);
  1127. }).toList();
  1128. if (!isBuyPicture && list.length > 4) {
  1129. list.length = 4;
  1130. }
  1131. TitleItem title;
  1132. if (!isMan) {
  1133. title = UserData().isVip
  1134. ? TitleItem(
  1135. title: I18n.of(context).unlock_user,
  1136. name: Provider.of<RefNameProvider>(context)
  1137. .getRefName(userInfo.userId, userInfo.nickName),
  1138. )
  1139. : TitleItem(
  1140. title: I18n.of(context).free_unlock,
  1141. name: userInfo.price.toString() + I18n.of(context).mask_coin);
  1142. } else {
  1143. title = TitleItem(
  1144. title: I18n.of(context).pay_unlock, name: userInfo.price.toString());
  1145. }
  1146. //我的相册
  1147. return Container(
  1148. alignment: Alignment.center,
  1149. margin: EdgeInsets.only(top: Separate_Size),
  1150. padding: EdgeInsets.symmetric(horizontal: 10),
  1151. width: isMyself ? Screen.width : cardWidth,
  1152. child: Column(
  1153. crossAxisAlignment: CrossAxisAlignment.start,
  1154. children: <Widget>[
  1155. FullWidthButton(
  1156. title: (isMyself
  1157. ? I18n.of(context).my_album
  1158. : (isMan
  1159. ? I18n.of(context).his_photo
  1160. : I18n.of(context).her_photo)),
  1161. //+'(${I18n.of(context).visit_you.replaceFirst('/s1', userInfo.accessNum.toString())})',
  1162. description: isMyself ? I18n.of(context).upload : '',
  1163. descriptionColor: Constants.BlueTextColor,
  1164. showDivider: true,
  1165. showRightIcon: false,
  1166. onPressed: isMyself ? _uploadPhoto : () {},
  1167. ),
  1168. list.length == 0
  1169. ? (isMyself
  1170. ? InkWell(
  1171. onTap: _uploadPhoto,
  1172. child: Container(
  1173. height: 100,
  1174. alignment: Alignment.center,
  1175. child: Column(
  1176. mainAxisAlignment: MainAxisAlignment.center,
  1177. children: <Widget>[
  1178. Text(I18n.of(context).first_photo,
  1179. textScaleFactor: 1.0),
  1180. Text(
  1181. isMan
  1182. ? I18n.of(context).have_picture
  1183. : I18n.of(context).no_photo,
  1184. textScaleFactor: 1.0,
  1185. style: TextStyle(
  1186. fontSize: 12, color: Colors.grey))
  1187. ],
  1188. )))
  1189. : Container(
  1190. alignment: Alignment.center,
  1191. height: 120,
  1192. child: Text(
  1193. isMan
  1194. ? I18n.of(context).not_up_man
  1195. : I18n.of(context).not_up_women,
  1196. textScaleFactor: 1.0,
  1197. style: TextStyle(fontSize: 14),
  1198. ),
  1199. ))
  1200. : (isBuyPicture
  1201. ? Container(
  1202. //alignment: Alignment.center,
  1203. child: Wrap(
  1204. crossAxisAlignment: WrapCrossAlignment.start,
  1205. children: list,
  1206. ))
  1207. : Container(
  1208. alignment: Alignment.center,
  1209. child: Stack(
  1210. //alignment: Alignment.center,
  1211. children: <Widget>[
  1212. Wrap(
  1213. crossAxisAlignment: WrapCrossAlignment.start,
  1214. children: list,
  1215. ),
  1216. Opacity(
  1217. opacity: 0.96,
  1218. child: Container(
  1219. decoration: BoxDecoration(color: Colors.white),
  1220. height: 200,
  1221. ),
  1222. ),
  1223. Container(
  1224. height: 200,
  1225. alignment: Alignment.center,
  1226. child: Column(
  1227. mainAxisAlignment: MainAxisAlignment.center,
  1228. children: <Widget>[
  1229. Image.asset(
  1230. 'assets/images/suo.png',
  1231. width: 35,
  1232. color: Colors.grey[700],
  1233. ),
  1234. Container(
  1235. margin: EdgeInsets.only(top: 10),
  1236. alignment: Alignment.center,
  1237. child: Text(
  1238. isMan
  1239. ? I18n.of(context).set_lock
  1240. : I18n.of(context).set_lock2,
  1241. textScaleFactor: 1.0,
  1242. style: TextStyle(
  1243. color: Colors.grey[700],
  1244. fontSize: 15),
  1245. ),
  1246. ),
  1247. Container(
  1248. margin: EdgeInsets.only(top: 8),
  1249. alignment: Alignment.center,
  1250. child: RichText(
  1251. text: TextSpan(
  1252. children: RichTitle.getRichText(title,
  1253. titleStyle: TextStyle(
  1254. color: Colors.grey[700],
  1255. fontSize: 13),
  1256. nameStyle: TextStyle(
  1257. color: Colors.red,
  1258. fontSize: 13))),
  1259. ),
  1260. ),
  1261. InkWell(
  1262. onTap: buyPhoto,
  1263. child: Container(
  1264. margin: EdgeInsets.only(top: 10),
  1265. padding:
  1266. EdgeInsets.only(top: 6, bottom: 6),
  1267. width: 100,
  1268. alignment: Alignment.center,
  1269. decoration: Constants
  1270. .ConfirmBUttonBoxDecoration,
  1271. child: Text(
  1272. I18n.of(context).unlock,
  1273. textScaleFactor: 1.0,
  1274. style: TextStyle(color: Colors.white),
  1275. ),
  1276. )),
  1277. ],
  1278. ))
  1279. ],
  1280. ))),
  1281. !isMan && isMyself
  1282. ? InkWell(
  1283. onTap: () {
  1284. if (!userInfo.isAttestation) {
  1285. _buildNotTrue();
  1286. return;
  1287. }
  1288. if (imgList.length == 0) {
  1289. showToast(I18n.of(context).no_photos);
  1290. return;
  1291. }
  1292. Navigator.of(context)
  1293. .push(new MaterialPageRoute(builder: (context) {
  1294. return MoneyPicture(
  1295. imageList: imgList,
  1296. );
  1297. }));
  1298. },
  1299. child: Container(
  1300. alignment: Alignment.centerRight,
  1301. // decoration: BoxDecoration(
  1302. // border:
  1303. // Border(top: BorderSide(color: Colors.grey[50]))),
  1304. margin: EdgeInsets.only(top: 10, right: 10, bottom: 10),
  1305. padding: EdgeInsets.only(top: 10),
  1306. child: Text(
  1307. I18n.of(context).set_photo,
  1308. textScaleFactor: 1.0,
  1309. style: TextStyle(color: Colors.red),
  1310. ),
  1311. ))
  1312. : Container(),
  1313. _buildRset(),
  1314. ],
  1315. ),
  1316. decoration: BoxDecoration(
  1317. color: Colors.white,
  1318. border: Border(
  1319. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1320. );
  1321. }
  1322. void _buildNotTrue() {
  1323. CustomUI.buildOneConfirm(context, I18n.of(context).moneyPageTip,
  1324. I18n.of(context).authenticate_now, () {
  1325. Navigator.pop(context);
  1326. Navigator.of(context).push(
  1327. new MaterialPageRoute(
  1328. builder: (context) {
  1329. return VerificationCenterPage();
  1330. },
  1331. ),
  1332. );
  1333. });
  1334. }
  1335. void _buildConfirmBlack() {
  1336. Navigator.of(context).pop();
  1337. CustomUI.buildOneConfirm(
  1338. context, I18n.of(context).blacklist_choose, I18n.of(context).determine,
  1339. () async {
  1340. Navigator.pop(context);
  1341. HttpUtil().blackUser(userInfo.userId, () {
  1342. isblack = true;
  1343. });
  1344. });
  1345. }
  1346. void _sendMySelfPicture() async {
  1347. if (await CustomUI.showPhotoPermissionSetting(context)) {
  1348. var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  1349. if (tempFile != null) {
  1350. Map data = {"type": 6, "userId": UserData().basicInfo.userId};
  1351. data['sign'] = TokenMgr().getSign(data);
  1352. data['isBurn'] = 1;
  1353. Response res = await HttpUtil().uploadFile(
  1354. tempFile, data, 'upload/file/postflie', 'image',
  1355. isShowLoading: true);
  1356. var resData = res.data;
  1357. if (resData['code'] == 0) {
  1358. showToast(I18n.of(context).successfully_submit);
  1359. myselfImg = resData['data']['photoId'];
  1360. Navigator.of(context).pop();
  1361. _postApply();
  1362. }
  1363. }
  1364. }
  1365. }
  1366. void _postApply() async {
  1367. Map data = {
  1368. "userId": userInfo.userId,
  1369. "imgUrl": myselfImg,
  1370. "applyUserId": UserData().basicInfo.userId
  1371. };
  1372. data['sign'] = TokenMgr().getSign(data);
  1373. Response res = await HttpUtil()
  1374. .post('user/apply/checkcords', data: data, isShowLoading: true);
  1375. Map resData = res.data;
  1376. if (resData['code'] == 0) {
  1377. isApplying = true;
  1378. setState(() {});
  1379. }
  1380. }
  1381. Widget _buildBody() {
  1382. Widget hidden = Container(
  1383. alignment: Alignment.center,
  1384. width: Screen.width,
  1385. height: Screen.height - 372,
  1386. color: Colors.white,
  1387. margin: EdgeInsets.only(top: 10),
  1388. child: Column(
  1389. mainAxisAlignment: MainAxisAlignment.center,
  1390. children: <Widget>[
  1391. Container(
  1392. margin: EdgeInsets.only(bottom: 10),
  1393. child: Image.asset('assets/images/login/lock.png',
  1394. height: 45, width: 45),
  1395. ),
  1396. Text(
  1397. isMan ? I18n.of(context).view_user : I18n.of(context).view_user2,
  1398. textScaleFactor: 1.0,
  1399. textAlign: TextAlign.center,
  1400. style: TextStyle(color: Constants.GreyTextColor, fontSize: 13.5),
  1401. ),
  1402. InkWell(
  1403. onTap: isApplying
  1404. ? null
  1405. : () async {
  1406. CustomUI.buildOneConfirm(
  1407. context,
  1408. I18n.of(context).need_photo,
  1409. I18n.of(context).choose_photo,
  1410. _sendMySelfPicture);
  1411. },
  1412. child: Container(
  1413. margin: EdgeInsets.only(top: 10, left: 100, right: 100),
  1414. padding: EdgeInsets.only(top: 10, bottom: 10),
  1415. alignment: Alignment.center,
  1416. decoration: BoxDecoration(
  1417. color: Constants.ConfrimButtonColor,
  1418. borderRadius: BorderRadius.all(
  1419. Radius.circular(Constants.LittleButtonRadius))),
  1420. child: Text(
  1421. isApplying
  1422. ? I18n.of(context).already_applied
  1423. : I18n.of(context).apply_now,
  1424. textScaleFactor: 1.0,
  1425. style: TextStyle(color: Colors.white),
  1426. ),
  1427. )),
  1428. ],
  1429. ),
  1430. );
  1431. List<Widget> child = [];
  1432. if (isMyself) {
  1433. child.addAll([
  1434. _buildHeadView(),
  1435. _buildGoldnessHot(),
  1436. _buildMoneyBox(),
  1437. _buildMyPicture(),
  1438. _buildTips(),
  1439. _buildHistory(),
  1440. //_buildApplyCode(),
  1441. _buildShare(),
  1442. ]);
  1443. } else if (isCanWatch) {
  1444. child.addAll([
  1445. _buildHeadView(),
  1446. _buildMyPicture(),
  1447. _buildBasicInfo(),
  1448. _buildBottomTips(),
  1449. ]);
  1450. } else if (userInfo.userId != null) {
  1451. child.addAll([
  1452. _buildHeadView(),
  1453. hidden,
  1454. ]);
  1455. } else {
  1456. child.addAll([
  1457. _buildHeadView(),
  1458. ]);
  1459. }
  1460. return Column(
  1461. children: child,
  1462. );
  1463. }
  1464. _inviteFdBtn() {
  1465. return Container(
  1466. width: Screen.width,
  1467. child: FlatButton(
  1468. child: fixedText(I18n.of(context).add_friends,
  1469. fontSize: 16,
  1470. color: Colors.blueAccent,
  1471. fontWeight: FontWeight.w500),
  1472. onPressed: () async {
  1473. //已经是好友
  1474. if (FriendListMgr().isMyFriend(userInfo.userId)) {
  1475. showToast(I18n.of(context).added);
  1476. return;
  1477. }
  1478. //已申请
  1479. if (userInfo.isAddFriends == 0) {
  1480. showToast(I18n.of(context).add_friends_tips);
  1481. return;
  1482. }
  1483. if (UserData().addFdDistanceSwitch > 0 && userInfo.distince > 200) {
  1484. showToast(I18n.of(context).distance_long);
  1485. return;
  1486. }
  1487. Navigator.of(context).push(
  1488. new MaterialPageRoute(
  1489. builder: (context) {
  1490. return AddFriendPage(
  1491. userId: userInfo.userId,
  1492. pageType: SendMessagePageType.AddFriends,
  1493. originalName: I18n.of(context)
  1494. .i_am
  1495. .replaceFirst('/s1', UserData().basicInfo.nickName),
  1496. );
  1497. },
  1498. ),
  1499. );
  1500. }),
  1501. );
  1502. }
  1503. void doFriendApply(state, callback) async {
  1504. Map data = {
  1505. "id": widget.applyId,
  1506. "userId": UserData().basicInfo.userId,
  1507. "status": state,
  1508. };
  1509. data['sign'] = TokenMgr().getSign(data);
  1510. Response res =
  1511. await HttpUtil().post('friendship/handler/apply', data: data);
  1512. if (res == null) {
  1513. return;
  1514. }
  1515. var resData = res.data;
  1516. if (resData['code'] == 0) {
  1517. callback(resData['msg']);
  1518. } else {}
  1519. }
  1520. _dealInvite() {
  1521. return Container(
  1522. width: Screen.width,
  1523. child: Row(
  1524. children: <Widget>[
  1525. Expanded(
  1526. child: InkWell(
  1527. onTap: () {
  1528. doFriendApply(1, (msg) {
  1529. showToast(msg);
  1530. Navigator.of(context).pop();
  1531. var friendModel = FriendModel.fromServerJson({
  1532. 'UserId': userInfo.userId,
  1533. 'ImgUrl': userInfo.headimgurl,
  1534. 'UserName': userInfo.nickName
  1535. });
  1536. FriendListMgr().addFriend(friendModel);
  1537. MessageMgr().emit('do_friend_apply',
  1538. {'userId': userInfo.userId, 'state': 1});
  1539. MessageMgr().emit('Add friend');
  1540. });
  1541. },
  1542. child: Container(
  1543. color: const Color(0xFF3875E9),
  1544. alignment: Alignment.center,
  1545. child: Text(
  1546. I18n.of(context).agree,
  1547. style: TextStyle(fontSize: 18, color: Colors.white),
  1548. ),
  1549. ),
  1550. )),
  1551. InkWell(
  1552. onTap: () {
  1553. doFriendApply(2, (msg) {
  1554. showToast(msg);
  1555. Navigator.of(context).pop();
  1556. MessageMgr().emit('do_friend_apply',
  1557. {'userId': userInfo.userId, 'state': 2});
  1558. });
  1559. },
  1560. child: Container(
  1561. alignment: Alignment.center,
  1562. color: const Color(0xFFA8D3FF),
  1563. width: Screen.width * 0.33,
  1564. child: Text(
  1565. I18n.of(context).refuse,
  1566. style:
  1567. TextStyle(fontSize: 18, color: const Color(0xFF007EFF)),
  1568. ),
  1569. ))
  1570. ],
  1571. ));
  1572. }
  1573. //自定义item
  1574. Widget _bottomBorderBox(
  1575. String textLeft, String textRight, bool showBorder, callback,
  1576. {showIcon: false}) {
  1577. Widget left = new Container(
  1578. margin: EdgeInsets.only(right: 20),
  1579. width: 90,
  1580. child: new Text(
  1581. textLeft,
  1582. textScaleFactor: 1.0,
  1583. style: TextStyle(fontSize: 14),
  1584. ));
  1585. Widget right = new Expanded(
  1586. child: Text(
  1587. textRight,
  1588. textScaleFactor: 1.0,
  1589. style: TextStyle(fontSize: 13, color: Constants.GreyTextColor),
  1590. ),
  1591. );
  1592. return InkWell(
  1593. highlightColor: Colors.transparent,
  1594. radius: 0.0,
  1595. onTap: callback,
  1596. child: Column(
  1597. children: <Widget>[
  1598. Container(
  1599. height: 53,
  1600. margin: EdgeInsets.only(left: 20, bottom: 0, right: 10),
  1601. child: Row(
  1602. children: <Widget>[
  1603. left,
  1604. right,
  1605. showIcon
  1606. ? Padding(
  1607. padding: EdgeInsets.only(right: 10),
  1608. child: Icon(
  1609. IconData(0xe63c, fontFamily: 'iconfont'),
  1610. size: 22.0,
  1611. color: Color(AppColors.TabIconNormal),
  1612. ))
  1613. : Container()
  1614. ],
  1615. ),
  1616. ),
  1617. showBorder ? _buildDivider() : Container(),
  1618. ],
  1619. ));
  1620. }
  1621. //下划线
  1622. Widget _buildDivider() {
  1623. return new Container(
  1624. margin: EdgeInsets.symmetric(horizontal: 15),
  1625. height: 1,
  1626. decoration:
  1627. BoxDecoration(border: Border(bottom: Constants.GreyBorderSide)),
  1628. width: MediaQuery.of(context).size.width,
  1629. );
  1630. }
  1631. testChatPermission(callback) {
  1632. becomeVip() {
  1633. Navigator.of(context).push(
  1634. new MaterialPageRoute(
  1635. builder: (context) {
  1636. return VipPage();
  1637. },
  1638. ),
  1639. );
  1640. }
  1641. payCallback() {
  1642. if (Provider.of<MoneyChangeProvider>(context).money <
  1643. UserData().accountPrice) {
  1644. Navigator.of(context).pop();
  1645. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1646. I18n.of(context).recharge, () {
  1647. Navigator.of(context).pop();
  1648. ChargeMoney.showChargeSheet(context, () {
  1649. setState(() {});
  1650. });
  1651. });
  1652. return;
  1653. }
  1654. Navigator.of(context).pop();
  1655. HttpUtil().buyChatAccount(
  1656. UserData().accountPrice, userInfo.userId, context, () {
  1657. setState(() {
  1658. isAuthority = true;
  1659. });
  1660. });
  1661. }
  1662. freeTime() {
  1663. HttpUtil().userFreeTime(context, userInfo.userId, 2, () {
  1664. UserData().basicInfo.usedNum++;
  1665. Navigator.of(context).pop();
  1666. setState(() {
  1667. isAuthority = true;
  1668. });
  1669. });
  1670. }
  1671. // //对方是女性用户,且未认证提示未认证
  1672. // if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1673. // showToast(I18n.of(context).not_video);
  1674. // return;
  1675. // }
  1676. //自己是女性,且未认证,提示去认证
  1677. if (!UserData().isMan() && !UserData().basicInfo.isAttestation) {
  1678. CustomUI.buildNotTrue(context);
  1679. return;
  1680. }
  1681. print('isAuthority $isAuthority');
  1682. var tipStr = '';
  1683. //没有解锁账号,并且对方禁止陌生人聊天
  1684. if (!isAuthority && !userInfo.isCanStrangerNews) {
  1685. tipStr = I18n.of(context).stranger_close;
  1686. } else {
  1687. tipStr = I18n.of(context).unlock_information;
  1688. if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1689. tipStr += '(${I18n.of(context).not_true_woman})';
  1690. }
  1691. }
  1692. if (isAuthority) {
  1693. if (callback != null) callback();
  1694. } else {
  1695. //如果自己是男性,vip提示免费次数,次数用完或者非vip提示购买
  1696. if (UserData().isMan()) {
  1697. if (UserData().isVip) {
  1698. UserData().basicInfo.freeNum < UserData().basicInfo.usedNum
  1699. ? CustomUI.buildOneConfirm(
  1700. context,
  1701. tipStr,
  1702. I18n.of(context)
  1703. .pay_unlock
  1704. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1705. payCallback)
  1706. : CustomUI.buildOneConfirm(
  1707. context,
  1708. tipStr,
  1709. I18n.of(context).unlock_choose,
  1710. freeTime,
  1711. );
  1712. } else {
  1713. CustomUI.buildTowConfirm(
  1714. context,
  1715. tipStr,
  1716. I18n.of(context).become_member,
  1717. becomeVip,
  1718. I18n.of(context)
  1719. .pay_unlock
  1720. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1721. payCallback);
  1722. }
  1723. }
  1724. }
  1725. }
  1726. buyChatAccount() {
  1727. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1728. ///如果是聊天界面跳转过来的,直接返回
  1729. Navigator.of(context).pop();
  1730. } else {
  1731. testChatPermission(() {
  1732. int fdId = userInfo.userId;
  1733. int sessionId = UserData().getSessionId(fdId);
  1734. MsgHandler.updateActiveSesstion(sessionId);
  1735. AppNavigator.pushChatPage(context, fdId);
  1736. });
  1737. }
  1738. }
  1739. buyPhoto() {
  1740. //女性用户付费,男性用户会员的话免费解锁,非会员付费解锁
  1741. becomeVip() {
  1742. Navigator.of(context).push(
  1743. new MaterialPageRoute(
  1744. builder: (context) {
  1745. return VipPage();
  1746. },
  1747. ),
  1748. );
  1749. }
  1750. payCallback() {
  1751. if (Provider.of<MoneyChangeProvider>(context).money < userInfo.price) {
  1752. Navigator.of(context).pop();
  1753. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1754. I18n.of(context).recharge, () {
  1755. Navigator.of(context).pop();
  1756. ChargeMoney.showChargeSheet(context, () {
  1757. setState(() {});
  1758. });
  1759. });
  1760. return;
  1761. }
  1762. Navigator.of(context).pop();
  1763. HttpUtil().buyPictures(userInfo.price, userInfo.userId, context, () {
  1764. setState(() {
  1765. isBuyPicture = true;
  1766. });
  1767. });
  1768. }
  1769. freeTime() {
  1770. HttpUtil().userFreeTime(context, userInfo.userId, 1, () {
  1771. UserData().basicInfo.usedNum++;
  1772. Navigator.of(context).pop();
  1773. setState(() {
  1774. isBuyPicture = true;
  1775. });
  1776. });
  1777. }
  1778. String title = I18n.of(context).unlock_user.replaceFirst(
  1779. '/s1',
  1780. Provider.of<RefNameProvider>(context)
  1781. .getRefName(userInfo.userId, userInfo.nickName),
  1782. );
  1783. if (!UserData().isMan()) {
  1784. CustomUI.buildOneConfirm(
  1785. context,
  1786. title,
  1787. I18n.of(context)
  1788. .pay_unlock
  1789. .replaceFirst('/s1', userInfo.price.toString()),
  1790. payCallback);
  1791. } else if (UserData().isVip) {
  1792. if (UserData().basicInfo.freeNum < UserData().basicInfo.usedNum) {
  1793. CustomUI.buildOneConfirm(
  1794. context,
  1795. title,
  1796. I18n.of(context)
  1797. .pay_unlock
  1798. .replaceFirst('/s1', userInfo.price.toString()),
  1799. payCallback);
  1800. } else {
  1801. CustomUI.buildOneConfirm(
  1802. context, title, I18n.of(context).unlock_choose, freeTime);
  1803. }
  1804. } else {
  1805. CustomUI.buildTowConfirm(
  1806. context,
  1807. title,
  1808. I18n.of(context).become_member,
  1809. becomeVip,
  1810. I18n.of(context)
  1811. .pay_unlock
  1812. .replaceFirst('/s1', userInfo.price.toString()),
  1813. payCallback);
  1814. }
  1815. }
  1816. Widget _buildBasicInfo() {
  1817. String wechat = '';
  1818. String facebook = '';
  1819. bool isHidden = userInfo.accountStatus == 1;
  1820. //隐藏社交账号
  1821. if (isHidden) {
  1822. wechat = I18n.of(context).ask_me;
  1823. facebook = I18n.of(context).ask_me;
  1824. } else {
  1825. wechat = isAuthority ? userInfo.wechat : I18n.of(context).filled_in;
  1826. facebook = isAuthority ? userInfo.facebook : I18n.of(context).filled_in;
  1827. }
  1828. heightStr = (userInfo.height == 0.0 || userInfo.height == null)
  1829. ? I18n.of(context).not_show
  1830. : '${userInfo.height}M';
  1831. weightStr = (userInfo.weight == 0.0 || userInfo.weight == null)
  1832. ? I18n.of(context).not_show
  1833. : '${userInfo.weight}KG';
  1834. List<Widget> basicList = [
  1835. userInfo.height != null && userInfo.height != 0
  1836. ? _bottomBorderBox(I18n.of(context).height, heightStr, true, () {})
  1837. : Container(),
  1838. userInfo.weight != null && userInfo.weight != 0
  1839. ? _bottomBorderBox(I18n.of(context).weight, weightStr, true, () {})
  1840. : Container(),
  1841. _bottomBorderBox(I18n.of(context).Resident_city, dateRange, true, () {}),
  1842. //_bottomBorderBox(I18n.of(context).program, dateItem, true, () {}),
  1843. _bottomBorderBox(I18n.of(context).expect_lover, lovePeople, true, () {}),
  1844. (userInfo.wechat != null && userInfo.wechat != '')
  1845. ? _bottomBorderBox(
  1846. I18n.of(context).wechat_number, wechat, true, buyChatAccount,
  1847. showIcon: !isAuthority)
  1848. : Container(),
  1849. (userInfo.facebook != null && userInfo.facebook != '')
  1850. ? _bottomBorderBox(
  1851. I18n.of(context).facebook, facebook, true, buyChatAccount,
  1852. showIcon: !isAuthority)
  1853. : Container(),
  1854. userInfo.ownMsg != null && userInfo.ownMsg != ''
  1855. ? _bottomBorderBox(
  1856. I18n.of(context).self_introduction, myMsg, false, () {})
  1857. : Container(),
  1858. ];
  1859. return Container(
  1860. width: cardWidth,
  1861. margin: EdgeInsets.only(top: Separate_Size),
  1862. decoration: BoxDecoration(
  1863. color: Colors.white,
  1864. border: Border(
  1865. top: Constants.GreyBorderSide,
  1866. bottom: Constants.GreyBorderSide)),
  1867. child: new Column(
  1868. children: basicList,
  1869. ));
  1870. }
  1871. Widget _buildTips() {
  1872. return Container(
  1873. margin: EdgeInsets.only(top: 10, bottom: 10, left: 20, right: 20),
  1874. child: Text(I18n.of(context).dont,
  1875. textScaleFactor: 1.0,
  1876. style: TextStyle(
  1877. fontSize: 12,
  1878. color: Colors.grey,
  1879. )));
  1880. }
  1881. Widget _buildBottomTips() {
  1882. return Container(
  1883. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 10),
  1884. width: cardWidth,
  1885. alignment: Alignment.center,
  1886. child: Text(I18n.of(context).not_illage,
  1887. textScaleFactor: 1.0,
  1888. textAlign: TextAlign.center,
  1889. style: TextStyle(fontSize: 12, color: Colors.grey)),
  1890. );
  1891. }
  1892. Widget _buildGoldnessHot() {
  1893. //女神热度
  1894. return isMan
  1895. ? Container()
  1896. : Container(
  1897. margin: EdgeInsets.only(top: Separate_Size),
  1898. padding: EdgeInsets.symmetric(horizontal: 10),
  1899. child: FullWidthButton(
  1900. title: I18n.of(context).Goddess_heat,
  1901. showDivider: false,
  1902. showRightIcon: true,
  1903. onPressed: () {
  1904. Navigator.of(context).push(
  1905. new MaterialPageRoute(
  1906. builder: (context) {
  1907. return GoddessHotPage(
  1908. userId: userInfo.userId,
  1909. );
  1910. },
  1911. ),
  1912. );
  1913. },
  1914. ),
  1915. decoration: BoxDecoration(
  1916. color: Colors.white,
  1917. border: Border(
  1918. top: Constants.GreyBorderSide,
  1919. bottom: Constants.GreyBorderSide)),
  1920. );
  1921. }
  1922. Widget _buildMoneyBox() {
  1923. //认证、钱包、隐私连麦设置
  1924. return Container(
  1925. margin: EdgeInsets.only(top: Separate_Size),
  1926. decoration: BoxDecoration(
  1927. color: Colors.white,
  1928. border: Border(
  1929. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1930. padding: EdgeInsets.all(10),
  1931. child: Column(
  1932. children: <Widget>[
  1933. isMan
  1934. ? FullWidthButton(
  1935. title: I18n.of(context).member,
  1936. description: UserData().isVip
  1937. ? I18n.of(context)
  1938. .expires
  1939. .replaceFirst('/s1', endTime.split(' ')[0])
  1940. : I18n.of(context).enjoy_privileges,
  1941. showDivider: true,
  1942. onPressed: () {
  1943. Navigator.of(context).push(
  1944. new MaterialPageRoute(
  1945. builder: (context) {
  1946. return VipPage();
  1947. },
  1948. ),
  1949. );
  1950. },
  1951. )
  1952. : FullWidthButton(
  1953. title: isAttestation
  1954. ? I18n.of(context).certified_video
  1955. : I18n.of(context).authenticate,
  1956. showDivider: true,
  1957. onPressed: () {
  1958. Navigator.of(context).push(
  1959. new MaterialPageRoute(
  1960. builder: (context) {
  1961. return isAttestation
  1962. ? VideoPage(
  1963. userId: userInfo.userId,
  1964. )
  1965. : VerificationCenterPage();
  1966. },
  1967. ),
  1968. );
  1969. },
  1970. ),
  1971. FullWidthButton(
  1972. title: I18n.of(context).wallet,
  1973. description:
  1974. '${Provider.of<MoneyChangeProvider>(context).money}${I18n.of(context).mask_coin}',
  1975. showDivider: false,
  1976. onPressed: () {
  1977. Navigator.of(context).push(
  1978. new MaterialPageRoute(
  1979. builder: (context) {
  1980. return MoneyPage();
  1981. },
  1982. ),
  1983. );
  1984. },
  1985. ),
  1986. ],
  1987. ),
  1988. );
  1989. }
  1990. Widget _buildHistory() {
  1991. //历史访客
  1992. return Container(
  1993. margin: EdgeInsets.only(top: Separate_Size),
  1994. padding: EdgeInsets.symmetric(horizontal: 10),
  1995. child: FullWidthButton(
  1996. title: I18n.of(context).historical_visitor,
  1997. description: I18n.of(context)
  1998. .visit_you
  1999. .replaceFirst('/s1', userInfo.accessNum.toString()),
  2000. showDivider: false,
  2001. showRightIcon: false,
  2002. onPressed: () {},
  2003. ),
  2004. decoration: BoxDecoration(
  2005. color: Colors.white,
  2006. border: Border(
  2007. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  2008. );
  2009. }
  2010. //恢复焚阅照片
  2011. Widget _buildRset() {
  2012. //历史访客
  2013. return isMyself
  2014. ? Container(
  2015. margin: EdgeInsets.only(top: Separate_Size),
  2016. //padding: EdgeInsets.symmetric(horizontal: 10),
  2017. child: FullWidthButton(
  2018. title: I18n.of(context)
  2019. .visit_photo
  2020. .replaceFirst('/s1', userInfo.burnNum.toString()),
  2021. description: I18n.of(context).recovery_photo,
  2022. showDivider: false,
  2023. showRightIcon: false,
  2024. onPressed: () async {
  2025. CustomUI.buildOneConfirm(
  2026. context,
  2027. I18n.of(context).confrim_recovery,
  2028. I18n.of(context).determine, () async {
  2029. Map data = {
  2030. "userId": UserData().basicInfo.userId,
  2031. };
  2032. data['sign'] = TokenMgr().getSign(data);
  2033. Response res = await HttpUtil().post('user/recover/photos',
  2034. data: data, isShowLoading: true);
  2035. Map resData = res.data;
  2036. if (resData['code'] == 0) {
  2037. showToast(resData['msg']);
  2038. Navigator.of(context).pop();
  2039. userInfo.burnNum = 0;
  2040. setState(() {});
  2041. }
  2042. });
  2043. },
  2044. ),
  2045. decoration: BoxDecoration(
  2046. color: Colors.white,
  2047. border: Border(top: Constants.GreyBorderSide)),
  2048. )
  2049. : Container();
  2050. }
  2051. // Widget _buildApplyCode() {
  2052. // //帮朋友申请邀请码
  2053. // return isMan
  2054. // ? Container(
  2055. // margin: EdgeInsets.only(top: Separate_Size),
  2056. // padding: EdgeInsets.symmetric(horizontal: 10),
  2057. // child: FullWidthButton(
  2058. // title: I18n.of(context).apply_code,
  2059. // showDivider: false,
  2060. // showRightIcon: false,
  2061. // onPressed: () {
  2062. // CustomUI.buildOneConfirm(context, I18n.of(context).issue_choose,
  2063. // I18n.of(context).determine, () async {
  2064. // Map data = {
  2065. // "userId": UserData().basicInfo.userId,
  2066. // };
  2067. // data['sign'] = TokenMgr().getSign(data);
  2068. // Response res =
  2069. // await HttpUtil().post('user/helper/apply', data: data);
  2070. // Map resData = res.data;
  2071. // if (resData['code'] == 0) {
  2072. // Navigator.of(context).pop();
  2073. // CustomUI.buildOneConfirm(
  2074. // context,
  2075. // I18n.of(context).receive_incode,
  2076. // I18n.of(context).ok, () {
  2077. // Navigator.of(context).pop();
  2078. // });
  2079. // } else {
  2080. // showToast(resData['msg']);
  2081. // }
  2082. // });
  2083. // },
  2084. // ),
  2085. // decoration: BoxDecoration(
  2086. // color: Colors.white,
  2087. // border: Border(
  2088. // top: Constants.GreyBorderSide,
  2089. // bottom: Constants.GreyBorderSide)),
  2090. // )
  2091. // : Container();
  2092. // }
  2093. Widget _buildShare() {
  2094. //分享
  2095. return Container(
  2096. margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size),
  2097. padding: EdgeInsets.symmetric(horizontal: 10),
  2098. child: FullWidthButton(
  2099. showRightIcon: false,
  2100. title: I18n.of(context).share_app,
  2101. showDivider: false,
  2102. onPressed: () {
  2103. Share.share('https://henho.jphgames.com/');
  2104. },
  2105. ),
  2106. decoration: BoxDecoration(
  2107. color: Colors.white,
  2108. border: Border(
  2109. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  2110. );
  2111. }
  2112. Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 28.0}) {
  2113. var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor;
  2114. return InkWell(
  2115. onTap: isCanHit
  2116. ? callback
  2117. : () {
  2118. showToast(isMan
  2119. ? I18n.of(context).view_user
  2120. : I18n.of(context).view_user2);
  2121. },
  2122. child: Row(
  2123. children: <Widget>[
  2124. Icon(
  2125. IconData(
  2126. code,
  2127. fontFamily: 'iconfont',
  2128. ),
  2129. color: color,
  2130. size: iconSize,
  2131. ),
  2132. Padding(
  2133. child: Text(
  2134. str,
  2135. textScaleFactor: 1.0,
  2136. style: TextStyle(color: color, fontSize: 12),
  2137. ),
  2138. padding: EdgeInsets.only(left: 5))
  2139. ],
  2140. ));
  2141. }
  2142. @override
  2143. Widget build(BuildContext context) {
  2144. Size screenSize = MediaQuery.of(context).size;
  2145. cardWidth = screenSize.width;
  2146. Widget appBar = AppBar(
  2147. // backgroundColor: AppColors.NewAppbarBgColor,
  2148. //automaticallyImplyLeading: !isMyself,
  2149. leading: isMyself ? Container() : CustomUI.buildCustomLeading(context),
  2150. titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing,
  2151. title: isMyself
  2152. ? Text(
  2153. I18n.of(context).me,
  2154. textScaleFactor: 1.0,
  2155. style: Constants.MainTitleStyle,
  2156. )
  2157. : Container(
  2158. alignment: Alignment.center,
  2159. child: Row(
  2160. mainAxisAlignment: MainAxisAlignment.center,
  2161. children: <Widget>[
  2162. Text(
  2163. WebData().subUserName(
  2164. Provider.of<RefNameProvider>(context)
  2165. .getRefName(userInfo.userId, userInfo.nickName)),
  2166. textScaleFactor: 1.0,
  2167. style: TextStyle(color: Constants.BlackTextColor)),
  2168. isAttestation && !isMan
  2169. ? Container(
  2170. height: 13,
  2171. margin: EdgeInsets.only(left: 5),
  2172. padding: EdgeInsets.only(left: 5, right: 5),
  2173. alignment: Alignment.center,
  2174. decoration: BoxDecoration(
  2175. borderRadius: BorderRadius.circular(10),
  2176. color: Constants.PurpleBackgroundColor,
  2177. ),
  2178. child: Text(
  2179. 'Real',
  2180. textScaleFactor: 1.0,
  2181. style: TextStyle(fontSize: 10, color: Colors.white),
  2182. ))
  2183. : Text(''),
  2184. isVip && isMan
  2185. ? Container(
  2186. margin: EdgeInsets.only(left: 5),
  2187. child:
  2188. isSvip ? Constants.svipIcon : Constants.vipIcon)
  2189. : Text(''),
  2190. ],
  2191. )),
  2192. centerTitle: !isMyself,
  2193. elevation: 1,
  2194. actions: <Widget>[
  2195. isMyself
  2196. ? Container(
  2197. padding: EdgeInsets.only(right: 15),
  2198. alignment: Alignment.center,
  2199. child: new InkWell(
  2200. child: CircleAvatar(
  2201. backgroundColor: Constants.GreyBackgroundColor,
  2202. radius: 15.75,
  2203. child: Icon(
  2204. IconData(0xe658, fontFamily: 'iconfont'),
  2205. color: Constants.BlackTextColor,
  2206. size: 20,
  2207. )),
  2208. onTap: () {
  2209. AppNavigator.pushQrPage(context);
  2210. },
  2211. ),
  2212. )
  2213. : Container(),
  2214. isMyself
  2215. ? Container(
  2216. padding: EdgeInsets.only(right: 15),
  2217. alignment: Alignment.center,
  2218. child: new InkWell(
  2219. child: CircleAvatar(
  2220. backgroundColor: Constants.GreyBackgroundColor,
  2221. radius: 15.75,
  2222. child: Icon(
  2223. Icons.settings,
  2224. //IconData(0xe6e5, fontFamily: 'iconfont'),
  2225. color: Constants.BlackTextColor,
  2226. size: 22,
  2227. )),
  2228. onTap: () {
  2229. Navigator.of(context).push(
  2230. new MaterialPageRoute(
  2231. builder: (context) {
  2232. return SystemEditPage();
  2233. },
  2234. ),
  2235. );
  2236. },
  2237. ),
  2238. )
  2239. : Container(),
  2240. isMyself
  2241. ? Container(
  2242. // padding: EdgeInsets.only(right: 10),
  2243. // alignment: Alignment.center,
  2244. // child: new InkWell(
  2245. // child: CircleAvatar(
  2246. // backgroundColor: Constants.GreyBackgroundColor,
  2247. // radius: 15.75,
  2248. // child: Icon(
  2249. // IconData(0xe6e5, fontFamily: 'iconfont'),
  2250. // color: Constants.BlackTextColor,
  2251. // size: 25,
  2252. // )),
  2253. // onTap: () {
  2254. // Navigator.of(context).push(
  2255. // new MaterialPageRoute(
  2256. // builder: (context) {
  2257. // return EditPage(isEditPage: true);
  2258. // },
  2259. // ),
  2260. // );
  2261. // },
  2262. // ),
  2263. )
  2264. : Container(
  2265. alignment: Alignment.center,
  2266. child: new InkWell(
  2267. child: new Padding(
  2268. padding: EdgeInsets.only(
  2269. right: 15, left: 15, top: 10, bottom: 10),
  2270. child: Icon(
  2271. IconData(
  2272. 0xe621,
  2273. fontFamily: 'iconfont',
  2274. ),
  2275. color: Constants.BlackTextColor,
  2276. size: 20,
  2277. ),
  2278. ),
  2279. onTap: () {
  2280. showModalBottomSheet(
  2281. context: registKey.currentContext,
  2282. builder: (BuildContext context) {
  2283. return SafeArea(
  2284. child: Container(
  2285. height: 137,
  2286. child: Column(
  2287. children: <Widget>[
  2288. InkWell(
  2289. child: Container(
  2290. height: 45,
  2291. alignment: Alignment.center,
  2292. child: Text(
  2293. isblack
  2294. ? I18n.of(context).remove_blacklist
  2295. : I18n.of(context).blacklist,
  2296. textScaleFactor: 1.0,
  2297. style: TextStyle(
  2298. fontSize: 18,
  2299. color: Constants.BlackTextColor),
  2300. ),
  2301. ),
  2302. onTap: isblack
  2303. ? () async {
  2304. HttpUtil().cancleBlackUser(
  2305. userInfo.userId, () {
  2306. Navigator.of(context).pop();
  2307. isblack = false;
  2308. });
  2309. }
  2310. : _buildConfirmBlack,
  2311. ),
  2312. Divider(height: 1),
  2313. InkWell(
  2314. onTap: () async {
  2315. Navigator.of(context).pop();
  2316. Navigator.of(context).push(
  2317. new MaterialPageRoute(
  2318. builder: (context) {
  2319. return InformUserPage(
  2320. isMan: isMan,
  2321. userId: userInfo.userId,
  2322. );
  2323. },
  2324. ),
  2325. );
  2326. },
  2327. child: Container(
  2328. alignment: Alignment.center,
  2329. height: 45,
  2330. child: Text(
  2331. I18n.of(context).anonymous_report,
  2332. textScaleFactor: 1.0,
  2333. style: TextStyle(
  2334. fontSize: 18,
  2335. color: Constants
  2336. .BlackTextColor)))),
  2337. Divider(height: 1),
  2338. InkWell(
  2339. onTap: () async {
  2340. Navigator.of(context).pop();
  2341. nickNameController.text =
  2342. Provider.of<RefNameProvider>(context)
  2343. .getRefName(userInfo.userId,
  2344. userInfo.nickName);
  2345. var confirm = CustomUI.buildConfirmBotton(
  2346. I18n.of(context).determine, () async {
  2347. nickNameController.text =
  2348. nickNameController.text.trim();
  2349. if (nickNameController.text == null ||
  2350. nickNameController.text.length >
  2351. 25) {
  2352. showToast(I18n.of(context).only1_8);
  2353. return;
  2354. }
  2355. Provider.of<RefNameProvider>(
  2356. registKey.currentContext)
  2357. .changeRefName(userInfo.userId,
  2358. nickNameController.text, () {
  2359. Navigator.of(registKey.currentContext)
  2360. .pop();
  2361. });
  2362. });
  2363. var tip = Column(
  2364. children: <Widget>[
  2365. Container(
  2366. margin: EdgeInsets.only(top: 20),
  2367. child: Text(
  2368. I18n.of(context).setRemark,
  2369. style: TextStyle(
  2370. color:
  2371. Constants.BlackTextColor,
  2372. fontSize: 16),
  2373. ),
  2374. ),
  2375. Container(
  2376. margin: EdgeInsets.only(
  2377. top: 23, bottom: 25),
  2378. decoration: BoxDecoration(
  2379. color: Colors.grey[200],
  2380. borderRadius: BorderRadius.all(
  2381. Radius.circular(8))),
  2382. child: TextField(
  2383. keyboardAppearance:
  2384. Brightness.light,
  2385. controller: nickNameController,
  2386. textAlign: TextAlign.center,
  2387. textInputAction:
  2388. TextInputAction.search,
  2389. style: TextStyle(
  2390. textBaseline:
  2391. TextBaseline.alphabetic,
  2392. fontSize: 14),
  2393. decoration: InputDecoration(
  2394. hintText: userInfo.nickName,
  2395. hintStyle:
  2396. TextStyle(fontSize: 12),
  2397. filled: true,
  2398. contentPadding: EdgeInsets.only(
  2399. top: 10, bottom: 10),
  2400. fillColor: Colors.transparent,
  2401. border: InputBorder.none,
  2402. ),
  2403. maxLines: 1,
  2404. inputFormatters: [
  2405. LengthLimitingTextInputFormatter(
  2406. 15)
  2407. ],
  2408. ),
  2409. )
  2410. ],
  2411. );
  2412. var content =
  2413. CustomUI.buildConfirmContent(
  2414. tip, confirm);
  2415. CustomUI.buildTip(
  2416. registKey.currentContext,
  2417. '',
  2418. content);
  2419. },
  2420. child: Container(
  2421. alignment: Alignment.center,
  2422. height: 45,
  2423. child: Text(I18n.of(context).Remark,
  2424. textScaleFactor: 1.0,
  2425. style: TextStyle(
  2426. fontSize: 18,
  2427. color: Constants
  2428. .BlackTextColor)))),
  2429. ],
  2430. ),
  2431. ),
  2432. );
  2433. },
  2434. ).then((val) {});
  2435. },
  2436. ),
  2437. ),
  2438. ],
  2439. );
  2440. Widget content = Container(
  2441. color: Colors.white,
  2442. child: SafeArea(
  2443. child: Scaffold(
  2444. bottomNavigationBar: !isMyself
  2445. ? Container(
  2446. height: 55,
  2447. decoration: BoxDecoration(
  2448. border:
  2449. Border(top: BorderSide(color: Color(0xffeaeaea))),
  2450. color: Constants.LightGreyBackgroundColor,
  2451. ),
  2452. child: Row(
  2453. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  2454. children: widget.addMode == 1
  2455. ? <Widget>[_inviteFdBtn()]
  2456. : (widget.addMode == 2
  2457. ? [_dealInvite()]
  2458. : <Widget>[
  2459. _buildIcon(
  2460. 0xe633, I18n.of(context).evaluate, true,
  2461. () async {
  2462. Map data = {
  2463. "userid": userInfo.userId,
  2464. 'evaluateuserid':
  2465. UserData().basicInfo.userId,
  2466. };
  2467. data['sign'] = TokenMgr().getSign(data);
  2468. Response res = await HttpUtil().post(
  2469. 'evaluate/user/info',
  2470. data: data,
  2471. isShowLoading: true);
  2472. Map resData = res.data;
  2473. print(resData);
  2474. if (resData['code'] == 0) {
  2475. Navigator.of(context).push(
  2476. TutorialOverlay(
  2477. child: ApplyContent(
  2478. userId: userInfo.userId,
  2479. isMan: isMan,
  2480. userInfo:
  2481. resData['data'])));
  2482. } else {
  2483. showToast(resData['msg']);
  2484. }
  2485. }),
  2486. _buildIcon(
  2487. 0xe637,
  2488. I18n.of(context).private_chat,
  2489. isCanWatch,
  2490. isCanWatch ? buyChatAccount : null,
  2491. iconSize: 24.0),
  2492. _buildIcon(0xe62f, I18n.of(context).chat,
  2493. isCanWatch, onAudio)
  2494. ]),
  2495. ),
  2496. )
  2497. : null,
  2498. appBar: appBar,
  2499. key: registKey,
  2500. body: SafeArea(
  2501. child: Container(
  2502. height: MediaQuery.of(context).size.height,
  2503. width: MediaQuery.of(context).size.width,
  2504. color: AppColors.BackgroundColor,
  2505. child: SingleChildScrollView(
  2506. child: _buildBody(),
  2507. ),
  2508. )))),
  2509. );
  2510. return CustomUI.buildPageLoading(context, content, !isLoadingFish);
  2511. }
  2512. //连麦
  2513. onAudio() async {
  2514. testChatPermission(() async {
  2515. if (userInfo.chatStatus == 0) {
  2516. showToast(I18n.of(context).cantt_voice);
  2517. return;
  2518. }
  2519. if (BlacklistMgr.isBlaklistMe(userInfo.userId)) {
  2520. showToast(I18n.of(context).you_are_blaklisted);
  2521. return;
  2522. }
  2523. if (BlacklistMgr.isInMyblaklist(userInfo.userId)) {
  2524. showToast(I18n.of(context).reject_message);
  2525. return;
  2526. }
  2527. //对方关闭陌生人消息,则提示
  2528. if (!userInfo.isCanStrangerNews) {
  2529. showToast(I18n.of(context).stranger_close_tips);
  2530. return;
  2531. }
  2532. if (await CustomUI.showPermissionSetting(context,
  2533. PermissionGroup.microphone, I18n.of(context).video_permission)) {
  2534. AppNavigator.pushAudioChatPage(context, userInfo);
  2535. } else {
  2536. showToast(I18n.of(context).need_record);
  2537. }
  2538. });
  2539. }
  2540. }