diff --git a/lib/community/community_page.dart b/lib/community/community_page.dart index 399124ff..897f4876 100644 --- a/lib/community/community_page.dart +++ b/lib/community/community_page.dart @@ -82,12 +82,17 @@ class _CommunityPage extends State onTap: () { _toRelease(); }, - action: SvgPicture.asset( - "assets/svg/shequ_fabu.svg", - fit: BoxFit.contain, - width: 24, - height: 24, - ), + action: GestureDetector( + behavior: HitTestBehavior.opaque, + child: Container(color: Colors.transparent, + padding: EdgeInsets.only(left: 20,right: 20), + child: SvgPicture.asset( + "assets/svg/shequ_fabu.svg", + fit: BoxFit.contain, + width: 24, + height: 24, + ),) + ) ), body: Container( padding: EdgeInsets.only(bottom: 76.h), diff --git a/lib/community/community_view/community_dynamic.dart b/lib/community/community_view/community_dynamic.dart index dc9674df..cbb7949b 100644 --- a/lib/community/community_view/community_dynamic.dart +++ b/lib/community/community_view/community_dynamic.dart @@ -19,7 +19,6 @@ import 'package:video_player/video_player.dart'; import '../photo_view_gallery_screen.dart'; - class CommunityDynamic extends StatefulWidget { final int itemCount; final Function(double height) heightFun; @@ -77,11 +76,9 @@ class _CommunityDynamic extends State { String filePath; initVideo() async { - if(widget?.article?.content == null) - return; + if (widget?.article?.content == null) return; var cnt = jsonDecode(widget.article.content); - if (cnt["type"] == "video" && - cnt["video"] != null) { + if (cnt["type"] == "video" && cnt["video"] != null) { if (widget.isList) { videoPlayerController = VideoPlayerController.network( cnt["video"], @@ -116,11 +113,12 @@ class _CommunityDynamic extends State { } ///关注/取关会员 - _vipFollow(followId,isFollow) async { + _vipFollow(followId, isFollow) async { BaseData baseData = await apiService.follow(followId); if (baseData != null && baseData.isSuccess) { widget.exitFull(); - SmartDialog.showToast(isFollow?"关注成功":"取关成功", alignment: Alignment.center); + SmartDialog.showToast(isFollow ? "关注成功" : "取关成功", + alignment: Alignment.center); setState(() {}); } else { // SmartDialog.showToast(baseData.msg, alignment: Alignment.center); @@ -173,26 +171,29 @@ class _CommunityDynamic extends State { child: Row( children: [ GestureDetector( - onTap: (){ - if(widget?.article?.authorHeadImg == ""){ - SmartDialog.showToast("用户暂未设置头像", alignment: Alignment.center); - return; - } - Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:[widget?.article?.authorHeadImg ?? ""],//传入图片list - index: 0,//传入当前点击的图片的index - ), )); - }, - child: MImage( - widget?.article?.authorHeadImg ?? "", - width: 44, - height: 44, - isCircle: true, - fit: BoxFit.cover, - errorSrc: "assets/image/default_1.png", - fadeSrc: "assets/image/default_1.png", - ), - ), + onTap: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: [(widget?.article?.authorHeadImg ?? "").isEmpty? + "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg":widget?.article?.authorHeadImg + ], //传入图片list + index: 0, //传入当前点击的图片的index + ), + )); + }, + child: + MImage( + (widget?.article?.authorHeadImg ?? "https://lmg.jj20.com/up/allimg/tx30/09041130358711081.jpg") + "?imageView2/1/w/200/h/200/format/jpg/q/75", + width: 44, + height: 44, + isCircle: true, + fit: BoxFit.cover, + errorSrc: "assets/image/default_1.png", + fadeSrc: "assets/image/default_1.png", + ), + ), SizedBox( width: 8, ), @@ -228,7 +229,8 @@ class _CommunityDynamic extends State { if (widget.commentType == 0) { widget.article.liked = !(widget.article.liked ?? false); - _vipFollow(widget.article.updateUser,widget.article.liked ?? false); + _vipFollow(widget.article.updateUser, + widget.article.liked ?? false); } else { showDeleteDialog(); } @@ -261,11 +263,14 @@ class _CommunityDynamic extends State { 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, + ), + ), ), ], ), @@ -344,34 +349,41 @@ class _CommunityDynamic extends State { } var cnt = jsonDecode(subjectInfo); Widget itemWidget = Container(); - if (cnt["type"] == "image"&& cnt["images"] != null && cnt["images"].length > 0) { + if (cnt["type"] == "image" && + cnt["images"] != null && + cnt["images"].length > 0) { if (cnt["images"].length == 1) { itemWidget = Container( child: InkWell( - onTap: () { - // ImagePickers.previewImages(subjectInfo.images,0); - Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:cnt["images"],//传入图片list - index: 0,//传入当前点击的图片的index - ), ), ); - }, - child: MImage( - cnt["images"][0], - fit: BoxFit.cover, - radius: BorderRadius.circular(2), - width: MediaQuery.of(context).size.width / 1.5, - height: MediaQuery.of(context).size.width / 1.5, - errorSrc: "assets/image/default_2_1.png", - fadeSrc: "assets/image/default_2_1.png", - )), + onTap: () { + // ImagePickers.previewImages(subjectInfo.images,0); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: 0, //传入当前点击的图片的index + ), + ), + ); + }, + child: MImage( + cnt["images"][0].replaceAll(".jpg", ".jpg?imageView2/0/q/75"), + fit: BoxFit.contain, + radius: BorderRadius.circular(2), + width: MediaQuery.of(context).size.width/1.5, + height:MediaQuery.of(context).size.width, + errorSrc: "assets/image/default_2_1.png", + fadeSrc: "assets/image/default_2_1.png", + )), ); } else { itemWidget = GridView.builder( gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( - crossAxisCount: (cnt["images"].length == 2 || - cnt["images"].length == 4) - ? 2 - : 3, + crossAxisCount: + (cnt["images"].length == 2 || cnt["images"].length == 4) + ? 2 + : 3, crossAxisSpacing: 12.w, mainAxisSpacing: 12.w, childAspectRatio: 1, @@ -384,13 +396,19 @@ class _CommunityDynamic extends State { child: InkWell( onTap: () { // ImagePickers.previewImages(subjectInfo.images, position); - Navigator.push(context, MaterialPageRoute( builder: (context) => PhotoViewGalleryScreen( - images:cnt["images"],//传入图片list - index: position,//传入当前点击的图片的index - ), ), ); + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => PhotoViewGalleryScreen( + images: cnt["images"], //传入图片list + index: position, //传入当前点击的图片的index + ), + ), + ); }, child: MImage( - cnt["images"][position], + cnt["images"][position] + .replaceAll(".jpg", ".jpg?imageView2/0/q/75"), fit: BoxFit.cover, aspectRatio: 1, radius: BorderRadius.circular(1), @@ -403,15 +421,16 @@ class _CommunityDynamic extends State { itemCount: cnt["images"].length, ); } - } - else if (cnt["type"] == "video" && cnt["video"]!= null && cnt["video"].isNotEmpty) { + } else if (cnt["type"] == "video" && + cnt["video"] != null && + cnt["video"].isNotEmpty) { itemWidget = videoWidget( MediaQuery.of(context).size.width - 32, videoPlayerController != null ? (MediaQuery.of(context).size.width - 32) / videoPlayerController.value.aspectRatio : MediaQuery.of(context).size.width / 2, - !widget.isList ? cnt["video"] : widget.article.coverImg, + cnt["video"].replaceAll(".mp4", "_poster.jpg"), ); } return Column( diff --git a/lib/community/headlines/activity_top_list.dart b/lib/community/headlines/activity_top_list.dart index d5524ecc..32e7bc3e 100644 --- a/lib/community/headlines/activity_top_list.dart +++ b/lib/community/headlines/activity_top_list.dart @@ -47,9 +47,11 @@ class _ActivityTopList extends State { itemBuilder: (context, position) { return GestureDetector( onTap: () { - Navigator.of(context).pushNamed( - '/router/headlines_column_details', - arguments: {"id": widget.articleTop[position].id}); + Navigator.of(context).pushNamed('/router/web_page', + arguments: {"articleId": widget.articleTop[position].id}); + widget.articleTop[position].viewers = + (widget.articleTop[position].viewers + 1); + setState(() {}); }, child: headlinesCollectionItem(widget.articleTop[position], position), ); diff --git a/lib/mine/mine_page.dart b/lib/mine/mine_page.dart index b6cdfcde..fa8e566a 100644 --- a/lib/mine/mine_page.dart +++ b/lib/mine/mine_page.dart @@ -53,12 +53,9 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { @override void dispose() { super.dispose(); - if (_refreshController != null) - _refreshController.dispose(); + if (_refreshController != null) _refreshController.dispose(); } - - @override void initState() { super.initState(); @@ -118,7 +115,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { EasyLoading.dismiss(); } - _onRefresh(){ + _onRefresh() { queryUserInfo(); querySocialInfo(); } @@ -134,7 +131,7 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ); BaseData baseData = - await apiService.socialInfo().catchError((onError) { + await apiService.socialInfo().catchError((onError) { _refreshController.refreshFailed(); }); if (baseData != null && baseData.isSuccess) { @@ -203,9 +200,12 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { tag: "vip", ranks: ranks, userInfo: userInfo, - rank: double.tryParse(userInfo?.expendAmount??"0").toInt(), - rankMax: userInfo?.memberRankVo?.nextOrigin??0, - createTime: userInfo?.createTime??"", + rank: double.tryParse( + userInfo?.expendAmount ?? "0") + .toInt(), + rankMax: + userInfo?.memberRankVo?.nextOrigin ?? 0, + createTime: userInfo?.createTime ?? "", ), ], ), @@ -309,10 +309,10 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { } ///关注度/粉丝/成就数量 - Widget attention(){ + Widget attention() { return Container( - margin: EdgeInsets.only(left: 16,top: 10,right: 16), - padding: EdgeInsets.only(top: 16,bottom: 16), + margin: EdgeInsets.only(left: 16, top: 10, right: 16), + // padding: EdgeInsets.only(top: 16,bottom: 16), decoration: BoxDecoration( color: Colors.white, borderRadius: BorderRadius.circular(8), @@ -325,36 +325,35 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), ], ), - child:GestureDetector( - onTap:(){ - Navigator.of(context).pushNamed( - '/router/communityFollow', - arguments: {}, - ); - }, - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceAround, - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - GestureDetector( - onTap:(){ + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceAround, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { Navigator.of(context).pushNamed( '/router/communityFollow', arguments: {}, ); }, - child: - Column( + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( children: [ Text( - infoNumber != null ?infoNumber.follow.toString() :"0", + infoNumber != null ? infoNumber.follow.toString() : "0", style: TextStyle( color: Color(0xFF000000), fontSize: 15.sp, fontWeight: MyFontWeight.medium, ), ), - SizedBox(height:4,), + SizedBox( + height: 4, + ), Text( S.of(context).guanzhu, style: TextStyle( @@ -364,70 +363,86 @@ class _MinePage extends State with AutomaticKeepAliveClientMixin { ), ), ], - ), + )), ), - GestureDetector( - onTap:(){ + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { Navigator.of(context).pushNamed( '/router/communityFollow', arguments: {}, ); }, - child: - Column( - children: [ - Text( - infoNumber != null ?infoNumber.fans.toString() :"0", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox(height:4,), - Text( - S.of(context).fensi, - style: TextStyle( - color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), - ), - ], - ), + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + infoNumber != null ? infoNumber.fans.toString() : "0", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 4, + ), + Text( + S.of(context).fensi, + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], + )), ), - GestureDetector( - onTap:(){ - Navigator.of(context).pushNamed( - '/router/mine_attainment_page', - arguments: {"userInfo":userInfo}, - ); - }, - child: - Column( - children: [ - Text( - infoNumber != null ?infoNumber.achievementNumber.toString() :"0", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 15.sp, - fontWeight: MyFontWeight.medium, - ), - ), - SizedBox(height:4,), - Text( - "成就", - style: TextStyle( - color: Color(0xFF000000), - fontSize: 14.sp, - fontWeight: MyFontWeight.regular, - ), + ), + Expanded( + child: GestureDetector( + behavior: HitTestBehavior.opaque, + onTap: () { + Navigator.of(context).pushNamed( + '/router/mine_attainment_page', + arguments: {"userInfo": userInfo}, + ); + }, + child: Container( + color: Colors.transparent, + padding: EdgeInsets.all(16), + child: Column( + children: [ + Text( + infoNumber != null + ? infoNumber.achievementNumber.toString() + : "0", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 15.sp, + fontWeight: MyFontWeight.medium, + ), + ), + SizedBox( + height: 4, + ), + Text( + "成就", + style: TextStyle( + color: Color(0xFF000000), + fontSize: 14.sp, + fontWeight: MyFontWeight.regular, + ), + ), + ], ), - ], - ), - ), - ], - ), + )), + ) + ], ), ); } diff --git a/lib/store/store_order.dart b/lib/store/store_order.dart index 42bae5f3..e4424e29 100644 --- a/lib/store/store_order.dart +++ b/lib/store/store_order.dart @@ -202,17 +202,19 @@ class _StoreOrderPage extends State @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: () async { - if (dialogShowing) { - debugPrint("ssssasdadsasdadasd"); - SmartDialog.dismiss(); - return false; - } else { - return true; - } - }, - child: Container( + return + // WillPopScope( + // onWillPop: () async { + // if (dialogShowing) { + // debugPrint("ssssasdadsasdadasd"); + // SmartDialog.dismiss(); + // return false; + // } else { + // return true; + // } + // }, + // child: + Container( color: Colors.white, child: Stack( children: [ @@ -241,10 +243,14 @@ class _StoreOrderPage extends State stretch: false, brightness: Brightness.light, leading: GestureDetector( + behavior: HitTestBehavior.opaque, onTap: () { Navigator.of(context).pop(); }, child: Container( + width: double.infinity, + height: double.infinity, + color: Colors.transparent, alignment: Alignment.centerRight, margin: EdgeInsets.only(left: 10), padding: EdgeInsets.all(10), @@ -484,8 +490,8 @@ class _StoreOrderPage extends State ), ], ), - ), - ); + ); + // ); } ///领取优惠券 diff --git a/lib/view_widget/custom_image.dart b/lib/view_widget/custom_image.dart index dbe05a58..de07a63d 100644 --- a/lib/view_widget/custom_image.dart +++ b/lib/view_widget/custom_image.dart @@ -34,12 +34,15 @@ class MImage extends StatelessWidget { Widget image = LayoutBuilder( builder: (context, constraints) { String imageUrl = ""; + ///压缩图片 if (src != null && src != "" && src.startsWith("http")) { + String oper = src.contains("?") ? "" :"?"; imageUrl = - "$src?imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" + "$src$oper/imageMogr2/thumbnail/${constraints.constrainWidth() * scaleIndex}" "x${constraints.constrainHeight() * scaleIndex}/format/webp/quality/100"; } + // print(imageUrl); // print("constrainWidth: ${constraints.constrainWidth()}"); // print("constrainHeight: ${constraints.constrainHeight()}");