Hibok
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

2682 rindas
97 KiB

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