fix: filter out timeline categories with key null when creating a new one

This commit is contained in:
Freek van de Ven 2024-05-10 10:07:15 +02:00
parent 13960c4f1c
commit 8d13e4af27
3 changed files with 9 additions and 2 deletions

View file

@ -3,6 +3,7 @@
- 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
- Add a getUserId function to retrieve the userId when needed in the userstory configuration
- Fix the timelinecategory selection by removing the categories with key null
## 3.0.1

View file

@ -15,6 +15,7 @@ class TimelineTheme {
this.sendIcon,
this.moreIcon,
this.deleteIcon,
this.categorySelectionBorderColor,
this.textStyles = const TimelineTextStyles(),
});
@ -38,5 +39,9 @@ class TimelineTheme {
/// The icon for delete action (delete post)
final Widget? deleteIcon;
/// The text style overrides for all the texts in the timeline
final TimelineTextStyles textStyles;
/// The color of the border around the category in the selection screen
final Color? categorySelectionBorderColor;
}

View file

@ -38,7 +38,7 @@ class TimelineSelectionScreen extends StatelessWidget {
),
const SizedBox(height: 4),
for (var category in categories.where(
(element) => element.canCreate,
(element) => element.canCreate && element.key != null,
)) ...[
options.categorySelectorButtonBuilder?.call(
context,
@ -55,7 +55,8 @@ class TimelineSelectionScreen extends StatelessWidget {
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: const Color(0xff71C6D1),
color: options.theme.categorySelectionBorderColor ??
const Color(0xff71C6D1),
width: 2,
),
),