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

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