diff --git a/assets/image/2x/mine_order.webp b/assets/image/2x/mine_order.webp new file mode 100644 index 00000000..4d92bd9f Binary files /dev/null and b/assets/image/2x/mine_order.webp differ diff --git a/assets/image/2x/mine_vip_logo.webp b/assets/image/2x/mine_vip_logo.webp new file mode 100644 index 00000000..a971662e Binary files /dev/null and b/assets/image/2x/mine_vip_logo.webp differ diff --git a/assets/image/2x/set.webp b/assets/image/2x/set.webp new file mode 100644 index 00000000..8bdaa12c Binary files /dev/null and b/assets/image/2x/set.webp differ diff --git a/assets/image/2x/vip_code.webp b/assets/image/2x/vip_code.webp new file mode 100644 index 00000000..86e339cf Binary files /dev/null and b/assets/image/2x/vip_code.webp differ diff --git a/assets/image/2x/wallet.webp b/assets/image/2x/wallet.webp new file mode 100644 index 00000000..9b4d7b70 Binary files /dev/null and b/assets/image/2x/wallet.webp differ diff --git a/assets/image/3x/mine_order.webp b/assets/image/3x/mine_order.webp new file mode 100644 index 00000000..129eb519 Binary files /dev/null and b/assets/image/3x/mine_order.webp differ diff --git a/assets/image/3x/mine_vip_logo.webp b/assets/image/3x/mine_vip_logo.webp new file mode 100644 index 00000000..00256821 Binary files /dev/null and b/assets/image/3x/mine_vip_logo.webp differ diff --git a/assets/image/3x/set.webp b/assets/image/3x/set.webp new file mode 100644 index 00000000..394ccc26 Binary files /dev/null and b/assets/image/3x/set.webp differ diff --git a/assets/image/3x/vip_code.webp b/assets/image/3x/vip_code.webp new file mode 100644 index 00000000..f7e16151 Binary files /dev/null and b/assets/image/3x/vip_code.webp differ diff --git a/assets/image/3x/wallet.webp b/assets/image/3x/wallet.webp new file mode 100644 index 00000000..7c248128 Binary files /dev/null and b/assets/image/3x/wallet.webp differ diff --git a/assets/image/mine_order.webp b/assets/image/mine_order.webp new file mode 100644 index 00000000..c53b1869 Binary files /dev/null and b/assets/image/mine_order.webp differ diff --git a/assets/image/mine_vip_logo.webp b/assets/image/mine_vip_logo.webp new file mode 100644 index 00000000..239b516f Binary files /dev/null and b/assets/image/mine_vip_logo.webp differ diff --git a/assets/image/set.webp b/assets/image/set.webp new file mode 100644 index 00000000..1c16f9b6 Binary files /dev/null and b/assets/image/set.webp differ diff --git a/assets/image/vip_code.webp b/assets/image/vip_code.webp new file mode 100644 index 00000000..05bc301b Binary files /dev/null and b/assets/image/vip_code.webp differ diff --git a/assets/image/wallet.webp b/assets/image/wallet.webp new file mode 100644 index 00000000..d8ae8010 Binary files /dev/null and b/assets/image/wallet.webp differ diff --git a/lib/community/community_child_page.dart b/lib/community/community_child_page.dart index 37018099..78734e3f 100644 --- a/lib/community/community_child_page.dart +++ b/lib/community/community_child_page.dart @@ -213,6 +213,8 @@ class CommunityChildPageState extends State setState(() {}); }); setState(() {}); + + // Navigator.of(context).pushNamed( '/router/eom'); }, ); }, diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index d68c1d52..30731e72 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -1,3 +1,5 @@ +import 'dart:ui'; + import 'package:dio/dio.dart'; import 'package:flutter/material.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; @@ -15,6 +17,8 @@ import 'package:huixiang/web/web_view/comment_list.dart'; import 'package:huixiang/web/web_view/input_comment.dart'; import 'package:shared_preferences/shared_preferences.dart'; +import '../web/web_view/input_comment_o.dart'; + class CommunityDetails extends StatefulWidget { final Map arguments; @@ -46,14 +50,23 @@ class _CommunityDetails extends State Article article; String businessId; - @override + final GlobalKey inputKey = GlobalKey(); + final TextEditingController commentTextController = TextEditingController(); + bool emojiShowing = false; + static double keyboard_height=300; + double keyboard = -1; + bool needShowSmiley = false; + bool needHideSmiley = false; + void didChangeMetrics() { WidgetsBinding.instance.addPostFrameCallback((_) { + // isKeyBoardShow = MediaQuery.of(context).viewInsets.bottom > 0; if (!mounted) return; if (MediaQuery.of(context).viewInsets.bottom == 0) { if (isKeyBoardShow) { FocusScope.of(context).requestFocus(FocusNode()); if (mounted) + if(!emojiShowing) setState(() { hintText = S.current.liuxianinjingcaidepinglunba; isKeyBoardShow = false; @@ -66,6 +79,18 @@ class _CommunityDetails extends State }); } }); + if (needShowSmiley && window.viewInsets.bottom <= 0.1) { + needShowSmiley = false; + setState(() { + emojiShowing = true; + }); + } + if(needHideSmiley && window.viewInsets.bottom > 0.1) { + needHideSmiley = false; + setState(() { + emojiShowing = false; + }); + } } @override @@ -74,11 +99,45 @@ class _CommunityDetails extends State // comunity = widget.arguments["comment"]; businessId = widget.arguments["businessId"]; WidgetsBinding.instance.addObserver(this); + commentFocus.addListener(_focusNodeListener); _queryMemberCommentList(); queryDetails(businessId); } + void _focusNodeListener() { + /*if (_focusNode.hasFocus || _focusNode.consumeKeyboardToken()){ + setState(() { + smileyPadGone = true; + }); + }*/ + } + + _onTextFieldTap() { + if(emojiShowing) { + needHideSmiley = true; + } + } + + _onSmileyTap() { + if(!emojiShowing && commentFocus.hasFocus && isKeyBoardShow) { + needShowSmiley = true; + commentFocus.unfocus(); + } else { + setState(() { + emojiShowing = !emojiShowing; + isKeyBoardShow = emojiShowing; + }); + } + } + + @override + void dispose(){ + WidgetsBinding.instance.removeObserver(this); + commentFocus.removeListener(_focusNodeListener); + super.dispose(); + } + ///详情接口 queryDetails(id) async { SharedPreferences value = await SharedPreferences.getInstance(); @@ -101,21 +160,31 @@ class _CommunityDetails extends State @override Widget build(BuildContext context) { - return Scaffold( - appBar: MyAppBar( - title: S.of(context).dongtaixiangqing, - titleColor: Colors.black, - titleSize: 18.sp, - background: Colors.white, - leading: true, - leadingColor: Colors.black, - ), - body: GestureDetector( - behavior: HitTestBehavior.translucent, - onTap: () { + double h = MediaQuery.of(context).viewInsets.bottom; + if(h > 0 && keyboard <= 0) { + setState(() { + keyboard = h; + }); + } + return GestureDetector( + behavior: HitTestBehavior.translucent, + onTap: () { + setState(() { + emojiShowing = false; + isKeyBoardShow = emojiShowing; FocusScope.of(context).requestFocus(FocusNode()); - }, - child: Container( + }); + }, + child: Scaffold( + appBar: MyAppBar( + title: S.of(context).dongtaixiangqing, + titleColor: Colors.black, + titleSize: 18.sp, + background: Colors.white, + leading: true, + leadingColor: Colors.black, + ), + body: Container( child: Column( children: [ Expanded( @@ -184,17 +253,22 @@ class _CommunityDetails extends State inputKey, hintText, isKeyBoardShow, + keyboard_height, + keyboard, + emojiShowing, commentFocus, commentTextController, _toComment, + _onSmileyTap, + _onTextFieldTap, _queryMemberComment, _queryInformationLikes, isLike: article?.liked ?? false, ), ], ), - )), - ); + ), + )); } ///给文章/活动点赞 @@ -246,9 +320,6 @@ class _CommunityDetails extends State ); } - final GlobalKey inputKey = GlobalKey(); - final TextEditingController commentTextController = TextEditingController(); - contentHeight() { double contentHeight = MediaQuery.of(context).size.height - kToolbarHeight - @@ -290,7 +361,7 @@ class _CommunityDetails extends State Dio(), context: context, token: sharedPreferences.getString("token"), - showLoading: false, + showLoading: true, ); BaseData> baseData = await apiService.memberCommentList({ diff --git a/lib/community/community_view/class_details.dart b/lib/community/community_view/class_details.dart index d7058800..cc60e937 100644 --- a/lib/community/community_view/class_details.dart +++ b/lib/community/community_view/class_details.dart @@ -1,4 +1,5 @@ import 'dart:convert'; +import 'dart:ui'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; @@ -53,11 +54,17 @@ class _ClassDetails extends State with WidgetsBindingObserver { int chapterIndex = 0; double height = 0; var isShowMore = false; + bool emojiShowing = false; + static double keyboard_height=300; + double keyboard = -1; + bool needShowSmiley = false; + bool needHideSmiley = false; @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); + commentFocus.addListener(_focusNodeListener); courseDetails(widget.arguments["id"]); queryChapterList(widget.arguments["id"]); } @@ -70,6 +77,7 @@ class _ClassDetails extends State with WidgetsBindingObserver { Dio(), context: context, token: value.getString("token"), + showLoading: true ); } BaseData> baseData = @@ -114,6 +122,7 @@ class _ClassDetails extends State with WidgetsBindingObserver { if (isKeyBoardShow) { FocusScope.of(context).requestFocus(FocusNode()); if (mounted) + if(!emojiShowing) setState(() { hintText = S.current.liuxianinjingcaidepinglunba; isKeyBoardShow = false; @@ -126,10 +135,61 @@ class _ClassDetails extends State with WidgetsBindingObserver { }); } }); + if (needShowSmiley && window.viewInsets.bottom <= 0.1) { + needShowSmiley = false; + setState(() { + emojiShowing = true; + }); + } + if(needHideSmiley && window.viewInsets.bottom > 0.1) { + needHideSmiley = false; + setState(() { + emojiShowing = false; + }); + } + } + + void _focusNodeListener() { + /*if (_focusNode.hasFocus || _focusNode.consumeKeyboardToken()){ + setState(() { + smileyPadGone = true; + }); + }*/ + } + + _onTextFieldTap() { + if(emojiShowing) { + needHideSmiley = true; + } + } + + _onSmileyTap() { + if(!emojiShowing && commentFocus.hasFocus && isKeyBoardShow) { + needShowSmiley = true; + commentFocus.unfocus(); + } else { + setState(() { + emojiShowing = !emojiShowing; + isKeyBoardShow = emojiShowing; + }); + } + } + + @override + void dispose(){ + WidgetsBinding.instance.removeObserver(this); + commentFocus.removeListener(_focusNodeListener); + super.dispose(); } @override Widget build(BuildContext context) { + double h = MediaQuery.of(context).viewInsets.bottom; + if(h > 0 && keyboard <= 0) { + setState(() { + keyboard = h; + }); + } return AnnotatedRegion( value: SystemUiOverlayStyle.light, child: Material( @@ -137,7 +197,11 @@ class _ClassDetails extends State with WidgetsBindingObserver { body: GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); + setState(() { + emojiShowing = false; + isKeyBoardShow = emojiShowing; + FocusScope.of(context).requestFocus(FocusNode()); + }); }, child: Container( // margin: EdgeInsets.only(top:25), @@ -411,9 +475,14 @@ class _ClassDetails extends State with WidgetsBindingObserver { inputKey, hintText, isKeyBoardShow, + keyboard_height, + keyboard, + emojiShowing, commentFocus, commentTextController, _toComment, + _onSmileyTap, + _onTextFieldTap, _queryMemberComment, _queryCourseLikes, isLike: course?.selfLiked, diff --git a/lib/community/community_view/class_details_video.dart b/lib/community/community_view/class_details_video.dart index abbf7d71..995b5ff6 100644 --- a/lib/community/community_view/class_details_video.dart +++ b/lib/community/community_view/class_details_video.dart @@ -138,16 +138,16 @@ class ClassDetailsVideoState extends State { ? Container( color: Colors.black, width: width, - // height: width / 7 * 5, - height: height, + height:MediaQuery.of(context).size.width / 1.5, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), child: chewies = Chewie( controller: chewieAudioController, ), ) : Container( width: width, - // height:width / 7 * 5, - height: height, + height:MediaQuery.of(context).size.width / 1.5, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), )), if (widget.isShowImg) GestureDetector( @@ -160,8 +160,8 @@ class ClassDetailsVideoState extends State { }, child: Container( width: width, - // height: width / 7 * 5, - height: height, + height: MediaQuery.of(context).size.width / 1.5, + margin: EdgeInsets.only(top: MediaQuery.of(context).padding.top), color: Colors.black, child: Stack( children: [ diff --git a/lib/community/new_community_details.dart b/lib/community/new_community_details.dart index 62dafc65..f005b3e2 100644 --- a/lib/community/new_community_details.dart +++ b/lib/community/new_community_details.dart @@ -1,3 +1,4 @@ +import 'dart:ui'; import 'dart:convert'; import 'package:dio/dio.dart'; @@ -55,6 +56,11 @@ class _NewCommunityDetails extends State with WidgetsBindin Article article; String commentsId; String userId; + bool emojiShowing =false; + static double keyboard_height=300; + double keyboard = -1; + bool needShowSmiley = false; + bool needHideSmiley = false; @override void initState() { @@ -62,6 +68,7 @@ class _NewCommunityDetails extends State with WidgetsBindin commentsId = widget.arguments["commentsId"]; userId = widget.arguments["userId"]; WidgetsBinding.instance.addObserver(this); + commentFocus.addListener(_focusNodeListener); queryDetails(commentsId); } @@ -105,6 +112,7 @@ class _NewCommunityDetails extends State with WidgetsBindin if (isKeyBoardShow) { FocusScope.of(context).requestFocus(FocusNode()); if (mounted) + if(!emojiShowing) setState(() { hintText = S.current.liuxianinjingcaidepinglunba; isKeyBoardShow = false; @@ -117,10 +125,61 @@ class _NewCommunityDetails extends State with WidgetsBindin }); } }); + if (needShowSmiley && window.viewInsets.bottom <= 0.1) { + needShowSmiley = false; + setState(() { + emojiShowing = true; + }); + } + if(needHideSmiley && window.viewInsets.bottom > 0.1) { + needHideSmiley = false; + setState(() { + emojiShowing = false; + }); + } + } + + void _focusNodeListener() { + /*if (_focusNode.hasFocus || _focusNode.consumeKeyboardToken()){ + setState(() { + smileyPadGone = true; + }); + }*/ + } + + _onTextFieldTap() { + if(emojiShowing) { + needHideSmiley = true; + } + } + + _onSmileyTap() { + if(!emojiShowing && commentFocus.hasFocus && isKeyBoardShow) { + needShowSmiley = true; + commentFocus.unfocus(); + } else { + setState(() { + emojiShowing = !emojiShowing; + isKeyBoardShow = emojiShowing; + }); + } + } + + @override + void dispose(){ + WidgetsBinding.instance.removeObserver(this); + commentFocus.removeListener(_focusNodeListener); + super.dispose(); } @override Widget build(BuildContext context) { + double h = MediaQuery.of(context).viewInsets.bottom; + if(h > 0 && keyboard <= 0) { + setState(() { + keyboard = h; + }); + } return WillPopScope( onWillPop: () async { Navigator.of(context).pop(true); @@ -312,9 +371,14 @@ class _NewCommunityDetails extends State with WidgetsBindin inputKey, hintText, isKeyBoardShow, + keyboard_height, + keyboard, + emojiShowing, commentFocus, commentTextController, _toComment, + _onSmileyTap, + _onTextFieldTap, _queryMemberComment, _queryInformationLikes, isLike: article?.liked ?? false, diff --git a/lib/home/welfare_exchange.dart b/lib/home/welfare_exchange.dart index ae017223..b1ee3566 100644 --- a/lib/home/welfare_exchange.dart +++ b/lib/home/welfare_exchange.dart @@ -166,7 +166,7 @@ class _WelfareExchange extends State @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: Colors.transparent, + backgroundColor: Colors.white, body: NestedScrollView( headerSliverBuilder: (context, inner) { return [ @@ -265,7 +265,7 @@ class _WelfareExchange extends State body: SmartRefresher( controller: refreshController, enablePullDown: true, - enablePullUp: false, + enablePullUp: true, physics: ClampingScrollPhysics(), header: MyHeader(), footer: CustomFooter( diff --git a/lib/main.dart b/lib/main.dart index 7d937077..49f8b9ed 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -111,6 +111,7 @@ import 'mine/mine_vip/legal_right_details.dart'; import 'mine/mine_vip/mine_attainment_page.dart'; import 'mine/mine_vip/mine_vip_core.dart'; import 'mine/scan_web.dart'; +import 'mine/vip_pay_code.dart'; import 'order/bargain_group_order.dart'; import 'mine/personal_page.dart'; import 'order/exchange_write_off_page.dart'; @@ -349,7 +350,7 @@ Map routers = { '/router/qr_share': (context, {arguments}) => QrSharePage(), '/router/main_page': (context, {arguments}) => MainPage(arguments: arguments), '/router/test_page': (context, {arguments}) => TestPage(), - '/router/communityFollow': (context, {arguments}) => CommunityFollow(), + '/router/communityFollow': (context, {arguments}) => CommunityFollow(arguments:arguments), '/router/releasePage': (context, {arguments}) => ReleasePage(), '/router/activity_list': (context, {arguments}) => ActivityList(), '/router/class_details': (context, {arguments}) => @@ -420,4 +421,6 @@ Map routers = { HelpFarmersPage(), '/router/scan_web': (context, {arguments}) => ScanWeb(arguments:arguments), + '/router/vip_pay_code': (context, {arguments}) => + VipPayCode(), }; diff --git a/lib/message/system_message.dart b/lib/message/system_message.dart index 46d07411..d4325106 100644 --- a/lib/message/system_message.dart +++ b/lib/message/system_message.dart @@ -124,12 +124,7 @@ class _SystemMessagePage extends State { @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - Navigator.of(context).pop(true); - return false; - }, - child:Scaffold( + return Scaffold( appBar: MyAppBar( background: Colors.white, leadingColor: Colors.black, @@ -139,7 +134,7 @@ class _SystemMessagePage extends State { actions: [ Container( margin: EdgeInsets.only(right: 16.w), - alignment: Alignment.centerRight, + alignment: Alignment.centerRight, child: GestureDetector( onTap: () { setState(() { @@ -147,7 +142,7 @@ class _SystemMessagePage extends State { }); }, child: Text( - S.of(context).biaojiweiyidu, + S.of(context).biaoweiyidu, style: TextStyle( fontSize: 16.sp, fontWeight:MyFontWeight.semi_bold, @@ -192,7 +187,7 @@ class _SystemMessagePage extends State { ), ), - )); + ); } Widget newsSurvey(){ diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index 1eb9a3dc..04157479 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -8,6 +8,7 @@ import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/main.dart'; import 'package:huixiang/mine/mine_view/mine_calendar.dart'; +import 'package:huixiang/mine/mine_view/mine_navbar.dart'; import 'package:huixiang/mine/mine_view/mine_order.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/examine_instance.dart'; @@ -26,6 +27,8 @@ import 'package:shared_preferences/shared_preferences.dart'; import 'package:dio/dio.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../retrofit/data/coupon.dart'; +import '../retrofit/data/page.dart'; import '../utils/flutter_utils.dart'; import 'mine_view/mine_item.dart'; import 'mine_view/mine_view.dart'; @@ -46,6 +49,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { SocialInfo infoNumber; final RefreshController _refreshController = RefreshController(); int totalMsg = 0; + String couponNum; _toUserInfo() async { SharedPreferences shared = await SharedPreferences.getInstance(); @@ -74,6 +78,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { super.initState(); querySocialInfo(); queryMsgStats(); + // queryCard(); eventBus.on().listen((event) { print("EventType: ${event.type}"); @@ -113,6 +118,22 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ranks.addAll(rankData.data); } + BaseData> baseData = await apiService.queryCard({ + "centre": true, + "pageNum": 1, + "pageSize": 10, + "searchKey": "", + "state": 1 + }).catchError((error) { + _refreshController.refreshFailed(); + }); + if (baseData != null && baseData.isSuccess) { + couponNum = baseData.data.total; + _refreshController.refreshCompleted(); + } else { + _refreshController.refreshFailed(); + } + BaseData baseDate = await apiService.queryInfo().catchError((onError) { _refreshController.refreshFailed(); @@ -203,14 +224,13 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { child: SingleChildScrollView( child: Container( child: Stack( - // alignment: Alignment.centerRight, children: [ Container( - height: 502.h, + height: 306.h, decoration: BoxDecoration( // color: Color(0xFF32A060) image: DecorationImage( - fit: BoxFit.cover, + fit: BoxFit.fill, image: AssetImage("assets/image/settlement_bg.webp"), ), ), @@ -229,21 +249,34 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { setState(() { totalMsg = 0; }); - }, totalMsg, infoNumber), + }, totalMsg, + infoNumber, + ranks + ), - ///我的 VIP等级信息 - MineVipEntry( - tag: "vip", - ranks: ranks, - userInfo: userInfo, - rank: double.tryParse(userInfo?.expendAmount ?? "0") - .toInt(), - rankMax: userInfo?.memberRankVo?.nextOrigin ?? 0, - createTime: userInfo?.createTime ?? "", + ///订单/钱包/会员码/设置 + MineNavbar( + couponNum, + userInfo, + infoNumber, + () { + toIntegralPage(); + }, ), + ///我的 VIP等级信息 + // MineVipEntry( + // tag: "vip", + // ranks: ranks, + // userInfo: userInfo, + // rank: double.tryParse(userInfo?.expendAmount ?? "0") + // .toInt(), + // rankMax: userInfo?.memberRankVo?.nextOrigin ?? 0, + // createTime: userInfo?.createTime ?? "", + // ), + ///我的订单 - MineOrderView(), + // MineOrderView(), ///推广图 spreadImage(), @@ -287,7 +320,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ); }, child: Container( - margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 15.h), + margin: EdgeInsets.only(left: 16.w, right: 16.w, bottom: 30.h), padding: EdgeInsets.only(left: 12.w, top: 12.h, right: 10.w, bottom: 17.h), width: double.infinity, @@ -389,7 +422,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { ///推广图 Widget spreadImage() { return Container( - margin: EdgeInsets.only(right: 14.w, bottom: 15.h, left: 14.w), + margin: EdgeInsets.only(right: 14.w, bottom: 30.h, left: 14.w), child: GestureDetector( onTap: () { Navigator.of(context).pushNamed('/router/invite_friends'); diff --git a/lib/mine/mine_view/community_follow.dart b/lib/mine/mine_view/community_follow.dart index c5a15b18..b0f7acd6 100644 --- a/lib/mine/mine_view/community_follow.dart +++ b/lib/mine/mine_view/community_follow.dart @@ -14,6 +14,11 @@ import 'package:shared_preferences/shared_preferences.dart'; import '../fans_page.dart'; class CommunityFollow extends StatefulWidget { + + final Map arguments; + + CommunityFollow({this.arguments}); + @override State createState() { return _CommunityFollow(); @@ -24,11 +29,13 @@ class _CommunityFollow extends State with SingleTickerProviderStateMixin, AutomaticKeepAliveClientMixin { ApiService apiService; SocialInfo infoNumber; + int status; @override void initState() { super.initState(); querySocialInfo(); + status = widget.arguments["status"]; } ///个人社交信息(粉丝/关注数量/成就数量) @@ -51,6 +58,7 @@ class _CommunityFollow extends State Widget build(BuildContext context) { return DefaultTabController( length: 2, + initialIndex: status, child: Scaffold( appBar: MyAppBar( title: "", diff --git a/lib/mine/mine_view/mine_item.dart b/lib/mine/mine_view/mine_item.dart index 2e897f8c..6a37dc05 100644 --- a/lib/mine/mine_view/mine_item.dart +++ b/lib/mine/mine_view/mine_item.dart @@ -20,7 +20,7 @@ class _MineItem extends State { @override Widget build(BuildContext context) { return Container( - margin: EdgeInsets.fromLTRB(16.w,0.h, 16.w, 15.h), + margin: EdgeInsets.fromLTRB(16.w,0.h, 16.w,30.h), // padding: EdgeInsets.fromLTRB(20.w, 12.h, 20.w, 12.h), decoration: BoxDecoration( color: Colors.white, diff --git a/lib/mine/mine_view/mine_navbar.dart b/lib/mine/mine_view/mine_navbar.dart new file mode 100644 index 00000000..4ebd8359 --- /dev/null +++ b/lib/mine/mine_view/mine_navbar.dart @@ -0,0 +1,301 @@ +import 'package:flutter/cupertino.dart'; +import 'package:flutter/material.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/view_widget/login_tips_dialog.dart'; +import 'package:shared_preferences/shared_preferences.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import '../../retrofit/data/social_info.dart'; +import '../../retrofit/data/user_info.dart'; + +class MineNavbar extends StatefulWidget { + final String couponNum; + final UserInfo userInfo; + final SocialInfo infoNumber; + final GestureTapCallback toIntegralPage; + + MineNavbar(this.couponNum,this.userInfo,this.infoNumber,this.toIntegralPage); + + @override + State createState() { + return _MineNavbar(); + } +} + +class _MineNavbar extends State { + @override + Widget build(BuildContext context) { + return Container( + margin: EdgeInsets.fromLTRB(13.5.w, 15.h, 13.5.w,30.h), + padding: EdgeInsets.only( + top: 26.h, + bottom: 24.h, + ), + decoration: BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.circular(6), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, + ), + ], + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + ///订单 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed( + '/router/order_history_page', + arguments: {"status": 0}); + }); + }, + child: mineTopItem( + S.of(context).dingdan, + "assets/image/mine_order.webp", + ), + ), + ), + + ///钱包 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/mine_wallet'); + }); + }, + child: mineTopItem( + "钱包", + "assets/image/wallet.webp", + ), + ), + ), + + ///会员码 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/vip_pay_code'); + }); + }, + child: mineTopItem( + "会员码", + "assets/image/vip_code.webp", + ), + ), + ), + + ///设置 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/setting_page'); + }); + }, + child: mineTopItem( + S.of(context).shezhi, + "assets/image/set.webp", + ), + ), + ), + ], + ), + Container( + width: double.infinity, + margin: EdgeInsets.only(top:17.h,left: 16.w,right: 16.w,bottom: 27.h), + child: Flex( + children: List.generate(120, (_) { + return SizedBox( + width: 1, + height: 1, + child: DecoratedBox( + decoration: BoxDecoration(color: Color(0xFFEDEDED)), + ), + ); + }), + mainAxisAlignment: MainAxisAlignment.spaceBetween, + direction: Axis.horizontal, + ), + ), + Row( + children: [ + ///优惠券 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/coupon_page'); + }); + }, + child: mineBottomItem( + widget?.couponNum ?? "0", + S.of(context).youhuiquan, + ), + ), + ), + ///积分 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + widget.toIntegralPage(); + }); + }, + child: mineBottomItem( + widget?.userInfo?.points?? "0", + "积分", + ), + ), + ), + ///关注 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/communityFollow',arguments: { + "status":0 + }); + });}, + child: mineBottomItem( + "${widget?.infoNumber?.follow ?? "0"}", + S.of(context).guanzhu, + ), + ), + ), + ///粉丝 + Expanded( + child: InkWell( + onTap: () { + SharedPreferences.getInstance().then((value) { + if (value.getString("token") == null || + value.getString("token") == "") { + LoginTipsDialog().show(context); + return; + } + Navigator.of(context).pushNamed('/router/communityFollow',arguments: { + "status":1 + }); + }); + }, + child: mineBottomItem( + "${widget?.infoNumber?.fans ?? "0"}", + S.of(context).fensi, + ), + ), + ), + ], + ) + ], + ), + ); + } + + ///导航栏条目 + Widget mineTopItem(text, icon) { + return Container( + color: Colors.white, + margin: EdgeInsets.symmetric(vertical: 6.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Image.asset( + icon, + width: 23, + height: 23, + ), + SizedBox( + height: 5.h, + ), + Text( + text, + style: TextStyle( + fontWeight: MyFontWeight.semi_bold, + fontSize: 12.sp, + color: Color(0xFF0D0D0D), + ), + ), + ], + ), + ); + } + + ///导航栏条目 + Widget mineBottomItem(textTop, text) { + return Container( + color: Colors.white, + margin: EdgeInsets.symmetric(vertical: 6.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Text( + textTop, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 18.sp, + color: Color(0xFF000000), + ), + ), + SizedBox( + height:11.h, + ), + Text( + text, + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 12.sp, + color: Color(0xFF4D4D4D), + ), + ), + ], + ), + ); + } +} diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index 81f6fb5b..e0292ffe 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -3,12 +3,9 @@ import 'dart:convert'; import 'package:dio/dio.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; -import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_smart_dialog/flutter_smart_dialog.dart'; -import 'package:flutter_svg/svg.dart'; import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/base_data.dart'; -import 'package:huixiang/retrofit/data/msg_stats.dart'; import 'package:huixiang/retrofit/data/social_info.dart'; import 'package:huixiang/retrofit/data/user_info.dart'; import 'package:huixiang/retrofit/retrofit_api.dart'; @@ -21,7 +18,9 @@ import 'package:huixiang/view_widget/request_permission.dart'; import 'package:huixiang/view_widget/round_button.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:shared_preferences/shared_preferences.dart'; -import 'package:webview_flutter/webview_flutter.dart'; + +import '../../retrofit/data/rank.dart'; +import '../../view_widget/mine_vip_entry.dart'; // import 'package:qrscan/qrscan.dart' as scanner; class MineView extends StatefulWidget { @@ -31,9 +30,10 @@ class MineView extends StatefulWidget { final Function messageZero; final int totalMsg; final SocialInfo infoNumber; + final List ranks; MineView(this.userInfo, this.toUserInfo, this.toIntegralPage, - this.messageZero, this.totalMsg, this.infoNumber); + this.messageZero, this.totalMsg, this.infoNumber,this.ranks); @override State createState() { @@ -43,6 +43,7 @@ class MineView extends StatefulWidget { class _MineView extends State { ApiService apiService; + String levelText = "普通用户"; ///核销用户优惠券 queryWiped(memberCouponId) async { @@ -136,21 +137,21 @@ class _MineView extends State { ), ), ), - InkWell( - onTap: () { - Navigator.of(context).pushNamed('/router/setting_page'); - }, - child: Container( - padding: EdgeInsets.all(8.h), - margin: EdgeInsets.only(right: 12.w), - child: Image.asset( - "assets/image/icon_mine_setting.webp", - width: 32, - height: 32, - color: Colors.white, - ), - ), - ), + // InkWell( + // onTap: () { + // Navigator.of(context).pushNamed('/router/setting_page'); + // }, + // child: Container( + // padding: EdgeInsets.all(8.h), + // margin: EdgeInsets.only(right: 12.w), + // child: Image.asset( + // "assets/image/icon_mine_setting.webp", + // width: 32, + // height: 32, + // color: Colors.white, + // ), + // ), + // ), ], ), ), @@ -215,6 +216,7 @@ class _MineView extends State { ); return; } + String title = uri.queryParameters["title"]; if (result.toString().contains("http:") || result.toString().contains("https:")) { ///扫码跳转任意网页 @@ -222,6 +224,7 @@ class _MineView extends State { '/router/scan_web', arguments: { "result": result, + "title":title, }, ); } @@ -259,21 +262,21 @@ class _MineView extends State { MImage( widget.userInfo == null ? "" : widget.userInfo.headimg, isCircle: true, - width: 58, - height: 58, + width: 60, + height: 60, fit: BoxFit.cover, errorSrc: "assets/image/default_user.webp", fadeSrc: "assets/image/default_user.webp", ), - Positioned( - bottom: 0, - right: 2.w, - child: Image.asset( - "assets/image/icon_mine_edit.webp", - width: 17, - height: 17, - ), - ), + // Positioned( + // bottom: 0, + // right: 2.w, + // child: Image.asset( + // "assets/image/icon_mine_edit.webp", + // width: 17, + // height: 17, + // ), + // ), ], ), ), @@ -336,34 +339,35 @@ class _MineView extends State { color: Color(0xFFFFFFFF), ), ) - : Row( - children: [ - Text( - "${S.of(context).guanzhu} ${widget?.infoNumber?.follow ?? "0"}", - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - fontFamily: 'JDZhengHT', - color: Color(0xFFFFFFFF), - ), - ), - Container( - width: 1.w, - height: 12.h, - margin: EdgeInsets.symmetric(horizontal: 3.w), - color: Color(0xFFFFFFFF), - ), - Text( - "${S.of(context).fensi} ${widget?.infoNumber?.fans ?? "0"}", - style: TextStyle( - fontSize: 12.sp, - fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), - ), - ), - ], - ), + : mineVip(), + // Row( + // children: [ + // Text( + // "${S.of(context).guanzhu} ${widget?.infoNumber?.follow ?? "0"}", + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.regular, + // fontFamily: 'JDZhengHT', + // color: Color(0xFFFFFFFF), + // ), + // ), + // Container( + // width: 1.w, + // height: 12.h, + // margin: EdgeInsets.symmetric(horizontal: 3.w), + // color: Color(0xFFFFFFFF), + // ), + // Text( + // "${S.of(context).fensi} ${widget?.infoNumber?.fans ?? "0"}", + // style: TextStyle( + // fontSize: 12.sp, + // fontFamily: 'JDZhengHT', + // fontWeight: MyFontWeight.regular, + // color: Color(0xFFFFFFFF), + // ), + // ), + // ], + // ), ], ), ), @@ -421,4 +425,19 @@ class _MineView extends State { ), ); } + + Widget mineVip(){ + return Container( + child: MineVipEntry( + tag: "vip", + ranks: widget.ranks, + userInfo: widget.userInfo, + rank: double.tryParse(widget.userInfo?.expendAmount ?? "0") + .toInt(), + rankMax: widget.userInfo?.memberRankVo?.nextOrigin ?? 0, + createTime: widget.userInfo?.createTime ?? "", + ), + ); + + } } diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index bde4cf32..4d07ff91 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -320,330 +320,333 @@ class _PersonalPage extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { - return SmartRefresher( - controller: refreshController, - enablePullDown: true, - enablePullUp: true, - header: MyHeader(), - footer: CustomFooter( - builder: (context, mode) { - return MyFooter(mode); - }, - ), - onRefresh: _onRefresh, - onLoading: () { - isLoadMore = true; - setState(() { - _onRefresh(); - }); - }, - physics: BouncingScrollPhysics(), - scrollController: scrollController, - child: SingleChildScrollView( + return Scaffold( + backgroundColor: Colors.white, + body:SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: true, + header: MyHeader(), + footer: CustomFooter( + builder: (context, mode) { + return MyFooter(mode); + }, + ), + onRefresh: _onRefresh, + onLoading: () { + isLoadMore = true; + setState(() { + _onRefresh(); + }); + }, physics: BouncingScrollPhysics(), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - height: 248.h, - color: Color(0xFFFFFFFF), - // color: Colors.red, - child: Stack( - // alignment: Alignment.bottomLeft, - children: [ - Positioned( - top: 0, - left: 0, - bottom: 36.h, - right: 0, - child: Stack( - alignment: Alignment.bottomRight, - children: [ - Container( - color: Colors.black, - child: Opacity( - opacity: 0.9, - child: MImage( - memberInfor?.background ?? "", - width: double.infinity, - height: 260.h, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.webp", - fadeSrc: "assets/image/default_1.webp", - ))), - Container( - margin: EdgeInsets.only( - top: 50.h, left: 16.w, right: 16.w), - alignment: Alignment.topLeft, - decoration: BoxDecoration( - color: Colors.transparent, - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - crossAxisAlignment: CrossAxisAlignment.center, - children: [ - GestureDetector( - child: Image.asset( - "assets/image/integral_return.webp", - width: 24, - height: 24, - ), - onTap: () { - Navigator.of(context).pop(); - }, + scrollController: scrollController, + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + height: 248.h, + color: Color(0xFFFFFFFF), + // color: Colors.red, + child: Stack( + // alignment: Alignment.bottomLeft, + children: [ + Positioned( + top: 0, + left: 0, + bottom: 36.h, + right: 0, + child: Stack( + alignment: Alignment.bottomRight, + children: [ + Container( + color: Colors.black, + child: Opacity( + opacity: 0.9, + child: MImage( + memberInfor?.background ?? "", + width: double.infinity, + height: 260.h, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ))), + Container( + margin: EdgeInsets.only( + top: 50.h, left: 16.w, right: 16.w), + alignment: Alignment.topLeft, + decoration: BoxDecoration( + color: Colors.transparent, ), - ], - ), - ), - if (memberId == "0") - Positioned( - bottom: 9.h, - right: 16.w, - child: GestureDetector( - onTap: () { - showImagePicker(); - }, - child: Container( - padding: EdgeInsets.only(left: 2, right: 2), - width: 59.w, - height: 23.h, - alignment: Alignment.center, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(2), - color: Color(0x80000000), - ), - child: Text( - S.of(context).genghuanbeijing, - overflow: TextOverflow.ellipsis, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - color: Color(0xFFFFFFFF), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + child: Image.asset( + "assets/image/integral_return.webp", + width: 24, + height: 24, + ), + onTap: () { + Navigator.of(context).pop(); + }, ), - ), + ], ), ), - ), - ], - ), - ), - homeInfo(), - ], - ), - ), - Container( - color: Color(0xFFFFFFFF), - margin: EdgeInsets.only(bottom: 30.h), - child: Column( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Container( - margin: - EdgeInsets.only(left: 86.w, top: 12.h, right: 16.w), - child: GestureDetector( - onTap: () { - setState(() { - isShrink = !isShrink; - }); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.end, - children: [ - Expanded( - flex: 1, - child: Text( - memberId == "0" - ? ((memberInfor?.signature == "") - ? "还未编辑个性签名~" - : memberInfor?.signature ?? "") - : "个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? ""}", - overflow: isShrink - ? TextOverflow.visible - : TextOverflow.ellipsis, - maxLines: isShrink ? 10 : 2, - style: TextStyle( - fontSize: 12.sp, - color: Color(0xFF868686), - fontWeight: MyFontWeight.regular, - height: 1.5.h), - )), - Icon( - (isShrink != null && !isShrink) - ? Icons.chevron_right - : Icons.keyboard_arrow_up, - color: Colors.black, - size: 18, - ), - ], - ), - )), - Container( - margin: EdgeInsets.only(left: 16.w, right: 16.w), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null - ? memberInfor.follow.toString() - : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4.h, - ), - Text( - S.of(context).guanzhu, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - memberInfor != null - ? memberInfor.fans.toString() - : "0", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4.h, - ), - Text( - S.of(context).fensi, - style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - )), - ), - ), - Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.trendTotal ?? 0) - .toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - ), + if (memberId == "0") + Positioned( + bottom: 9.h, + right: 16.w, + child: GestureDetector( + onTap: () { + showImagePicker(); + }, + child: Container( + padding: EdgeInsets.only(left: 2, right: 2), + width: 59.w, + height: 23.h, + alignment: Alignment.center, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(2), + color: Color(0x80000000), ), - SizedBox( - height: 4.h, - ), - Text( - S.of(context).dongtai, + child: Text( + S.of(context).genghuanbeijing, + overflow: TextOverflow.ellipsis, style: TextStyle( - color: Color(0xFF353535), fontSize: 12.sp, fontWeight: MyFontWeight.regular, + color: Color(0xFFFFFFFF), ), ), - ], - )), - ), + ), + ), + ), + ], ), - Expanded( + ), + homeInfo(), + ], + ), + ), + Container( + color: Color(0xFFFFFFFF), + margin: EdgeInsets.only(bottom: 30.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Container( + margin: + EdgeInsets.only(left: 86.w, top: 12.h, right: 16.w), child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () {}, - child: Container( - color: Colors.transparent, - padding: EdgeInsets.all(16), - child: Column( - children: [ - Text( - (memberInfor?.gainLikeTotal ?? 0) - .toString(), - style: TextStyle( - color: Color(0xFF353535), - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - ), - ), - SizedBox( - height: 4.h, - ), - Text( - S.of(context).huozan, + onTap: () { + setState(() { + isShrink = !isShrink; + }); + }, + child: Row( + mainAxisAlignment: MainAxisAlignment.start, + crossAxisAlignment: CrossAxisAlignment.end, + children: [ + Expanded( + flex: 1, + child: Text( + memberId == "0" + ? ((memberInfor?.signature == "") + ? "还未编辑个性签名~" + : memberInfor?.signature ?? "") + : "个性签名: ${(memberInfor?.signature == "") ? "还未编辑个性签名~" : memberInfor?.signature ?? ""}", + overflow: isShrink + ? TextOverflow.visible + : TextOverflow.ellipsis, + maxLines: isShrink ? 10 : 2, style: TextStyle( - color: Color(0xFF353535), - fontSize: 12.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - )), - ), + fontSize: 12.sp, + color: Color(0xFF868686), + fontWeight: MyFontWeight.regular, + height: 1.5.h), + )), + Icon( + (isShrink != null && !isShrink) + ? Icons.chevron_right + : Icons.keyboard_arrow_up, + color: Colors.black, + size: 18, + ), + ], + ), + )), + Container( + margin: EdgeInsets.only(left: 16.w, right: 16.w), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.follow.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4.h, + ), + Text( + S.of(context).guanzhu, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + memberInfor != null + ? memberInfor.fans.toString() + : "0", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4.h, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.trendTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4.h, + ), + Text( + S.of(context).dongtai, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () {}, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + (memberInfor?.gainLikeTotal ?? 0) + .toString(), + style: TextStyle( + color: Color(0xFF353535), + fontSize: 16.sp, + fontWeight: MyFontWeight.semi_bold, + ), + ), + SizedBox( + height: 4.h, + ), + Text( + S.of(context).huozan, + style: TextStyle( + color: Color(0xFF353535), + fontSize: 12.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), + ), + ), + ], ), - ], - ), - ), - Container( - margin: EdgeInsets.all(16), - height: 1.h, - color: Color(0xFFF7F7F7), + ), + Container( + margin: EdgeInsets.all(16), + height: 1.h, + color: Color(0xFFF7F7F7), + ), + Padding( + padding: EdgeInsets.only(left: 16.w), + child: Text( + memberId != "0" ? "TA的动态" : "我的动态", + style: TextStyle( + color: Color(0xFF353535), + fontSize: 15.sp, + fontWeight: MyFontWeight.semi_bold, + ), + )), + dynamicList(), + ], ), - Padding( - padding: EdgeInsets.only(left: 16.w), - child: Text( - memberId != "0" ? "TA的动态" : "我的动态", - style: TextStyle( - color: Color(0xFF353535), - fontSize: 15.sp, - fontWeight: MyFontWeight.semi_bold, - ), - )), - dynamicList(), - ], - ), - ), - ], - )), + ), + ], + )), + ) ); } @@ -670,7 +673,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { builder: (context) => PhotoViewGalleryScreen( images: [ (memberInfor?.headimg ?? "").isEmpty - ? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg" + ? "https://i.postimg.cc/Pq6vjfnw/default-1.webp" : memberInfor?.headimg ], //传入图片list index: 0, //传入当前点击的图片的index @@ -749,7 +752,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { isShowBtn: false, text: "目前暂无发布动态,要把开心的事讲出来哦~", fontSize: 16.sp, - margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom: 75.h), + margin: EdgeInsets.only(left: 60.w, right: 60.w, bottom:80.h), ) : ListView.builder( physics: NeverScrollableScrollPhysics(), diff --git a/lib/mine/scan_web.dart b/lib/mine/scan_web.dart index c54e6a66..b738be34 100644 --- a/lib/mine/scan_web.dart +++ b/lib/mine/scan_web.dart @@ -1,12 +1,8 @@ -import 'dart:io'; - import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:huixiang/generated/l10n.dart'; -import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/view_widget/my_appbar.dart'; -import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:webview_flutter/webview_flutter.dart'; class ScanWeb extends StatefulWidget { @@ -21,29 +17,42 @@ class ScanWeb extends StatefulWidget { class _ScanWeb extends State { var controller = new ScrollController(); + WebViewController webViewController; String result; + String title; @override void initState() { super.initState(); result = widget.arguments["result"]; + title = widget.arguments["title"]; EasyLoading.show(status: S.current.zhengzaijiazai); } @override Widget build(BuildContext context) { - return Container( - margin: EdgeInsets.only(top:MediaQuery.of(context).padding.top), - width: MediaQuery.of(context).size.width, - height: MediaQuery.of(context).size.height, - alignment: Alignment.center, - child: - WebView( - initialUrl:result, - javascriptMode: JavascriptMode.unrestricted, - onPageFinished: (initialUrl){ - EasyLoading.dismiss(); - }, - )); + return Scaffold( + appBar: MyAppBar( + title:title ?? "", + titleColor: Colors.black, + background: Colors.transparent, + leadingColor: Colors.black, + ), + body: + WebView( + initialUrl:result, + javascriptMode: JavascriptMode.unrestricted, + onWebViewCreated: (WebViewController controller){ + webViewController =controller; + }, + onProgress: (int progress) async { + if(widget.arguments["title"] != null) + return; + title = await webViewController?.getTitle(); + setState((){}); + EasyLoading.dismiss(); + }, + ), + ); } } diff --git a/lib/mine/vip_pay_code.dart b/lib/mine/vip_pay_code.dart new file mode 100644 index 00000000..63f18fe4 --- /dev/null +++ b/lib/mine/vip_pay_code.dart @@ -0,0 +1,253 @@ +import 'dart:convert'; + +import 'package:barcode_widget/barcode_widget.dart'; +import 'package:dio/dio.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_bmflocation/flutter_bmflocation.dart'; +import 'package:flutter_easyloading/flutter_easyloading.dart'; +import 'package:huixiang/generated/l10n.dart'; +import 'package:huixiang/retrofit/data/base_data.dart'; +import 'package:huixiang/retrofit/data/product.dart'; +import 'package:huixiang/retrofit/data/vip_card.dart'; +import 'package:huixiang/retrofit/retrofit_api.dart'; +import 'package:huixiang/store/scan.dart'; +import 'package:huixiang/utils/font_weight.dart'; +import 'package:huixiang/utils/location.dart'; +import 'package:huixiang/utils/painter_bg.dart'; +import 'package:huixiang/view_widget/custom_image.dart'; +import 'package:huixiang/view_widget/my_appbar.dart'; +import 'package:huixiang/view_widget/my_footer.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:pull_to_refresh/pull_to_refresh.dart'; +import 'package:qr_flutter/qr_flutter.dart'; +import 'package:shared_preferences/shared_preferences.dart'; + +import '../retrofit/data/user_info.dart'; +import '../view_widget/classic_header.dart'; + +class VipPayCode extends StatefulWidget { + @override + State createState() { + return _VipPayCode(); + } +} + +class _VipPayCode extends State { + ApiService apiService; + + @override + void dispose() { + super.dispose(); + refreshController.dispose(); + Location.getInstance().stopLocation(); + } + + @override + void initState() { + super.initState(); + queryUser(); + } + + UserInfo userInfo; + final RefreshController refreshController = RefreshController(); + bool vipCodeText = false; + + ///查询用户信息 + queryUser() async { + try{ + SharedPreferences value = await SharedPreferences.getInstance(); + if (apiService == null) + apiService = ApiService( + Dio(), + context: context, + token: value.getString("token"), + ); + BaseData baseData = + await apiService.queryInfo().catchError((onError) { + refreshController.refreshFailed();}); + if (baseData != null && baseData.isSuccess) { + userInfo = baseData.data; + setState(() {}); + SharedPreferences.getInstance().then((value) => { + value.setString('user', jsonEncode(baseData.data)), + }); + refreshController.refreshCompleted(); + }else{ + refreshController.refreshFailed(); + } + }finally{ + setState((){}); + } + } + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: MyAppBar( + title: "会员码", + background: Colors.white, + titleColor: Colors.black, + brightness: Brightness.dark, + leadingColor: Colors.black, + ), + body: SmartRefresher( + controller: refreshController, + enablePullDown: true, + enablePullUp: false, + header: MyHeader(), + physics: BouncingScrollPhysics(), + onRefresh: () { + queryUser(); + }, + child: SingleChildScrollView( + child: Container( + color: Colors.white, + padding: EdgeInsets.only(top: 45.h), + child: Stack( + alignment: Alignment.topCenter, + children: [ + Container( + padding: EdgeInsets.only(top: 50.h), + child: Container( + width: double.infinity, + margin: EdgeInsets.symmetric(horizontal: 14.w), + padding: EdgeInsets.only(top: 68.h, bottom: 16.h), + decoration: BoxDecoration( + color: Color(0xFF32A060), + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), + ), + child: Container( + width: double.infinity, + decoration: BoxDecoration( + color: Colors.white, + boxShadow: [ + BoxShadow( + color: Colors.black.withAlpha(12), + offset: Offset(0, 2), + blurRadius: 14, + spreadRadius: 0, + ), + ], + borderRadius: BorderRadius.circular(6), + ), + margin: EdgeInsets.symmetric(horizontal: 16.w), + padding: EdgeInsets.only( + top: 46.h, left:16.w, right: 15.w, bottom: 79.h), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + onTap: (){ + setState(() { + vipCodeText = !vipCodeText; + }); + }, + child: + vipCodeText ? Text( + userInfo != null + ? "${(userInfo?.vipNo ?? "").substring(0, 4)} " + "${(userInfo?.vipNo ?? "").substring(4, 8)} " + "${(userInfo?.vipNo ?? "").substring(8, 12)} " + "${(userInfo?.vipNo ?? "").substring(12, 16)} " + "${(userInfo?.vipNo ?? "").substring(16, (userInfo?.vipNo ?? "").length)}" + : "", + style: TextStyle( + fontSize: 14.sp, + wordSpacing: userInfo == null + ? 10 + : (MediaQuery.of(context).size.width - 64.w) / + ((((userInfo?.vipNo ?? "") + .length) * + 4)), + letterSpacing: userInfo == null + ? 8 + : (MediaQuery.of(context).size.width - 64.w) / + ((((userInfo?.vipNo ?? "") + .length) * + 4)), + fontWeight: MyFontWeight.semi_bold, + color: Color(0xFF353535), + ), + ) + :Text( + "轻触可查看会员码数字", + style: TextStyle( + fontWeight: MyFontWeight.medium, + fontSize: 13.sp, + color: Color(0xFFCACACA), + ), + ), + ), + SizedBox( + height: 12.h, + ), + BarcodeWidget( + barcode: Barcode.code128(useCode128C: true), + data: + userInfo != null ? userInfo?.vipNo : "", + height: 72.h, + color: Colors.black, + drawText: false, + ), + SizedBox( + height: 16.h, + ), + QrImage( + data: userInfo != null + ? (userInfo?.vipNo ?? "") + : "", + version: QrVersions.auto, + size: 200.w, + gapless: true, + ), + ], + ), + ), + ), + ), + Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(56), + color: Colors.white, + border: Border.all( + color: Colors.white, + width: 8.w, + ), + ), + child: Container( + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(56), + color: Colors.white, + border: Border.all( + color: Color(0xFF32A060), + width: 2.w, + ), + ), + child: MImage( + userInfo?.headimg ?? "", + width: 80, + height: 80, + radius: BorderRadius.circular(56), + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.webp", + fadeSrc: "assets/image/default_1.webp", + ), + ), + ), + ], + ), + ), + ), + ), + ); + } +} diff --git a/lib/order/exchange_order_page.dart b/lib/order/exchange_order_page.dart index d65341fa..2d348dba 100644 --- a/lib/order/exchange_order_page.dart +++ b/lib/order/exchange_order_page.dart @@ -878,7 +878,7 @@ class _ExchangeOrderPage extends State { width: 10, ), Text( - S.of(context).pingtaiyue, + S.of(context).huixiangqianbao, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), diff --git a/lib/order/order_detail_page.dart b/lib/order/order_detail_page.dart index 260099c0..eb37b90a 100644 --- a/lib/order/order_detail_page.dart +++ b/lib/order/order_detail_page.dart @@ -225,7 +225,7 @@ class _OrderDetailPage extends State { payResult(BaseData baseData) async{ await queryDetails(); - Future.delayed(Duration(milliseconds: 400), () { + Future.delayed(Duration(milliseconds: 800), () { EasyLoading.dismiss(); SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center); }); diff --git a/lib/qr/qr_code_scan.dart b/lib/qr/qr_code_scan.dart index c575652d..9376b6a1 100644 --- a/lib/qr/qr_code_scan.dart +++ b/lib/qr/qr_code_scan.dart @@ -57,31 +57,81 @@ class _QrCodeScanPage extends State { right: 0, ), Positioned( - child: MyAppBar( - title: "扫码", - titleColor: Colors.white, - leadingColor: Colors.white, - brightness: Brightness.dark, - background: Colors.transparent, - action: Container( - alignment: Alignment.center, - margin: EdgeInsets.only(right: 16.w), - child: GestureDetector( - onTap: () { - pickImage(); - }, - child: Text( - S.of(context).xiangce, + child: Container( + margin: EdgeInsets.only(left:12.w,right: 16.w,top: 16.h), + child:Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: (){ + Navigator.of(context).pop(); + }, + child: Container( + padding: EdgeInsets.symmetric(horizontal:10.w), + alignment: Alignment.centerLeft, + child: Image.asset( + "assets/image/return_left.webp", + fit: BoxFit.fill, + color: Colors.white, + ), + ), + ), + Spacer(), + Expanded(child:Text( + S.of(context).saoma, style: TextStyle( - color: Colors.black, + color: Colors.white, fontSize: 18.sp, fontWeight: FontWeight.bold, ), + )), + GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + pickImage(); + }, + child:Container( + padding: EdgeInsets.symmetric(horizontal:10.w), + child: Text( + S.of(context).xiangce, + style: TextStyle( + color: Colors.black, + fontSize: 18.sp, + fontWeight: FontWeight.bold, + ), + ), + ), ), - ), + ], ), ), - top: 0, + // MyAppBar( + // title: "扫码", + // titleColor: Colors.white, + // leadingColor: Colors.white, + // brightness: Brightness.dark, + // background: Colors.transparent, + // action: Container( + // alignment: Alignment.center, + // margin: EdgeInsets.only(right: 16.w), + // child: GestureDetector( + // onTap: () { + // pickImage(); + // }, + // child: Text( + // S.of(context).xiangce, + // style: TextStyle( + // color: Colors.black, + // fontSize: 18.sp, + // fontWeight: FontWeight.bold, + // ), + // ), + // ), + // ), + // ), + top:MediaQuery.of(context).padding.top, left: 0, right: 0, ), diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index 1308a39d..f7e60731 100644 --- a/lib/retrofit/min_api.dart +++ b/lib/retrofit/min_api.dart @@ -26,7 +26,7 @@ import 'data/shopping_home_config.dart'; part 'min_api.g.dart'; -const localBaseUrl = "https://pos.api.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8765/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.api.lotus-wallet.com/app/";///线上 diff --git a/lib/retrofit/retrofit_api.dart b/lib/retrofit/retrofit_api.dart index c1b9a541..06429ed5 100644 --- a/lib/retrofit/retrofit_api.dart +++ b/lib/retrofit/retrofit_api.dart @@ -64,7 +64,7 @@ import 'data/wx_pay.dart'; part 'retrofit_api.g.dart'; -const localBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///本地 +const localBaseUrl = "http://192.168.10.78:8766/app/";///本地 // const localBaseUrl = "https://2946-27-19-77-115.jp.ngrok.io/app/";///本地 const serviceBaseUrl = "https://pos.platform.lotus-wallet.com/app/";///线上 diff --git a/lib/setting/logout_ing.dart b/lib/setting/logout_ing.dart index 243f784d..f097aea4 100644 --- a/lib/setting/logout_ing.dart +++ b/lib/setting/logout_ing.dart @@ -422,7 +422,7 @@ class _LogoutIng extends State { Padding( padding: EdgeInsets.only(bottom: 13), child: Text( - (balance == "0.00" && money == "0.00") ? "由于当于帐号已注销,系统将自动退出登录":"您的平台余额及店铺余额未使用完!", + (balance == "0.00" && money == "0.00") ? "由于当于帐号已注销,系统将自动退出登录":"您的回乡钱包余额及门店余额未使用完!", textAlign: TextAlign.center, style: TextStyle( fontSize: 16.sp, @@ -434,7 +434,7 @@ class _LogoutIng extends State { ), if(balance != "0.00" && money != "0.00" || balance != "0.00" || money != "0.00") Text( - "${S.of(context).pingtaiyue}:¥ $money", + "${S.of(context).huixiangqianbao}:¥ $money", textAlign: TextAlign.center, style: TextStyle( fontSize: 16.sp, @@ -444,7 +444,7 @@ class _LogoutIng extends State { ), if(balance != "0.00" && money != "0.00" || balance != "0.00" || money != "0.00") Text( - "${S.of(context).dianpuyue}:¥ $balance", + "${S.of(context).mendianyue}:¥ $balance", textAlign: TextAlign.center, style: TextStyle( fontSize: 16.sp, diff --git a/lib/settlement/settlement.dart b/lib/settlement/settlement.dart index 463b5186..830c108f 100644 --- a/lib/settlement/settlement.dart +++ b/lib/settlement/settlement.dart @@ -82,7 +82,7 @@ class _Settlement extends State { int count1 = 0; String productId; bool orderButton = false; - bool useVipPriceSelect = false; + bool useVipPriceSelect = true; bool showVipTips = false; bool isRaiseChannel = false; diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index ece002da..73a5caa6 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -47,7 +47,7 @@ class ActivityCouponRemarks extends StatefulWidget { } class _ActivityCouponRemarks extends State { - bool vipSelect = false; + bool vipSelect = true; @override Widget build(BuildContext context) { @@ -76,7 +76,7 @@ class _ActivityCouponRemarks extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, crossAxisAlignment: CrossAxisAlignment.center, children: [ - if(!(widget?.settleOrderInfo?.isRaise ?? false)) + if(!(widget?.settleOrderInfo?.isRaise ?? false) && (widget?.settleOrderInfo?.memberVO?.isVip ?? false)) Row( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/settlement/settlement_view/settlement_order_commodity.dart b/lib/settlement/settlement_view/settlement_order_commodity.dart index 552dbd9e..fa7a2ee1 100644 --- a/lib/settlement/settlement_view/settlement_order_commodity.dart +++ b/lib/settlement/settlement_view/settlement_order_commodity.dart @@ -105,7 +105,7 @@ class _SettlementOrderCommodity extends State { ); } - if(widget.useVipPriceSelect ){ + if(widget.useVipPriceSelect && widget.settleOrderInfo.memberVO.isVip && (!widget.settleOrderInfo.isRaise) && (widget?.settleOrderInfo?.discountAmount!= "0")){ widgets.add(vipItem(Color(0xFFFF7A1A), "VIP优惠", widget?.settleOrderInfo?.discountAmount ?? "")); } diff --git a/lib/view_widget/mine_vip_entry.dart b/lib/view_widget/mine_vip_entry.dart index 88f3edd3..2c6ae5a0 100644 --- a/lib/view_widget/mine_vip_entry.dart +++ b/lib/view_widget/mine_vip_entry.dart @@ -32,6 +32,9 @@ class MineVipEntry extends StatelessWidget { String topLeft = ""; String levelText = "普通用户"; + Color logoColor = Color(0xFFCACACA); + Color levelTextColor = Color(0xFFCACACA); + Color levelTextBackdrop = Color(0xFFFFF8EC); @override Widget build(BuildContext context) { @@ -54,109 +57,184 @@ class MineVipEntry extends StatelessWidget { case 1: { levelText = "${S.of(context).yinkahuiyuan}"; + logoColor = Color(0xFFA0C4E7); + levelTextColor = Color(0xFF61ABF3); + levelTextBackdrop = Color(0xFFC1DBF4); break; } case 2: { levelText = "${S.of(context).jinkahuiyuan}"; + logoColor = Color(0xFFFBB43A); + levelTextColor = Color(0xFFFBB43A); + levelTextBackdrop = Color(0xFFFFECD2); break; } case 3: { levelText = "${S.of(context).gongchuanghuiyuan}"; + logoColor = Color(0xFF352822); + levelTextColor = Color(0xFF92755D); + levelTextBackdrop = Color(0xFFFFECD2); break; } } Widget widget = Container( - width: double.infinity, - padding: EdgeInsets.only(top: 12.h, bottom: 22.h, left: 12.w, right: 12.w), - margin: EdgeInsets.only(top: 23.h,left: 13.5.w,right: 13.5.w,bottom:15.h), - decoration: BoxDecoration( - color: Color(0xFF3D3D5D), - borderRadius: BorderRadius.circular(6), - boxShadow: [ - BoxShadow( - color: Colors.black.withAlpha(12), - offset: Offset(0, 3), - blurRadius: 14, - spreadRadius: 0, - ) - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.start, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - Row( - children: [ - Image.asset( - "assets/image/vip_logo.webp", - width: 24, - height: 24, - ), - SizedBox( - width: 5.w, + child: Row( + children: [ + Container( + padding: EdgeInsets.symmetric(horizontal:4.w,vertical: 3.h), + decoration: BoxDecoration( + color: logoColor, + borderRadius: BorderRadius.only( + topLeft: Radius.circular(4), + bottomLeft: Radius.circular(4),), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, ), - Expanded( - child: Text( - levelText, - style: TextStyle( - fontSize: 16.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFFFFEAD2)), - )), - Container( - padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), - decoration: BoxDecoration( - color: Color(0xFFFFECD2), - borderRadius: BorderRadius.circular(10), - ), - child: Text( - S.of(context).chakanquanyi, - style: TextStyle( - fontSize: 12.sp, - fontWeight: MyFontWeight.semi_bold, - color: Color(0xFF92755D), - ), - ), - ) ], ), - SizedBox( - height: 16.h, + child: Image.asset( + "assets/image/mine_vip_logo.webp", + fit: BoxFit.cover, + width: 13.w, + height: 11.h, ), - Container( - height: 4.h, - child: ClipRRect( - borderRadius: BorderRadius.circular(6.5), - child: LinearProgressIndicator( - value: rankMax > (rank ?? 0) - ? ((vipLevel < curLevel) - ? rankMax / rankMax - : (rank ?? 0) / rankMax) - : 0, - backgroundColor: Color(0xFF222233), - color: Color(0xFFFFECD2), + ), + Container( + padding: EdgeInsets.symmetric(horizontal:2.w,vertical:3.h), + decoration: BoxDecoration( + color: levelTextBackdrop, + borderRadius: BorderRadius.only( + topRight: Radius.circular(4), + bottomRight: Radius.circular(4),), + boxShadow: [ + BoxShadow( + color: Color(0x08213303).withAlpha(12), + offset: Offset(0, 2), + blurRadius: 4, + spreadRadius: 0, ), - ), + ], ), - SizedBox( - height: 8.h, + child:Row( + children: [ + Text( + levelText, + textAlign: TextAlign.center, + style: TextStyle( + color: levelTextColor, + fontSize: 10.sp, + fontWeight: MyFontWeight.regular, + ), + ), + Image.asset( + "assets/image/icon_right.webp", + fit: BoxFit.cover, + width: 8.w, + height: 8.h, + color: levelTextColor, + ), + ], ), - Text( - rank > rankMax - ? S.of(context).dangqiandengji - : "消费金额¥${rank.toStringAsFixed(2).toString()} 距${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}", - style: TextStyle( - color: Color(0xFFFFEAD2), - fontWeight: MyFontWeight.light, - fontFamily: 'JDZhengHT', - fontSize: 14.sp, - ), - ) - ], - )); + ) + ], + ), + ); + // Container( + // width: double.infinity, + // padding: EdgeInsets.only(top: 12.h, bottom: 22.h, left: 12.w, right: 12.w), + // margin: EdgeInsets.only(top: 23.h,left: 13.5.w,right: 13.5.w,bottom:15.h), + // decoration: BoxDecoration( + // color: Color(0xFF3D3D5D), + // borderRadius: BorderRadius.circular(6), + // boxShadow: [ + // BoxShadow( + // color: Colors.black.withAlpha(12), + // offset: Offset(0, 3), + // blurRadius: 14, + // spreadRadius: 0, + // ) + // ], + // ), + // child: Column( + // mainAxisAlignment: MainAxisAlignment.start, + // crossAxisAlignment: CrossAxisAlignment.start, + // children: [ + // Row( + // children: [ + // Image.asset( + // "assets/image/vip_logo.webp", + // width: 24, + // height: 24, + // ), + // SizedBox( + // width: 5.w, + // ), + // Expanded( + // child: Text( + // levelText, + // style: TextStyle( + // fontSize: 16.sp, + // fontWeight: MyFontWeight.semi_bold, + // color: Color(0xFFFFEAD2)), + // )), + // Container( + // padding: EdgeInsets.fromLTRB(9.w, 4.h, 8.w, 4.h), + // decoration: BoxDecoration( + // color: Color(0xFFFFECD2), + // borderRadius: BorderRadius.circular(10), + // ), + // child: Text( + // S.of(context).chakanquanyi, + // style: TextStyle( + // fontSize: 12.sp, + // fontWeight: MyFontWeight.semi_bold, + // color: Color(0xFF92755D), + // ), + // ), + // ) + // ], + // ), + // SizedBox( + // height: 16.h, + // ), + // Container( + // height: 4.h, + // child: ClipRRect( + // borderRadius: BorderRadius.circular(6.5), + // child: LinearProgressIndicator( + // value: rankMax > (rank ?? 0) + // ? ((vipLevel < curLevel) + // ? rankMax / rankMax + // : (rank ?? 0) / rankMax) + // : 0, + // backgroundColor: Color(0xFF222233), + // color: Color(0xFFFFECD2), + // ), + // ), + // ), + // SizedBox( + // height: 8.h, + // ), + // Text( + // rank > rankMax + // ? S.of(context).dangqiandengji + // : "消费金额¥${rank.toStringAsFixed(2).toString()} 距${S.of(context).xiayidengji}还需¥${(rankMax - (rank ?? 0)).toStringAsFixed(2)}", + // style: TextStyle( + // color: Color(0xFFFFEAD2), + // fontWeight: MyFontWeight.light, + // fontFamily: 'JDZhengHT', + // fontSize: 14.sp, + // ), + // ) + // ], + // )); return GestureDetector( onTap: () { diff --git a/lib/view_widget/update_dialog.dart b/lib/view_widget/update_dialog.dart index 8c951cf1..2aaad41d 100644 --- a/lib/view_widget/update_dialog.dart +++ b/lib/view_widget/update_dialog.dart @@ -43,17 +43,12 @@ class _UpdateDialog extends State { alignment: Alignment.bottomCenter, children: [ Container( - // height: 100.h, decoration: BoxDecoration( color: Colors.white, border: Border.all( color: Colors.white, width: 0, style: BorderStyle.solid), - // borderRadius: BorderRadius.only( - // topLeft: Radius.circular(8.r), - // topRight: Radius.circular(8.r), - // ), ), ), Image.asset( diff --git a/lib/vip/vip_view/vip_top.dart b/lib/vip/vip_view/vip_top.dart index b7b05e97..74fd97ff 100644 --- a/lib/vip/vip_view/vip_top.dart +++ b/lib/vip/vip_view/vip_top.dart @@ -717,7 +717,8 @@ class _VipTop extends State { topLeft: const Radius.circular(8.0), topRight: const Radius.circular(8.0))), child: Container( - height: 230.h, + // height: 230.h, + height: 160.h, child: Column( mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/web/web_page.dart b/lib/web/web_page.dart index 9a6ef32b..aa53cb2a 100644 --- a/lib/web/web_page.dart +++ b/lib/web/web_page.dart @@ -51,11 +51,17 @@ class _WebPage extends State with WidgetsBindingObserver { final GlobalKey inputKey = GlobalKey(); final ScrollController scrollController = ScrollController(); final TextEditingController commentTextController = TextEditingController(); + bool emojiShowing = false; + static double keyboard_height=300; + double keyboard = -1; + bool needShowSmiley = false; + bool needHideSmiley = false; @override void initState() { super.initState(); WidgetsBinding.instance.addObserver(this); + commentFocus.addListener(_focusNodeListener); if (Platform.isAndroid) WebView.platform = SurfaceAndroidWebView(); queryHtml(); @@ -69,6 +75,7 @@ class _WebPage extends State with WidgetsBindingObserver { if (MediaQuery.of(context).viewInsets.bottom == 0) { if (isKeyBoardShow) { FocusScope.of(context).requestFocus(FocusNode()); + if(!emojiShowing) setState(() { hintText = S.current.liuxianinjingcaidepinglunba; isKeyBoardShow = false; @@ -80,11 +87,50 @@ class _WebPage extends State with WidgetsBindingObserver { }); } }); + if (needShowSmiley && window.viewInsets.bottom <= 0.1) { + needShowSmiley = false; + setState(() { + emojiShowing = true; + }); + } + if(needHideSmiley && window.viewInsets.bottom > 0.1) { + needHideSmiley = false; + setState(() { + emojiShowing = false; + }); + } + } + + void _focusNodeListener() { + /*if (_focusNode.hasFocus || _focusNode.consumeKeyboardToken()){ + setState(() { + smileyPadGone = true; + }); + }*/ + } + + _onTextFieldTap() { + if(emojiShowing) { + needHideSmiley = true; + } + } + + _onSmileyTap() { + if(!emojiShowing && commentFocus.hasFocus && isKeyBoardShow) { + needShowSmiley = true; + commentFocus.unfocus(); + } else { + setState(() { + emojiShowing = !emojiShowing; + isKeyBoardShow = emojiShowing; + }); + } } @override - void dispose() { + void dispose(){ WidgetsBinding.instance.removeObserver(this); + commentFocus.removeListener(_focusNodeListener); super.dispose(); } @@ -218,10 +264,20 @@ class _WebPage extends State with WidgetsBindingObserver { @override Widget build(BuildContext context) { + double h = MediaQuery.of(context).viewInsets.bottom; + if(h > 0 && keyboard <= 0) { + setState(() { + keyboard = h; + }); + } return GestureDetector( behavior: HitTestBehavior.translucent, onTap: () { - FocusScope.of(context).requestFocus(FocusNode()); + setState(() { + emojiShowing = false; + isKeyBoardShow = emojiShowing; + FocusScope.of(context).requestFocus(FocusNode()); + }); }, child:Scaffold( appBar: MyAppBar( @@ -307,9 +363,14 @@ class _WebPage extends State with WidgetsBindingObserver { inputKey, hintText, isKeyBoardShow, + keyboard_height, + keyboard, + emojiShowing, commentFocus, commentTextController, _toComment, + _onSmileyTap, + _onTextFieldTap, _queryMemberComment, _queryInformationLikes, activity: activity, diff --git a/lib/web/web_view/input_comment.dart b/lib/web/web_view/input_comment.dart index d89346f4..ad9d7513 100644 --- a/lib/web/web_view/input_comment.dart +++ b/lib/web/web_view/input_comment.dart @@ -4,33 +4,47 @@ import 'package:huixiang/generated/l10n.dart'; import 'package:huixiang/retrofit/data/activity.dart'; import 'package:huixiang/retrofit/data/article.dart'; import 'package:like_button/like_button.dart'; +import 'dart:io'; + +import 'package:emoji_picker_flutter/emoji_picker_flutter.dart'; class InputComment extends StatefulWidget { final String hintText; final Activity activity; final Article article; final bool isKeyBoardShow; + final double keyboard_height; + final double keyboard; + final bool emojiShowing; final FocusNode commentFocus; final Function toComment; + final Function onSmileyTap; + final Function onTextFieldTap; final Function(String text) queryMemberComment; final Function() queryInformationLikes; final TextEditingController commentTextController; final bool isLike; + final Function(bool emojiShow) emojiShowFunction; InputComment( Key key, this.hintText, this.isKeyBoardShow, + this.keyboard_height, + this.keyboard, + this.emojiShowing, this.commentFocus, this.commentTextController, this.toComment, + this.onSmileyTap, + this.onTextFieldTap, this.queryMemberComment, this.queryInformationLikes, { this.activity, this.article, - this.isLike - + this.isLike, + this.emojiShowFunction } ) : super(key: key); @@ -41,11 +55,12 @@ class InputComment extends StatefulWidget { } class _InputComment extends State { + bool emojiShowing = false; @override Widget build(BuildContext context) { return Container( - padding: EdgeInsets.all(16), + padding: EdgeInsets.only(top: 16.h,), decoration: BoxDecoration( color: Colors.white, boxShadow: [ @@ -60,134 +75,188 @@ class _InputComment extends State { top: Radius.circular(8), ), ), - child: Row( + child: Column( children: [ - Expanded( - flex: 1, - child: Container( - decoration: BoxDecoration( - color: Color(0xffF2F2F2), - borderRadius: BorderRadius.circular(2.0), + Row( + children: [ + IconButton( + onPressed: () { + widget.onSmileyTap(); + }, + icon: Icon( + Icons.emoji_emotions, + color: Color(0xFF868686), + ), ), - child: Container( - margin: EdgeInsets.symmetric(horizontal: 4.w), - alignment: Alignment.topLeft, - child: TextField( - textInputAction:TextInputAction.send, - onEditingComplete: () { + Expanded( + flex: 1, + child: Container( + decoration: BoxDecoration( + color: Color(0xffF2F2F2), + borderRadius: BorderRadius.circular(2.0), + ), + child: Container( + margin: EdgeInsets.symmetric(horizontal: 4.w), + alignment: Alignment.topLeft, + child: TextField( + textInputAction:TextInputAction.send, + onTap: (){ + widget.onTextFieldTap(); + }, + onEditingComplete: () { + var commentText = widget.commentTextController.text; + if (commentText.trim() == "") { + return; + } + widget.queryMemberComment(commentText); + }, + maxLines: 8, + minLines: 1, + focusNode: widget.commentFocus, + controller: widget.commentTextController, + decoration: InputDecoration( + border: InputBorder.none, + hintText: widget.hintText, + hintStyle: TextStyle( + fontSize: 14.sp, + color: Color(0xFF868686), + ), + ), + ), + ), + ), + ), + if (widget.isKeyBoardShow) + GestureDetector( + onTap: () { var commentText = widget.commentTextController.text; if (commentText.trim() == "") { return; } widget.queryMemberComment(commentText); }, - maxLines: 8, - minLines: 1, - focusNode: widget.commentFocus, - controller: widget.commentTextController, - decoration: InputDecoration( - border: InputBorder.none, - hintText: widget.hintText, - hintStyle: TextStyle( - fontSize: 14.sp, - color: Color(0xFF868686), + child: Container( + padding: EdgeInsets.symmetric(horizontal: 20.w), + child: Text( + S.of(context).fasong, + style: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.bold, + color: Color(0XFF1A1A1A), + ), ), ), ), - ), - ), - ), - if (widget.isKeyBoardShow) - GestureDetector( - onTap: () { - var commentText = widget.commentTextController.text; - if (commentText.trim() == "") { - return; - } - widget.queryMemberComment(commentText); - }, - child: Container( - padding: EdgeInsets.symmetric(horizontal: 20.w), - child: Text( - S.of(context).fasong, - style: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.bold, - color: Color(0XFF1A1A1A), - ), - ), - ), - ), - if (!widget.isKeyBoardShow) - InkWell( - onTap: widget.toComment, - child: Tooltip( - message: S.of(context).daopinglunliebiaodingbu, - child: Container( - padding: EdgeInsets.only(left: 20.w, right: 10.w), - child: Image.asset( - "assets/image/icon_comment.webp", - width: 24, - height: 24, + if (!widget.isKeyBoardShow) + InkWell( + onTap: widget.toComment, + child: Tooltip( + message: S.of(context).daopinglunliebiaodingbu, + child: Container( + padding: EdgeInsets.only(left: 20.w, right: 10.w), + child: Image.asset( + "assets/image/icon_comment.webp", + width: 24, + height: 24, + ), + ), ), ), - ), - ), - if (!widget.isKeyBoardShow) - Tooltip( - message: S.of(context).dianzanxihuan_(widget.activity == null ? S.of(context).wenzhang : S.of(context).huodong), - child: LikeButton( - padding: EdgeInsets.all(10), - size: 24, - circleSize: 24, - circleColor: CircleColor( - start: Color(0xff00ddff), - end: Color(0xff0099cc), - ), - bubblesColor: BubblesColor( - dotPrimaryColor: Color(0xff33b5e5), - dotSecondaryColor: Color(0xff0099cc), - ), - bubblesSize: 24, - likeBuilder: (bool isLiked) { - return isLiked - ? Image.asset( - "assets/image/icon_like.webp", - width: 24, - height: 24, - ) - : Image.asset( - "assets/image/icon_like_h.webp", - width: 24, - height: 24, - ); - }, - isLiked: (widget.activity != null - ? widget.activity.liked - : widget.article != null + if (!widget.isKeyBoardShow) + Tooltip( + message: S.of(context).dianzanxihuan_(widget.activity == null ? S.of(context).wenzhang : S.of(context).huodong), + child: LikeButton( + padding: EdgeInsets.all(10), + size: 24, + circleSize: 24, + circleColor: CircleColor( + start: Color(0xff00ddff), + end: Color(0xff0099cc), + ), + bubblesColor: BubblesColor( + dotPrimaryColor: Color(0xff33b5e5), + dotSecondaryColor: Color(0xff0099cc), + ), + bubblesSize: 24, + likeBuilder: (bool isLiked) { + return isLiked + ? Image.asset( + "assets/image/icon_like.webp", + width: 24, + height: 24, + ) + : Image.asset( + "assets/image/icon_like_h.webp", + width: 24, + height: 24, + ); + }, + isLiked: (widget.activity != null + ? widget.activity.liked + : widget.article != null ? widget.article.liked : widget.isLike??false), - onTap: (isLiked) async { - await widget.queryInformationLikes(); - return (widget.activity != null - ? widget.activity.liked - : widget.article != null + onTap: (isLiked) async { + await widget.queryInformationLikes(); + return (widget.activity != null + ? widget.activity.liked + : widget.article != null ? widget.article.liked : widget.isLike??false); - }, - countBuilder: (int count, bool isLiked, String text) { - return Text( - text, - style: TextStyle( - color: Color(0xFF1A1A1A), - fontSize: 12.sp, + }, + countBuilder: (int count, bool isLiked, String text) { + return Text( + text, + style: TextStyle( + color: Color(0xFF1A1A1A), + fontSize: 12.sp, + ), + ); + }, + ), + ), + ], + ), + SizedBox(height: 16.h,), + Offstage( + offstage: !widget.emojiShowing, + child: SizedBox( + height: 250.h, + child: + EmojiPicker( + textEditingController: widget.commentTextController, + config: Config( + columns: 7, + emojiSizeMax: 32 * (Platform.isIOS ? 1.30 : 1.0), + verticalSpacing: 0, + horizontalSpacing: 0, + gridPadding: EdgeInsets.zero, + initCategory: Category.RECENT, + bgColor: const Color(0xFFF2F2F2), + // indicatorColor: Colors.blue, + iconColor: Colors.grey, + iconColorSelected: Colors.blue, + backspaceColor: Colors.blue, + skinToneDialogBgColor: Colors.white, + skinToneIndicatorColor: Colors.grey, + enableSkinTones: true, + showRecentsTab: true, + recentsLimit: 28, + replaceEmojiOnLimitExceed: false, + noRecents:Text( + "最近使用", + style: TextStyle(fontSize: 20, color: Colors.black26), + textAlign: TextAlign.center, ), - ); - }, - ), - ), + loadingIndicator: const SizedBox.shrink(), + tabIndicatorAnimDuration: kTabScrollDuration, + categoryIcons: const CategoryIcons(), + buttonMode: ButtonMode.MATERIAL, + checkPlatformCompatibility: true, + ), + )), + ), ], ), ); - } -} + }} diff --git a/pubspec.yaml b/pubspec.yaml index 0afefa75..95525547 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -3,7 +3,7 @@ description: 一心回乡. publish_to: 'none' # Remove this line if you wish to publish to pub.dev -version: 3.1.9+39 +version: 3.2.0+41 environment: sdk: ">=2.7.0 <3.0.0" @@ -101,6 +101,8 @@ dependencies: flutter_slidable: ^1.3.0 + emoji_picker_flutter: ^1.4.1 + dev_dependencies: flutter_test: sdk: flutter