@ -23,34 +23,6 @@ class QuillSimpleToolbar extends StatelessWidget
Widget build ( BuildContext context ) {
final theEmbedButtons = configurations . embedButtons ;
final isButtonGroupShown = [
configurations . showFontFamily | |
configurations . showFontSize | |
configurations . showBoldButton | |
configurations . showItalicButton | |
configurations . showSmallButton | |
configurations . showUnderLineButton | |
configurations . showLineHeightButton | |
configurations . showStrikeThrough | |
configurations . showInlineCode | |
configurations . showColorButton | |
configurations . showBackgroundColorButton | |
configurations . showClearFormat | |
theEmbedButtons ? . isNotEmpty = = true ,
configurations . showLeftAlignment | |
configurations . showCenterAlignment | |
configurations . showRightAlignment | |
configurations . showJustifyAlignment | |
configurations . showDirection ,
configurations . showHeaderStyle ,
configurations . showListNumbers | |
configurations . showListBullets | |
configurations . showListCheck | |
configurations . showCodeBlock ,
configurations . showQuote | | configurations . showIndent ,
configurations . showLink | | configurations . showSearchButton
] ;
List < Widget > childrenBuilder ( BuildContext context ) {
final toolbarConfigurations =
context . requireQuillSimpleToolbarConfigurations ;
@ -68,7 +40,8 @@ class QuillSimpleToolbar extends StatelessWidget
space: configurations . sectionDividerSpace ,
) ) ;
return [
final groups = [
[
if ( configurations . showUndo )
QuillToolbarHistoryButton (
isUndo: true ,
@ -163,18 +136,13 @@ class QuillSimpleToolbar extends StatelessWidget
globalIconSize ? ? kDefaultIconSize ,
context . quillToolbarBaseButtonOptions ? . iconTheme ,
configurations . dialogTheme ) ,
if ( configurations . showDividers & &
isButtonGroupShown [ 0 ] & &
( isButtonGroupShown [ 1 ] | |
isButtonGroupShown [ 2 ] | |
isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
] ,
[
if ( configurations . showAlignmentButtons )
QuillToolbarSelectAlignmentButtons (
controller: globalController ,
options: toolbarConfigurations . buttonOptions . selectAlignmentButtons
options: toolbarConfigurations
. buttonOptions . selectAlignmentButtons
. copyWith (
showLeftAlignment: configurations . showLeftAlignment ,
showCenterAlignment: configurations . showCenterAlignment ,
@ -188,13 +156,8 @@ class QuillSimpleToolbar extends StatelessWidget
options: toolbarConfigurations . buttonOptions . direction ,
controller: globalController ,
) ,
if ( configurations . showDividers & &
isButtonGroupShown [ 1 ] & &
( isButtonGroupShown [ 2 ] | |
isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
] ,
[
if ( configurations . showLineHeightButton )
QuillToolbarSelectLineHeightStyleDropdownButton (
controller: globalController ,
@ -211,17 +174,12 @@ class QuillSimpleToolbar extends StatelessWidget
else
QuillToolbarSelectHeaderStyleButtons (
controller: globalController ,
options:
toolbarConfigurations . buttonOptions . selectHeaderStyleButtons ,
options: toolbarConfigurations
. buttonOptions . selectHeaderStyleButtons ,
) ,
] ,
if ( configurations . showDividers & &
configurations . showHeaderStyle & &
isButtonGroupShown [ 2 ] & &
( isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
] ,
[
if ( configurations . showListNumbers )
QuillToolbarToggleStyleButton (
attribute: Attribute . ol ,
@ -245,11 +203,8 @@ class QuillSimpleToolbar extends StatelessWidget
options: toolbarConfigurations . buttonOptions . codeBlock ,
controller: globalController ,
) ,
if ( configurations . showDividers & &
isButtonGroupShown [ 3 ] & &
( isButtonGroupShown [ 4 ] | | isButtonGroupShown [ 5 ] ) ) . . . [
divider ,
] ,
[
if ( configurations . showQuote )
QuillToolbarToggleStyleButton (
options: toolbarConfigurations . buttonOptions . quote ,
@ -268,10 +223,8 @@ class QuillSimpleToolbar extends StatelessWidget
isIncrease: false ,
options: toolbarConfigurations . buttonOptions . indentDecrease ,
) ,
if ( configurations . showDividers & &
isButtonGroupShown [ 4 ] & &
isButtonGroupShown [ 5 ] )
divider ,
] ,
[
if ( configurations . showLink )
toolbarConfigurations . linkStyleType . isOriginal
? QuillToolbarLinkStyleButton (
@ -311,8 +264,8 @@ class QuillSimpleToolbar extends StatelessWidget
controller: globalController ,
clipboardAction: ClipboardAction . paste ,
) ,
if ( configurations . customButtons . isNotEmpty ) . . . [
if ( configurations . showDividers ) divider ,
] ,
[
for ( final customButton in configurations . customButtons )
QuillToolbarCustomButton (
options: customButton ,
@ -320,6 +273,21 @@ class QuillSimpleToolbar extends StatelessWidget
) ,
] ,
] ;
final buttonsAll = < Widget > [ ] ;
for ( var i = 0 ; i < groups . length ; i + + ) {
final buttons = groups [ i ] ;
if ( buttons . isNotEmpty ) {
if ( buttonsAll . isNotEmpty ) {
buttonsAll . add ( divider ) ;
}
buttonsAll . addAll ( buttons ) ;
}
}
return buttonsAll ;
}
return QuillSimpleToolbarProvider (