feat: add listHeaderBuilder

This commit is contained in:
Freek van de Ven 2024-05-09 22:31:11 +02:00
parent 4f7fa834e4
commit 933386623a
3 changed files with 10 additions and 1 deletions

View file

@ -1,7 +1,7 @@
## 4.0.0
- Add a serviceBuilder to the userstory configuration
- Add a listHeaderBuilder for showing a header at the top of the list of posts in the timeline
## 3.0.1

View file

@ -52,6 +52,7 @@ class TimelineOptions {
this.maxContentLength,
this.categorySelectorButtonBuilder,
this.postOverviewButtonBuilder,
this.listHeaderBuilder,
this.titleInputDecoration,
this.contentInputDecoration,
});
@ -156,6 +157,11 @@ class TimelineOptions {
String text,
)? categorySelectorButtonBuilder;
/// This widgetbuilder is placed at the top of the list of posts and can be
/// used to add custom elements
final Widget Function(BuildContext context, String? category)?
listHeaderBuilder;
/// Builder for the post overview button
/// on the timeline post overview screen
final Widget Function(

View file

@ -223,6 +223,9 @@ class _TimelineScreenState extends State<TimelineScreen> {
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
/// Add a optional custom header to the list of posts
widget.options.listHeaderBuilder?.call(context, category) ??
const SizedBox.shrink(),
...posts.map(
(post) => Padding(
padding: widget.options.postPadding,