Hibok
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

2487 wiersze
88 KiB

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