diff --git a/lib/community/community_details.dart b/lib/community/community_details.dart index 89bf4e40..d68c1d52 100644 --- a/lib/community/community_details.dart +++ b/lib/community/community_details.dart @@ -26,9 +26,11 @@ class CommunityDetails extends StatefulWidget { } } -class _CommunityDetails extends State with WidgetsBindingObserver { +class _CommunityDetails extends State + with WidgetsBindingObserver { double height = 0; double commentHeight = 60.h; + // ComunityComment comunity; String parenId = "0"; final GlobalKey commentKey = GlobalKey(); @@ -44,15 +46,11 @@ class _CommunityDetails extends State with WidgetsBindingObser Article article; String businessId; - @override void didChangeMetrics() { WidgetsBinding.instance.addPostFrameCallback((_) { if (!mounted) return; - if (MediaQuery - .of(context) - .viewInsets - .bottom == 0) { + if (MediaQuery.of(context).viewInsets.bottom == 0) { if (isKeyBoardShow) { FocusScope.of(context).requestFocus(FocusNode()); if (mounted) @@ -90,8 +88,8 @@ class _CommunityDetails extends State with WidgetsBindingObser context: context, token: value.getString("token"), ); - BaseData
baseData = await apiService.informationInfo(id) - .catchError((onError) { + BaseData
baseData = + await apiService.informationInfo(id).catchError((onError) { debugPrint(onError.toString()); }); if (baseData != null && baseData.isSuccess) { @@ -117,91 +115,92 @@ class _CommunityDetails extends State with WidgetsBindingObser onTap: () { FocusScope.of(context).requestFocus(FocusNode()); }, - child:Container( - child: Column( - children: [ - Expanded( - child: SingleChildScrollView( - physics: BouncingScrollPhysics(), - child: Column( - children: [ - if(article != null) - CommunityDynamic( - article, - 0, - exitFull: () { - setState(() {}); - }, - userId:widget.arguments !=null ? widget.arguments["userId"] :widget.arguments["mid"], - itemCount: 3, - isDetails: true, - heightFun: (height) { - this.height = height + - MediaQuery - .of(context) - .padding - .top + - kToolbarHeight + - 24; - if (mounted) setState(() {}); - }, - ), - CommentList( - commentKey, - article?.likes ?? 0, - businessId, - 4, - isKeyBoardShow, - _reply, - _delCommentTips, - 12.sp, - requestApiFinish: (total){setState(() { - commentTotal = total; - });}, - ), - if (memberList == null || memberList.length == 0) - Container( - width: double.infinity, - alignment: Alignment.topCenter, - margin: EdgeInsets.only(top: 40), - padding: EdgeInsets.all(22.h), - child: Text( - S.of(context) - .zanwupinglun, - style: TextStyle( - fontSize: 12, - fontWeight: FontWeight.bold, - color: Color(0xFFA0A0A0), + child: Container( + child: Column( + children: [ + Expanded( + child: SingleChildScrollView( + physics: BouncingScrollPhysics(), + child: Column( + children: [ + if (article != null) + CommunityDynamic( + article, + 0, + exitFull: () { + setState(() {}); + }, + userId: widget.arguments != null + ? widget.arguments["userId"] + : widget.arguments["mid"], + itemCount: 3, + isDetails: true, + heightFun: (height) { + this.height = height + + MediaQuery.of(context).padding.top + + kToolbarHeight + + 24; + if (mounted) setState(() {}); + }, ), + CommentList( + commentKey, + article?.likes ?? 0, + businessId, + 4, + isKeyBoardShow, + _reply, + _delCommentTips, + 12.sp, + requestApiFinish: (total) { + setState(() { + commentTotal = total; + }); + }, ), - ), - ], + if (memberList == null || memberList.length == 0) + Container( + width: double.infinity, + alignment: Alignment.topCenter, + margin: EdgeInsets.only(top: 40), + padding: EdgeInsets.all(22.h), + child: Text( + S.of(context).zanwupinglun, + style: TextStyle( + fontSize: 12, + fontWeight: FontWeight.bold, + color: Color(0xFFA0A0A0), + ), + ), + ), + ], + ), + ), + flex: 1, ), - ), - flex: 1, - ), - /// 富文本评论的输入框 - InputComment( - inputKey, - hintText, - isKeyBoardShow, - commentFocus, - commentTextController, - _toComment, - _queryMemberComment, - _queryInformationLikes, - isLike: article?.liked ?? false, + /// 富文本评论的输入框 + InputComment( + inputKey, + hintText, + isKeyBoardShow, + commentFocus, + commentTextController, + _toComment, + _queryMemberComment, + _queryInformationLikes, + isLike: article?.liked ?? false, + ), + ], ), - ], - ), - )), + )), ); } ///给文章/活动点赞 _queryInformationLikes() async { - BaseData baseData = await apiService.informationLikes(businessId).catchError((onError) {}); + BaseData baseData = + await apiService.informationLikes(businessId).catchError((onError) {}); if (baseData != null && baseData.isSuccess) { commentKey.currentState.setState(() {}); setState(() { @@ -222,7 +221,7 @@ class _CommunityDetails extends State with WidgetsBindingObser "content": content, "parentId": parenId, "relationalId": businessId, - "relationalType":4 + "relationalType": 4 }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { CommentListState state = commentKey.currentState; @@ -241,10 +240,7 @@ class _CommunityDetails extends State with WidgetsBindingObser scrollController.animateTo( first.dy + scrollController.offset - - (kToolbarHeight + MediaQuery - .of(context) - .padding - .top), + (kToolbarHeight + MediaQuery.of(context).padding.top), duration: Duration(milliseconds: 300), curve: Curves.easeIn, ); @@ -254,15 +250,9 @@ class _CommunityDetails extends State with WidgetsBindingObser final TextEditingController commentTextController = TextEditingController(); contentHeight() { - double contentHeight = MediaQuery - .of(context) - .size - .height - + double contentHeight = MediaQuery.of(context).size.height - kToolbarHeight - - MediaQuery - .of(context) - .padding - .top - + MediaQuery.of(context).padding.top - 160.h; if ((contentHeight - 60.h) > (128.h * memberList.length)) { commentHeight = contentHeight - (128.h * memberList.length); @@ -303,11 +293,11 @@ class _CommunityDetails extends State with WidgetsBindingObser showLoading: false, ); BaseData> baseData = - await apiService.memberCommentList({ + await apiService.memberCommentList({ "pageNum": 1, "pageSize": 100, "relationalId": businessId, - "relationalType":4, + "relationalType": 4, }).catchError((error) {}); if (baseData != null && baseData.isSuccess) { commentTotal = baseData.data.size; diff --git a/lib/community/community_list.dart b/lib/community/community_list.dart index 7c532043..358af6f8 100644 --- a/lib/community/community_list.dart +++ b/lib/community/community_list.dart @@ -24,16 +24,8 @@ class CommunityList extends StatefulWidget { final Function exitFull; final Function removalDynamic; - CommunityList( - this.comments, - this.userId, - this.commentType,{ - this.isList = false, - this.exitFull, - this.removalDynamic - } - - ); + CommunityList(this.comments, this.userId, this.commentType, + {this.isList = false, this.exitFull, this.removalDynamic}); @override State createState() { @@ -88,39 +80,43 @@ class _CommunityList extends State { children: [ (widget.comments == null || widget.comments.length == 0) ? NoDataView( - src: widget.commentType == 1 ? "assets/image/dong_tai.webp" :"assets/image/guan_zhu.webp", - isShowBtn: false, - text:widget.commentType == 1 ? "目前暂无发布动态,要把开心的事讲出来哦~" :"目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", - fontSize: 16.sp, - margin: EdgeInsets.only(top: 120.h,left: 60.w,right: 60.w), - ): - ListView.builder( - padding: EdgeInsets.zero, - itemCount: widget.comments.length, - scrollDirection: Axis.vertical, - shrinkWrap: true, - physics: NeverScrollableScrollPhysics(), - itemBuilder: (context, position) { - return GestureDetector( - onTap: () { - Navigator.of(context) - .pushNamed('/router/new_community_details', arguments: { - "commentsId": widget.comments[position].id, - "userId":widget.userId, - // exitFull: () { - // setState(() {}); - // }, - }).then((value) { - widget.exitFull(); - setState(() { - }); - }); - setState(() {}); - }, - child: communityItem(widget.comments[position], position), - ); - }, - ), + src: widget.commentType == 1 + ? "assets/image/dong_tai.webp" + : "assets/image/guan_zhu.webp", + isShowBtn: false, + text: widget.commentType == 1 + ? "目前暂无发布动态,要把开心的事讲出来哦~" + : "目前暂无添加关注,可在推荐中关注自己喜欢的人哦~", + fontSize: 16.sp, + margin: EdgeInsets.only(top: 120.h, left: 60.w, right: 60.w), + ) + : ListView.builder( + padding: EdgeInsets.zero, + itemCount: widget.comments.length, + scrollDirection: Axis.vertical, + shrinkWrap: true, + physics: NeverScrollableScrollPhysics(), + itemBuilder: (context, position) { + return GestureDetector( + onTap: () { + Navigator.of(context).pushNamed( + '/router/new_community_details', + arguments: { + "commentsId": widget.comments[position].id, + "userId": widget.userId, + // exitFull: () { + // setState(() {}); + // }, + }).then((value) { + widget.exitFull(); + setState(() {}); + }); + setState(() {}); + }, + child: communityItem(widget.comments[position], position), + ); + }, + ), ], )); } @@ -149,7 +145,7 @@ class _CommunityList extends State { fit: BoxFit.contain, radius: BorderRadius.circular(2), width: MediaQuery.of(context).size.width / 1.5, - height: MediaQuery.of(context).size.width/1.5, + height: MediaQuery.of(context).size.width / 1.5, errorSrc: "assets/image/default_2_1.webp", fadeSrc: "assets/image/default_2_1.webp", )), @@ -315,54 +311,55 @@ class _CommunityList extends State { ), ), if ((comments?.memberInfo?.mid ?? "") != (widget.userId)) - GestureDetector( - onTap: () { - setState(() { - if (widget.commentType == 0) { - comments.selfFollow = !(comments.selfFollow ?? false); - _vipFollow(comments?.memberInfo?.mid,comments?.selfFollow ?? false); - } else { - showDeleteDialog(position); - } - }); - }, - child: - (widget.commentType == 0) ? - Container( - width: 56.w, - height: 25.h, - alignment: Alignment.center, - child: RoundButton( + GestureDetector( + onTap: () { + setState(() { + if (widget.commentType == 0) { + comments.selfFollow = + !(comments.selfFollow ?? false); + _vipFollow(comments?.memberInfo?.mid, + comments?.selfFollow ?? false); + } else { + showDeleteDialog(position); + } + }); + }, + child: (widget.commentType == 0) + ? Container( + width: 56.w, height: 25.h, - backgroup: (comments?.selfFollow ?? false) - ? Color(0xFFE6E6E6) - : Color(0xFF32A060), - textColor: (comments?.selfFollow ?? false) - ? Color(0xFF808080) - : Colors.white, - text: (comments?.selfFollow ?? false) - ? S.of(context).yiguanzhu - : S.of(context).guanzhu, - radius: 20, - icons: Icon( - (comments?.selfFollow ?? false) - ? Icons.check - : Icons.add, - color: (comments?.selfFollow ?? false) + alignment: Alignment.center, + child: RoundButton( + height: 25.h, + backgroup: (comments?.selfFollow ?? false) + ? Color(0xFFE6E6E6) + : Color(0xFF32A060), + textColor: (comments?.selfFollow ?? false) ? Color(0xFF808080) : Colors.white, - size: 15, + text: (comments?.selfFollow ?? false) + ? S.of(context).yiguanzhu + : S.of(context).guanzhu, + radius: 20, + icons: Icon( + (comments?.selfFollow ?? false) + ? Icons.check + : Icons.add, + color: (comments?.selfFollow ?? false) + ? Color(0xFF808080) + : Colors.white, + size: 15, + ), + )) + : Padding( + padding: EdgeInsets.all(20), + child: Icon( + Icons.close, + color: Colors.black, + size: 16, ), - )) - : Padding( - padding: EdgeInsets.all(20), - child: Icon( - Icons.close, - color: Colors.black, - size: 16, ), - ), - ), + ), ], ), SizedBox( @@ -457,7 +454,7 @@ class _CommunityList extends State { Expanded( child: InkWell( child: BorderText( - text:S.of(context).quxiao, + text: S.of(context).quxiao, textColor: Color(0xFF32A060), fontSize: 16.sp, fontWeight: FontWeight.bold, @@ -478,7 +475,7 @@ class _CommunityList extends State { Expanded( child: InkWell( child: RoundButton( - text:S.of(context).queding, + text: S.of(context).queding, textColor: Colors.white, radius: 4, padding: EdgeInsets.all(12), diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index 2e31ffc9..4b7c66a2 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -37,7 +37,7 @@ class CommunityDynamic extends StatefulWidget { CommunityDynamic( this.article, - this.commentType,{ + this.commentType, { Key key, this.itemCount = 9, this.heightFun, @@ -437,47 +437,46 @@ class _CommunityDynamic extends State { ], ))), Expanded( - child: GestureDetector( - behavior: HitTestBehavior.opaque, - onTap: () { - setState(() { - widget.article.liked = - !(widget.article.liked ?? false); - _queryInformationLikes( - widget.article.liked ?? false); - }); - }, - child: Container( - padding: EdgeInsets.only(bottom: 16.h), - child: Row( - children: [ - (widget.article.liked ?? false) - ? Image.asset( - "assets/image/icon_like.webp", - width: 16, - height: 16, - ) - : Image.asset( - "assets/image/icon_like_h.webp", - width: 16, - height: 16, - ), - SizedBox( - width: 5.w, - ), - Text( - "${widget.article.likes ?? 0}", - style: TextStyle( - fontSize: 14.sp, - fontFamily: 'JDZhengHT', - fontWeight: MyFontWeight.regular, - color: Color(0xFF1A1A1A), - ), - ), - ], - )), - ) - ), + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + setState(() { + widget.article.liked = + !(widget.article.liked ?? false); + _queryInformationLikes( + widget.article.liked ?? false); + }); + }, + child: Container( + padding: EdgeInsets.only(bottom: 16.h), + child: Row( + children: [ + (widget.article.liked ?? false) + ? Image.asset( + "assets/image/icon_like.webp", + width: 16, + height: 16, + ) + : Image.asset( + "assets/image/icon_like_h.webp", + width: 16, + height: 16, + ), + SizedBox( + width: 5.w, + ), + Text( + "${widget.article.likes ?? 0}", + style: TextStyle( + fontSize: 14.sp, + fontFamily: 'JDZhengHT', + fontWeight: MyFontWeight.regular, + color: Color(0xFF1A1A1A), + ), + ), + ], + )), + )), if ((widget?.article?.author != widget.userId ?? "") && widget.commentType == 0) Expanded( diff --git a/lib/generated/intl/messages_en.dart b/lib/generated/intl/messages_en.dart index 9a698a61..47f6d6d2 100644 --- a/lib/generated/intl/messages_en.dart +++ b/lib/generated/intl/messages_en.dart @@ -409,6 +409,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("欢迎来到一心回乡"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("绿币余额"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("绿币支付"), "main_menu1" : MessageLookupByLibrary.simpleMessage("净弼"), "main_menu2" : MessageLookupByLibrary.simpleMessage("联盟"), "main_menu3" : MessageLookupByLibrary.simpleMessage("有机生活"), @@ -423,6 +424,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("每周三更新"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("每周三更新劵包"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("门店选择"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("门店余额"), "menpaihao" : MessageLookupByLibrary.simpleMessage("请输入门牌号"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("明细"), diff --git a/lib/generated/intl/messages_en_US.dart b/lib/generated/intl/messages_en_US.dart index fd59232d..5f7fea35 100644 --- a/lib/generated/intl/messages_en_US.dart +++ b/lib/generated/intl/messages_en_US.dart @@ -409,6 +409,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("Welcome Back Home"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("balance of green currency"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("green payment"), "main_menu1" : MessageLookupByLibrary.simpleMessage("Jing Bi"), "main_menu2" : MessageLookupByLibrary.simpleMessage("Union"), "main_menu3" : MessageLookupByLibrary.simpleMessage("Organic Life"), @@ -423,6 +424,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("updated every Wednesday"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("Wednesday renewal coupon"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("Store Selection"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("store balance"), "menpaihao" : MessageLookupByLibrary.simpleMessage("Please enter the house number"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("Details"), diff --git a/lib/generated/intl/messages_zh_CN.dart b/lib/generated/intl/messages_zh_CN.dart index bf6757c5..c6ed4607 100644 --- a/lib/generated/intl/messages_zh_CN.dart +++ b/lib/generated/intl/messages_zh_CN.dart @@ -409,6 +409,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("欢迎来到一心回乡"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("绿币余额"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("绿币支付"), "main_menu1" : MessageLookupByLibrary.simpleMessage("净弼"), "main_menu2" : MessageLookupByLibrary.simpleMessage("联盟"), "main_menu3" : MessageLookupByLibrary.simpleMessage("有机生活"), @@ -423,6 +424,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("每周三更新"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("每周三更新劵包"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("门店选择"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("门店余额"), "menpaihao" : MessageLookupByLibrary.simpleMessage("请输入门牌号"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("明细"), diff --git a/lib/generated/intl/messages_zh_Hans_CN.dart b/lib/generated/intl/messages_zh_Hans_CN.dart index b5bd83c7..39e563c8 100644 --- a/lib/generated/intl/messages_zh_Hans_CN.dart +++ b/lib/generated/intl/messages_zh_Hans_CN.dart @@ -409,6 +409,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("欢迎来到一心回乡"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("绿币余额"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("绿币支付"), "main_menu1" : MessageLookupByLibrary.simpleMessage("净弼"), "main_menu2" : MessageLookupByLibrary.simpleMessage("联盟"), "main_menu3" : MessageLookupByLibrary.simpleMessage("有机生活"), @@ -423,6 +424,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("每周三更新"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("每周三更新劵包"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("门店选择"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("门店余额"), "menpaihao" : MessageLookupByLibrary.simpleMessage("请输入门牌号"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("明细"), diff --git a/lib/generated/intl/messages_zh_Hant_CN.dart b/lib/generated/intl/messages_zh_Hant_CN.dart index ec37d6fd..974a5f96 100644 --- a/lib/generated/intl/messages_zh_Hant_CN.dart +++ b/lib/generated/intl/messages_zh_Hant_CN.dart @@ -405,6 +405,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("歡迎來到一心回鄉"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("綠幣餘額"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("綠幣支付"), "main_menu1" : MessageLookupByLibrary.simpleMessage("淨弼"), "main_menu2" : MessageLookupByLibrary.simpleMessage("聯盟"), "main_menu3" : MessageLookupByLibrary.simpleMessage("有機生活"), @@ -419,6 +420,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("每週三更新"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("每週三更新劵包"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("门店选择"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("門店餘額"), "menpaihao" : MessageLookupByLibrary.simpleMessage("請輸入門牌號"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("明細"), diff --git a/lib/generated/intl/messages_zh_TW.dart b/lib/generated/intl/messages_zh_TW.dart index 0abb2099..dc3695e1 100644 --- a/lib/generated/intl/messages_zh_TW.dart +++ b/lib/generated/intl/messages_zh_TW.dart @@ -407,6 +407,7 @@ class MessageLookup extends MessageLookupByLibrary { "login_splash" : MessageLookupByLibrary.simpleMessage("歡迎來到一心回鄉"), "lvbiyue" : MessageLookupByLibrary.simpleMessage("綠幣餘額"), "lvbiyue_" : m18, + "lvbizhifu" : MessageLookupByLibrary.simpleMessage("綠幣支付"), "main_menu1" : MessageLookupByLibrary.simpleMessage("淨弼"), "main_menu2" : MessageLookupByLibrary.simpleMessage("聯盟"), "main_menu3" : MessageLookupByLibrary.simpleMessage("有機生活"), @@ -421,6 +422,7 @@ class MessageLookup extends MessageLookupByLibrary { "meizhousangengxin" : MessageLookupByLibrary.simpleMessage("每週三更新"), "meizhousanquanbao" : MessageLookupByLibrary.simpleMessage("每週三更新劵包"), "mendianxuanzhe" : MessageLookupByLibrary.simpleMessage("门店选择"), + "mendianyue" : MessageLookupByLibrary.simpleMessage("門店餘額"), "menpaihao" : MessageLookupByLibrary.simpleMessage("請輸入門牌號"), "mi" : m21, "mingxi" : MessageLookupByLibrary.simpleMessage("明細"), diff --git a/lib/generated/l10n.dart b/lib/generated/l10n.dart index ff27cb82..de8a06e8 100644 --- a/lib/generated/l10n.dart +++ b/lib/generated/l10n.dart @@ -6935,6 +6935,26 @@ class S { ); } + /// `门店余额` + String get mendianyue { + return Intl.message( + '门店余额', + name: 'mendianyue', + desc: '', + args: [], + ); + } + + /// `绿币支付` + String get lvbizhifu { + return Intl.message( + '绿币支付', + name: 'lvbizhifu', + desc: '', + args: [], + ); + } + /// `并使用本机号码登录` String get privacy_policy4 { return Intl.message( diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 8ee66699..5a7dc9a8 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -721,6 +721,8 @@ "lijishiyong":"立即使用", "wangjimima":"忘记密码", "xuanzeshangpinlingqufangshi":"请选择商品的领取方式", + "mendianyue":"门店余额", + "lvbizhifu":"绿币支付", diff --git a/lib/l10n/intl_en_US.arb b/lib/l10n/intl_en_US.arb index 076d6fbb..b7d1860b 100644 --- a/lib/l10n/intl_en_US.arb +++ b/lib/l10n/intl_en_US.arb @@ -722,6 +722,8 @@ "lijishiyong":"Use Now", "wangjimima":"Forgot password", "xuanzeshangpinlingqufangshi":"Please select the picking method of goods", + "mendianyue":"store balance", + "lvbizhifu":"green payment", diff --git a/lib/l10n/intl_zh_CN.arb b/lib/l10n/intl_zh_CN.arb index 4a53c7b4..5f95dbc4 100644 --- a/lib/l10n/intl_zh_CN.arb +++ b/lib/l10n/intl_zh_CN.arb @@ -722,6 +722,8 @@ "lijishiyong":"立即使用", "wangjimima":"忘记密码", "xuanzeshangpinlingqufangshi":"请选择商品的领取方式", + "mendianyue":"门店余额", + "lvbizhifu":"绿币支付", diff --git a/lib/l10n/intl_zh_Hans_CN.arb b/lib/l10n/intl_zh_Hans_CN.arb index 6c615ef0..7b4fe637 100644 --- a/lib/l10n/intl_zh_Hans_CN.arb +++ b/lib/l10n/intl_zh_Hans_CN.arb @@ -722,6 +722,8 @@ "lijishiyong":"立即使用", "wangjimima":"忘记密码", "xuanzeshangpinlingqufangshi":"请选择商品的领取方式", + "mendianyue":"门店余额", + "lvbizhifu":"绿币支付", diff --git a/lib/l10n/intl_zh_Hant_CN.arb b/lib/l10n/intl_zh_Hant_CN.arb index be665571..ae04fcf5 100644 --- a/lib/l10n/intl_zh_Hant_CN.arb +++ b/lib/l10n/intl_zh_Hant_CN.arb @@ -713,6 +713,8 @@ "lijishiyong":"立即使用", "wangjimima":"忘記密碼", "xuanzeshangpinlingqufangshi":"請選擇商品的領取方式", + "mendianyue":"門店餘額", + "lvbizhifu":"綠幣支付", diff --git a/lib/l10n/intl_zh_TW.arb b/lib/l10n/intl_zh_TW.arb index 1e4c6b0f..641c5f9a 100644 --- a/lib/l10n/intl_zh_TW.arb +++ b/lib/l10n/intl_zh_TW.arb @@ -715,6 +715,8 @@ "lijishiyong":"立即使用", "wangjimima":"忘記密碼", "xuanzeshangpinlingqufangshi":"請選擇商品的領取方式", + "mendianyue":"門店餘額", + "lvbizhifu":"綠幣支付", diff --git a/lib/main.dart b/lib/main.dart index 41c34173..7d937077 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -110,6 +110,7 @@ import 'mine/mine_vip/binding_assistant_card.dart'; 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 'order/bargain_group_order.dart'; import 'mine/personal_page.dart'; import 'order/exchange_write_off_page.dart'; @@ -417,4 +418,6 @@ Map routers = { UserVipServicePage(), '/router/help_farmers_page': (context, {arguments}) => HelpFarmersPage(), + '/router/scan_web': (context, {arguments}) => + ScanWeb(arguments:arguments), }; diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index e5577168..1eb9a3dc 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -259,7 +259,7 @@ class MinePageState extends State with AutomaticKeepAliveClientMixin { // ///关注度/粉丝/发布 // attention(), - // + // /// 钱包或领券中心 // WalletCoupon(), ], diff --git a/lib/mine/mine_view/mine_view.dart b/lib/mine/mine_view/mine_view.dart index 8780951d..81f6fb5b 100644 --- a/lib/mine/mine_view/mine_view.dart +++ b/lib/mine/mine_view/mine_view.dart @@ -21,6 +21,7 @@ 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 'package:qrscan/qrscan.dart' as scanner; class MineView extends StatefulWidget { @@ -29,9 +30,10 @@ class MineView extends StatefulWidget { final GestureTapCallback toIntegralPage; final Function messageZero; final int totalMsg; - final SocialInfo infoNumber; + final SocialInfo infoNumber; - MineView(this.userInfo, this.toUserInfo, this.toIntegralPage,this.messageZero,this.totalMsg,this.infoNumber); + MineView(this.userInfo, this.toUserInfo, this.toIntegralPage, + this.messageZero, this.totalMsg, this.infoNumber); @override State createState() { @@ -60,8 +62,6 @@ class _MineView extends State { } } - - @override Widget build(BuildContext context) { return Column( @@ -77,28 +77,30 @@ class _MineView extends State { alignment: Alignment.center, child: GestureDetector( onTap: () { - Navigator.of(context).pushNamed('/router/system_msg_page').then((value) { + Navigator.of(context) + .pushNamed('/router/system_msg_page') + .then((value) { widget.messageZero(); }); }, child: Container( height: 24.h, - alignment:Alignment.center, - child:Stack( + alignment: Alignment.center, + child: Stack( children: [ Image.asset( "assets/image/icon_notices.webp", - width:32, + width: 32, height: 32, color: Colors.white, ), - if(widget.totalMsg != 0) + if (widget.totalMsg != 0) Container( - width:36.w, + width: 36.w, alignment: Alignment.topRight, - child:Container( - width:22.w, - height:14.h, + child: Container( + width: 22.w, + height: 14.h, decoration: BoxDecoration( borderRadius: BorderRadius.circular(100), border: Border.all( @@ -106,23 +108,20 @@ class _MineView extends State { color: Colors.white, style: BorderStyle.solid, ), - color:Color(0xFFFF441A), + color: Color(0xFFFF441A), ), - child:RoundButton( - text:widget.totalMsg.toString(), + child: RoundButton( + text: widget.totalMsg.toString(), textColor: Colors.white, fontWeight: MyFontWeight.regular, backgroup: Color(0xFFFF441A), - fontSize:8.sp, + fontSize: 8.sp, radius: 100, - ) - ), + )), ) ], ), - ) - ) - ), + ))), InkWell( onTap: () { toScan(); @@ -131,7 +130,7 @@ class _MineView extends State { padding: EdgeInsets.all(8.h), child: Image.asset( "assets/image/icon_scan_qr_code.webp", - width:32, + width: 32, height: 32, color: Colors.white, ), @@ -184,11 +183,12 @@ class _MineView extends State { } else if (await Permission.camera.isGranted) { // http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512 var result = await Navigator.of(context).pushNamed('/router/qr_scan'); - if(result.toString().contains("type\":\"coupon")){ + if (result.toString().contains("type\":\"coupon")) { ///活动优惠券赠送弹窗 activityShowAlertDialog(result.toString()); return; - }if(result.toString().contains("type\":\"wiped")){ + } + if (result.toString().contains("type\":\"wiped")) { ///核销券 queryWiped(jsonDecode(result.toString())["memberCouponId"]); return; @@ -213,6 +213,17 @@ class _MineView extends State { "tableId": int.tryParse(tableId), }, ); + return; + } + if (result.toString().contains("http:") || + result.toString().contains("https:")) { + ///扫码跳转任意网页 + Navigator.of(context).pushNamed( + '/router/scan_web', + arguments: { + "result": result, + }, + ); } } else { await Permission.camera.request(); @@ -300,7 +311,7 @@ class _MineView extends State { child: Text( widget.userInfo == null ? S.of(context).denglu - : "${widget.userInfo.nickname==""?"回乡":widget.userInfo.nickname}", + : "${widget.userInfo.nickname == "" ? "回乡" : widget.userInfo.nickname}", style: TextStyle( fontSize: 16.sp, fontWeight: FontWeight.bold, @@ -308,12 +319,12 @@ class _MineView extends State { ), ), ), - if(widget.userInfo.level != 1) - Image.asset( - "assets/image/icon_user.webp", - width: 18.w, - height: 18.h, - ), + if (widget.userInfo.level != 1) + Image.asset( + "assets/image/icon_user.webp", + width: 18.w, + height: 18.h, + ), ], ), widget.userInfo == null @@ -326,33 +337,33 @@ class _MineView extends State { ), ) : 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), + 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), + ), + ), + ], ), - ), - ], - ), ], ), ), @@ -375,12 +386,12 @@ class _MineView extends State { widget.toIntegralPage(); }, child: Container( - padding: EdgeInsets.only(top: 4.h, bottom: 4.h, right: 16.w,left: 7.w), + padding: EdgeInsets.only( + top: 4.h, bottom: 4.h, right: 16.w, left: 7.w), margin: EdgeInsets.only(right: 14.w), decoration: BoxDecoration( - borderRadius: BorderRadius.circular(12), - color: Colors.white - ), + borderRadius: BorderRadius.circular(12), + color: Colors.white), child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ diff --git a/lib/mine/mine_wallet_page.dart b/lib/mine/mine_wallet_page.dart index 04b0b817..11b8a568 100644 --- a/lib/mine/mine_wallet_page.dart +++ b/lib/mine/mine_wallet_page.dart @@ -458,7 +458,7 @@ class _MineWalletPage extends State { Expanded( flex: 7, child: Text( - userBill.title, + userBill.type, style: TextStyle( color: Colors.black, fontSize: 12.sp, diff --git a/lib/mine/personal_page.dart b/lib/mine/personal_page.dart index b2cccb9b..bde4cf32 100644 --- a/lib/mine/personal_page.dart +++ b/lib/mine/personal_page.dart @@ -434,7 +434,7 @@ class _PersonalPage extends State with WidgetsBindingObserver { ), Container( color: Color(0xFFFFFFFF), - margin: EdgeInsets.only(bottom:30.h), + margin: EdgeInsets.only(bottom: 30.h), child: Column( mainAxisAlignment: MainAxisAlignment.spaceAround, crossAxisAlignment: CrossAxisAlignment.start, diff --git a/lib/mine/scan_web.dart b/lib/mine/scan_web.dart new file mode 100644 index 00000000..c54e6a66 --- /dev/null +++ b/lib/mine/scan_web.dart @@ -0,0 +1,49 @@ +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 { + final Map arguments; + + ScanWeb({this.arguments}); + @override + State createState() { + return _ScanWeb(); + } +} + +class _ScanWeb extends State { + var controller = new ScrollController(); + String result; + + @override + void initState() { + super.initState(); + result = widget.arguments["result"]; + 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(); + }, + )); + } +} diff --git a/lib/order/order_history_page.dart b/lib/order/order_history_page.dart index eb5ddd9e..682f1c57 100644 --- a/lib/order/order_history_page.dart +++ b/lib/order/order_history_page.dart @@ -70,42 +70,42 @@ class _OrderHistoryPage extends State bottom: PreferredSize( preferredSize: Size(double.infinity, 38.h), child: Theme( - data: ThemeData( - splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 - highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 - ), - child: TabBar( - controller: tabController, - isScrollable: false, - indicatorWeight: 2.w, - indicatorSize: TabBarIndicatorSize.label, - indicatorColor: Color(0xFF39B54A), - indicatorPadding: EdgeInsets.only(top: 3.h), - unselectedLabelStyle: TextStyle( - fontSize: 16.sp, - fontWeight: FontWeight.normal, - ), - labelStyle: TextStyle( - color: Colors.black, - fontSize: 16.sp, - fontWeight: FontWeight.bold, - ), - labelColor: Colors.black, - tabs: [ - MyTab( - text: S.of(context).quanbu, - ), - MyTab( - text: S.of(context).daifukuan, - ), - MyTab( - text: S.of(context).weiwancheng, + data: ThemeData( + splashColor: Colors.transparent, // 点击时的水波纹颜色设置为透明 + highlightColor: Colors.transparent, // 点击时的背景高亮颜色设置为透明 ), - MyTab( - text: S.of(context).yiwancheng, - ) - ], - )), + child: TabBar( + controller: tabController, + isScrollable: false, + indicatorWeight: 2.w, + indicatorSize: TabBarIndicatorSize.label, + indicatorColor: Color(0xFF39B54A), + indicatorPadding: EdgeInsets.only(top: 3.h), + unselectedLabelStyle: TextStyle( + fontSize: 16.sp, + fontWeight: FontWeight.normal, + ), + labelStyle: TextStyle( + color: Colors.black, + fontSize: 16.sp, + fontWeight: FontWeight.bold, + ), + labelColor: Colors.black, + tabs: [ + MyTab( + text: S.of(context).quanbu, + ), + MyTab( + text: S.of(context).daifukuan, + ), + MyTab( + text: S.of(context).weiwancheng, + ), + MyTab( + text: S.of(context).yiwancheng, + ) + ], + )), ), ), body: TabBarView( @@ -212,6 +212,7 @@ class _OrderHistoryList extends State } setState(() {}); } else { + SmartDialog.showToast(baseData?.msg ?? "",alignment: Alignment.center); refreshController.refreshFailed(); refreshController.loadFailed(); } @@ -230,9 +231,9 @@ class _OrderHistoryList extends State }); } - String orderAllGoods(OrderInfo orderInfo){ + String orderAllGoods(OrderInfo orderInfo) { int count = 0; - if(orderInfo.productList != null){ + if (orderInfo.productList != null) { orderInfo.productList.forEach((element) { count += element.buyNum; }); @@ -314,7 +315,7 @@ class _OrderHistoryList extends State // ), // ), Container( - margin: EdgeInsets.only(left: 5.w, top: 12.h), + margin: EdgeInsets.only(left: 5.w, top: 12.h), ), Expanded( child: Container( @@ -568,16 +569,11 @@ class _OrderHistoryList extends State queryDetails(id) async { if (apiService == null) { SharedPreferences value = await SharedPreferences.getInstance(); - apiService = ApiService( - Dio(), - context: context, - token: value.getString("token"), - showLoading: true - ); + apiService = ApiService(Dio(), + context: context, token: value.getString("token"), showLoading: true); } - BaseData baseData = await apiService - .orderDetail(id) - .catchError((error) {}); + BaseData baseData = + await apiService.orderDetail(id).catchError((error) {}); if (baseData != null && baseData.isSuccess) { return baseData.data; } @@ -598,7 +594,9 @@ class _OrderHistoryList extends State minService, orderInfo, (BaseData baseData) { - SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center); + SmartDialog.showToast( + baseData?.msg == "ok" ? "订单支付成功" : baseData?.msg, + alignment: Alignment.center); Future.delayed(Duration(seconds: 3), () { _onRefresh(); }); diff --git a/lib/order/order_view/order_pay_selected.dart b/lib/order/order_view/order_pay_selected.dart index b265c09d..c3ea3250 100644 --- a/lib/order/order_view/order_pay_selected.dart +++ b/lib/order/order_view/order_pay_selected.dart @@ -70,7 +70,7 @@ class _OrderPaySelected extends State { Expanded(child: Padding( padding: EdgeInsets.only(left: 8.w), child:Text( - "助农积分", + S.of(context).zhunongjifen, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), @@ -101,7 +101,7 @@ class _OrderPaySelected extends State { Expanded(child: Padding( padding: EdgeInsets.only(left: 8.w), child: Text( - S.of(context).pingtaiyue, + S.of(context).huixiangqianbao, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), @@ -132,7 +132,7 @@ class _OrderPaySelected extends State { Expanded(child: Padding( padding: EdgeInsets.only(left: 8.w), child:Text( - S.of(context).dianpuyue, + S.of(context).mendianyue, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), @@ -164,7 +164,7 @@ class _OrderPaySelected extends State { Expanded(child: Padding( padding: EdgeInsets.only(left: 8.w), child:Text( - "绿币余额", + S.of(context).lvbizhifu, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), diff --git a/lib/retrofit/min_api.dart b/lib/retrofit/min_api.dart index f7e60731..1308a39d 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 = "http://192.168.10.78:8765/app/";///本地 +const localBaseUrl = "https://pos.api.lotus-wallet.com/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 06429ed5..c1b9a541 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 = "http://192.168.10.78:8766/app/";///本地 +const localBaseUrl = "https://pos.platform.lotus-wallet.com/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/retrofit/retrofit_api.g.dart b/lib/retrofit/retrofit_api.g.dart index 40d5e1d9..9d5c20d7 100644 --- a/lib/retrofit/retrofit_api.g.dart +++ b/lib/retrofit/retrofit_api.g.dart @@ -866,7 +866,7 @@ class _ApiService implements ApiService { data: _data); final value = BaseData>.fromJson( _result.data, - (json) => PageInfo.fromJson( + (json) => ((json??"") == "")?null:PageInfo.fromJson( json, (json) => OrderInfo.fromJson(json), ), diff --git a/lib/settlement/settlement_view/activity_coupon_remarks.dart b/lib/settlement/settlement_view/activity_coupon_remarks.dart index 282f23ff..ece002da 100644 --- a/lib/settlement/settlement_view/activity_coupon_remarks.dart +++ b/lib/settlement/settlement_view/activity_coupon_remarks.dart @@ -84,7 +84,7 @@ class _ActivityCouponRemarks extends State { Expanded( flex: 1, child: Text( - "VIP价格", + "VIP权益", style: TextStyle( fontWeight: MyFontWeight.regular, fontSize: 14.sp, diff --git a/lib/settlement/settlement_view/pay_method.dart b/lib/settlement/settlement_view/pay_method.dart index 481e1fb1..65a11ec1 100644 --- a/lib/settlement/settlement_view/pay_method.dart +++ b/lib/settlement/settlement_view/pay_method.dart @@ -118,7 +118,7 @@ class _PayMethod extends State { width: 10, ), Text( - S.of(context).pingtaiyue, + S.of(context).huixiangqianbao, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), @@ -162,7 +162,7 @@ class _PayMethod extends State { width: 10, ), Text( - S.of(context).dianpuyue, + S.of(context).mendianyue, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535), @@ -215,7 +215,7 @@ class _PayMethod extends State { width: 10, ), Text( - "绿币余额", + S.of(context).lvbizhifu, style: TextStyle( fontSize: 14.sp, color: Color(0xff353535),