From 94f92bfe5ab9352fdaa89feab1b041e3d959d6a6 Mon Sep 17 00:00:00 2001 From: Sobhan Moradi Date: Mon, 18 Dec 2023 12:22:22 +0100 Subject: [PATCH] Add conditional rendering for toolbar header style options The toolbar header style now has two possible displays. If the 'headerStyleType' configuration is set to 'isOriginal', the toolbar will exhibit 'QuillToolbarSelectHeaderStyleButtons'. Otherwise, it will show a dropdown menu 'QuillToolbarSelectHeaderStyleDropdownButton'. This adds flexibility to the UI of the toolbar. --- lib/src/widgets/toolbar/simple_toolbar.dart | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/src/widgets/toolbar/simple_toolbar.dart b/lib/src/widgets/toolbar/simple_toolbar.dart index 7ae05372..5d93b666 100644 --- a/lib/src/widgets/toolbar/simple_toolbar.dart +++ b/lib/src/widgets/toolbar/simple_toolbar.dart @@ -195,12 +195,20 @@ class QuillSimpleToolbar extends StatelessWidget color: configurations.sectionDividerColor, space: configurations.sectionDividerSpace, ), - if (configurations.showHeaderStyle) - QuillToolbarSelectHeaderStyleDropdownButton( - controller: globalController, - options: toolbarConfigurations - .buttonOptions.selectHeaderStyleDropdownButton, - ), + if (configurations.showHeaderStyle) ...[ + if (configurations.headerStyleType.isOriginal) + QuillToolbarSelectHeaderStyleButtons( + controller: globalController, + options: + toolbarConfigurations.buttonOptions.selectHeaderStyleButtons, + ) + else + QuillToolbarSelectHeaderStyleDropdownButton( + controller: globalController, + options: toolbarConfigurations + .buttonOptions.selectHeaderStyleDropdownButton, + ), + ], if (configurations.showDividers && configurations.showHeaderStyle && isButtonGroupShown[2] &&