From 48af9ae2d91628888ad873775901e9dd4f314f84 Mon Sep 17 00:00:00 2001 From: Ellet Date: Tue, 19 Dec 2023 19:46:00 +0300 Subject: [PATCH] Make the header dropdown button as a default --- example/lib/presentation/quill/my_quill_toolbar.dart | 1 - .../toolbar/simple_toolbar_configurations.dart | 8 ++++---- lib/src/widgets/toolbar/simple_toolbar.dart | 12 ++++++------ 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/example/lib/presentation/quill/my_quill_toolbar.dart b/example/lib/presentation/quill/my_quill_toolbar.dart index f85dbe0b..4a07cee0 100644 --- a/example/lib/presentation/quill/my_quill_toolbar.dart +++ b/example/lib/presentation/quill/my_quill_toolbar.dart @@ -201,7 +201,6 @@ class MyQuillToolbar extends StatelessWidget { configurations: QuillSimpleToolbarConfigurations( controller: controller, showAlignmentButtons: true, - headerStyleType: HeaderStyleType.dropdown, buttonOptions: QuillSimpleToolbarButtonOptions( base: QuillToolbarBaseButtonOptions( // Request editor focus when any button is pressed diff --git a/lib/src/models/config/toolbar/simple_toolbar_configurations.dart b/lib/src/models/config/toolbar/simple_toolbar_configurations.dart index f4c9d62e..8156a144 100644 --- a/lib/src/models/config/toolbar/simple_toolbar_configurations.dart +++ b/lib/src/models/config/toolbar/simple_toolbar_configurations.dart @@ -52,14 +52,14 @@ enum LinkStyleType { } enum HeaderStyleType { - /// Defines the original [QuillToolbarSelectHeaderStyleButtons]. + /// Defines the original [QuillToolbarSelectHeaderStyleDropdownButton]. original, - /// Defines the alternative [QuillToolbarSelectHeaderStyleDropdownButton]. - dropdown; + /// Defines the alternative [QuillToolbarSelectHeaderStyleButtons]. + buttons; bool get isOriginal => this == HeaderStyleType.original; - bool get isDropdown => this == HeaderStyleType.dropdown; + bool get isButtons => this == HeaderStyleType.buttons; } /// The configurations for the toolbar widget of flutter quill diff --git a/lib/src/widgets/toolbar/simple_toolbar.dart b/lib/src/widgets/toolbar/simple_toolbar.dart index f482af08..26000092 100644 --- a/lib/src/widgets/toolbar/simple_toolbar.dart +++ b/lib/src/widgets/toolbar/simple_toolbar.dart @@ -197,16 +197,16 @@ class QuillSimpleToolbar extends StatelessWidget ), if (configurations.showHeaderStyle) ...[ if (configurations.headerStyleType.isOriginal) - QuillToolbarSelectHeaderStyleButtons( - controller: globalController, - options: - toolbarConfigurations.buttonOptions.selectHeaderStyleButtons, - ) - else QuillToolbarSelectHeaderStyleDropdownButton( controller: globalController, options: toolbarConfigurations .buttonOptions.selectHeaderStyleDropdownButton, + ) + else + QuillToolbarSelectHeaderStyleButtons( + controller: globalController, + options: + toolbarConfigurations.buttonOptions.selectHeaderStyleButtons, ), ], if (configurations.showDividers &&