Hibok
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 
 
 
 

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