Hibok
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

2556 righe
92 KiB

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