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.
 
 
 
 
 
 

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