Skip to content

Commit

Permalink
[fix] 修bug,修改版本号到准备打包的版本
Browse files Browse the repository at this point in the history
修复了图片超出范围 加载不流畅 多重按钮的bug
  • Loading branch information
steven12138 committed Mar 14, 2024
1 parent 395ae5a commit cc6545d
Show file tree
Hide file tree
Showing 5 changed files with 152 additions and 151 deletions.
7 changes: 4 additions & 3 deletions lib/feedback/view/components/normal_comment_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,10 @@ class _NCommentCardState extends State<NCommentCard>
),
),
CupertinoActionSheetAction(
onPressed: (){
onPressed: () {
Navigator.pop(context);
if (Provider.of<NewFloorProvider>(context, listen: false)
if (Provider.of<NewFloorProvider>(context,
listen: false)
.inputFieldEnabled) {
context.read<NewFloorProvider>().clearAndClose();
} else {
Expand Down Expand Up @@ -800,7 +801,7 @@ class _NCommentCardState extends State<NCommentCard>
)),
],
),
Positioned(right: 8.w, child: commentMenuButton)
// Positioned(right: 8.w, child: commentMenuButton)
],
);
}
Expand Down
241 changes: 113 additions & 128 deletions lib/feedback/view/components/post_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -184,12 +184,13 @@ class _PostCardNormalState extends State<PostCardNormal> {
));

/// 图片
var outerImages =
post.imageUrls.length == 1 ? outerSingleImage : outerMultipleImage;
var outerImages = post.imageUrls.length == 1
? outerSingleImage
: multiImage(tapPreview: false);

var innerImages = post.imageUrls.length == 1
? InnerSingleImageWidget(post.imageUrls[0])
: innerMultipleImage;
: multiImage();

/// 评论点赞点踩浏览量
var likeUnlikeVisit = Row(
Expand Down Expand Up @@ -339,74 +340,75 @@ class _PostCardNormalState extends State<PostCardNormal> {
controller: widget.screenshotController ?? ScreenshotController(),
child: Container(
color: WpyTheme.of(context).get(WpyColorKey.primaryBackgroundColor),
child: widget.outer
// outer 框架
? GestureDetector(
onTap: () {
if (SplitUtil.needHorizontalView) {
context.read<LakeModel>().clearAndSetSplitPost(post);
} else {
FeedbackService.visitPost(
id: widget.post.id, onFailure: (_) {});
Navigator.pushNamed(
context,
FeedbackRouter.detail,
arguments: post,
);
}
},
child: Container(
padding: EdgeInsets.fromLTRB(0, 0, 0, SplitUtil.h * 8),
color: WpyTheme.of(context)
.get(WpyColorKey.primaryBackgroundColor),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...head,
if (post.imageUrls.isNotEmpty)
Padding(
padding: EdgeInsets.only(
left: SplitUtil.w * 16,
right: SplitUtil.w * 16,
bottom: SplitUtil.h * 8),
child: outerImages),
Padding(
padding: EdgeInsets.only(left: SplitUtil.w * 10),
child: likeUnlikeVisit,
)
],
),
),
)

// inner 框架
: Container(
child: Builder(builder: (context) {
if (widget.outer) {
return GestureDetector(
onTap: () {
if (SplitUtil.needHorizontalView) {
context.read<LakeModel>().clearAndSetSplitPost(post);
} else {
FeedbackService.visitPost(
id: widget.post.id, onFailure: (_) {});
Navigator.pushNamed(
context,
FeedbackRouter.detail,
arguments: post,
);
}
},
child: Container(
padding: EdgeInsets.fromLTRB(0, 0, 0, SplitUtil.h * 8),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: WpyTheme.of(context)
.get(WpyColorKey.lightBorderColor),
width: 1.h))),
color: WpyTheme.of(context)
.get(WpyColorKey.primaryBackgroundColor),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...head,
if (post.imageUrls.isNotEmpty)
Padding(
padding: EdgeInsets.only(
left: SplitUtil.w * 16,
right: SplitUtil.w * 16,
bottom: SplitUtil.h * 10),
child: innerImages,
),
padding: EdgeInsets.only(
left: SplitUtil.w * 16,
right: SplitUtil.w * 16,
bottom: SplitUtil.h * 8),
child: outerImages),
Padding(
padding: EdgeInsets.only(left: SplitUtil.w * 8),
child: tagCampusVisit,
),
padding: EdgeInsets.only(left: SplitUtil.w * 10),
child: likeUnlikeVisit,
)
],
),
),
);
} else {
return Container(
padding: EdgeInsets.fromLTRB(0, 0, 0, SplitUtil.h * 8),
decoration: BoxDecoration(
border: Border(
bottom: BorderSide(
color: WpyTheme.of(context)
.get(WpyColorKey.lightBorderColor),
width: 1.h))),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
...head,
if (post.imageUrls.isNotEmpty)
Padding(
padding: EdgeInsets.only(
left: SplitUtil.w * 16,
right: SplitUtil.w * 16,
bottom: SplitUtil.h * 10),
child: innerImages,
),
Padding(
padding: EdgeInsets.only(left: SplitUtil.w * 8),
child: tagCampusVisit,
),
],
),
);
}
}),
),
);

Expand All @@ -415,76 +417,59 @@ class _PostCardNormalState extends State<PostCardNormal> {
/////////////////////////////////////////////////////////
}

Widget get outerSingleImage {
return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: Container(
width: SplitUtil.sw - SplitUtil.w * 20 - SplitUtil.toolbarWidth,
height: SplitUtil.w * 150,
color: WpyTheme.of(context).get(WpyColorKey.iconAnimationStartColor),
child: WpyPic(
picBaseUrl + 'origin/' + post.imageUrls[0],
width: 350.w,
height: 197.w,
fit: BoxFit.cover,
alignment: Alignment.topCenter,
),
));
}

Widget get innerMultipleImage => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: List.generate(
post.imageUrls.length,
(index) => WButton(
onPressed: () => Navigator.pushNamed(
context,
FeedbackRouter.imageView,
arguments: ImageViewPageArgs(
post.imageUrls, post.imageUrls.length, index, false),
),
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: WpyPic(picBaseUrl + 'thumb/' + post.imageUrls[index],
fit: BoxFit.cover,
width: ((SplitUtil.sw -
SplitUtil.w * 20 -
SplitUtil.toolbarWidth) -
(post.imageUrls.length - 1) * SplitUtil.w * 6) /
post.imageUrls.length,
height: ((SplitUtil.sw -
SplitUtil.w * 20 -
SplitUtil.toolbarWidth) -
(post.imageUrls.length - 1) * SplitUtil.w * 6) /
post.imageUrls.length,
withHolder: true),
),
),
Widget get outerSingleImage => ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: Container(
width: SplitUtil.sw - SplitUtil.w * 20 - SplitUtil.toolbarWidth,
height: SplitUtil.w * 150,
color: WpyTheme.of(context).get(WpyColorKey.iconAnimationStartColor),
child: WpyPic(
picBaseUrl + 'origin/' + post.imageUrls[0],
width: 350.w,
height: 197.w,
fit: BoxFit.cover,
alignment: Alignment.topCenter,
),
);

Widget get outerMultipleImage => Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: List.generate(
post.imageUrls.length,
(index) => ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: WpyPic(picBaseUrl + 'thumb/' + post.imageUrls[index],
fit: BoxFit.cover,
width: ((SplitUtil.sw -
SplitUtil.w * 20 -
SplitUtil.toolbarWidth) -
(post.imageUrls.length - 1) * SplitUtil.w * 6) /
post.imageUrls.length,
height: ((SplitUtil.sw -
SplitUtil.w * 20 -
SplitUtil.toolbarWidth) -
(post.imageUrls.length - 1) * SplitUtil.w * 6) /
post.imageUrls.length,
withHolder: true),
));

Widget multiImage({bool tapPreview = true}) =>
LayoutBuilder(builder: (context, layout) {
double padding = 4.w;
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: List.generate(
post.imageUrls.length,
(index) => Padding(
padding: EdgeInsets.all(padding),
child: IgnorePointer(
ignoring: !tapPreview,
child: GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
FeedbackRouter.imageView,
arguments: ImageViewPageArgs(
post.imageUrls, post.imageUrls.length, index, false),
);
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(8.r)),
child: WpyPic(
picBaseUrl + 'thumb/' + post.imageUrls[index],
fit: BoxFit.cover,
width:
layout.maxWidth / post.imageUrls.length - padding * 2,
height:
layout.maxWidth / post.imageUrls.length - padding * 2,
withHolder: true,
),
),
),
),
),
),
),
);
);
});
}

class InnerSingleImageWidget extends StatefulWidget {
Expand Down
14 changes: 9 additions & 5 deletions lib/feedback/view/image_view/image_view_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ class _ImageViewPageState extends State<ImageViewPage> {
scrollDirection: Axis.horizontal,
itemCount: widget.args.urlListLength,
backgroundDecoration: BoxDecoration(
color: WpyTheme.of(context)
.get(WpyColorKey.reverseBackgroundColor)),
color:
WpyTheme.of(context).get(WpyColorKey.reverseBackgroundColor)),
pageController: PageController(
initialPage: indexNow,
),
Expand All @@ -99,10 +99,12 @@ class _ImageViewPageState extends State<ImageViewPage> {
child: Container(
decoration: BoxDecoration(
color: WpyTheme.of(context)
.get(WpyColorKey.labelTextColor),
.get(WpyColorKey.labelTextColor)
.withOpacity(0.8),
borderRadius:
BorderRadius.all(Radius.circular(14.r))),
padding: EdgeInsets.fromLTRB(14.w, 10.w, 14.w, 14.w),
// 这里设置不一样是因为 返回图标的中心靠右 往左稍微拉一点
padding: EdgeInsets.fromLTRB(12.w, 10.w, 14.w, 10.w),
child: Icon(
CupertinoIcons.back,
color: WpyTheme.of(context)
Expand All @@ -120,7 +122,9 @@ class _ImageViewPageState extends State<ImageViewPage> {
right: 10.w,
child: Container(
decoration: BoxDecoration(
color: WpyTheme.of(context).get(WpyColorKey.labelTextColor),
color: WpyTheme.of(context)
.get(WpyColorKey.labelTextColor)
.withOpacity(0.7),
borderRadius: BorderRadius.all(Radius.circular(14.r))),
padding: EdgeInsets.fromLTRB(14.w, 10.w, 14.w, 14.w),
child: Row(
Expand Down
Loading

0 comments on commit cc6545d

Please sign in to comment.