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.
 
 
 
 
 
 

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