Hibok
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 
 
 

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