Hibok
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
 
 
 
 
 
 

1870 рядки
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: Wrap(
  728. crossAxisAlignment: WrapCrossAlignment.center,
  729. //mainAxisAlignment: MainAxisAlignment.start,
  730. children: <Widget>[
  731. isAttestation && !isMan
  732. ? Container(
  733. height: 13,
  734. width: 33,
  735. alignment: Alignment.center,
  736. decoration: BoxDecoration(
  737. borderRadius: BorderRadius.circular(10),
  738. color: Constants.PurpleBackgroundColor,
  739. ),
  740. child: Text(
  741. 'Real',
  742. textScaleFactor: 1.0,
  743. style: TextStyle(fontSize: 9, color: Colors.white),
  744. ))
  745. : Text(''),
  746. isVip && isMan
  747. ? Container(
  748. child: isSvip ? Constants.svipIcon : Constants.vipIcon)
  749. : Text(''),
  750. (isAttestation && !isMan) || isVip && isMan
  751. ? _buildDivder()
  752. : Container(),
  753. Text(
  754. '${UserData().hasLocationPermission ? WebData().getDateRange(userInfo.meetPlace) : I18n.of(context).unknown}',
  755. style: textStyle,
  756. ),
  757. _buildDivder(),
  758. Text(
  759. '$age ${I18n.of(context).years_old}-${WebData().getConstellation(context, userInfo.constellation)}',
  760. style: textStyle,
  761. ),
  762. _buildDivder(),
  763. Text(
  764. userInfo.occupation == null
  765. ? ''
  766. : WebData().getProffesionName(userInfo.occupation),
  767. style: textStyle,
  768. )
  769. ],
  770. ));
  771. }
  772. //用户头像
  773. Widget _buildHeadImg() {
  774. double width = 85;
  775. return InkWell(
  776. onTap: isMyself
  777. ? showHeadView
  778. : () {
  779. Navigator.of(context).push(
  780. new MaterialPageRoute(
  781. builder: (context) {
  782. return PicSwiper(
  783. id: 0,
  784. pics: [PicSwiperItem(userInfo.headimgurl, id: 0)],
  785. );
  786. },
  787. ),
  788. );
  789. },
  790. child: Container(
  791. margin: EdgeInsets.only(left: 19, right: 0, bottom: 15),
  792. decoration: BoxDecoration(shape: BoxShape.circle, boxShadow: [
  793. BoxShadow(
  794. color: Color(0xFFD9D9D9),
  795. offset: Offset(0, 0.5),
  796. blurRadius: 5,
  797. )
  798. ]),
  799. width: width,
  800. height: width,
  801. child: ClipRRect(
  802. borderRadius: BorderRadius.circular(100),
  803. child: userInfo.headimgurl == null || userInfo.headimgurl == ''
  804. ? Image.asset(Constants.DefaultHeadImgUrl,
  805. height: width, width: width)
  806. : CachedNetworkImage(
  807. imageUrl: userInfo.headimgurl,
  808. placeholder: (context, url) => Image.asset(
  809. Constants.DefaultHeadImgUrl,
  810. height: width,
  811. width: width,
  812. ),
  813. fit: BoxFit.cover,
  814. ),
  815. )),
  816. );
  817. }
  818. void _buildConfirmBlack() {
  819. Navigator.of(context).pop();
  820. CustomUI.buildOneConfirm(
  821. context, I18n.of(context).blacklist_choose, I18n.of(context).determine,
  822. () async {
  823. Navigator.pop(context);
  824. HttpUtil().blackUser(userInfo.userId, () {
  825. isblack = true;
  826. });
  827. });
  828. }
  829. void _sendMySelfPicture() async {
  830. if (await CustomUI.showPhotoPermissionSetting(context)) {
  831. var tempFile = await ImagePicker.pickImage(source: ImageSource.gallery);
  832. if (tempFile != null) {
  833. Map data = {"type": 6, "userId": UserData().basicInfo.userId};
  834. data['sign'] = TokenMgr().getSign(data);
  835. data['isBurn'] = 1;
  836. Response res = await HttpUtil().uploadFile(
  837. tempFile, data, 'upload/file/postflie', 'image',
  838. isShowLoading: true);
  839. var resData = res.data;
  840. if (resData['code'] == 0) {
  841. showToast(I18n.of(context).successfully_submit);
  842. myselfImg = resData['data']['photoId'];
  843. Navigator.of(context).pop();
  844. _postApply();
  845. }
  846. }
  847. }
  848. }
  849. void _postApply() async {
  850. Map data = {
  851. "userId": userInfo.userId,
  852. "imgUrl": myselfImg,
  853. "applyUserId": UserData().basicInfo.userId
  854. };
  855. data['sign'] = TokenMgr().getSign(data);
  856. Response res = await HttpUtil()
  857. .post('user/apply/checkcords', data: data, isShowLoading: true);
  858. Map resData = res.data;
  859. if (resData['code'] == 0) {
  860. isApplying = true;
  861. setState(() {});
  862. }
  863. }
  864. Widget _buildBody() {
  865. Widget hidden = Container(
  866. alignment: Alignment.center,
  867. width: Screen.width,
  868. height: Screen.height - 372,
  869. color: Colors.white,
  870. margin: EdgeInsets.only(top: 10),
  871. child: Column(
  872. mainAxisAlignment: MainAxisAlignment.center,
  873. children: <Widget>[
  874. Container(
  875. margin: EdgeInsets.only(bottom: 10),
  876. child: Image.asset('assets/images/login/lock.png',
  877. height: 45, width: 45),
  878. ),
  879. Text(
  880. isMan ? I18n.of(context).view_user : I18n.of(context).view_user2,
  881. textScaleFactor: 1.0,
  882. textAlign: TextAlign.center,
  883. style: TextStyle(color: Constants.GreyTextColor, fontSize: 13.5),
  884. ),
  885. InkWell(
  886. onTap: isApplying
  887. ? null
  888. : () async {
  889. CustomUI.buildOneConfirm(
  890. context,
  891. I18n.of(context).need_photo,
  892. I18n.of(context).choose_photo,
  893. _sendMySelfPicture);
  894. },
  895. child: Container(
  896. margin: EdgeInsets.only(top: 10, left: 100, right: 100),
  897. padding: EdgeInsets.only(top: 10, bottom: 10),
  898. alignment: Alignment.center,
  899. decoration: BoxDecoration(
  900. color: Constants.ConfrimButtonColor,
  901. borderRadius: BorderRadius.all(
  902. Radius.circular(Constants.LittleButtonRadius))),
  903. child: Text(
  904. isApplying
  905. ? I18n.of(context).already_applied
  906. : I18n.of(context).apply_now,
  907. textScaleFactor: 1.0,
  908. style: TextStyle(color: Colors.white),
  909. ),
  910. )),
  911. ],
  912. ),
  913. );
  914. List<Widget> child = [];
  915. if (isMyself) {
  916. child.addAll([
  917. _buildHeadView(),
  918. _buildSignIn(),
  919. _buildMoneyBox(),
  920. ]);
  921. } else if (isCanWatch) {
  922. child.addAll([
  923. _buildHeadView(),
  924. Container(
  925. margin: EdgeInsets.only(top: Separate_Size, bottom: Separate_Size),
  926. padding: EdgeInsets.symmetric(horizontal: 10),
  927. child: _buildPicture(),
  928. decoration: BoxDecoration(
  929. color: Colors.white,
  930. border: Border(
  931. top: Constants.GreyBorderSide,
  932. bottom: Constants.GreyBorderSide)),
  933. ),
  934. _buildBasicInfo(),
  935. _buildBottomTips(),
  936. ]);
  937. } else if (userInfo.userId != null) {
  938. child.addAll([
  939. _buildHeadView(),
  940. hidden,
  941. ]);
  942. } else {
  943. child.addAll([
  944. _buildHeadView(),
  945. ]);
  946. }
  947. return Column(
  948. children: child,
  949. );
  950. }
  951. _inviteFdBtn() {
  952. return Container(
  953. width: Screen.width,
  954. child: FlatButton(
  955. child: fixedText(I18n.of(context).add_friends,
  956. fontSize: 16,
  957. color: Colors.blueAccent,
  958. fontWeight: FontWeight.w500),
  959. onPressed: () async {
  960. //已经是好友
  961. if (FriendListMgr().isMyFriend(userInfo.userId)) {
  962. showToast(I18n.of(context).added);
  963. return;
  964. }
  965. //已申请
  966. if (userInfo.isAddFriends == 0) {
  967. showToast(I18n.of(context).add_friends_tips);
  968. return;
  969. }
  970. if (widget.addMode != 3 &&
  971. UserData().addFdDistanceSwitch > 0 &&
  972. userInfo.distince > 200) {
  973. showToast(I18n.of(context).distance_long);
  974. return;
  975. }
  976. Navigator.of(context).push(
  977. new MaterialPageRoute(
  978. builder: (context) {
  979. return AddFriendPage(
  980. userId: userInfo.userId,
  981. pageType: SendMessagePageType.AddFriends,
  982. originalName: I18n.of(context)
  983. .i_am
  984. .replaceFirst('/s1', UserData().basicInfo.nickName),
  985. );
  986. },
  987. ),
  988. );
  989. }),
  990. );
  991. }
  992. void doFriendApply(state, callback) async {
  993. Map data = {
  994. "id": widget.applyId,
  995. "userId": UserData().basicInfo.userId,
  996. "status": state,
  997. };
  998. data['sign'] = TokenMgr().getSign(data);
  999. Response res =
  1000. await HttpUtil().post('friendship/handler/apply', data: data);
  1001. if (res == null) {
  1002. return;
  1003. }
  1004. var resData = res.data;
  1005. if (resData['code'] == 0) {
  1006. callback(resData['msg']);
  1007. } else {}
  1008. }
  1009. _dealInvite() {
  1010. return Container(
  1011. width: Screen.width,
  1012. child: Row(
  1013. children: <Widget>[
  1014. Expanded(
  1015. child: InkWell(
  1016. onTap: () {
  1017. doFriendApply(1, (msg) {
  1018. showToast(msg);
  1019. Navigator.of(context).pop();
  1020. var friendModel = FriendModel.fromServerJson({
  1021. 'UserId': userInfo.userId,
  1022. 'ImgUrl': userInfo.headimgurl,
  1023. 'UserName': userInfo.nickName
  1024. });
  1025. FriendListMgr().addFriend(friendModel);
  1026. FriendListMgr().deleteLocalUserIdById(userInfo.userId);
  1027. MessageMgr().emit('do_friend_apply',
  1028. {'userId': userInfo.userId, 'state': 1});
  1029. MessageMgr().emit('Add friend');
  1030. //同意好友后发送打招呼
  1031. MsgModel msgModel = MsgHandler.createSendMsg(
  1032. ChatType.TextChatType, I18n.of(context).new_friends_tips,
  1033. friendId: userInfo.userId,
  1034. refMsg: null,
  1035. refShortTxt: null,
  1036. altUsers: null,
  1037. channelType: ChatChannelType.Session);
  1038. int sessionId = UserData().getSessionId(userInfo.userId);
  1039. MsgHandler.updateActiveSesstion(sessionId);
  1040. AppNavigator.pushChatPage(context, userInfo.userId,
  1041. enterType: 3, enterContent: msgModel);
  1042. });
  1043. },
  1044. child: Container(
  1045. color: const Color(0xFF3875E9),
  1046. alignment: Alignment.center,
  1047. child: Text(
  1048. I18n.of(context).agree,
  1049. style: TextStyle(fontSize: 18, color: Colors.white),
  1050. ),
  1051. ),
  1052. )),
  1053. InkWell(
  1054. onTap: () {
  1055. doFriendApply(2, (msg) {
  1056. showToast(msg);
  1057. Navigator.of(context).pop();
  1058. FriendListMgr().deleteLocalUserIdById(userInfo.userId);
  1059. MessageMgr().emit('do_friend_apply',
  1060. {'userId': userInfo.userId, 'state': 2});
  1061. });
  1062. },
  1063. child: Container(
  1064. alignment: Alignment.center,
  1065. color: const Color(0xFFA8D3FF),
  1066. width: Screen.width * 0.33,
  1067. child: Text(
  1068. I18n.of(context).refuse,
  1069. style:
  1070. TextStyle(fontSize: 18, color: const Color(0xFF007EFF)),
  1071. ),
  1072. ))
  1073. ],
  1074. ));
  1075. }
  1076. //自定义item
  1077. Widget _bottomBorderBox(
  1078. String textLeft, String textRight, bool showBorder, callback,
  1079. {showIcon: false}) {
  1080. Widget left = new Container(
  1081. margin: EdgeInsets.only(right: 20),
  1082. width: 90,
  1083. child: new Text(
  1084. textLeft,
  1085. textScaleFactor: 1.0,
  1086. style: TextStyle(fontSize: 14),
  1087. ));
  1088. Widget right = new Expanded(
  1089. child: Text(
  1090. textRight,
  1091. textScaleFactor: 1.0,
  1092. style: TextStyle(fontSize: 13, color: Constants.GreyTextColor),
  1093. ),
  1094. );
  1095. return InkWell(
  1096. highlightColor: Colors.transparent,
  1097. radius: 0.0,
  1098. onTap: callback,
  1099. child: Container(
  1100. decoration: showBorder
  1101. ? BoxDecoration(border: Border(bottom: Constants.GreyBorderSide))
  1102. : null,
  1103. alignment: Alignment.center,
  1104. padding: EdgeInsets.only(
  1105. top: 17,
  1106. bottom: 17,
  1107. ),
  1108. margin: EdgeInsets.only(left: 45, bottom: 0, right: 10),
  1109. child: Row(
  1110. crossAxisAlignment: CrossAxisAlignment.start,
  1111. children: <Widget>[
  1112. left,
  1113. right,
  1114. showIcon
  1115. ? Padding(
  1116. padding: EdgeInsets.only(right: 10),
  1117. child: Icon(
  1118. IconData(0xe63c, fontFamily: 'iconfont'),
  1119. size: 22.0,
  1120. color: Color(AppColors.TabIconNormal),
  1121. ))
  1122. : Container()
  1123. ],
  1124. ),
  1125. ));
  1126. }
  1127. testChatPermission(callback) {
  1128. becomeVip() {
  1129. Navigator.of(context).push(
  1130. new MaterialPageRoute(
  1131. builder: (context) {
  1132. return VipPage();
  1133. },
  1134. ),
  1135. );
  1136. }
  1137. payCallback() {
  1138. if (Provider.of<MoneyChangeProvider>(context).money <
  1139. UserData().accountPrice) {
  1140. Navigator.of(context).pop();
  1141. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1142. I18n.of(context).recharge, () {
  1143. Navigator.of(context).pop();
  1144. ChargeMoney.showChargeSheet(context, () {
  1145. setState(() {});
  1146. });
  1147. });
  1148. return;
  1149. }
  1150. Navigator.of(context).pop();
  1151. HttpUtil().buyChatAccount(
  1152. UserData().accountPrice, userInfo.userId, context, () {
  1153. setState(() {
  1154. isAuthority = true;
  1155. });
  1156. });
  1157. }
  1158. freeTime() {
  1159. HttpUtil().userFreeTime(context, userInfo.userId, 2, () {
  1160. UserData().basicInfo.usedNum++;
  1161. Navigator.of(context).pop();
  1162. setState(() {
  1163. isAuthority = true;
  1164. });
  1165. });
  1166. }
  1167. //自己是女性,且未认证,提示去认证(好友除外)
  1168. if (!UserData().isMan() &&
  1169. !UserData().basicInfo.isAttestation &&
  1170. !FriendListMgr().isMyFriend(userInfo.userId)) {
  1171. CustomUI.buildNotTrue(context);
  1172. return;
  1173. }
  1174. print('isAuthority $isAuthority');
  1175. var tipStr = '';
  1176. //没有解锁账号,并且对方禁止陌生人聊天
  1177. if (!isAuthority && !userInfo.isCanStrangerNews) {
  1178. tipStr = I18n.of(context).stranger_close;
  1179. } else {
  1180. tipStr = I18n.of(context).unlock_information;
  1181. if (userInfo.sex == 2 && !userInfo.isAttestation) {
  1182. tipStr += '(${I18n.of(context).not_true_woman})';
  1183. }
  1184. }
  1185. if (isAuthority) {
  1186. if (callback != null) callback();
  1187. } else {
  1188. //如果自己是男性,vip提示免费次数,次数用完或者非vip提示购买
  1189. if (UserData().isMan()) {
  1190. if (UserData().isVip) {
  1191. UserData().basicInfo.freeNum < UserData().basicInfo.usedNum
  1192. ? CustomUI.buildOneConfirm(
  1193. context,
  1194. tipStr,
  1195. I18n.of(context)
  1196. .pay_unlock
  1197. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1198. payCallback)
  1199. : CustomUI.buildOneConfirm(
  1200. context,
  1201. tipStr,
  1202. I18n.of(context).unlock_choose,
  1203. freeTime,
  1204. );
  1205. } else {
  1206. CustomUI.buildTowConfirm(
  1207. context,
  1208. tipStr,
  1209. I18n.of(context).become_member,
  1210. becomeVip,
  1211. I18n.of(context)
  1212. .pay_unlock
  1213. .replaceFirst('/s1', UserData().accountPrice.toString()),
  1214. payCallback);
  1215. }
  1216. }
  1217. }
  1218. }
  1219. buyChatAccount() {
  1220. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1221. ///如果是聊天界面跳转过来的,直接返回
  1222. Navigator.of(context).pop();
  1223. } else {
  1224. testChatPermission(() {
  1225. int fdId = userInfo.userId;
  1226. int sessionId = UserData().getSessionId(fdId);
  1227. MsgHandler.updateActiveSesstion(sessionId);
  1228. AppNavigator.pushChatPage(context, fdId);
  1229. });
  1230. }
  1231. }
  1232. clickChatAccout() {
  1233. if (widget.fromWhere != null && widget.fromWhere == 0) {
  1234. ///如果是聊天界面跳转过来的,直接返回
  1235. Navigator.of(context).pop();
  1236. } else {
  1237. testChatPermission(() {});
  1238. }
  1239. }
  1240. buyPhoto() {
  1241. //女性用户付费,男性用户会员的话免费解锁,非会员付费解锁
  1242. becomeVip() {
  1243. Navigator.of(context).push(
  1244. new MaterialPageRoute(
  1245. builder: (context) {
  1246. return VipPage();
  1247. },
  1248. ),
  1249. );
  1250. }
  1251. payCallback() {
  1252. if (Provider.of<MoneyChangeProvider>(context).money < userInfo.price) {
  1253. Navigator.of(context).pop();
  1254. CustomUI.buildOneConfirm(context, I18n.of(context).balance_insufficien,
  1255. I18n.of(context).recharge, () {
  1256. Navigator.of(context).pop();
  1257. ChargeMoney.showChargeSheet(context, () {
  1258. setState(() {});
  1259. });
  1260. });
  1261. return;
  1262. }
  1263. Navigator.of(context).pop();
  1264. HttpUtil().buyPictures(userInfo.price, userInfo.userId, context, () {
  1265. setState(() {
  1266. isBuyPicture = true;
  1267. });
  1268. });
  1269. }
  1270. freeTime() {
  1271. HttpUtil().userFreeTime(context, userInfo.userId, 1, () {
  1272. UserData().basicInfo.usedNum++;
  1273. Navigator.of(context).pop();
  1274. setState(() {
  1275. isBuyPicture = true;
  1276. });
  1277. });
  1278. }
  1279. String title = I18n.of(context).unlock_user.replaceFirst(
  1280. '/s1',
  1281. Provider.of<RefNameProvider>(context)
  1282. .getRefName(userInfo.userId, userInfo.nickName),
  1283. );
  1284. if (!UserData().isMan()) {
  1285. CustomUI.buildOneConfirm(
  1286. context,
  1287. title,
  1288. I18n.of(context)
  1289. .pay_unlock
  1290. .replaceFirst('/s1', userInfo.price.toString()),
  1291. payCallback);
  1292. } else if (UserData().isVip) {
  1293. if (UserData().basicInfo.freeNum < UserData().basicInfo.usedNum) {
  1294. CustomUI.buildOneConfirm(
  1295. context,
  1296. title,
  1297. I18n.of(context)
  1298. .pay_unlock
  1299. .replaceFirst('/s1', userInfo.price.toString()),
  1300. payCallback);
  1301. } else {
  1302. CustomUI.buildOneConfirm(
  1303. context, title, I18n.of(context).unlock_choose, freeTime);
  1304. }
  1305. } else {
  1306. CustomUI.buildTowConfirm(
  1307. context,
  1308. title,
  1309. I18n.of(context).become_member,
  1310. becomeVip,
  1311. I18n.of(context)
  1312. .pay_unlock
  1313. .replaceFirst('/s1', userInfo.price.toString()),
  1314. payCallback);
  1315. }
  1316. }
  1317. Widget _buildBasicInfo() {
  1318. String wechat = '';
  1319. String facebook = '';
  1320. bool isHidden = userInfo.accountStatus == 1;
  1321. //隐藏社交账号
  1322. if (isHidden) {
  1323. wechat = I18n.of(context).ask_me;
  1324. facebook = I18n.of(context).ask_me;
  1325. } else {
  1326. wechat = isAuthority ? userInfo.wechat : I18n.of(context).filled_in;
  1327. facebook = isAuthority ? userInfo.facebook : I18n.of(context).filled_in;
  1328. }
  1329. heightStr = (userInfo.height == 0.0 || userInfo.height == null)
  1330. ? I18n.of(context).not_show
  1331. : '${userInfo.height.toInt()}CM';
  1332. weightStr = (userInfo.weight == 0.0 || userInfo.weight == null)
  1333. ? I18n.of(context).not_show
  1334. : '${userInfo.weight.toInt()}KG';
  1335. List<Widget> basicList = [
  1336. Container(
  1337. padding: EdgeInsets.symmetric(horizontal: 10),
  1338. child: FullWidthButton(
  1339. iconCode: 0xe676,
  1340. iconColor: 0xFF57BBFB,
  1341. title: isMan
  1342. ? I18n.of(context).his_profile
  1343. : I18n.of(context).her_profile,
  1344. showDivider: true,
  1345. showRightIcon: false,
  1346. onPressed: () {})),
  1347. userInfo.height != null && userInfo.height != 0
  1348. ? _bottomBorderBox(I18n.of(context).height, heightStr, true, () {})
  1349. : Container(),
  1350. userInfo.weight != null && userInfo.weight != 0
  1351. ? _bottomBorderBox(I18n.of(context).weight, weightStr, true, () {})
  1352. : Container(),
  1353. _bottomBorderBox(I18n.of(context).Resident_city, dateRange, true, () {}),
  1354. _bottomBorderBox(I18n.of(context).expect_lover, lovePeople, true, () {}),
  1355. (userInfo.wechat != null && userInfo.wechat != '')
  1356. ? _bottomBorderBox(
  1357. I18n.of(context).wechat_number, wechat, true, clickChatAccout,
  1358. showIcon: !isAuthority)
  1359. : Container(),
  1360. (userInfo.facebook != null && userInfo.facebook != '')
  1361. ? _bottomBorderBox(
  1362. I18n.of(context).facebook, facebook, true, clickChatAccout,
  1363. showIcon: !isAuthority)
  1364. : Container(),
  1365. ];
  1366. return Container(
  1367. width: cardWidth,
  1368. margin: EdgeInsets.only(top: Separate_Size),
  1369. decoration: BoxDecoration(
  1370. color: Colors.white,
  1371. border: Border(
  1372. top: Constants.GreyBorderSide,
  1373. bottom: Constants.GreyBorderSide)),
  1374. child: new Column(
  1375. children: basicList,
  1376. ));
  1377. }
  1378. Widget _buildBottomTips() {
  1379. return Container(
  1380. margin: EdgeInsets.only(bottom: 10, left: 10, right: 10, top: 10),
  1381. width: cardWidth,
  1382. alignment: Alignment.center,
  1383. child: Text(I18n.of(context).not_illage,
  1384. textScaleFactor: 1.0,
  1385. textAlign: TextAlign.center,
  1386. style: TextStyle(fontSize: 12, color: Colors.grey)),
  1387. );
  1388. }
  1389. Widget _buildMoneyBox() {
  1390. //认证、钱包、隐私连麦设置
  1391. return Container(
  1392. margin: EdgeInsets.only(top: Separate_Size),
  1393. decoration: BoxDecoration(
  1394. color: Colors.white,
  1395. border: Border(
  1396. top: Constants.GreyBorderSide, bottom: Constants.GreyBorderSide)),
  1397. padding: EdgeInsets.only(top: 4, bottom: 4, left: 10, right: 10),
  1398. child: Column(
  1399. children: <Widget>[
  1400. isMan
  1401. ? Container()
  1402. : FullWidthButton(
  1403. iconCode: 0xe687,
  1404. iconColor: 0xFFFF7752,
  1405. title: I18n.of(context).Goddess_heat,
  1406. showDivider: true,
  1407. showRightIcon: true,
  1408. onPressed: () {
  1409. Navigator.of(context).push(
  1410. new MaterialPageRoute(
  1411. builder: (context) {
  1412. return GoddessHotPage(
  1413. userId: userInfo.userId,
  1414. );
  1415. },
  1416. ),
  1417. );
  1418. },
  1419. ),
  1420. isMan
  1421. ? FullWidthButton(
  1422. iconCode: 0xe68e,
  1423. iconColor: 0xFF3D83E6,
  1424. title: I18n.of(context).member,
  1425. description: UserData().isVip
  1426. ? I18n.of(context)
  1427. .expires
  1428. .replaceFirst('/s1', endTime.split(' ')[0])
  1429. : I18n.of(context).enjoy_privileges,
  1430. showDivider: true,
  1431. onPressed: () {
  1432. Navigator.of(context).push(
  1433. new MaterialPageRoute(
  1434. builder: (context) {
  1435. return VipPage();
  1436. },
  1437. ),
  1438. );
  1439. },
  1440. )
  1441. : FullWidthButton(
  1442. iconCode: 0xe688,
  1443. iconColor: 0xFF3D83E6,
  1444. title: isAttestation
  1445. ? I18n.of(context).certified_video
  1446. : I18n.of(context).authenticate,
  1447. showDivider: true,
  1448. onPressed: () {
  1449. Navigator.of(context).push(
  1450. new MaterialPageRoute(
  1451. builder: (context) {
  1452. return isAttestation
  1453. ? VideoPage(
  1454. userId: userInfo.userId,
  1455. )
  1456. : VerificationCenterPage();
  1457. },
  1458. ),
  1459. );
  1460. },
  1461. ),
  1462. FullWidthButton(
  1463. iconCode: 0xe68a,
  1464. iconColor: 0xFF4CB871,
  1465. title: I18n.of(context).wallet,
  1466. description:
  1467. '${Provider.of<MoneyChangeProvider>(context).money}${I18n.of(context).mask_coin}',
  1468. showDivider: true,
  1469. onPressed: () {
  1470. Navigator.of(context).push(
  1471. new MaterialPageRoute(
  1472. builder: (context) {
  1473. return MoneyPage();
  1474. },
  1475. ),
  1476. );
  1477. },
  1478. ),
  1479. _buildPicture(),
  1480. ],
  1481. ),
  1482. );
  1483. }
  1484. Widget _buildIcon(code, str, isCanHit, callback, {iconSize = 28.0}) {
  1485. var color = isCanHit ? Constants.BlueTextColor : Constants.GreyTextColor;
  1486. return InkWell(
  1487. onTap: isCanHit
  1488. ? callback
  1489. : () {
  1490. showToast(isMan
  1491. ? I18n.of(context).view_user
  1492. : I18n.of(context).view_user2);
  1493. },
  1494. child: Row(
  1495. children: <Widget>[
  1496. Icon(
  1497. IconData(
  1498. code,
  1499. fontFamily: 'iconfont',
  1500. ),
  1501. color: color,
  1502. size: iconSize,
  1503. ),
  1504. Padding(
  1505. child: Text(
  1506. str,
  1507. textScaleFactor: 1.0,
  1508. style: TextStyle(color: color, fontSize: 12),
  1509. ),
  1510. padding: EdgeInsets.only(left: 5))
  1511. ],
  1512. ));
  1513. }
  1514. @override
  1515. Widget build(BuildContext context) {
  1516. Size screenSize = MediaQuery.of(context).size;
  1517. cardWidth = screenSize.width;
  1518. Widget appBar = AppBar(
  1519. leading: isMyself ? Container() : CustomUI.buildCustomLeading(context),
  1520. titleSpacing: isMyself ? -40 : NavigationToolbar.kMiddleSpacing,
  1521. title: isMyself
  1522. ? Text(
  1523. userInfo.nickName,
  1524. //I18n.of(context).me,
  1525. textScaleFactor: 1.0,
  1526. style: Constants.MainTitleStyle,
  1527. )
  1528. : Text(
  1529. WebData().subUserName(Provider.of<RefNameProvider>(context)
  1530. .getRefName(userInfo.userId, userInfo.nickName)),
  1531. textScaleFactor: 1.0,
  1532. style: TextStyle(color: Constants.BlackTextColor)),
  1533. centerTitle: !isMyself,
  1534. elevation: 1,
  1535. actions: <Widget>[
  1536. isMyself
  1537. ? Container(
  1538. padding: EdgeInsets.only(right: 15),
  1539. alignment: Alignment.center,
  1540. child: new InkWell(
  1541. child: CircleAvatar(
  1542. backgroundColor: Constants.GreyBackgroundColor,
  1543. radius: 15.75,
  1544. child: Icon(
  1545. IconData(0xe685, fontFamily: 'iconfont'),
  1546. color: Constants.BlackTextColor,
  1547. size: 20,
  1548. )),
  1549. onTap: () {
  1550. Share.share('https://henho.jphgames.com/');
  1551. },
  1552. ),
  1553. )
  1554. : Container(),
  1555. isMyself
  1556. ? Container()
  1557. : Container(
  1558. alignment: Alignment.center,
  1559. child: new InkWell(
  1560. child: new Padding(
  1561. padding: EdgeInsets.only(
  1562. right: 15, left: 15, top: 10, bottom: 10),
  1563. child: Icon(
  1564. IconData(
  1565. 0xe621,
  1566. fontFamily: 'iconfont',
  1567. ),
  1568. color: Constants.BlackTextColor,
  1569. size: 20,
  1570. ),
  1571. ),
  1572. onTap: () {
  1573. showModalBottomSheet(
  1574. context: registKey.currentContext,
  1575. builder: (BuildContext context) {
  1576. return SafeArea(
  1577. child: Container(
  1578. height: 137,
  1579. child: Column(
  1580. children: <Widget>[
  1581. InkWell(
  1582. onTap: () async {
  1583. Navigator.of(context).pop();
  1584. Navigator.of(context).push(
  1585. new MaterialPageRoute(
  1586. builder: (context) {
  1587. return AddFriendPage(
  1588. userId: userInfo.userId,
  1589. pageType:
  1590. SendMessagePageType.Remark,
  1591. originalName: Provider.of<
  1592. RefNameProvider>(
  1593. context)
  1594. .getRefName(userInfo.userId,
  1595. userInfo.nickName));
  1596. },
  1597. ),
  1598. );
  1599. },
  1600. child: Container(
  1601. alignment: Alignment.center,
  1602. height: 45,
  1603. child: Text(I18n.of(context).Remark,
  1604. textScaleFactor: 1.0,
  1605. style: TextStyle(
  1606. fontSize: 18,
  1607. color: Constants
  1608. .BlackTextColor)))),
  1609. Divider(height: 1),
  1610. InkWell(
  1611. child: Container(
  1612. height: 45,
  1613. alignment: Alignment.center,
  1614. child: Text(
  1615. isblack
  1616. ? I18n.of(context).remove_blacklist
  1617. : I18n.of(context).blacklist,
  1618. textScaleFactor: 1.0,
  1619. style: TextStyle(
  1620. fontSize: 18,
  1621. color: Constants.BlackTextColor),
  1622. ),
  1623. ),
  1624. onTap: isblack
  1625. ? () async {
  1626. HttpUtil().cancleBlackUser(
  1627. userInfo.userId, () {
  1628. Navigator.of(context).pop();
  1629. isblack = false;
  1630. });
  1631. }
  1632. : _buildConfirmBlack,
  1633. ),
  1634. Divider(height: 1),
  1635. InkWell(
  1636. onTap: () async {
  1637. Navigator.of(context).pop();
  1638. Navigator.of(context).push(
  1639. new MaterialPageRoute(
  1640. builder: (context) {
  1641. return InformUserPage(
  1642. isMan: isMan,
  1643. userId: userInfo.userId,
  1644. );
  1645. },
  1646. ),
  1647. );
  1648. },
  1649. child: Container(
  1650. alignment: Alignment.center,
  1651. height: 45,
  1652. child: Text(
  1653. I18n.of(context).anonymous_report,
  1654. textScaleFactor: 1.0,
  1655. style: TextStyle(
  1656. fontSize: 18,
  1657. color: Constants
  1658. .BlackTextColor)))),
  1659. ],
  1660. ),
  1661. ),
  1662. );
  1663. },
  1664. ).then((val) {});
  1665. },
  1666. ),
  1667. ),
  1668. ],
  1669. );
  1670. var bottomWidget = Container(
  1671. height: 55,
  1672. decoration: BoxDecoration(
  1673. border: Border(top: BorderSide(color: Color(0xffeaeaea))),
  1674. color: Constants.LightGreyBackgroundColor,
  1675. ),
  1676. child: Row(
  1677. mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  1678. children: widget.addMode == 1 || widget.addMode == 3
  1679. ? <Widget>[_inviteFdBtn()]
  1680. : (widget.addMode == 2
  1681. ? [_dealInvite()]
  1682. : <Widget>[
  1683. _buildIcon(0xe68b, I18n.of(context).evaluate, true,
  1684. () async {
  1685. Map data = {
  1686. "userid": userInfo.userId,
  1687. 'evaluateuserid': UserData().basicInfo.userId,
  1688. };
  1689. data['sign'] = TokenMgr().getSign(data);
  1690. Response res = await HttpUtil().post('evaluate/user/info',
  1691. data: data, isShowLoading: true);
  1692. Map resData = res.data;
  1693. print(resData);
  1694. if (resData['code'] == 0) {
  1695. Navigator.of(context).push(TutorialOverlay(
  1696. child: ApplyContent(
  1697. userId: userInfo.userId,
  1698. isMan: isMan,
  1699. userInfo: resData['data'])));
  1700. } else {
  1701. showToast(resData['msg']);
  1702. }
  1703. }),
  1704. _buildIcon(
  1705. 0xe62f, I18n.of(context).chat, isCanWatch, onAudio)
  1706. ]),
  1707. ),
  1708. );
  1709. Widget content = Container(
  1710. color: Colors.white,
  1711. child: SafeArea(
  1712. child: Scaffold(
  1713. bottomNavigationBar: !isMyself ? bottomWidget : null,
  1714. appBar: appBar,
  1715. key: registKey,
  1716. body: SafeArea(
  1717. child: Container(
  1718. height: MediaQuery.of(context).size.height,
  1719. width: MediaQuery.of(context).size.width,
  1720. color: AppColors.BackgroundColor,
  1721. child: SingleChildScrollView(
  1722. child: _buildBody(),
  1723. ),
  1724. )))),
  1725. );
  1726. return CustomUI.buildPageLoading(context, content, !isLoadingFish);
  1727. }
  1728. //连麦
  1729. onAudio() async {
  1730. testChatPermission(() async {
  1731. if (userInfo.chatStatus == 0) {
  1732. showToast(I18n.of(context).cantt_voice);
  1733. return;
  1734. }
  1735. if (BlacklistMgr.isBlack(userInfo.userId)) {
  1736. return;
  1737. }
  1738. //对方关闭陌生人消息,则提示
  1739. if (!userInfo.isCanStrangerNews) {
  1740. showToast(I18n.of(context).stranger_close_tips);
  1741. return;
  1742. }
  1743. if (await CustomUI.showPermissionSetting(context,
  1744. PermissionGroup.microphone, I18n.of(context).video_permission)) {
  1745. AppNavigator.pushAudioChatPage(context, userInfo);
  1746. } else {
  1747. showToast(I18n.of(context).need_record);
  1748. }
  1749. });
  1750. }
  1751. }