QuillToolbar.basic constructor
QuillToolbar.basic({
- required QuillController controller,
- double toolbarIconSize = kDefaultIconSize,
- double toolbarSectionSpacing = 4,
- WrapAlignment toolbarIconAlignment = WrapAlignment.center,
- bool showDividers = true,
- bool showBoldButton = true,
- bool showItalicButton = true,
- bool showSmallButton = false,
- bool showUnderLineButton = true,
- bool showStrikeThrough = true,
- bool showInlineCode = true,
- bool showColorButton = true,
- bool showBackgroundColorButton = true,
- bool showClearFormat = true,
- bool showAlignmentButtons = false,
- bool showLeftAlignment = true,
- bool showCenterAlignment = true,
- bool showRightAlignment = true,
- bool showJustifyAlignment = true,
- bool showHeaderStyle = true,
- bool showListNumbers = true,
- bool showListBullets = true,
- bool showListCheck = true,
- bool showCodeBlock = true,
- bool showQuote = true,
- bool showIndent = true,
- bool showLink = true,
- bool showUndo = true,
- bool showRedo = true,
- bool multiRowsDisplay = true,
- bool showImageButton = true,
- bool showVideoButton = true,
- bool showCameraButton = true,
- OnImagePickCallback? onImagePickCallback,
- OnVideoPickCallback? onVideoPickCallback,
- MediaPickSettingSelector? mediaPickSettingSelector,
- FilePickImpl? filePickImpl,
- WebImagePickImpl? webImagePickImpl,
- WebVideoPickImpl? webVideoPickImpl,
- QuillIconTheme? iconTheme,
- QuillDialogTheme? dialogTheme,
- Locale? locale,
- Key? key,
Implementation
factory QuillToolbar.basic({
required QuillController controller,
double toolbarIconSize = kDefaultIconSize,
double toolbarSectionSpacing = 4,
WrapAlignment toolbarIconAlignment = WrapAlignment.center,
bool showDividers = true,
bool showBoldButton = true,
bool showItalicButton = true,
bool showSmallButton = false,
bool showUnderLineButton = true,
bool showStrikeThrough = true,
bool showInlineCode = true,
bool showColorButton = true,
bool showBackgroundColorButton = true,
bool showClearFormat = true,
bool showAlignmentButtons = false,
bool showLeftAlignment = true,
bool showCenterAlignment = true,
bool showRightAlignment = true,
bool showJustifyAlignment = true,
bool showHeaderStyle = true,
bool showListNumbers = true,
bool showListBullets = true,
bool showListCheck = true,
bool showCodeBlock = true,
bool showQuote = true,
bool showIndent = true,
bool showLink = true,
bool showUndo = true,
bool showRedo = true,
bool multiRowsDisplay = true,
bool showImageButton = true,
bool showVideoButton = true,
bool showCameraButton = true,
OnImagePickCallback? onImagePickCallback,
OnVideoPickCallback? onVideoPickCallback,
MediaPickSettingSelector? mediaPickSettingSelector,
FilePickImpl? filePickImpl,
WebImagePickImpl? webImagePickImpl,
WebVideoPickImpl? webVideoPickImpl,
///The theme to use for the icons in the toolbar, uses type [QuillIconTheme]
QuillIconTheme? iconTheme,
///The theme to use for the theming of the [LinkDialog()],
///shown when embedding an image, for example
QuillDialogTheme? dialogTheme,
/// The locale to use for the editor toolbar, defaults to system locale
/// More at https://github.com/singerdmx/flutter-quill#translation
Locale? locale,
Key? key,
}) {
final isButtonGroupShown = [
showBoldButton ||
showItalicButton ||
showSmallButton ||
showUnderLineButton ||
showStrikeThrough ||
showInlineCode ||
showColorButton ||
showBackgroundColorButton ||
showClearFormat ||
onImagePickCallback != null ||
onVideoPickCallback != null,
showAlignmentButtons,
showLeftAlignment,
showCenterAlignment,
showRightAlignment,
showJustifyAlignment,
showHeaderStyle,
showListNumbers || showListBullets || showListCheck || showCodeBlock,
showQuote || showIndent,
showLink
];
return QuillToolbar(
key: key,
toolbarHeight: toolbarIconSize * 2,
toolbarSectionSpacing: toolbarSectionSpacing,
toolbarIconAlignment: toolbarIconAlignment,
multiRowsDisplay: multiRowsDisplay,
locale: locale,
children: [
if (showUndo)
Tooltip(
message: 'Cofnij',
child: HistoryButton(
icon: Icons.undo_outlined,
iconSize: toolbarIconSize,
controller: controller,
undo: true,
iconTheme: iconTheme,
),
),
if (showRedo)
Tooltip(
message: 'Ponów',
child: HistoryButton(
icon: Icons.redo_outlined,
iconSize: toolbarIconSize,
controller: controller,
undo: false,
iconTheme: iconTheme,
),
),
if (showBoldButton)
Tooltip(
message: 'Pogrubienie',
child: ToggleStyleButton(
attribute: Attribute.bold,
icon: Icons.format_bold,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
),
if (showItalicButton)
Tooltip(
message: 'Kursywa',
child: ToggleStyleButton(
attribute: Attribute.italic,
icon: Icons.format_italic,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
),
if (showSmallButton)
ToggleStyleButton(
attribute: Attribute.small,
icon: Icons.format_size,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
if (showUnderLineButton)
Tooltip(
message: 'Podkreślenie',
child: ToggleStyleButton(
attribute: Attribute.underline,
icon: Icons.format_underline,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
),
if (showStrikeThrough)
Tooltip(
message: 'Przekreślenie',
child: ToggleStyleButton(
attribute: Attribute.strikeThrough,
icon: Icons.format_strikethrough,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
),
if (showInlineCode)
ToggleStyleButton(
attribute: Attribute.inlineCode,
icon: Icons.code,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
if (showColorButton)
Tooltip(
message: 'Kolor tekstu',
child: ColorButton(
icon: Icons.color_lens,
iconSize: toolbarIconSize,
controller: controller,
background: false,
iconTheme: iconTheme,
),
),
if (showBackgroundColorButton)
Tooltip(
message: 'Kolor zaznaczenia',
child: ColorButton(
icon: Icons.format_color_fill,
iconSize: toolbarIconSize,
controller: controller,
background: true,
iconTheme: iconTheme,
),
),
if (showClearFormat)
Tooltip(
message: 'Wyczyść formatowanie',
child: ClearFormatButton(
icon: Icons.format_clear,
iconSize: toolbarIconSize,
controller: controller,
iconTheme: iconTheme,
),
),
if (showImageButton)
ImageButton(
icon: Icons.image,
iconSize: toolbarIconSize,
controller: controller,
onImagePickCallback: onImagePickCallback,
filePickImpl: filePickImpl,
webImagePickImpl: webImagePickImpl,
mediaPickSettingSelector: mediaPickSettingSelector,
iconTheme: iconTheme,
dialogTheme: dialogTheme,
),
if (showVideoButton)
VideoButton(
icon: Icons.movie_creation,
iconSize: toolbarIconSize,
controller: controller,
onVideoPickCallback: onVideoPickCallback,
filePickImpl: filePickImpl,
webVideoPickImpl: webImagePickImpl,
mediaPickSettingSelector: mediaPickSettingSelector,
iconTheme: iconTheme,
dialogTheme: dialogTheme,
),
if ((onImagePickCallback != null || onVideoPickCallback != null) &&
showCameraButton)
CameraButton(
icon: Icons.photo_camera,
iconSize: toolbarIconSize,
controller: controller,
onImagePickCallback: onImagePickCallback,
onVideoPickCallback: onVideoPickCallback,
filePickImpl: filePickImpl,
webImagePickImpl: webImagePickImpl,
webVideoPickImpl: webVideoPickImpl,
iconTheme: iconTheme,
),
if (showDividers &&
isButtonGroupShown[0] &&
(isButtonGroupShown[1] ||
isButtonGroupShown[2] ||
isButtonGroupShown[3] ||
isButtonGroupShown[4] ||
isButtonGroupShown[5]))
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
if (showAlignmentButtons)
SelectAlignmentButton(
controller: controller,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
showLeftAlignment: showLeftAlignment,
showCenterAlignment: showCenterAlignment,
showRightAlignment: showRightAlignment,
showJustifyAlignment: showJustifyAlignment,
),
if (showDividers &&
isButtonGroupShown[1] &&
(isButtonGroupShown[2] ||
isButtonGroupShown[3] ||
isButtonGroupShown[4] ||
isButtonGroupShown[5]))
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
if (showHeaderStyle)
Tooltip(
message: 'Rozmiar czcionki',
child: SelectHeaderStyleButton(
controller: controller,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
),
if (showDividers &&
showHeaderStyle &&
isButtonGroupShown[2] &&
(isButtonGroupShown[3] ||
isButtonGroupShown[4] ||
isButtonGroupShown[5]))
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
if (showListNumbers)
Tooltip(
message: 'Lista numerowana',
child: ToggleStyleButton(
attribute: Attribute.ol,
controller: controller,
icon: Icons.format_list_numbered,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
),
if (showListBullets)
Tooltip(
message: 'Lista punktowana',
child: ToggleStyleButton(
attribute: Attribute.ul,
controller: controller,
icon: Icons.format_list_bulleted,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
),
if (showListCheck)
Tooltip(
message: 'Lista kontrolna',
child: ToggleCheckListButton(
attribute: Attribute.unchecked,
controller: controller,
icon: Icons.check_box,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
),
if (showCodeBlock)
ToggleStyleButton(
attribute: Attribute.codeBlock,
controller: controller,
icon: Icons.code,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
if (showDividers &&
isButtonGroupShown[3] &&
(isButtonGroupShown[4] || isButtonGroupShown[5]))
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
if (showQuote)
Tooltip(
message: 'Cytat',
child: ToggleStyleButton(
attribute: Attribute.blockQuote,
controller: controller,
icon: Icons.format_quote,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
),
),
if (showIndent)
Tooltip(
message: 'Zwiększ wcięcie',
child: IndentButton(
icon: Icons.format_indent_increase,
iconSize: toolbarIconSize,
controller: controller,
isIncrease: true,
iconTheme: iconTheme,
),
),
if (showIndent)
Tooltip(
message: 'Zmniejsz wcięcie',
child: IndentButton(
icon: Icons.format_indent_decrease,
iconSize: toolbarIconSize,
controller: controller,
isIncrease: false,
iconTheme: iconTheme,
),
),
if (showDividers && isButtonGroupShown[4] && isButtonGroupShown[5])
VerticalDivider(
indent: 12,
endIndent: 12,
color: Colors.grey.shade400,
),
if (showLink)
LinkStyleButton(
controller: controller,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
dialogTheme: dialogTheme,
),
],
);
}