@ -48,7 +48,6 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
factory QuillToolbar . basic ( {
factory QuillToolbar . basic ( {
Axis axis = Axis . horizontal ,
Axis axis = Axis . horizontal ,
/ / double toolbarIconSize = kDefaultIconSize ,
double toolbarSectionSpacing = kToolbarSectionSpacing ,
double toolbarSectionSpacing = kToolbarSectionSpacing ,
WrapAlignment toolbarIconAlignment = WrapAlignment . center ,
WrapAlignment toolbarIconAlignment = WrapAlignment . center ,
WrapCrossAlignment toolbarIconCrossAlignment = WrapCrossAlignment . center ,
WrapCrossAlignment toolbarIconCrossAlignment = WrapCrossAlignment . center ,
@ -88,9 +87,6 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
/ / / The decoration to use for the toolbar .
/ / / The decoration to use for the toolbar .
Decoration ? decoration ,
Decoration ? decoration ,
/ / / Map of font sizes in string
Map < String , String > ? fontSizeValues ,
/ / / Toolbar items to display for controls of embed blocks
/ / / Toolbar items to display for controls of embed blocks
List < EmbedButtonBuilder > ? embedButtons ,
List < EmbedButtonBuilder > ? embedButtons ,
@ -161,20 +157,9 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
showLink | | showSearchButton
showLink | | showSearchButton
] ;
] ;
/ / default font size values
final fontSizes = fontSizeValues ? ?
{
' Small ' . i18n: ' small ' ,
' Large ' . i18n: ' large ' ,
' Huge ' . i18n: ' huge ' ,
' Clear ' . i18n: ' 0 '
} ;
/ / default button tooltips
/ / default button tooltips
final buttonTooltips = tooltips ? ?
final buttonTooltips = tooltips ? ?
< ToolbarButtons , String > {
< ToolbarButtons , String > {
/ / ToolbarButtons . undo: ' Undo ' . i18n ,
/ / ToolbarButtons . redo: ' Redo ' . i18n ,
ToolbarButtons . fontFamily: ' Font family ' . i18n ,
ToolbarButtons . fontFamily: ' Font family ' . i18n ,
ToolbarButtons . fontSize: ' Font size ' . i18n ,
ToolbarButtons . fontSize: ' Font size ' . i18n ,
ToolbarButtons . bold: ' Bold ' . i18n ,
ToolbarButtons . bold: ' Bold ' . i18n ,
@ -235,96 +220,127 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if ( showFontFamily )
if ( showFontFamily )
QuillToolbarFontFamilyButton (
QuillToolbarFontFamilyButton (
options: toolbarConfigurations . buttonOptions . fontFamily ,
options: toolbarConfigurations . buttonOptions . fontFamily ,
controller:
toolbarConfigurations . buttonOptions . fontFamily . controller ? ?
context . requireQuillController ,
) ,
) ,
if ( showFontSize )
if ( showFontSize )
QuillToolbarFontSizeButton (
QuillToolbarFontSizeButton (
iconTheme: iconTheme ,
options: toolbarConfigurations . buttonOptions . fontSize ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . fontSize ] ,
toolbarConfigurations . buttonOptions . fontFamily . controller ? ?
attribute: Attribute . size ,
context . requireQuillController ,
controller: controller ,
rawItemsMap: fontSizes ,
afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showBoldButton )
if ( showBoldButton )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . bold ,
attribute: Attribute . bold ,
icon: Icons . format_bold ,
options: toolbarConfigurations . buttonOptions . bold ,
iconSize: toolbarIconSize ,
controller: toolbarConfigurations . buttonOptions . bold . controller ? ?
tooltip: buttonTooltips [ ToolbarButtons . bold ] ,
context . requireQuillController ,
controller: controller ,
/ / icon: Icons . format_bold ,
iconTheme: iconTheme ,
/ / iconSize: toolbarIconSize ,
afterButtonPressed: afterButtonPressed ,
/ / tooltip: buttonTooltips [ ToolbarButtons . bold ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showSubscript )
if ( showSubscript )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . subscript ,
attribute: Attribute . subscript ,
icon: Icons . subscript ,
options: toolbarConfigurations . buttonOptions . subscript ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . subscript ] ,
toolbarConfigurations . buttonOptions . subscript . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . subscript ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . subscript ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showSuperscript )
if ( showSuperscript )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . superscript ,
attribute: Attribute . superscript ,
icon: Icons . superscript ,
options: toolbarConfigurations . buttonOptions . superscript ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . superscript ] ,
toolbarConfigurations . buttonOptions . superscript . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . superscript ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . superscript ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showItalicButton )
if ( showItalicButton )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . italic ,
attribute: Attribute . italic ,
icon: Icons . format_italic ,
options: toolbarConfigurations . buttonOptions . italic ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . italic ] ,
toolbarConfigurations . buttonOptions . italic . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . format_italic ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . italic ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showSmallButton )
if ( showSmallButton )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . small ,
attribute: Attribute . small ,
icon: Icons . format_size ,
options: toolbarConfigurations . buttonOptions . small ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . small ] ,
toolbarConfigurations . buttonOptions . small . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . format_size ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . small ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showUnderLineButton )
if ( showUnderLineButton )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . underline ,
attribute: Attribute . underline ,
icon: Icons . format_underline ,
options: toolbarConfigurations . buttonOptions . underLine ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . underline ] ,
toolbarConfigurations . buttonOptions . underLine . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . format_underline ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . underline ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showStrikeThrough )
if ( showStrikeThrough )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . strikeThrough ,
attribute: Attribute . strikeThrough ,
icon: Icons . format_strikethrough ,
options: toolbarConfigurations . buttonOptions . strikeThrough ,
iconSize: toolbarIconSize ,
controller: toolbarConfigurations
tooltip: buttonTooltips [ ToolbarButtons . strikeThrough ] ,
. buttonOptions . strikeThrough . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . format_strikethrough ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . strikeThrough ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showInlineCode )
if ( showInlineCode )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . inlineCode ,
attribute: Attribute . inlineCode ,
icon: Icons . code ,
options: toolbarConfigurations . buttonOptions . inlineCode ,
iconSize: toolbarIconSize ,
controller:
tooltip: buttonTooltips [ ToolbarButtons . inlineCode ] ,
toolbarConfigurations . buttonOptions . inlineCode . controller ? ?
controller: controller ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / icon: Icons . code ,
afterButtonPressed: afterButtonPressed ,
/ / iconSize: toolbarIconSize ,
/ / tooltip: buttonTooltips [ ToolbarButtons . inlineCode ] ,
/ / controller: controller ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showColorButton )
if ( showColorButton )
ColorButton (
ColorButton (
@ -395,12 +411,16 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if ( showDirection )
if ( showDirection )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . rtl ,
attribute: Attribute . rtl ,
tooltip: buttonTooltips [ ToolbarButtons . direction ] ,
options: toolbarConfigurations . buttonOptions . direction ,
controller: controller ,
controller:
icon: Icons . format_textdirection_r_to_l ,
toolbarConfigurations . buttonOptions . direction . controller ? ?
iconSize: toolbarIconSize ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / tooltip: buttonTooltips [ ToolbarButtons . direction ] ,
afterButtonPressed: afterButtonPressed ,
/ / controller: controller ,
/ / icon: Icons . format_textdirection_r_to_l ,
/ / iconSize: toolbarIconSize ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showDividers & &
if ( showDividers & &
isButtonGroupShown [ 1 ] & &
isButtonGroupShown [ 1 ] & &
@ -436,22 +456,30 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if ( showListNumbers )
if ( showListNumbers )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . ol ,
attribute: Attribute . ol ,
tooltip: buttonTooltips [ ToolbarButtons . listNumbers ] ,
options: toolbarConfigurations . buttonOptions . listNumbers ,
controller: controller ,
controller:
icon: Icons . format_list_numbered ,
toolbarConfigurations . buttonOptions . listNumbers . controller ? ?
iconSize: toolbarIconSize ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / tooltip: buttonTooltips [ ToolbarButtons . listNumbers ] ,
afterButtonPressed: afterButtonPressed ,
/ / controller: controller ,
/ / icon: Icons . format_list_numbered ,
/ / iconSize: toolbarIconSize ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showListBullets )
if ( showListBullets )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . ul ,
attribute: Attribute . ul ,
tooltip: buttonTooltips [ ToolbarButtons . listBullets ] ,
options: toolbarConfigurations . buttonOptions . listBullets ,
controller: controller ,
controller:
icon: Icons . format_list_bulleted ,
toolbarConfigurations . buttonOptions . listBullets . controller ? ?
iconSize: toolbarIconSize ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / tooltip: buttonTooltips [ ToolbarButtons . listBullets ] ,
afterButtonPressed: afterButtonPressed ,
/ / controller: controller ,
/ / icon: Icons . format_list_bulleted ,
/ / iconSize: toolbarIconSize ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showListCheck )
if ( showListCheck )
ToggleCheckListButton (
ToggleCheckListButton (
@ -466,12 +494,16 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if ( showCodeBlock )
if ( showCodeBlock )
ToggleStyleButton (
ToggleStyleButton (
attribute: Attribute . codeBlock ,
attribute: Attribute . codeBlock ,
tooltip: buttonTooltips [ ToolbarButtons . codeBlock ] ,
options: toolbarConfigurations . buttonOptions . codeBlock ,
controller: controller ,
controller:
icon: Icons . code ,
toolbarConfigurations . buttonOptions . codeBlock . controller ? ?
iconSize: toolbarIconSize ,
context . requireQuillController ,
iconTheme: iconTheme ,
/ / tooltip: buttonTooltips [ ToolbarButtons . codeBlock ] ,
afterButtonPressed: afterButtonPressed ,
/ / controller: controller ,
/ / icon: Icons . code ,
/ / iconSize: toolbarIconSize ,
/ / iconTheme: iconTheme ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showDividers & &
if ( showDividers & &
isButtonGroupShown [ 3 ] & &
isButtonGroupShown [ 3 ] & &
@ -480,13 +512,17 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
color: sectionDividerColor , space: sectionDividerSpace ) ,
color: sectionDividerColor , space: sectionDividerSpace ) ,
if ( showQuote )
if ( showQuote )
ToggleStyleButton (
ToggleStyleButton (
options: toolbarConfigurations . buttonOptions . quote ,
controller:
toolbarConfigurations . buttonOptions . quote . controller ? ?
context . requireQuillController ,
attribute: Attribute . blockQuote ,
attribute: Attribute . blockQuote ,
tooltip: buttonTooltips [ ToolbarButtons . quote ] ,
/ / tooltip: buttonTooltips [ ToolbarButtons . quote ] ,
controller: controller ,
/ / controller: controller ,
icon: Icons . format_quote ,
/ / icon: Icons . format_quote ,
iconSize: toolbarIconSize ,
/ / iconSize: toolbarIconSize ,
iconTheme: iconTheme ,
/ / iconTheme: iconTheme ,
afterButtonPressed: afterButtonPressed ,
/ / afterButtonPressed: afterButtonPressed ,
) ,
) ,
if ( showIndent )
if ( showIndent )
IndentButton (
IndentButton (