Hibok
Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 
 

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