Hibok
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 
 
 
 

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