@ -8,7 +8,8 @@ import 'base_toolbar.dart';
import ' buttons/alignment/select_alignment_buttons.dart ' ;
import ' buttons/alignment/select_alignment_buttons.dart ' ;
import ' buttons/arrow_indicated_list_button.dart ' ;
import ' buttons/arrow_indicated_list_button.dart ' ;
class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget {
class QuillSimpleToolbar extends StatelessWidget
implements PreferredSizeWidget {
const QuillSimpleToolbar ( {
const QuillSimpleToolbar ( {
required this . configurations ,
required this . configurations ,
super . key ,
super . key ,
@ -36,15 +37,23 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
configurations . showBackgroundColorButton | |
configurations . showBackgroundColorButton | |
configurations . showClearFormat | |
configurations . showClearFormat | |
theEmbedButtons ? . isNotEmpty = = true ,
theEmbedButtons ? . isNotEmpty = = true ,
configurations . showLeftAlignment | | configurations . showCenterAlignment | | configurations . showRightAlignment | | configurations . showJustifyAlignment | | configurations . showDirection ,
configurations . showLeftAlignment | |
configurations . showCenterAlignment | |
configurations . showRightAlignment | |
configurations . showJustifyAlignment | |
configurations . showDirection ,
configurations . showHeaderStyle ,
configurations . showHeaderStyle ,
configurations . showListNumbers | | configurations . showListBullets | | configurations . showListCheck | | configurations . showCodeBlock ,
configurations . showListNumbers | |
configurations . showListBullets | |
configurations . showListCheck | |
configurations . showCodeBlock ,
configurations . showQuote | | configurations . showIndent ,
configurations . showQuote | | configurations . showIndent ,
configurations . showLink | | configurations . showSearchButton
configurations . showLink | | configurations . showSearchButton
] ;
] ;
List < Widget > childrenBuilder ( BuildContext context ) {
List < Widget > childrenBuilder ( BuildContext context ) {
final toolbarConfigurations = context . requireQuillSimpleToolbarConfigurations ;
final toolbarConfigurations =
context . requireQuillSimpleToolbarConfigurations ;
final globalIconSize = toolbarConfigurations . buttonOptions . base . iconSize ;
final globalIconSize = toolbarConfigurations . buttonOptions . base . iconSize ;
@ -148,13 +157,25 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
options: toolbarConfigurations . buttonOptions . clearFormat ,
options: toolbarConfigurations . buttonOptions . clearFormat ,
) ,
) ,
if ( theEmbedButtons ! = null )
if ( theEmbedButtons ! = null )
for ( final builder in theEmbedButtons ) builder ( globalController , globalIconSize ? ? kDefaultIconSize , context . quillToolbarBaseButtonOptions ? . iconTheme , configurations . dialogTheme ) ,
for ( final builder in theEmbedButtons )
if ( configurations . showDividers & & isButtonGroupShown [ 0 ] & & ( isButtonGroupShown [ 1 ] | | isButtonGroupShown [ 2 ] | | isButtonGroupShown [ 3 ] | | isButtonGroupShown [ 4 ] | | isButtonGroupShown [ 5 ] ) )
builder (
globalController ,
globalIconSize ? ? kDefaultIconSize ,
context . quillToolbarBaseButtonOptions ? . iconTheme ,
configurations . dialogTheme ) ,
if ( configurations . showDividers & &
isButtonGroupShown [ 0 ] & &
( isButtonGroupShown [ 1 ] | |
isButtonGroupShown [ 2 ] | |
isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
divider ,
if ( configurations . showAlignmentButtons )
if ( configurations . showAlignmentButtons )
QuillToolbarSelectAlignmentButtons (
QuillToolbarSelectAlignmentButtons (
controller: globalController ,
controller: globalController ,
options: toolbarConfigurations . buttonOptions . selectAlignmentButtons . copyWith (
options: toolbarConfigurations . buttonOptions . selectAlignmentButtons
. copyWith (
showLeftAlignment: configurations . showLeftAlignment ,
showLeftAlignment: configurations . showLeftAlignment ,
showCenterAlignment: configurations . showCenterAlignment ,
showCenterAlignment: configurations . showCenterAlignment ,
showRightAlignment: configurations . showRightAlignment ,
showRightAlignment: configurations . showRightAlignment ,
@ -167,20 +188,34 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
options: toolbarConfigurations . buttonOptions . direction ,
options: toolbarConfigurations . buttonOptions . direction ,
controller: globalController ,
controller: globalController ,
) ,
) ,
if ( configurations . showDividers & & isButtonGroupShown [ 1 ] & & ( isButtonGroupShown [ 2 ] | | isButtonGroupShown [ 3 ] | | isButtonGroupShown [ 4 ] | | isButtonGroupShown [ 5 ] ) ) divider ,
if ( configurations . showDividers & &
isButtonGroupShown [ 1 ] & &
( isButtonGroupShown [ 2 ] | |
isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
if ( configurations . showHeaderStyle ) . . . [
if ( configurations . showHeaderStyle ) . . . [
if ( configurations . headerStyleType . isOriginal )
if ( configurations . headerStyleType . isOriginal )
QuillToolbarSelectHeaderStyleDropdownButton (
QuillToolbarSelectHeaderStyleDropdownButton (
controller: globalController ,
controller: globalController ,
options: toolbarConfigurations . buttonOptions . selectHeaderStyleDropdownButton ,
options: toolbarConfigurations
. buttonOptions . selectHeaderStyleDropdownButton ,
)
)
else
else
QuillToolbarSelectHeaderStyleButtons (
QuillToolbarSelectHeaderStyleButtons (
controller: globalController ,
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 . showDividers & &
configurations . showHeaderStyle & &
isButtonGroupShown [ 2 ] & &
( isButtonGroupShown [ 3 ] | |
isButtonGroupShown [ 4 ] | |
isButtonGroupShown [ 5 ] ) )
divider ,
if ( configurations . showListNumbers )
if ( configurations . showListNumbers )
QuillToolbarToggleStyleButton (
QuillToolbarToggleStyleButton (
attribute: Attribute . ol ,
attribute: Attribute . ol ,
@ -204,7 +239,9 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
options: toolbarConfigurations . buttonOptions . codeBlock ,
options: toolbarConfigurations . buttonOptions . codeBlock ,
controller: globalController ,
controller: globalController ,
) ,
) ,
if ( configurations . showDividers & & isButtonGroupShown [ 3 ] & & ( isButtonGroupShown [ 4 ] | | isButtonGroupShown [ 5 ] ) ) . . . [
if ( configurations . showDividers & &
isButtonGroupShown [ 3 ] & &
( isButtonGroupShown [ 4 ] | | isButtonGroupShown [ 5 ] ) ) . . . [
divider ,
divider ,
] ,
] ,
if ( configurations . showQuote )
if ( configurations . showQuote )
@ -225,7 +262,10 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
isIncrease: false ,
isIncrease: false ,
options: toolbarConfigurations . buttonOptions . indentDecrease ,
options: toolbarConfigurations . buttonOptions . indentDecrease ,
) ,
) ,
if ( configurations . showDividers & & isButtonGroupShown [ 4 ] & & isButtonGroupShown [ 5 ] ) divider ,
if ( configurations . showDividers & &
isButtonGroupShown [ 4 ] & &
isButtonGroupShown [ 5 ] )
divider ,
if ( configurations . showLink )
if ( configurations . showLink )
toolbarConfigurations . linkStyleType . isOriginal
toolbarConfigurations . linkStyleType . isOriginal
? QuillToolbarLinkStyleButton (
? QuillToolbarLinkStyleButton (
@ -305,11 +345,15 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
return Container (
return Container (
decoration: configurations . decoration ? ?
decoration: configurations . decoration ? ?
BoxDecoration (
BoxDecoration (
color: configurations . color ? ? Theme . of ( context ) . canvasColor ,
color:
configurations . color ? ? Theme . of ( context ) . canvasColor ,
) ,
) ,
constraints: BoxConstraints . tightFor (
constraints: BoxConstraints . tightFor (
height: configurations . axis = = Axis . horizontal ? _toolbarSize : null ,
height: configurations . axis = = Axis . horizontal
width: configurations . axis = = Axis . vertical ? _toolbarSize : null ,
? _toolbarSize
: null ,
width:
configurations . axis = = Axis . vertical ? _toolbarSize : null ,
) ,
) ,
child: QuillToolbarArrowIndicatedButtonList (
child: QuillToolbarArrowIndicatedButtonList (
axis: configurations . axis ,
axis: configurations . axis ,
@ -323,7 +367,9 @@ class QuillSimpleToolbar extends StatelessWidget implements PreferredSizeWidget
}
}
@ override
@ override
Size get preferredSize = > configurations . axis = = Axis . horizontal ? const Size . fromHeight ( kDefaultToolbarSize ) : const Size . fromWidth ( kDefaultToolbarSize ) ;
Size get preferredSize = > configurations . axis = = Axis . horizontal
? const Size . fromHeight ( kDefaultToolbarSize )
: const Size . fromWidth ( kDefaultToolbarSize ) ;
}
}
/ / / The divider which is used for separation of buttons in the toolbar .
/ / / The divider which is used for separation of buttons in the toolbar .
@ -339,10 +385,12 @@ class QuillToolbarDivider extends StatelessWidget {
} ) ;
} ) ;
/ / / Provides a horizontal divider for vertical toolbar .
/ / / Provides a horizontal divider for vertical toolbar .
const QuillToolbarDivider . horizontal ( { Key ? key , Color ? color , double ? space } ) : this ( Axis . horizontal , color: color , space: space , key: key ) ;
const QuillToolbarDivider . horizontal ( { Key ? key , Color ? color , double ? space } )
: this ( Axis . horizontal , color: color , space: space , key: key ) ;
/ / / Provides a horizontal divider for horizontal toolbar .
/ / / Provides a horizontal divider for horizontal toolbar .
const QuillToolbarDivider . vertical ( { Key ? key , Color ? color , double ? space } ) : this ( Axis . vertical , color: color , space: space , key: key ) ;
const QuillToolbarDivider . vertical ( { Key ? key , Color ? color , double ? space } )
: this ( Axis . vertical , color: color , space: space , key: key ) ;
/ / / The axis along which the toolbar is .
/ / / The axis along which the toolbar is .
final Axis axis ;
final Axis axis ;