🐛 Fix post item color mismatch

This commit is contained in:
LittleSheep 2024-08-02 05:10:10 +08:00
parent 5b6a5d9046
commit bc3401a897
5 changed files with 31 additions and 10 deletions

View File

@ -24,7 +24,8 @@ class PostItem extends StatefulWidget {
final bool isShowEmbed;
final bool isFullDate;
final bool isContentSelectable;
final String? overrideAttachmentParent;
final String? attachmentParent;
final Color? backgroundColor;
const PostItem({
super.key,
@ -36,7 +37,8 @@ class PostItem extends StatefulWidget {
this.isShowEmbed = true,
this.isFullDate = false,
this.isContentSelectable = false,
this.overrideAttachmentParent,
this.attachmentParent,
this.backgroundColor,
});
@override
@ -186,7 +188,7 @@ class _PostItemState extends State<PostItem> {
child: PostItem(
item: widget.item.replyTo!,
isCompact: true,
overrideAttachmentParent: widget.item.id.toString(),
attachmentParent: widget.item.id.toString(),
).paddingSymmetric(vertical: 8),
),
],
@ -198,7 +200,9 @@ class _PostItemState extends State<PostItem> {
post: widget.item.replyTo!,
),
),
closedColor: Theme.of(context).colorScheme.surface,
closedElevation: 0,
openElevation: 0,
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
openColor: Theme.of(context).colorScheme.surface,
);
}
@ -229,7 +233,7 @@ class _PostItemState extends State<PostItem> {
child: PostItem(
item: widget.item.repostTo!,
isCompact: true,
overrideAttachmentParent: widget.item.id.toString(),
attachmentParent: widget.item.id.toString(),
).paddingSymmetric(vertical: 8),
),
],
@ -241,7 +245,9 @@ class _PostItemState extends State<PostItem> {
post: widget.item.repostTo!,
),
),
closedColor: Theme.of(context).colorScheme.surface,
closedElevation: 0,
openElevation: 0,
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
openColor: Theme.of(context).colorScheme.surface,
);
}
@ -369,7 +375,9 @@ class _PostItemState extends State<PostItem> {
post: item,
),
),
closedColor: Theme.of(context).colorScheme.surface,
closedElevation: 0,
openElevation: 0,
closedColor: widget.backgroundColor ?? Theme.of(context).colorScheme.surface,
openColor: Theme.of(context).colorScheme.surface,
);
}

View File

@ -11,6 +11,7 @@ class PostListWidget extends StatelessWidget {
final bool isClickable;
final bool isNestedClickable;
final PagingController<int, Post> controller;
final Color? backgroundColor;
const PostListWidget({
super.key,
@ -18,6 +19,7 @@ class PostListWidget extends StatelessWidget {
this.isShowEmbed = true,
this.isClickable = true,
this.isNestedClickable = true,
this.backgroundColor,
});
@override
@ -32,6 +34,7 @@ class PostListWidget extends StatelessWidget {
isNestedClickable: isNestedClickable,
isClickable: isClickable,
item: item,
backgroundColor: backgroundColor,
onUpdate: () {
controller.refresh();
},
@ -50,6 +53,7 @@ class PostListEntryWidget extends StatelessWidget {
final bool isClickable;
final Post item;
final Function onUpdate;
final Color? backgroundColor;
const PostListEntryWidget({
super.key,
@ -59,6 +63,7 @@ class PostListEntryWidget extends StatelessWidget {
required this.isClickable,
required this.item,
required this.onUpdate,
this.backgroundColor,
});
@override
@ -69,6 +74,7 @@ class PostListEntryWidget extends StatelessWidget {
item: item,
isShowEmbed: isShowEmbed,
isClickable: isNestedClickable,
backgroundColor: backgroundColor,
).paddingSymmetric(vertical: 8),
onLongPress: () {
final AuthProvider auth = Get.find();

View File

@ -102,7 +102,6 @@ class _PostQuickActionState extends State<PostQuickAction> {
onPressed: () {
showModalBottomSheet(
useRootNavigator: true,
backgroundColor: Theme.of(context).colorScheme.surface,
context: context,
builder: (context) {
return PostReplyListPopup(item: widget.item);

View File

@ -8,10 +8,12 @@ import 'package:solian/widgets/posts/post_list.dart';
class PostReplyList extends StatefulWidget {
final Post item;
final Color? backgroundColor;
const PostReplyList({
super.key,
required this.item,
this.backgroundColor,
});
@override
@ -45,7 +47,6 @@ class _PostReplyListState extends State<PostReplyList> {
@override
void initState() {
super.initState();
_pagingController.addPageRequestListener(getReplies);
}
@ -54,6 +55,7 @@ class _PostReplyListState extends State<PostReplyList> {
return PostListWidget(
isShowEmbed: false,
controller: _pagingController,
backgroundColor: widget.backgroundColor,
);
}
}
@ -74,7 +76,12 @@ class PostReplyListPopup extends StatelessWidget {
).paddingOnly(left: 24, right: 24, top: 32, bottom: 16),
Expanded(
child: CustomScrollView(
slivers: [PostReplyList(item: item)],
slivers: [
PostReplyList(
item: item,
backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow,
),
],
),
),
],

View File

@ -24,6 +24,7 @@ class PostSingleDisplay extends StatelessWidget {
isShowEmbed: true,
isNestedClickable: true,
onUpdate: onUpdate,
backgroundColor: Theme.of(context).colorScheme.surfaceContainerLow,
),
),
),