🐛 Bug fixes
This commit is contained in:
parent
9ec0f1ff19
commit
4146820be5
@ -167,11 +167,13 @@ class PostCommentSliverListState extends State<PostCommentSliverList> {
|
|||||||
class PostCommentListPopup extends StatefulWidget {
|
class PostCommentListPopup extends StatefulWidget {
|
||||||
final SnPost post;
|
final SnPost post;
|
||||||
final int commentCount;
|
final int commentCount;
|
||||||
|
final int depth;
|
||||||
|
|
||||||
const PostCommentListPopup({
|
const PostCommentListPopup({
|
||||||
super.key,
|
super.key,
|
||||||
required this.post,
|
required this.post,
|
||||||
this.commentCount = 0,
|
this.commentCount = 0,
|
||||||
|
this.depth = 1,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -186,50 +188,53 @@ class _PostCommentListPopupState extends State<PostCommentListPopup> {
|
|||||||
final ua = context.watch<UserProvider>();
|
final ua = context.watch<UserProvider>();
|
||||||
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
final devicePixelRatio = MediaQuery.of(context).devicePixelRatio;
|
||||||
|
|
||||||
return Column(
|
return SizedBox(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
height: MediaQuery.of(context).size.height * 0.85,
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
const Icon(Symbols.comment, size: 24),
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
const Gap(16),
|
children: [
|
||||||
Text('postCommentsDetailed')
|
const Icon(Symbols.comment, size: 24),
|
||||||
.plural(widget.commentCount)
|
const Gap(16),
|
||||||
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
Text('postCommentsDetailed')
|
||||||
],
|
.plural(widget.commentCount)
|
||||||
).padding(horizontal: 20, top: 16, bottom: 12),
|
.textStyle(Theme.of(context).textTheme.titleLarge!),
|
||||||
Expanded(
|
],
|
||||||
child: CustomScrollView(
|
).padding(horizontal: 20, top: 16, bottom: 12),
|
||||||
slivers: [
|
Expanded(
|
||||||
if (ua.isAuthorized)
|
child: CustomScrollView(
|
||||||
SliverToBoxAdapter(
|
slivers: [
|
||||||
child: Container(
|
if (ua.isAuthorized)
|
||||||
height: 240,
|
SliverToBoxAdapter(
|
||||||
decoration: BoxDecoration(
|
child: Container(
|
||||||
border: Border.symmetric(
|
height: 240,
|
||||||
horizontal: BorderSide(
|
decoration: BoxDecoration(
|
||||||
color: Theme.of(context).dividerColor,
|
border: Border.symmetric(
|
||||||
width: 1 / devicePixelRatio,
|
horizontal: BorderSide(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1 / devicePixelRatio,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
child: PostMiniEditor(
|
||||||
child: PostMiniEditor(
|
postReplyId: widget.post.id,
|
||||||
postReplyId: widget.post.id,
|
onPost: () {
|
||||||
onPost: () {
|
_childListKey.currentState!.refresh();
|
||||||
_childListKey.currentState!.refresh();
|
},
|
||||||
},
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
PostCommentSliverList(
|
||||||
|
parentPost: widget.post,
|
||||||
|
key: _childListKey,
|
||||||
),
|
),
|
||||||
PostCommentSliverList(
|
],
|
||||||
parentPost: widget.post,
|
),
|
||||||
key: _childListKey,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -205,72 +205,6 @@ class PostItem extends StatelessWidget {
|
|||||||
final ua = context.read<UserProvider>();
|
final ua = context.read<UserProvider>();
|
||||||
final isAuthor = ua.isAuthorized && data.publisher.accountId == ua.user?.id;
|
final isAuthor = ua.isAuthorized && data.publisher.accountId == ua.user?.id;
|
||||||
|
|
||||||
if (!showFullPost && data.type == 'article') {
|
|
||||||
return Container(
|
|
||||||
constraints: BoxConstraints(maxWidth: maxWidth ?? double.infinity),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
_PostContentHeader(
|
|
||||||
data: data,
|
|
||||||
isRelativeDate: !showFullPost,
|
|
||||||
).padding(horizontal: 12, top: 8, bottom: 8),
|
|
||||||
if (data.preload?.video != null)
|
|
||||||
_PostVideoPlayer(data: data).padding(horizontal: 12, bottom: 8),
|
|
||||||
Container(
|
|
||||||
width: double.infinity,
|
|
||||||
margin: const EdgeInsets.only(bottom: 4, left: 12, right: 12),
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(8)),
|
|
||||||
border: Border.all(
|
|
||||||
color: Theme.of(context).dividerColor,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (data.preload?.thumbnail != null)
|
|
||||||
AspectRatio(
|
|
||||||
aspectRatio: 16 / 9,
|
|
||||||
child: ClipRRect(
|
|
||||||
borderRadius: const BorderRadius.only(
|
|
||||||
topLeft: Radius.circular(8),
|
|
||||||
topRight: Radius.circular(8),
|
|
||||||
),
|
|
||||||
child: AutoResizeUniversalImage(
|
|
||||||
sn.getAttachmentUrl(data.preload!.thumbnail!.rid),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const Gap(8),
|
|
||||||
_PostHeadline(data: data).padding(horizontal: 14),
|
|
||||||
const Gap(4),
|
|
||||||
Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
if (data.visibility > 0) _PostVisibilityHint(data: data),
|
|
||||||
_PostTruncatedHint(data: data),
|
|
||||||
if (data.tags.isNotEmpty) _PostTagsList(data: data),
|
|
||||||
],
|
|
||||||
).padding(horizontal: 12),
|
|
||||||
const Gap(8),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Text('postArticle')
|
|
||||||
.tr()
|
|
||||||
.fontSize(13)
|
|
||||||
.opacity(0.75)
|
|
||||||
.padding(horizontal: 24, bottom: 8),
|
|
||||||
_PostFeaturedComment(data: data, maxWidth: maxWidth)
|
|
||||||
.padding(horizontal: 12),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
).center();
|
|
||||||
}
|
|
||||||
|
|
||||||
final displayableAttachments = data.preload?.attachments
|
final displayableAttachments = data.preload?.attachments
|
||||||
?.where((ele) =>
|
?.where((ele) =>
|
||||||
ele?.mediaType != SnMediaType.image || data.type != 'article')
|
ele?.mediaType != SnMediaType.image || data.type != 'article')
|
||||||
@ -326,6 +260,33 @@ class PostItem extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
const Gap(8),
|
const Gap(8),
|
||||||
|
if (data.preload?.thumbnail != null)
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.only(bottom: 8),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
border: Border.all(
|
||||||
|
color: Theme.of(context).dividerColor,
|
||||||
|
width: 1,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: AspectRatio(
|
||||||
|
aspectRatio: 16 / 9,
|
||||||
|
child: ClipRRect(
|
||||||
|
borderRadius: const BorderRadius.all(
|
||||||
|
Radius.circular(8),
|
||||||
|
),
|
||||||
|
child: AutoResizeUniversalImage(
|
||||||
|
sn.getAttachmentUrl(
|
||||||
|
data.preload!.thumbnail!.rid,
|
||||||
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
if (data.preload?.video != null)
|
if (data.preload?.video != null)
|
||||||
_PostVideoPlayer(data: data).padding(bottom: 8),
|
_PostVideoPlayer(data: data).padding(bottom: 8),
|
||||||
if (data.type == 'question')
|
if (data.type == 'question')
|
||||||
@ -336,7 +297,14 @@ class PostItem extends StatelessWidget {
|
|||||||
data: data,
|
data: data,
|
||||||
isEnlarge: data.type == 'article' && showFullPost,
|
isEnlarge: data.type == 'article' && showFullPost,
|
||||||
).padding(bottom: 8),
|
).padding(bottom: 8),
|
||||||
if (data.body['content']?.isNotEmpty ?? false)
|
if (data.type == 'article' && !showFullPost)
|
||||||
|
Text('postArticle')
|
||||||
|
.tr()
|
||||||
|
.fontSize(13)
|
||||||
|
.opacity(0.75)
|
||||||
|
.padding(bottom: 8),
|
||||||
|
if ((data.body['content']?.isNotEmpty ?? false) &&
|
||||||
|
(showFullPost || data.type != 'article'))
|
||||||
_PostContentBody(
|
_PostContentBody(
|
||||||
data: data,
|
data: data,
|
||||||
isSelectable: showFullPost,
|
isSelectable: showFullPost,
|
||||||
@ -1431,7 +1399,10 @@ class _PostFeaturedComment extends StatefulWidget {
|
|||||||
final SnPost data;
|
final SnPost data;
|
||||||
final double? maxWidth;
|
final double? maxWidth;
|
||||||
|
|
||||||
const _PostFeaturedComment({required this.data, this.maxWidth});
|
const _PostFeaturedComment({
|
||||||
|
required this.data,
|
||||||
|
this.maxWidth,
|
||||||
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<_PostFeaturedComment> createState() => _PostFeaturedCommentState();
|
State<_PostFeaturedComment> createState() => _PostFeaturedCommentState();
|
||||||
@ -1493,6 +1464,7 @@ class _PostFeaturedCommentState extends State<_PostFeaturedComment> {
|
|||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
context: context,
|
context: context,
|
||||||
useRootNavigator: true,
|
useRootNavigator: true,
|
||||||
|
isScrollControlled: true,
|
||||||
builder: (context) => PostCommentListPopup(
|
builder: (context) => PostCommentListPopup(
|
||||||
post: widget.data,
|
post: widget.data,
|
||||||
commentCount: widget.data.metric.replyCount,
|
commentCount: widget.data.metric.replyCount,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user