From 24c779d43be518dda5987942dd8bbd4fb57dc772 Mon Sep 17 00:00:00 2001 From: Freek van de Ven Date: Fri, 17 May 2024 14:57:01 +0200 Subject: [PATCH] feat: add option to set postCreationFloatingActionButtonColor to override floatingbuttoncolor --- CHANGELOG.md | 1 + .../lib/src/flutter_timeline_gorouter_userstory.dart | 6 +++++- .../lib/src/flutter_timeline_navigator_userstory.dart | 6 +++++- .../lib/src/config/timeline_theme.dart | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 479f846..bd4b83d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - 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 - Set an optional max length on the default post title input field +- Add a postCreationFloatingActionButtonColor to the timeline theme to set the color of the floating action button ## 3.0.1 diff --git a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart index fba23b9..91b238c 100644 --- a/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart +++ b/packages/flutter_timeline/lib/src/flutter_timeline_gorouter_userstory.dart @@ -44,7 +44,11 @@ List getTimelineStoryRoutes({ ); var button = FloatingActionButton( - backgroundColor: const Color(0xff71C6D1), + backgroundColor: config + .optionsBuilder(context) + .theme + .postCreationFloatingActionButtonColor ?? + const Color(0xff71C6D1), onPressed: () async => context.push( TimelineUserStoryRoutes.timelineCategorySelection, ), diff --git a/packages/flutter_timeline/lib/src/flutter_timeline_navigator_userstory.dart b/packages/flutter_timeline/lib/src/flutter_timeline_navigator_userstory.dart index 90465e4..b8f6d00 100644 --- a/packages/flutter_timeline/lib/src/flutter_timeline_navigator_userstory.dart +++ b/packages/flutter_timeline/lib/src/flutter_timeline_navigator_userstory.dart @@ -65,7 +65,11 @@ Widget _timelineScreenRoute({ ); var button = FloatingActionButton( - backgroundColor: const Color(0xff71C6D1), + backgroundColor: config + .optionsBuilder(context) + .theme + .postCreationFloatingActionButtonColor ?? + const Color(0xff71C6D1), onPressed: () async => Navigator.of(context).push( MaterialPageRoute( builder: (context) => _postCategorySelectionScreen( 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 2bb32fe..c5af788 100644 --- a/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart +++ b/packages/flutter_timeline_view/lib/src/config/timeline_theme.dart @@ -16,6 +16,7 @@ class TimelineTheme { this.moreIcon, this.deleteIcon, this.categorySelectionBorderColor, + this.postCreationFloatingActionButtonColor, this.textStyles = const TimelineTextStyles(), }); @@ -44,4 +45,7 @@ class TimelineTheme { /// The color of the border around the category in the selection screen final Color? categorySelectionBorderColor; + + /// The color of the floating action button on the overview screen + final Color? postCreationFloatingActionButtonColor; }