HtmlToolbarOptions class
Options that modify the toolbar and its behavior
Constructors
-
HtmlToolbarOptions({List<
String> ? audioExtensions, List<Widget> customToolbarButtons = const [], List<int> customToolbarInsertionIndices = const [], List<Toolbar> defaultToolbarButtons = const [StyleButtons(), FontSettingButtons(fontSizeUnit: false), FontButtons(clearAll: false), ColorButtons(), ListButtons(listStyles: false), ParagraphButtons(textDirection: false, lineHeight: false, caseConverter: false), InsertButtons(video: false, audio: false, table: false, hr: false, otherFile: false)], List<String> ? otherFileExtensions, List<String> ? imageExtensions, bool initiallyExpanded = false, FutureOr<bool> linkInsertInterceptor(String, String, bool)?, FutureOr<bool> mediaLinkInsertInterceptor(String, InsertFileType)?, FutureOr<bool> mediaUploadInterceptor(PlatformFile, InsertFileType)?, FutureOr<bool> onButtonPressed(ButtonType, bool?, Function?)?, FutureOr<bool> onDropdownChanged(DropdownType, dynamic, void (dynamic)?)?, void onOtherFileLinkInsert(String)?, void onOtherFileUpload(PlatformFile)?, ToolbarType toolbarType = ToolbarType.nativeScrollable, ToolbarPosition toolbarPosition = ToolbarPosition.aboveEditor, List<String> ? videoExtensions, int dropdownElevation = 8, Widget? dropdownIcon, Color? dropdownIconColor, double dropdownIconSize = 24, double dropdownItemHeight = kMinInteractiveDimension, Color? dropdownFocusColor, Color? dropdownBackgroundColor, DropdownMenuDirection? dropdownMenuDirection, double? dropdownMenuMaxHeight, BoxDecoration? dropdownBoxDecoration, Color? buttonColor, Color? buttonSelectedColor, Color? buttonFillColor, Color? buttonFocusColor, Color? buttonHighlightColor, Color? buttonHoverColor, Color? buttonSplashColor, Color? buttonBorderColor, Color? buttonSelectedBorderColor, BorderRadius? buttonBorderRadius, double? buttonBorderWidth, bool renderBorder = false, TextStyle? textStyle, Widget separatorWidget = const VerticalDivider(indent: 2, endIndent: 2, color: Colors.grey), bool renderSeparatorWidget = true, double toolbarItemHeight = 36, double gridViewHorizontalSpacing = 5, double gridViewVerticalSpacing = 5, bool allowImagePicking = true}) -
const
Properties
- allowImagePicking → bool
-
Allow the user to choose an image from their device when image selection
is enabled. Inserting images via URL will still be possible if this is false.
final
-
audioExtensions
→ List<
String> ? -
Allows you to set the allowed extensions when a user inserts an audio file
final
-
final
-
final
-
final
-
Styling options that only apply to the buttons:
(See the ToggleButtons class for more information)
final
-
final
-
final
-
final
-
final
-
final
-
final
-
final
-
customToolbarButtons
→ List<
Widget> -
Allows you to create your own buttons that are added to the end of the
default buttons list
final
-
customToolbarInsertionIndices
→ List<
int> -
Allows you to set where each custom toolbar button is inserted into the
toolbar buttons.
final
-
defaultToolbarButtons
→ List<
Toolbar> -
Sets which options are visible in the toolbar for the editor.
final
- dropdownBackgroundColor → Color?
-
final
- dropdownBoxDecoration → BoxDecoration?
-
final
- dropdownElevation → int
-
Styling options that only apply to dropdowns:
(See the DropdownButton class for more information)
final
- dropdownFocusColor → Color?
-
final
- dropdownIcon → Widget?
-
final
- dropdownIconColor → Color?
-
final
- dropdownIconSize → double
-
final
- dropdownItemHeight → double
-
final
- dropdownMenuDirection → DropdownMenuDirection?
-
Set the menu opening direction for the dropdown. Only useful when using
ToolbarPosition.custom since the toolbar otherwise automatically
determines the correct direction.
final
- dropdownMenuMaxHeight → double?
-
final
- gridViewHorizontalSpacing → double
-
Sets the horizontal spacing between items when using ToolbarType.nativeGrid
final
- gridViewVerticalSpacing → double
-
Sets the vertical spacing between rows when using ToolbarType.nativeGrid
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
imageExtensions
→ List<
String> ? -
Allows you to set the allowed extensions when a user inserts an image
final
- initiallyExpanded → bool
-
Allows you to set whether the toolbar starts out expanded (in gridview)
or contracted (in scrollview).
final
-
linkInsertInterceptor
→ FutureOr<
bool> Function(String, String, bool)? -
Allows you to intercept any links being inserted into the editor. The
function passes the display text, the URL itself, and whether the
URL should open a new tab.
final
-
mediaLinkInsertInterceptor
→ FutureOr<
bool> Function(String, InsertFileType)? -
Allows you to intercept any image/video/audio inserted as a link into the editor.
The function passes the URL of the media inserted.
final
-
mediaUploadInterceptor
→ FutureOr<
bool> Function(PlatformFile, InsertFileType)? -
Allows you to intercept any image/video/audio files being inserted into the editor.
The function passes the PlatformFile class, which contains all the file data
including name, size, type, Uint8List bytes, etc.
final
-
onButtonPressed
→ FutureOr<
bool> Function(ButtonType, bool?, Function?)? -
Allows you to intercept any button press. The function passes the ButtonType
enum, which tells you which button was pressed, the current selected status of
the button, and a function to reverse the status (in case you decide to handle
the button press yourself).
final
-
onDropdownChanged
→ FutureOr<
bool> Function(DropdownType, dynamic, void (dynamic)?)? -
Allows you to intercept any dropdown changes. The function passes the
DropdownType enum, which tells you which dropdown was changed,
the changed value to indicate what the dropdown was changed to, and the
function to update the changed value (in case you decide to handle the
dropdown change yourself). The function is null in some cases because
the dropdown does not update its value.
final
- onOtherFileLinkInsert → void Function(String)?
-
Called when a link is inserted for a file using the "other file" button.
final
- onOtherFileUpload → void Function(PlatformFile)?
-
Called when a file is uploaded using the "other file" button.
final
-
otherFileExtensions
→ List<
String> ? -
Allows you to set the allowed extensions when a user inserts a file other
than image/audio/video
final
- renderBorder → bool
-
Styling options for the toolbar:
Determines whether a border is rendered around all toolbar widgets
final
- renderSeparatorWidget → bool
-
Determines whether the separator widget is rendered
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- separatorWidget → Widget
-
Sets the separator widget between toolbar sections. This widget is only
used in ToolbarType.nativeScrollable.
final
- textStyle → TextStyle?
-
Sets the text style for all toolbar widgets
final
- toolbarItemHeight → double
-
Sets the height of the toolbar items
final
- toolbarPosition → ToolbarPosition
-
Controls where the toolbar is positioned. See ToolbarPosition for more details.
final
- toolbarType → ToolbarType
-
Controls how the toolbar displays. See ToolbarType for more details.
final
-
videoExtensions
→ List<
String> ? -
Allows you to set the allowed extensions when a user inserts a video.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited