Hibok
Você não pode selecionar mais de 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.
 
 
 
 
 
 

1895 linhas
62 KiB

  1. import 'dart:convert';
  2. import 'package:chat/home/fans_page.dart';
  3. import 'package:chat/home/goddess_hot.dart';
  4. import 'package:chat/home/my_headview.dart';
  5. import 'package:chat/home/photo_page.dart';
  6. import 'package:chat/models/ChatMsg.dart';
  7. import 'package:chat/models/money_change.dart';
  8. import 'package:chat/models/ref_name_provider.dart';
  9. import 'package:chat/models/voucher_change.dart';
  10. import 'package:chat/proto/all.pbserver.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/MessageMgr.dart';
  32. import 'package:chat/utils/TutorialOverlay.dart';
  33. import 'package:cached_network_image/cached_network_image.dart';
  34. import 'package:image_picker/image_picker.dart';
  35. import 'package:oktoast/oktoast.dart';
  36. import 'package:permission_handler/permission_handler.dart';
  37. import 'package:provider/provider.dart';
  38. import 'package:share/share.dart';
  39. import '../utils/FullWithButton.dart';
  40. import '../home/EditData.dart';
  41. import '../home/SystemEditPage.dart';
  42. import '../data/UserData.dart';
  43. import '../utils/TokenMgr.dart';
  44. import 'package:dio/dio.dart';
  45. import 'package:chat/utils/HttpUtil.dart';
  46. import 'VerificationCenter.dart';
  47. import 'WhiteAndBlackList.dart';
  48. import "package:chat/utils/PicSwiper.dart";
  49. import 'add_friend.dart';
  50. import 'apply_content_view.dart';
  51. import 'daily_bonus_page.dart';
  52. import 'dart:math' as math;
  53. var cardWidth;
  54. var greyColor = const Color(0xFFB2B2B2);
  55. const MaxImgSize = 20;
  56. class ProfilePage extends StatefulWidget {
  57. @required
  58. final userId;
  59. final int fromWhere;
  60. final int addMode;
  61. final int applyId; //好友申请id
  62. ProfilePage(
  63. {Key key,
  64. this.userId,
  65. this.fromWhere,
  66. this.addMode = 0,
  67. this.applyId = 0})
  68. : super(key: key);
  69. _ProfilePageState createState() => _ProfilePageState();
  70. }
  71. class _ProfilePageState extends State<ProfilePage>
  72. with TickerProviderStateMixin {
  73. static const Separate_Size = 10.0;
  74. GlobalKey<ScaffoldState> registKey = new GlobalKey();
  75. UserInfo userInfo = new UserInfo();
  76. TextEditingController nickNameController = new TextEditingController();
  77. bool isMyself = false;
  78. List imgList = [];
  79. bool isCanWatch = false;
  80. bool isMan = true;
  81. bool isAttestation = false;
  82. bool isBuyPicture = false;
  83. bool isVip = false;
  84. bool isSvip = false;
  85. bool isApplying = false; //是否申请中
  86. //约会节目
  87. String dateItem = '';
  88. //期待对象
  89. String lovePeople = '';
  90. //约会范围
  91. String dateRange = '';
  92. //生日
  93. String birthday = '';
  94. //身高数据
  95. String heightStr = '';
  96. //体重数据
  97. String weightStr = '';
  98. //个人介绍
  99. String myMsg = '';
  100. Map wealthData = {
  101. 'CoinValue': 0,
  102. 'IsMember': 0,
  103. };
  104. int myselfImg = 0;
  105. String endTime = '';
  106. bool isLoadingFish = false;
  107. String firstDyImg = ''; //第一条动态的图片
  108. int programId = 0; //是否有一条活跃的节目
  109. bool isblack = false;
  110. bool isAuthority = false; //是否有聊天和查看用户资料的权限
  111. bool isShowAll = false;
  112. double fansWidth = Screen.width - 105;
  113. getUserInfo({mymsg = ''}) async {
  114. if (mymsg != '' && mymsg != null) {
  115. UserData().basicInfo.ownMsg = mymsg;
  116. }
  117. HttpUtil().getUserInfo(
  118. widget.userId,
  119. (data) async {
  120. print('getUserInfo $data');
  121. if (isMyself) {
  122. saveLocalData(data);
  123. }
  124. userInfo = UserInfo.fromJson(data);
  125. initValues();
  126. isLoadingFish = true;
  127. showMyMsgDialog();
  128. if (mounted) {
  129. setState(() {});
  130. }
  131. },
  132. _buildJoinVip,
  133. () {
  134. if (!isMyself) {
  135. Future.delayed(Duration(milliseconds: 500), () {
  136. Navigator.of(context).pop();
  137. });
  138. }
  139. });
  140. if (isMyself) {
  141. HttpUtil().getWealth(context, (data) {
  142. wealthData = data;
  143. endTime = data['MemberEnd'];
  144. if (mounted) {
  145. Provider.of<MoneyChangeProvider>(context)
  146. .initMoney(data['CoinValue']);
  147. Provider.of<VoucherChangeProvider>(context)
  148. .initVoucher(data['Voucher']);
  149. }
  150. });
  151. }
  152. }
  153. saveLocalData(data) {
  154. UserData().basicInfo = UserInfo.fromJson(data);
  155. SPUtils.saveString(
  156. Constants.LocalUsrInfo, jsonEncode(UserData().toJson()).toString());
  157. }
  158. initLocalData() async {
  159. if (isMyself && await SPUtils.get(Constants.LocalUsrInfo) != null) {
  160. isLoadingFish = true;
  161. userInfo = UserData().basicInfo;
  162. initValues();
  163. showMyMsgDialog();
  164. }
  165. }
  166. showMyMsgDialog() {
  167. if (!UserData().isFirstTip &&
  168. (UserData().basicInfo.ownMsg == '' ||
  169. UserData().basicInfo.ownMsg == null) &&
  170. UserData().homemainIndex == 4) {
  171. UserData().isFirstTip = true;
  172. CustomUI.buildOneConfirm(
  173. context, I18n.of(context).personal, I18n.of(context).white_now, () {
  174. Navigator.pop(context);
  175. Navigator.of(context).push(
  176. new MaterialPageRoute(
  177. builder: (context) {
  178. return EditPage(
  179. isEditPage: true,
  180. );
  181. },
  182. ),
  183. );
  184. });
  185. }
  186. }
  187. initValues() {
  188. isMan = userInfo.sex == 1;
  189. isAttestation = userInfo.isAttestation == null || userInfo.isAttestation;
  190. isVip = userInfo.isMember > 0;
  191. isSvip = userInfo.isMember == 2;
  192. isCanWatch = userInfo.infoAut == 0 || userInfo.applyStatus == 1;
  193. isApplying = userInfo.applyStatus == 0;
  194. isblack = userInfo.isBlackList;
  195. isBuyPicture =
  196. (isMyself || userInfo.photoAut == 0 || userInfo.payStatus == 1);
  197. dateItem =
  198. userInfo.program == null ? "" : WebData().getProgram(userInfo.program);
  199. lovePeople = userInfo.hopeObject == null
  200. ? ""
  201. : WebData().getLovePeople(userInfo.hopeObject);
  202. dateRange = WebData().getDateRange(userInfo.meetPlace);
  203. birthday = userInfo.birthday == null ? '' : userInfo.birthday;
  204. isAuthority = userInfo.isAuthority ||
  205. (!UserData().isMan() && UserData().basicInfo.isAttestation) ||
  206. userInfo.distince < 200;
  207. myMsg = userInfo.ownMsg;
  208. }
  209. @override
  210. void initState() {
  211. super.initState();
  212. print('ProfilePage initState');
  213. isMyself = widget.userId == UserData().basicInfo.userId;
  214. messageOn();
  215. initLocalData();
  216. getUserInfo();
  217. }
  218. void initMyController() {}
  219. void _buildJoinVip() {
  220. isLoadingFish = true;
  221. CustomUI.buildOneConfirm(
  222. context, I18n.of(context).only_see, I18n.of(context).joinvip, () {
  223. Navigator.of(context).push(
  224. new MaterialPageRoute(
  225. builder: (context) {
  226. return VipPage();
  227. },
  228. ),
  229. );
  230. }, failcallbak: () {
  231. Navigator.of(context).pop();
  232. });
  233. }
  234. msgBuyVip(data) {
  235. HttpUtil().getWealth(context, (data) {
  236. wealthData = data;
  237. endTime = data['MemberEnd'];
  238. if (mounted) {
  239. Provider.of<MoneyChangeProvider>(context).initMoney(data['CoinValue']);
  240. }
  241. });
  242. }
  243. msgUpdateData(data) {
  244. print('msgUpdateData $data');
  245. getUserInfo(mymsg: data);
  246. }
  247. msgInformSucess(data) {
  248. if (!isMyself)
  249. CustomUI.buildOneConfirm(
  250. context, I18n.of(context).waiting_results, I18n.of(context).ok, () {
  251. Navigator.of(context).pop();
  252. });
  253. }
  254. msgListDelete(data) {
  255. if (userInfo.dynamicNum > 0) {
  256. if (mounted) {
  257. setState(() {
  258. userInfo.dynamicNum--;
  259. });
  260. }
  261. }
  262. }
  263. addProgramCallback(data) {
  264. if (mounted) {
  265. setState(() {
  266. userInfo.dynamicNum++;
  267. });
  268. }
  269. }
  270. void messageOn() {
  271. MessageMgr().on('inform_sucess', msgInformSucess);
  272. MessageMgr().on('refresh_money', msgBuyVip);
  273. MessageMgr().on('update_data', msgUpdateData);
  274. MessageMgr().on('delete_program', msgListDelete);
  275. MessageMgr().on('post_add_friend', msgAddFriend);
  276. MessageMgr().on('refresh_love_list', msgRefreshLoveList);
  277. MessageMgr().on('refresh_fans_num', msgRefreshFansNum);
  278. MessageMgr().on('change_my_headview', msgChangeMyHeadView);
  279. MessageMgr().on('Add_program', addProgramCallback);
  280. }
  281. void messageOff() {
  282. MessageMgr().off('inform_sucess', msgInformSucess);
  283. MessageMgr().off('refresh_money', msgBuyVip);
  284. MessageMgr().off('update_data', msgUpdateData);
  285. MessageMgr().off('delete_program', msgListDelete);
  286. MessageMgr().off('post_add_friend', msgAddFriend);
  287. MessageMgr().off('refresh_love_list', msgRefreshLoveList);
  288. MessageMgr().off('refresh_fans_num', msgRefreshFansNum);
  289. MessageMgr().off('change_my_headview', msgChangeMyHeadView);
  290. MessageMgr().off('Add_program', addProgramCallback);
  291. }
  292. msgChangeMyHeadView(data) {
  293. if (isMyself) {
  294. userInfo.headimgurl = UserData().basicInfo.headimgurl;
  295. setState(() {});
  296. }
  297. }
  298. msgRefreshFansNum(data) {
  299. setState(() {
  300. if (data['UserId'] == userInfo.userId && userInfo.fans < data['nums']) {
  301. userInfo.fans = data['nums'];
  302. }
  303. });
  304. }
  305. msgRefreshLoveList(data) {
  306. setState(() {
  307. if (data['flag'] == 0) {
  308. isMyself ? userInfo.followNum++ : userInfo.fans++;
  309. } else {
  310. isMyself ? userInfo.followNum-- : userInfo.fans--;
  311. }
  312. });
  313. }
  314. msgAddFriend(data) {
  315. setState(() {
  316. userInfo.isAddFriends = 0;
  317. });
  318. }
  319. @override
  320. void dispose() {
  321. messageOff();
  322. registKey = null;
  323. nickNameController.dispose();
  324. super.dispose();
  325. }
  326. showHeadView() {
  327. Navigator.of(context).push(
  328. new MaterialPageRoute(
  329. builder: (context) {
  330. return MyHeadViewPage();
  331. },
  332. ),
  333. );
  334. }
  335. Widget _buildSignIn() {
  336. return Container(
  337. margin: EdgeInsets.only(top: 19, bottom: 19),
  338. padding: EdgeInsets.symmetric(horizontal: 10),
  339. child: FullWidthButton(
  340. iconCode: 0xe65c,
  341. iconColor: 0xFFAF60F8,
  342. showRightIcon: true,
  343. title: I18n.of(context).sign_in,
  344. showDivider: false,
  345. onPressed: () {
  346. if (UserData().sign <= 0) {
  347. showToast(I18n.of(context).system_not_open);
  348. return;
  349. }
  350. Navigator.of(context).push(MaterialPageRoute(
  351. builder: (context) {
  352. return DailyBonusPage();
  353. },
  354. ));
  355. },
  356. ),
  357. decoration: BoxDecoration(
  358. color: Colors.white,
  359. border: Border(
  360. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  361. );
  362. }
  363. Widget _buildPicture() {
  364. return FullWidthButton(
  365. iconCode: 0xe689,
  366. iconColor: 0xFFE3AA10,
  367. title: (isMyself
  368. ? I18n.of(context).my_album
  369. : (isMan ? I18n.of(context).his_photo : I18n.of(context).her_photo)),
  370. descriptionColor: Constants.BlueTextColor,
  371. showDivider: false,
  372. showRightIcon: true,
  373. onPressed: () {
  374. Navigator.of(context).push(
  375. new MaterialPageRoute(
  376. builder: (context) {
  377. return PhotoPage(
  378. userInfo: userInfo,
  379. );
  380. },
  381. ),
  382. );
  383. },
  384. );
  385. }
  386. Widget _buildHeadView() {
  387. cardWidth = MediaQuery.of(context).size.width;
  388. return Container(
  389. decoration: BoxDecoration(
  390. color: Colors.white,
  391. border: Border(bottom: Constants.GreyBorderSide)),
  392. child: Container(
  393. decoration: BoxDecoration(
  394. color: Colors.white,
  395. ),
  396. width: MediaQuery.of(context).size.width,
  397. padding: EdgeInsets.only(top: 19),
  398. child: Column(
  399. children: <Widget>[
  400. Container(
  401. child: Row(
  402. crossAxisAlignment: CrossAxisAlignment.center,
  403. children: <Widget>[
  404. _buildHeadImg(),
  405. Column(children: <Widget>[
  406. _buildFans(),
  407. _buildButtonList(),
  408. ])
  409. ],
  410. )),
  411. _buildUserChips(),
  412. _buildAttestation(),
  413. _buildMyMsg(),
  414. ],
  415. ),
  416. ),
  417. );
  418. }
  419. Widget _buildMyMsg() {
  420. double width = Screen.width - 80;
  421. var textStyle = TextStyle(fontSize: 12, color: Color(0xFF333333));
  422. // userInfo.ownMsg =
  423. // '哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈哈';
  424. bool showAllContent = isExpansion(userInfo.ownMsg, width);
  425. return Container(
  426. padding:
  427. EdgeInsets.only(left: 25.5, bottom: isMyself ? 20 : 20, right: 10),
  428. child: userInfo.ownMsg == null || userInfo.ownMsg == ''
  429. ? (isMyself
  430. ? InkWell(
  431. onTap: () {
  432. Navigator.of(context).push(
  433. new MaterialPageRoute(
  434. builder: (context) {
  435. return EditPage(isEditPage: true);
  436. },
  437. ),
  438. );
  439. },
  440. child: Row(
  441. crossAxisAlignment: CrossAxisAlignment.start,
  442. children: <Widget>[
  443. Container(
  444. constraints: BoxConstraints(maxWidth: width),
  445. child: Text(I18n.of(context).msg_tips,
  446. style: textStyle)),
  447. Transform.rotate(
  448. angle: math.pi * 2,
  449. child: Icon(
  450. IconData(0xe68d,
  451. fontFamily: Constants.IconFontFamily),
  452. color: Color(0xFF717171),
  453. size: 16,
  454. ))
  455. ]))
  456. : Container())
  457. : Row(
  458. crossAxisAlignment: CrossAxisAlignment.start,
  459. children: <Widget>[
  460. Container(
  461. width: width,
  462. child: Text(
  463. userInfo.ownMsg,
  464. style: textStyle,
  465. maxLines: isShowAll ? 10 : 1,
  466. overflow: TextOverflow.ellipsis,
  467. )),
  468. SizedBox(width: 4),
  469. showAllContent
  470. ? InkWell(
  471. onTap: () {
  472. setState(() {
  473. isShowAll = !isShowAll;
  474. });
  475. },
  476. child: Transform.rotate(
  477. angle: isShowAll ? math.pi : 0,
  478. child: Icon(
  479. IconData(0xe684,
  480. fontFamily: Constants.IconFontFamily),
  481. color: Color(0xFF717171),
  482. size: 13,
  483. )))
  484. : Container(),
  485. ],
  486. ));
  487. }
  488. bool isExpansion(String text, double width) {
  489. TextPainter _textPainter = TextPainter(
  490. maxLines: 2,
  491. text: TextSpan(
  492. text: text, style: TextStyle(fontSize: 12.0, color: Colors.black)),
  493. textDirection: TextDirection.ltr)
  494. ..layout(maxWidth: width, minWidth: width);
  495. if (_textPainter.didExceedMaxLines) {
  496. //这里判断 文本是否截断
  497. return true;
  498. } else {
  499. return false;
  500. }
  501. }
  502. Widget _buildBorderButton(String str, double width, callback,
  503. {IconData iconCode, int iconColor = 0xFF181818}) {
  504. return InkWell(
  505. onTap: callback,
  506. child: Container(
  507. alignment: Alignment.center,
  508. decoration: BoxDecoration(
  509. border: Border.all(color: Color(0xB5CCCCCC)),
  510. borderRadius: BorderRadius.circular(14)),
  511. height: 28,
  512. width: width,
  513. child: Row(mainAxisAlignment: MainAxisAlignment.center, children: [
  514. iconCode != null
  515. ? Container(
  516. margin: EdgeInsets.only(right: str == null ? 0 : 2),
  517. child: Icon(
  518. iconCode,
  519. size: 16,
  520. color: Color(iconColor),
  521. ))
  522. : Container(),
  523. Text(
  524. str,
  525. style: TextStyle(fontSize: 14),
  526. )
  527. ]),
  528. ));
  529. }
  530. gotoEditPage() {
  531. Navigator.of(context).push(
  532. new MaterialPageRoute(
  533. builder: (context) {
  534. return EditPage(isEditPage: true);
  535. },
  536. ),
  537. );
  538. }
  539. gotoSystemEditPage() {
  540. Navigator.of(context).push(
  541. new MaterialPageRoute(
  542. builder: (context) {
  543. return SystemEditPage();
  544. },
  545. ),
  546. );
  547. }
  548. loveOrCancele() {
  549. if (!userInfo.isLike) {
  550. HttpUtil().setLove(userInfo.userId, () {
  551. MessageMgr()
  552. .emit('refresh_love_list', {'UserId': userInfo.userId, 'flag': 0});
  553. setState(() {
  554. userInfo.isLike = true;
  555. });
  556. });
  557. } else {
  558. HttpUtil().cancleLove(userInfo.userId, () {
  559. MessageMgr()
  560. .emit('refresh_love_list', {'UserId': userInfo.userId, 'flag': 2});
  561. setState(() {
  562. userInfo.isLike = false;
  563. });
  564. });
  565. }
  566. }
  567. cannotWatchTips() {
  568. showToast(isMan ? I18n.of(context).view_user : I18n.of(context).view_user2);
  569. }
  570. Widget _buildButtonList() {
  571. List<Widget> list = [];
  572. if (isMyself) {
  573. list = [
  574. _buildBorderButton(
  575. I18n.of(context).edit_information, 140, gotoEditPage),
  576. SizedBox(width: 12.5),
  577. _buildBorderButton('', 54, gotoSystemEditPage,
  578. iconCode: Icons.settings),
  579. ];
  580. } else if (userInfo.sex == UserData().basicInfo.sex) {
  581. list = [
  582. _buildBorderButton(I18n.of(context).private_chat, fansWidth - 80,
  583. isCanWatch ? buyChatAccount : cannotWatchTips,
  584. iconCode: IconData(0xe68c, fontFamily: 'iconfont')),
  585. ];
  586. } else {
  587. list = [
  588. _buildBorderButton(I18n.of(context).like, 140, loveOrCancele,
  589. iconCode: IconData(userInfo.isLike ? 0xe623 : 0xe625,
  590. fontFamily: Constants.IconFontFamily),
  591. iconColor: userInfo.isLike ? 0xFFFF7777 : 0xFF181818),
  592. SizedBox(width: 12.5),
  593. _buildBorderButton(
  594. '', 53, isCanWatch ? buyChatAccount : cannotWatchTips,
  595. iconCode: IconData(0xe68c, fontFamily: 'iconfont')),
  596. ];
  597. }
  598. return Container(
  599. margin: EdgeInsets.only(top: 13, bottom: 10),
  600. child: Row(
  601. children: list,
  602. ));
  603. }
  604. //认证相关
  605. Widget _buildAttestation() {
  606. return Container(
  607. margin: EdgeInsets.only(top: 7, bottom: 7, left: 25.5),
  608. alignment: Alignment.centerLeft,
  609. child: Row(
  610. mainAxisAlignment: MainAxisAlignment.start,
  611. children: <Widget>[
  612. isAttestation
  613. ? Icon(Icons.check_circle_outline,
  614. size: 12, color: Constants.BlueTextColor)
  615. : Padding(
  616. padding: EdgeInsets.only(bottom: 0.5),
  617. child: Icon(IconData(0xe63a, fontFamily: 'iconfont'),
  618. size: 16, color: const Color(0xFFA9A9A9))),
  619. SizedBox(width: 3),
  620. Text(
  621. isAttestation
  622. ? isMyself
  623. ? (isMan
  624. ? (userInfo.isVipAttestation
  625. ? I18n.of(context).by_paying
  626. : I18n.of(context).incode_passed)
  627. : I18n.of(context).certified)
  628. : (isMan
  629. ? (userInfo.isVipAttestation
  630. ? I18n.of(context).pay_join
  631. : I18n.of(context).passed_review)
  632. : I18n.of(context).passed_video)
  633. : isMyself
  634. ? I18n.of(context).not_certified
  635. : (isMan ? '' : I18n.of(context).not_video),
  636. textScaleFactor: 1.0,
  637. style: TextStyle(fontSize: 11, color: Constants.GreyTextColor))
  638. ],
  639. ));
  640. }
  641. Widget _buildFansButton(int nums, String text, callback,
  642. {bool isShowDot = false}) {
  643. return InkWell(
  644. onTap: callback,
  645. child: Container(
  646. width: fansWidth / 3,
  647. child: Column(
  648. children: <Widget>[
  649. Stack(
  650. children: <Widget>[
  651. Padding(
  652. padding: EdgeInsets.only(left: 4, right: 4),
  653. child: Text(
  654. nums > 99 ? "99+" : nums.toString(),
  655. style: TextStyle(
  656. fontSize: 15,
  657. color: Constants.BlackTextColor,
  658. fontWeight: FontWeight.w400),
  659. )),
  660. isShowDot
  661. ? Positioned(
  662. top: 2,
  663. right: 0,
  664. child: CircleAvatar(
  665. radius: 2,
  666. backgroundColor: const Color(0xFFE50000),
  667. ),
  668. )
  669. : Container(
  670. width: 0,
  671. )
  672. ],
  673. ),
  674. SizedBox(height: 4),
  675. Text(
  676. text,
  677. style: TextStyle(fontSize: 11, color: greyColor),
  678. ),
  679. ],
  680. )),
  681. );
  682. }
  683. //关注列表
  684. Widget _buildFans() {
  685. return Container(
  686. child: Row(
  687. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  688. children: <Widget>[
  689. _buildFansButton(
  690. userInfo.fans,
  691. I18n.of(context).fans,
  692. isMyself
  693. ? () {
  694. Navigator.of(context).push(
  695. new MaterialPageRoute(
  696. builder: (context) {
  697. return FansPage();
  698. },
  699. ),
  700. );
  701. }
  702. : null),
  703. _buildFansButton(
  704. userInfo.followNum,
  705. I18n.of(context).attention,
  706. isMyself
  707. ? () {
  708. Navigator.of(context).push(
  709. new MaterialPageRoute(
  710. builder: (context) {
  711. return WhiteAndBlackPage(
  712. isWhite: true,
  713. );
  714. },
  715. ),
  716. );
  717. }
  718. : null),
  719. _buildFansButton(userInfo.dynamicNum, I18n.of(context).dynamics, () {
  720. Navigator.of(context).push(
  721. new MaterialPageRoute(
  722. builder: (context) {
  723. return MyProgramPage(
  724. userId: userInfo.userId,
  725. isMan: isMan,
  726. );
  727. },
  728. ),
  729. );
  730. }, isShowDot: userInfo.dynamicNum > 0),
  731. ],
  732. ));
  733. }
  734. Widget _buildDivder() {
  735. return Container(
  736. color: Color(0xFFE6E6E6),
  737. width: 1.5,
  738. height: 10,
  739. margin: EdgeInsets.only(left: 7.5, right: 7.5));
  740. }
  741. //用户chips
  742. Widget _buildUserChips() {
  743. var age = 0;
  744. if (userInfo.birthday != null) {
  745. age = DateTime.now().year - int.parse(userInfo.birthday.split('-')[0]);
  746. }
  747. var textStyle = TextStyle(fontSize: 12);
  748. return Container(
  749. width: Screen.width,
  750. padding: EdgeInsets.only(left: 25.5),
  751. child: Wrap(
  752. crossAxisAlignment: WrapCrossAlignment.center,
  753. //mainAxisAlignment: MainAxisAlignment.start,
  754. children: <Widget>[
  755. isAttestation && !isMan
  756. ? Container(
  757. height: 13,
  758. width: 33,
  759. alignment: Alignment.center,
  760. decoration: BoxDecoration(
  761. borderRadius: BorderRadius.circular(10),
  762. color: Constants.PurpleBackgroundColor,
  763. ),
  764. child: Text(
  765. 'Real',
  766. textScaleFactor: 1.0,
  767. style: TextStyle(fontSize: 9, color: Colors.white),
  768. ))
  769. : Container(width: 0),
  770. isVip && isMan
  771. ? Container(
  772. child: isSvip ? Constants.svipIcon : Constants.vipIcon)
  773. : Container(width: 0),
  774. (isAttestation && !isMan) || isVip && isMan
  775. ? _buildDivder()
  776. : Container(),
  777. Text(
  778. '${UserData().hasLocationPermission ? WebData().getDateRange(userInfo.meetPlace) : I18n.of(context).unknown}',
  779. style: textStyle,
  780. ),
  781. _buildDivder(),
  782. Text(
  783. '$age ${I18n.of(context).years_old}-${WebData().getConstellation(context, userInfo.constellation)}',
  784. style: textStyle,
  785. ),
  786. _buildDivder(),
  787. Text(
  788. userInfo.occupation == null
  789. ? ''
  790. : WebData().getProffesionName(userInfo.occupation),
  791. style: textStyle,
  792. )
  793. ],
  794. ));
  795. }
  796. //用户头像
  797. Widget _buildHeadImg() {
  798. double width = 85;
  799. return InkWell(
  800. onTap: isMyself
  801. ? showHeadView
  802. : () {
  803. Navigator.of(context).push(
  804. new MaterialPageRoute(
  805. builder: (context) {
  806. return PicSwiper(
  807. id: 0,
  808. pics: [PicSwiperItem(userInfo.headimgurl, id: 0)],
  809. );
  810. },
  811. ),
  812. );
  813. },
  814. child: Container(
  815. margin: EdgeInsets.only(left: 19, right: 0, bottom: 15),
  816. decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [
  817. BoxShadow(
  818. color: Color(0xFFD9D9D9),
  819. offset: Offset(0, 0.5),
  820. blurRadius: 5,
  821. )
  822. ]),
  823. width: width,
  824. height: width,
  825. child: ClipRRect(
  826. borderRadius: BorderRadius.circular(100),
  827. child: userInfo.headimgurl == null || userInfo.headimgurl == ''
  828. ? Image.asset(Constants.DefaultHeadImgUrl,
  829. height: width, width: width)
  830. : CachedNetworkImage(
  831. imageUrl: userInfo.headimgurl,
  832. placeholder: (context, url) => Image.asset(
  833. Constants.DefaultHeadImgUrl,
  834. height: width,
  835. width: width,
  836. ),
  837. fit: BoxFit.cover,
  838. ),
  839. )),
  840. );
  841. }
  842. void _buildConfirmBlack() {
  843. Navigator.of(context).pop();
  844. CustomUI.buildOneConfirm(
  845. context, I18n.of(context).blacklist_choose, I18n.of(context).determine,
  846. () async {
  847. Navigator.pop(context);
  848. HttpUtil().blackUser(userInfo.userId, () {
  849. isblack = true;
  850. });
  851. });
  852. }
  853. void _sendMySelfPicture() async {
  854. if (await CustomUI.showPhotoPermissionSetting(context)) {
  855. var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  856. if (tempFile != null) {
  857. Map data = {"type": 6, "userId": UserData().basicInfo.userId};
  858. data['sign'] = TokenMgr().getSign(data);
  859. data['isBurn'] = 1;
  860. Response res = await HttpUtil().uploadFile(
  861. tempFile, data, 'upload/file/postflie', 'image',
  862. isShowLoading: true);
  863. var resData = res.data;
  864. if (resData['code'] == 0) {
  865. showToast(I18n.of(context).successfully_submit);
  866. myselfImg = resData['data']['photoId'];
  867. Navigator.of(context).pop();
  868. _postApply();
  869. }
  870. }
  871. }
  872. }
  873. void _postApply() async {
  874. Map data = {
  875. "userId": userInfo.userId,
  876. "imgUrl": myselfImg,
  877. "applyUserId": UserData().basicInfo.userId
  878. };
  879. data['sign'] = TokenMgr().getSign(data);
  880. Response res = await HttpUtil()
  881. .post('user/apply/checkcords', data: data, isShowLoading: true);
  882. Map resData = res.data;
  883. if (resData['code'] == 0) {
  884. isApplying = true;
  885. setState(() {});
  886. }
  887. }
  888. Widget _buildBody() {
  889. Widget hidden = Container(
  890. alignment: Alignment.center,
  891. width: Screen.width,
  892. height: Screen.height - 372,
  893. color: Colors.white,
  894. margin: EdgeInsets.only(top: 10),
  895. child: Column(
  896. mainAxisAlignment: MainAxisAlignment.center,
  897. children: <Widget>[
  898. Container(
  899. margin: EdgeInsets.only(bottom: 10),
  900. child: Image.asset('assets/images/login/lock.png',
  901. height: 45, width: 45),
  902. ),
  903. Text(
  904. isMan ? I18n.of(context).view_user : I18n.of(context).view_user2,
  905. textScaleFactor: 1.0,
  906. textAlign: TextAlign.center,
  907. style: TextStyle(color: Constants.GreyTextColor, fontSize: 13.5),
  908. ),
  909. InkWell(
  910. onTap: isApplying
  911. ? null
  912. : () async {
  913. CustomUI.buildOneConfirm(
  914. context,
  915. I18n.of(context).need_photo,
  916. I18n.of(context).choose_photo,
  917. _sendMySelfPicture);
  918. },
  919. child: Container(
  920. margin: EdgeInsets.only(top: 10, left: 100, right: 100),
  921. padding: EdgeInsets.only(top: 10, bottom: 10),
  922. alignment: Alignment.center,
  923. decoration: BoxDecoration(
  924. color: Constants.ConfrimButtonColor,
  925. borderRadius: BorderRadius.all(
  926. Radius.circular(Constants.LittleButtonRadius))),
  927. child: Text(
  928. isApplying
  929. ? I18n.of(context).already_applied
  930. : I18n.of(context).apply_now,
  931. textScaleFactor: 1.0,
  932. style: TextStyle(color: Colors.white),
  933. ),
  934. )),
  935. ],
  936. ),
  937. );
  938. List<Widget> child = [];
  939. if (isMyself) {
  940. child.addAll([
  941. _buildHeadView(),
  942. _buildSignIn(),
  943. _buildMoneyBox(),
  944. ]);
  945. } else if (isCanWatch) {
  946. child.addAll([
  947. _buildHeadView(),
  948. Container(
  949. margin: EdgeInsets.only(top: 19, bottom: 19),
  950. padding: EdgeInsets.symmetric(horizontal: 10),
  951. child: _buildPicture(),
  952. decoration: BoxDecoration(
  953. color: Colors.white,
  954. border: Border(
  955. top: Constants.GreyBorderSide,
  956. bottom: Constants.GreyBorderSide)),
  957. ),
  958. _buildBasicInfo(),
  959. _buildBottomTips(),
  960. ]);
  961. } else if (userInfo.userId != null) {
  962. child.addAll([
  963. _buildHeadView(),
  964. hidden,
  965. ]);
  966. } else {
  967. child.addAll([
  968. _buildHeadView(),
  969. ]);
  970. }
  971. return Column(
  972. children: child,
  973. );
  974. }
  975. _inviteFdBtn() {
  976. return Container(
  977. width: Screen.width,
  978. child: FlatButton(
  979. child: fixedText(I18n.of(context).add_friends,
  980. fontSize: 16,
  981. color: Colors.blueAccent,
  982. fontWeight: FontWeight.w500),
  983. onPressed: () async {
  984. //已经是好友
  985. if (FriendListMgr().isMyFriend(userInfo.userId)) {
  986. showToast(I18n.of(context).added);
  987. return;
  988. }
  989. //已申请
  990. if (userInfo.isAddFriends == 0) {
  991. showToast(I18n.of(context).add_friends_tips);
  992. return;
  993. }
  994. if (widget.addMode != 3 &&
  995. UserData().addFdDistanceSwitch > 0 &&
  996. userInfo.distince > 200) {
  997. showToast(I18n.of(context).distance_long);
  998. return;
  999. }
  1000. Navigator.of(context).push(
  1001. new MaterialPageRoute(
  1002. builder: (context) {
  1003. return AddFriendPage(
  1004. userId: userInfo.userId,
  1005. pageType: SendMessagePageType.AddFriends,
  1006. originalName: I18n.of(context)
  1007. .i_am
  1008. .replaceFirst('/s1', UserData().basicInfo.nickName),
  1009. );
  1010. },
  1011. ),
  1012. );
  1013. }),
  1014. );
  1015. }
  1016. void doFriendApply(state, callback) async {
  1017. Map data = {
  1018. "id": widget.applyId,
  1019. "userId": UserData().basicInfo.userId,
  1020. "status": state,
  1021. };
  1022. data['sign'] = TokenMgr().getSign(data);
  1023. Response res =
  1024. await HttpUtil().post('friendship/handler/apply', data: data);
  1025. if (res == null) {
  1026. return;
  1027. }
  1028. var resData = res.data;
  1029. if (resData['code'] == 0) {
  1030. callback(resData['msg']);
  1031. } else {}
  1032. }
  1033. _dealInvite() {
  1034. return Container(
  1035. width: Screen.width,
  1036. child: Row(
  1037. children: <Widget>[
  1038. Expanded(
  1039. child: InkWell(
  1040. onTap: () {
  1041. doFriendApply(1, (msg) {
  1042. showToast(msg);
  1043. Navigator.of(context).pop();
  1044. var friendModel = FriendModel.fromServerJson({
  1045. 'UserId': userInfo.userId,
  1046. 'ImgUrl': userInfo.headimgurl,
  1047. 'UserName': userInfo.nickName
  1048. });
  1049. FriendListMgr().addFriend(friendModel);
  1050. FriendListMgr().deleteLocalUserIdById(userInfo.userId);
  1051. MessageMgr().emit('do_friend_apply',
  1052. {'userId': userInfo.userId, 'state': 1});
  1053. MessageMgr().emit('Add friend');
  1054. //同意好友后发送打招呼
  1055. MsgModel msgModel = MsgHandler.createSendMsg(
  1056. ChatType.TextChatType, I18n.of(context).new_friends_tips,
  1057. friendId: userInfo.userId,
  1058. refMsg: null,
  1059. refShortTxt: null,
  1060. altUsers: null,
  1061. channelType: ChatChannelType.Session);
  1062. int sessionId = UserData().getSessionId(userInfo.userId);
  1063. MsgHandler.updateActiveSesstion(sessionId);
  1064. AppNavigator.pushChatPage(context, userInfo.userId,
  1065. enterType: 3, enterContent: msgModel);
  1066. });
  1067. },
  1068. child: Container(
  1069. color: const Color(0xFF3875E9),
  1070. alignment: Alignment.center,
  1071. child: Text(
  1072. I18n.of(context).agree,
  1073. style: TextStyle(fontSize: 18, color: Colors.white),
  1074. ),
  1075. ),
  1076. )),
  1077. InkWell(
  1078. onTap: () {
  1079. doFriendApply(2, (msg) {
  1080. showToast(msg);
  1081. Navigator.of(context).pop();
  1082. FriendListMgr().deleteLocalUserIdById(userInfo.userId);
  1083. MessageMgr().emit('do_friend_apply',
  1084. {'userId': userInfo.userId, 'state': 2});
  1085. });
  1086. },
  1087. child: Container(
  1088. alignment: Alignment.center,
  1089. color: const Color(0xFFA8D3FF),
  1090. width: Screen.width * 0.33,
  1091. child: Text(
  1092. I18n.of(context).refuse,
  1093. style:
  1094. TextStyle(fontSize: 18, color: const Color(0xFF007EFF)),
  1095. ),
  1096. ))
  1097. ],
  1098. ));
  1099. }
  1100. //自定义item
  1101. Widget _bottomBorderBox(
  1102. String textLeft, String textRight, bool showBorder, callback,
  1103. {showIcon: false}) {
  1104. Widget left = new Container(
  1105. margin: EdgeInsets.only(right: 20),
  1106. width: 90,
  1107. child: new Text(
  1108. textLeft,
  1109. textScaleFactor: 1.0,
  1110. style: TextStyle(fontSize: 14),
  1111. ));
  1112. Widget right = new Expanded(
  1113. child: Text(
  1114. textRight,
  1115. textScaleFactor: 1.0,
  1116. style: TextStyle(fontSize: 13, color: Constants.GreyTextColor),
  1117. ),
  1118. );
  1119. return InkWell(
  1120. highlightColor: Colors.transparent,
  1121. radius: 0.0,
  1122. onTap: callback,
  1123. child: Container(
  1124. decoration: showBorder
  1125. ? BoxDecoration(border: Border(bottom: Constants.GreyBorderSide))
  1126. : null,
  1127. alignment: Alignment.center,
  1128. padding: EdgeInsets.only(
  1129. top: 17,
  1130. bottom: 17,
  1131. ),
  1132. margin: EdgeInsets.only(left: 45, bottom: 0, right: 10),
  1133. child: Row(
  1134. crossAxisAlignment: CrossAxisAlignment.start,
  1135. children: <Widget>[
  1136. left,
  1137. right,
  1138. showIcon
  1139. ? Padding(
  1140. padding: EdgeInsets.only(right: 10),
  1141. child: Icon(
  1142. IconData(0xe63c, fontFamily: 'iconfont'),
  1143. size: 22.0,
  1144. color: Color(AppColors.TabIconNormal),
  1145. ))
  1146. : Container()
  1147. ],
  1148. ),
  1149. ));
  1150. }
  1151. testChatPermission(callback) {
  1152. becomeVip() {
  1153. Navigator.of(context).push(
  1154. new MaterialPageRoute(
  1155. builder: (context) {
  1156. return VipPage();
  1157. },
  1158. ),
  1159. );
  1160. }
  1161. payCallback() {
  1162. if (Provider.of<MoneyChangeProvider>(context).money <
  1163. UserData().accountPrice) {
  1164. Navigator.of(context).pop();
  1165. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1166. I18n.of(context).recharge, () {
  1167. Navigator.of(context).pop();
  1168. ChargeMoney.showChargeSheet(context, () {
  1169. setState(() {});
  1170. });
  1171. });
  1172. return;
  1173. }
  1174. Navigator.of(context).pop();
  1175. HttpUtil().buyChatAccount(
  1176. UserData().accountPrice, userInfo.userId, context, () {
  1177. setState(() {
  1178. isAuthority = true;
  1179. });
  1180. });
  1181. }
  1182. freeTime() {
  1183. HttpUtil().userFreeTime(context, userInfo.userId, 2, () {
  1184. UserData().basicInfo.usedNum++;
  1185. Navigator.of(context).pop();
  1186. setState(() {
  1187. isAuthority = true;
  1188. });
  1189. });
  1190. }
  1191. //自己是女性,且未认证,提示去认证(好友除外)
  1192. if (!UserData().isMan() &&
  1193. !UserData().basicInfo.isAttestation &&
  1194. !FriendListMgr().isMyFriend(userInfo.userId)) {
  1195. CustomUI.buildNotTrue(context);
  1196. return;
  1197. }
  1198. print('isAuthority $isAuthority');
  1199. var tipStr = '';
  1200. //没有解锁账号,并且对方禁止陌生人聊天
  1201. if (!isAuthority && !userInfo.isCanStrangerNews) {
  1202. tipStr = I18n.of(context).stranger_close;
  1203. } else {
  1204. tipStr = I18n.of(context).unlock_information;
  1205. if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1206. tipStr += '(${I18n.of(context).not_true_woman})';
  1207. }
  1208. }
  1209. if (isAuthority) {
  1210. if (callback != null) callback();
  1211. } else {
  1212. //如果自己是男性,vip提示免费次数,次数用完或者非vip提示购买
  1213. if (UserData().isMan()) {
  1214. if (UserData().isVip) {
  1215. UserData().basicInfo.freeNum < UserData().basicInfo.usedNum
  1216. ? CustomUI.buildOneConfirm(
  1217. context,
  1218. tipStr,
  1219. I18n.of(context)
  1220. .pay_unlock
  1221. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1222. payCallback)
  1223. : CustomUI.buildOneConfirm(
  1224. context,
  1225. tipStr,
  1226. I18n.of(context).unlock_choose,
  1227. freeTime,
  1228. );
  1229. } else {
  1230. CustomUI.buildTowConfirm(
  1231. context,
  1232. tipStr,
  1233. I18n.of(context).become_member,
  1234. becomeVip,
  1235. I18n.of(context)
  1236. .pay_unlock
  1237. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1238. payCallback);
  1239. }
  1240. }
  1241. }
  1242. }
  1243. buyChatAccount() {
  1244. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1245. ///如果是聊天界面跳转过来的,直接返回
  1246. Navigator.of(context).pop();
  1247. } else {
  1248. testChatPermission(() {
  1249. int fdId = userInfo.userId;
  1250. int sessionId = UserData().getSessionId(fdId);
  1251. MsgHandler.updateActiveSesstion(sessionId);
  1252. AppNavigator.pushChatPage(context, fdId);
  1253. });
  1254. }
  1255. }
  1256. clickChatAccout() {
  1257. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1258. ///如果是聊天界面跳转过来的,直接返回
  1259. Navigator.of(context).pop();
  1260. } else {
  1261. testChatPermission(() {});
  1262. }
  1263. }
  1264. buyPhoto() {
  1265. //女性用户付费,男性用户会员的话免费解锁,非会员付费解锁
  1266. becomeVip() {
  1267. Navigator.of(context).push(
  1268. new MaterialPageRoute(
  1269. builder: (context) {
  1270. return VipPage();
  1271. },
  1272. ),
  1273. );
  1274. }
  1275. payCallback() {
  1276. if (Provider.of<MoneyChangeProvider>(context).money < userInfo.price) {
  1277. Navigator.of(context).pop();
  1278. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1279. I18n.of(context).recharge, () {
  1280. Navigator.of(context).pop();
  1281. ChargeMoney.showChargeSheet(context, () {
  1282. setState(() {});
  1283. });
  1284. });
  1285. return;
  1286. }
  1287. Navigator.of(context).pop();
  1288. HttpUtil().buyPictures(userInfo.price, userInfo.userId, context, () {
  1289. setState(() {
  1290. isBuyPicture = true;
  1291. });
  1292. });
  1293. }
  1294. freeTime() {
  1295. HttpUtil().userFreeTime(context, userInfo.userId, 1, () {
  1296. UserData().basicInfo.usedNum++;
  1297. Navigator.of(context).pop();
  1298. setState(() {
  1299. isBuyPicture = true;
  1300. });
  1301. });
  1302. }
  1303. String title = I18n.of(context).unlock_user.replaceFirst(
  1304. '/s1',
  1305. Provider.of<RefNameProvider>(context)
  1306. .getRefName(userInfo.userId, userInfo.nickName),
  1307. );
  1308. if (!UserData().isMan()) {
  1309. CustomUI.buildOneConfirm(
  1310. context,
  1311. title,
  1312. I18n.of(context)
  1313. .pay_unlock
  1314. .replaceFirst('/s1', userInfo.price.toString()),
  1315. payCallback);
  1316. } else if (UserData().isVip) {
  1317. if (UserData().basicInfo.freeNum < UserData().basicInfo.usedNum) {
  1318. CustomUI.buildOneConfirm(
  1319. context,
  1320. title,
  1321. I18n.of(context)
  1322. .pay_unlock
  1323. .replaceFirst('/s1', userInfo.price.toString()),
  1324. payCallback);
  1325. } else {
  1326. CustomUI.buildOneConfirm(
  1327. context, title, I18n.of(context).unlock_choose, freeTime);
  1328. }
  1329. } else {
  1330. CustomUI.buildTowConfirm(
  1331. context,
  1332. title,
  1333. I18n.of(context).become_member,
  1334. becomeVip,
  1335. I18n.of(context)
  1336. .pay_unlock
  1337. .replaceFirst('/s1', userInfo.price.toString()),
  1338. payCallback);
  1339. }
  1340. }
  1341. Widget _buildBasicInfo() {
  1342. String wechat = '';
  1343. String facebook = '';
  1344. bool isHidden = userInfo.accountStatus == 1;
  1345. //隐藏社交账号
  1346. if (isHidden) {
  1347. wechat = I18n.of(context).ask_me;
  1348. facebook = I18n.of(context).ask_me;
  1349. } else {
  1350. wechat = isAuthority ? userInfo.wechat : I18n.of(context).filled_in;
  1351. facebook = isAuthority ? userInfo.facebook : I18n.of(context).filled_in;
  1352. }
  1353. heightStr = (userInfo.height == 0.0 || userInfo.height == null)
  1354. ? I18n.of(context).not_show
  1355. : '${userInfo.height.toInt()}CM';
  1356. weightStr = (userInfo.weight == 0.0 || userInfo.weight == null)
  1357. ? I18n.of(context).not_show
  1358. : '${userInfo.weight.toInt()}KG';
  1359. List<Widget> basicList = [
  1360. Container(
  1361. padding: EdgeInsets.symmetric(horizontal: 10),
  1362. child: FullWidthButton(
  1363. iconCode: 0xe676,
  1364. iconColor: 0xFF57BBFB,
  1365. title: isMan
  1366. ? I18n.of(context).his_profile
  1367. : I18n.of(context).her_profile,
  1368. showDivider: true,
  1369. showRightIcon: false,
  1370. onPressed: () {})),
  1371. userInfo.height != null && userInfo.height != 0
  1372. ? _bottomBorderBox(I18n.of(context).height, heightStr, true, () {})
  1373. : Container(),
  1374. userInfo.weight != null && userInfo.weight != 0
  1375. ? _bottomBorderBox(I18n.of(context).weight, weightStr, true, () {})
  1376. : Container(),
  1377. _bottomBorderBox(I18n.of(context).Resident_city, dateRange, true, () {}),
  1378. _bottomBorderBox(I18n.of(context).expect_lover, lovePeople, true, () {}),
  1379. (userInfo.wechat != null && userInfo.wechat != '')
  1380. ? _bottomBorderBox(
  1381. I18n.of(context).wechat_number, wechat, true, clickChatAccout,
  1382. showIcon: !isAuthority)
  1383. : Container(),
  1384. (userInfo.facebook != null && userInfo.facebook != '')
  1385. ? _bottomBorderBox(
  1386. I18n.of(context).facebook, facebook, true, clickChatAccout,
  1387. showIcon: !isAuthority)
  1388. : Container(),
  1389. ];
  1390. return Container(
  1391. width: cardWidth,
  1392. decoration: BoxDecoration(
  1393. color: Colors.white,
  1394. border: Border(
  1395. top: Constants.GreyBorderSide,
  1396. bottom: Constants.GreyBorderSide)),
  1397. child: new Column(
  1398. children: basicList,
  1399. ));
  1400. }
  1401. Widget _buildBottomTips() {
  1402. return Container(
  1403. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 10),
  1404. width: cardWidth,
  1405. alignment: Alignment.center,
  1406. child: Text(I18n.of(context).not_illage,
  1407. textScaleFactor: 1.0,
  1408. textAlign: TextAlign.center,
  1409. style: TextStyle(fontSize: 12, color: Colors.grey)),
  1410. );
  1411. }
  1412. Widget _buildMoneyBox() {
  1413. //认证、钱包、隐私连麦设置
  1414. return Container(
  1415. decoration: BoxDecoration(
  1416. color: Colors.white,
  1417. border: Border(
  1418. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1419. padding: EdgeInsets.only(top: 4, bottom: 4, left: 10, right: 10),
  1420. child: Column(
  1421. children: <Widget>[
  1422. isMan
  1423. ? Container()
  1424. : FullWidthButton(
  1425. iconCode: 0xe687,
  1426. iconColor: 0xFFFF7752,
  1427. title: I18n.of(context).Goddess_heat,
  1428. showDivider: true,
  1429. showRightIcon: true,
  1430. onPressed: () {
  1431. Navigator.of(context).push(
  1432. new MaterialPageRoute(
  1433. builder: (context) {
  1434. return GoddessHotPage(
  1435. userId: userInfo.userId,
  1436. );
  1437. },
  1438. ),
  1439. );
  1440. },
  1441. ),
  1442. isMan
  1443. ? FullWidthButton(
  1444. iconCode: 0xe68e,
  1445. iconColor: 0xFF3D83E6,
  1446. title: I18n.of(context).member,
  1447. description: UserData().isVip
  1448. ? I18n.of(context)
  1449. .expires
  1450. .replaceFirst('/s1', endTime.split(' ')[0])
  1451. : I18n.of(context).enjoy_privileges,
  1452. showDivider: true,
  1453. onPressed: () {
  1454. Navigator.of(context).push(
  1455. new MaterialPageRoute(
  1456. builder: (context) {
  1457. return VipPage();
  1458. },
  1459. ),
  1460. );
  1461. },
  1462. )
  1463. : FullWidthButton(
  1464. iconCode: 0xe688,
  1465. iconColor: 0xFF3D83E6,
  1466. title: isAttestation
  1467. ? I18n.of(context).certified_video
  1468. : I18n.of(context).authenticate,
  1469. showDivider: true,
  1470. onPressed: () {
  1471. Navigator.of(context).push(
  1472. new MaterialPageRoute(
  1473. builder: (context) {
  1474. return isAttestation
  1475. ? VideoPage(
  1476. userId: userInfo.userId,
  1477. )
  1478. : VerificationCenterPage();
  1479. },
  1480. ),
  1481. );
  1482. },
  1483. ),
  1484. FullWidthButton(
  1485. iconCode: 0xe68a,
  1486. iconColor: 0xFF4CB871,
  1487. title: I18n.of(context).wallet,
  1488. description:
  1489. '${Provider.of<MoneyChangeProvider>(context).money}${I18n.of(context).mask_coin}',
  1490. showDivider: true,
  1491. onPressed: () {
  1492. Navigator.of(context).push(
  1493. new MaterialPageRoute(
  1494. builder: (context) {
  1495. return MoneyPage();
  1496. },
  1497. ),
  1498. );
  1499. },
  1500. ),
  1501. _buildPicture(),
  1502. ],
  1503. ),
  1504. );
  1505. }
  1506. Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 30.0}) {
  1507. var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor;
  1508. return InkWell(
  1509. onTap: isCanHit
  1510. ? callback
  1511. : () {
  1512. showToast(isMan
  1513. ? I18n.of(context).view_user
  1514. : I18n.of(context).view_user2);
  1515. },
  1516. child: Row(
  1517. children: <Widget>[
  1518. Icon(
  1519. IconData(
  1520. code,
  1521. fontFamily: 'iconfont',
  1522. ),
  1523. color: color,
  1524. size: iconSize,
  1525. ),
  1526. Padding(
  1527. child: Text(
  1528. str,
  1529. textScaleFactor: 1.0,
  1530. style: TextStyle(color: color, fontSize: 14),
  1531. ),
  1532. padding: EdgeInsets.only(left: 5))
  1533. ],
  1534. ));
  1535. }
  1536. @override
  1537. Widget build(BuildContext context) {
  1538. Size screenSize = MediaQuery.of(context).size;
  1539. cardWidth = screenSize.width;
  1540. Widget appBar = AppBar(
  1541. leading: isMyself ? Container() : CustomUI.buildCustomLeading(context),
  1542. titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing,
  1543. title: isMyself
  1544. ? Text(
  1545. userInfo.nickName,
  1546. //I18n.of(context).me,
  1547. textScaleFactor: 1.0,
  1548. style: Constants.MainTitleStyle,
  1549. )
  1550. : Text(
  1551. WebData().subUserName(Provider.of<RefNameProvider>(context)
  1552. .getRefName(userInfo.userId, userInfo.nickName)),
  1553. textScaleFactor: 1.0,
  1554. style: TextStyle(color: Constants.BlackTextColor)),
  1555. centerTitle: !isMyself,
  1556. elevation: 1,
  1557. actions: <Widget>[
  1558. isMyself
  1559. ? Container(
  1560. padding: EdgeInsets.only(right: 15),
  1561. alignment: Alignment.center,
  1562. child: new InkWell(
  1563. child: CircleAvatar(
  1564. backgroundColor: Constants.GreyBackgroundColor,
  1565. radius: 15.75,
  1566. child: Icon(
  1567. IconData(0xe685, fontFamily: 'iconfont'),
  1568. color: Constants.BlackTextColor,
  1569. size: 20,
  1570. )),
  1571. onTap: () {
  1572. Share.share('https://henho.jphgames.com/');
  1573. },
  1574. ),
  1575. )
  1576. : Container(),
  1577. isMyself
  1578. ? Container()
  1579. : Container(
  1580. alignment: Alignment.center,
  1581. child: new InkWell(
  1582. child: new Padding(
  1583. padding: EdgeInsets.only(
  1584. right: 15, left: 15, top: 10, bottom: 10),
  1585. child: Icon(
  1586. IconData(
  1587. 0xe621,
  1588. fontFamily: 'iconfont',
  1589. ),
  1590. color: Constants.BlackTextColor,
  1591. size: 20,
  1592. ),
  1593. ),
  1594. onTap: () {
  1595. showModalBottomSheet(
  1596. context: registKey.currentContext,
  1597. builder: (BuildContext context) {
  1598. return SafeArea(
  1599. child: Container(
  1600. height: 137,
  1601. child: Column(
  1602. children: <Widget>[
  1603. InkWell(
  1604. onTap: () async {
  1605. Navigator.of(context).pop();
  1606. Navigator.of(context).push(
  1607. new MaterialPageRoute(
  1608. builder: (context) {
  1609. return AddFriendPage(
  1610. userId: userInfo.userId,
  1611. pageType:
  1612. SendMessagePageType.Remark,
  1613. originalName: Provider.of<
  1614. RefNameProvider>(
  1615. context)
  1616. .getRefName(userInfo.userId,
  1617. userInfo.nickName));
  1618. },
  1619. ),
  1620. );
  1621. },
  1622. child: Container(
  1623. alignment: Alignment.center,
  1624. height: 45,
  1625. child: Text(I18n.of(context).Remark,
  1626. textScaleFactor: 1.0,
  1627. style: TextStyle(
  1628. fontSize: 18,
  1629. color: Constants
  1630. .BlackTextColor)))),
  1631. Divider(height: 1),
  1632. InkWell(
  1633. child: Container(
  1634. height: 45,
  1635. alignment: Alignment.center,
  1636. child: Text(
  1637. isblack
  1638. ? I18n.of(context).remove_blacklist
  1639. : I18n.of(context).blacklist,
  1640. textScaleFactor: 1.0,
  1641. style: TextStyle(
  1642. fontSize: 18,
  1643. color: Constants.BlackTextColor),
  1644. ),
  1645. ),
  1646. onTap: isblack
  1647. ? () async {
  1648. HttpUtil().cancleBlackUser(
  1649. userInfo.userId, () {
  1650. Navigator.of(context).pop();
  1651. isblack = false;
  1652. });
  1653. }
  1654. : _buildConfirmBlack,
  1655. ),
  1656. Divider(height: 1),
  1657. InkWell(
  1658. onTap: () async {
  1659. Navigator.of(context).pop();
  1660. Navigator.of(context).push(
  1661. new MaterialPageRoute(
  1662. builder: (context) {
  1663. return InformUserPage(
  1664. isMan: isMan,
  1665. userId: userInfo.userId,
  1666. );
  1667. },
  1668. ),
  1669. );
  1670. },
  1671. child: Container(
  1672. alignment: Alignment.center,
  1673. height: 45,
  1674. child: Text(
  1675. I18n.of(context).anonymous_report,
  1676. textScaleFactor: 1.0,
  1677. style: TextStyle(
  1678. fontSize: 18,
  1679. color: Constants
  1680. .BlackTextColor)))),
  1681. ],
  1682. ),
  1683. ),
  1684. );
  1685. },
  1686. ).then((val) {});
  1687. },
  1688. ),
  1689. ),
  1690. ],
  1691. );
  1692. var bottomWidget = Container(
  1693. height: 55,
  1694. decoration: BoxDecoration(
  1695. border: Border(top: BorderSide(color: Color(0xffeaeaea))),
  1696. color: Constants.LightGreyBackgroundColor,
  1697. ),
  1698. child: Row(
  1699. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  1700. children: widget.addMode == 1 || widget.addMode == 3
  1701. ? <Widget>[_inviteFdBtn()]
  1702. : (widget.addMode == 2
  1703. ? [_dealInvite()]
  1704. : <Widget>[
  1705. _buildIcon(0xe68b, I18n.of(context).evaluate, true,
  1706. () async {
  1707. Map data = {
  1708. "userid": userInfo.userId,
  1709. 'evaluateuserid': UserData().basicInfo.userId,
  1710. };
  1711. data['sign'] = TokenMgr().getSign(data);
  1712. Response res = await HttpUtil().post('evaluate/user/info',
  1713. data: data, isShowLoading: true);
  1714. Map resData = res.data;
  1715. print(resData);
  1716. if (resData['code'] == 0) {
  1717. Navigator.of(context).push(TutorialOverlay(
  1718. child: ApplyContent(
  1719. userId: userInfo.userId,
  1720. isMan: isMan,
  1721. userInfo: resData['data'])));
  1722. } else {
  1723. showToast(resData['msg']);
  1724. }
  1725. }),
  1726. _buildIcon(
  1727. 0xe62f, I18n.of(context).chat, isCanWatch, onAudio)
  1728. ]),
  1729. ),
  1730. );
  1731. Widget content = Container(
  1732. color: Colors.white,
  1733. child: SafeArea(
  1734. child: Scaffold(
  1735. bottomNavigationBar: !isMyself ? bottomWidget : null,
  1736. appBar: appBar,
  1737. key: registKey,
  1738. body: SafeArea(
  1739. child: Container(
  1740. height: MediaQuery.of(context).size.height,
  1741. width: MediaQuery.of(context).size.width,
  1742. color: AppColors.BackgroundColor,
  1743. child: SingleChildScrollView(
  1744. child: _buildBody(),
  1745. ),
  1746. )))),
  1747. );
  1748. return CustomUI.buildPageLoading(context, content, !isLoadingFish);
  1749. }
  1750. //连麦
  1751. onAudio() async {
  1752. testChatPermission(() async {
  1753. if (userInfo.chatStatus == 0) {
  1754. showToast(I18n.of(context).cantt_voice);
  1755. return;
  1756. }
  1757. if (BlacklistMgr.isBlack(userInfo.userId)) {
  1758. return;
  1759. }
  1760. //对方关闭陌生人消息,则提示
  1761. if (!userInfo.isCanStrangerNews) {
  1762. showToast(I18n.of(context).stranger_close_tips);
  1763. return;
  1764. }
  1765. if (await CustomUI.showPermissionSetting(context,
  1766. PermissionGroup.microphone, I18n.of(context).video_permission)) {
  1767. AppNavigator.pushAudioChatPage(context, userInfo);
  1768. } else {
  1769. showToast(I18n.of(context).need_record);
  1770. }
  1771. });
  1772. }
  1773. }