From 8d13e4af277dcccc733239f246b9e4a5ab80d5e9 Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Fri, 10 May 2024 10:07:15 +0200 Subject: [PATCH] fix: filter out timeline categories with key null when creating a new one --- CHANGELOG.md | 1 + .../flutter_timeline_view/lib/src/config/timeline_theme.dart | 5 +++++ .../lib/src/screens/timeline_selection_screen.dart | 5 +++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ff63f0..2fd622a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart b/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart index a2bb2c0..2bb32fe 100644 --- a/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart +++ b/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart @@ -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; } diff --git a/packages/flutter_timeline_view/lib/src/screens/timeline_selection_screen.dart b/packages/flutter_timeline_view/lib/src/screens/timeline_selection_screen.dart index e9e16d0..2b32668 100644 --- a/packages/flutter_timeline_view/lib/src/screens/timeline_selection_screen.dart +++ b/packages/flutter_timeline_view/lib/src/screens/timeline_selection_screen.dart @@ -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, ), ),