fix: first item scrolling under categories

This commit is contained in:
mike doornenbal 2024-08-22 14:42:13 +02:00 committed by Freek van de Ven
parent 09b11dbbc7
commit c41f43bb2a
3 changed files with 36 additions and 16 deletions

View file

@ -10,5 +10,3 @@ jobs:
uses: Iconica-Development/.github/.github/workflows/melos-ci.yml@master uses: Iconica-Development/.github/.github/workflows/melos-ci.yml@master
secrets: inherit secrets: inherit
permissions: write-all permissions: write-all
with:
flutter_version: 3.24

View file

@ -95,7 +95,7 @@ class _TimelineScreenState extends State<TimelineScreen> {
void _updateIsOnTop() { void _updateIsOnTop() {
setState(() { setState(() {
_isOnTop = controller.position.pixels < 40; _isOnTop = controller.position.pixels < 0.1;
}); });
} }

View file

@ -55,6 +55,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
var theme = Theme.of(context); var theme = Theme.of(context);
var isLikedByUser = widget.post.likedBy?.contains(widget.userId) ?? false; var isLikedByUser = widget.post.likedBy?.contains(widget.userId) ?? false;
return SizedBox( return SizedBox(
height: widget.post.imageUrl != null || widget.post.image != null height: widget.post.imageUrl != null || widget.post.image != null
? widget.options.postWidgetHeight ? widget.options.postWidgetHeight
@ -65,7 +66,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
children: [ children: [
Row( Row(
children: [ children: [
if (widget.post.creator != null) if (widget.post.creator != null) ...[
InkWell( InkWell(
onTap: widget.onUserTap != null onTap: widget.onUserTap != null
? () => ? () =>
@ -110,9 +111,10 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
], ],
), ),
), ),
],
const Spacer(), const Spacer(),
if (widget.allowAllDeletion || if (widget.allowAllDeletion ||
widget.post.creator?.userId == widget.userId) widget.post.creator?.userId == widget.userId) ...[
PopupMenuButton( PopupMenuButton(
onSelected: (value) async { onSelected: (value) async {
if (value == 'delete') { if (value == 'delete') {
@ -152,6 +154,7 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
), ),
), ),
], ],
],
), ),
// image of the post // image of the post
if (widget.post.imageUrl != null || widget.post.image != null) ...[ if (widget.post.imageUrl != null || widget.post.image != null) ...[
@ -313,16 +316,9 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
post: widget.post, post: widget.post,
), ),
] else ...[ ] else ...[
Text( _PostLikeCountText(
'${widget.post.likes} ' post: widget.post,
'${widget.post.likes > 1 options: widget.options,
? widget.options.translations.multipleLikesTitle
: widget.options.translations.oneLikeTitle}',
style:
widget.options.theme.textStyles.listPostLikeTitleAndAmount ??
theme.textTheme.titleSmall!.copyWith(
color: Colors.black,
),
), ),
Text.rich( Text.rich(
TextSpan( TextSpan(
@ -362,6 +358,32 @@ class _TimelinePostWidgetState extends State<TimelinePostWidget> {
} }
} }
class _PostLikeCountText extends StatelessWidget {
const _PostLikeCountText({
required this.post,
required this.options,
});
final TimelineOptions options;
final TimelinePost post;
@override
Widget build(BuildContext context) {
var theme = Theme.of(context);
var likeTranslation = post.likes > 1
? options.translations.multipleLikesTitle
: options.translations.oneLikeTitle;
return Text(
'${post.likes} '
'$likeTranslation',
style: options.theme.textStyles.listPostLikeTitleAndAmount ??
theme.textTheme.titleSmall!.copyWith(
color: Colors.black,
),
);
}
}
Future<void> showPostDeletionConfirmationDialog( Future<void> showPostDeletionConfirmationDialog(
TimelineOptions options, TimelineOptions options,
BuildContext context, BuildContext context,