Carry all the changes from @MacDeveloper1 PR
parent
47031e1250
commit
b03e6f4f29
50 changed files with 925 additions and 260 deletions
@ -1,32 +0,0 @@ |
|||||||
import 'package:flutter/widgets.dart' show TextStyle; |
|
||||||
|
|
||||||
import '../../../../widgets/toolbar/base_toolbar.dart'; |
|
||||||
|
|
||||||
class QuillToolbarSelectHeaderStyleButtonExtraOptions |
|
||||||
extends QuillToolbarBaseButtonExtraOptions { |
|
||||||
const QuillToolbarSelectHeaderStyleButtonExtraOptions({ |
|
||||||
required super.controller, |
|
||||||
required super.context, |
|
||||||
required super.onPressed, |
|
||||||
}); |
|
||||||
} |
|
||||||
|
|
||||||
class QuillToolbarSelectHeaderStyleButtonOptions |
|
||||||
extends QuillToolbarBaseButtonOptions< |
|
||||||
QuillToolbarSelectHeaderStyleButtonOptions, |
|
||||||
QuillToolbarSelectHeaderStyleButtonExtraOptions> { |
|
||||||
const QuillToolbarSelectHeaderStyleButtonOptions({ |
|
||||||
super.afterButtonPressed, |
|
||||||
super.childBuilder, |
|
||||||
super.iconTheme, |
|
||||||
super.tooltip, |
|
||||||
this.iconSize, |
|
||||||
this.iconButtonFactor, |
|
||||||
this.textStyle, |
|
||||||
}); |
|
||||||
|
|
||||||
/// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations] |
|
||||||
final double? iconSize; |
|
||||||
final double? iconButtonFactor; |
|
||||||
final TextStyle? textStyle; |
|
||||||
} |
|
@ -0,0 +1,121 @@ |
|||||||
|
import 'package:flutter/material.dart' show PopupMenuEntry; |
||||||
|
import 'package:flutter/widgets.dart' |
||||||
|
show |
||||||
|
Color, |
||||||
|
EdgeInsets, |
||||||
|
EdgeInsetsGeometry, |
||||||
|
IconData, |
||||||
|
TextOverflow, |
||||||
|
TextStyle, |
||||||
|
ValueChanged, |
||||||
|
VoidCallback; |
||||||
|
|
||||||
|
import '../../../../widgets/toolbar/base_toolbar.dart'; |
||||||
|
import '../../../documents/attribute.dart'; |
||||||
|
import '../../../themes/quill_icon_theme.dart'; |
||||||
|
|
||||||
|
class QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions |
||||||
|
extends QuillToolbarBaseButtonExtraOptions { |
||||||
|
const QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions({ |
||||||
|
required super.controller, |
||||||
|
required super.context, |
||||||
|
required super.onPressed, |
||||||
|
required this.currentValue, |
||||||
|
}); |
||||||
|
final Attribute currentValue; |
||||||
|
} |
||||||
|
|
||||||
|
class QuillToolbarSelectHeaderStyleDropdownButtonOptions |
||||||
|
extends QuillToolbarBaseButtonOptions< |
||||||
|
QuillToolbarSelectHeaderStyleDropdownButtonOptions, |
||||||
|
QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions> { |
||||||
|
const QuillToolbarSelectHeaderStyleDropdownButtonOptions({ |
||||||
|
super.afterButtonPressed, |
||||||
|
super.childBuilder, |
||||||
|
super.iconTheme, |
||||||
|
super.tooltip, |
||||||
|
this.iconSize, |
||||||
|
this.iconButtonFactor, |
||||||
|
this.textStyle, |
||||||
|
super.iconData, |
||||||
|
this.fillColor, |
||||||
|
this.hoverElevation = 1, |
||||||
|
this.highlightElevation = 1, |
||||||
|
this.onSelected, |
||||||
|
this.attributes, |
||||||
|
this.padding, |
||||||
|
this.style, |
||||||
|
this.width, |
||||||
|
this.labelOverflow = TextOverflow.visible, |
||||||
|
this.itemHeight, |
||||||
|
this.itemPadding, |
||||||
|
this.defaultItemColor, |
||||||
|
this.renderItemTextStyle = false, |
||||||
|
}); |
||||||
|
|
||||||
|
/// By default we will the toolbar axis from [QuillSimpleToolbarConfigurations] |
||||||
|
final double? iconSize; |
||||||
|
final double? iconButtonFactor; |
||||||
|
final TextStyle? textStyle; |
||||||
|
|
||||||
|
final Color? fillColor; |
||||||
|
final double hoverElevation; |
||||||
|
final double highlightElevation; |
||||||
|
final ValueChanged<String>? onSelected; |
||||||
|
final List<HeaderAttribute>? attributes; |
||||||
|
final EdgeInsetsGeometry? padding; |
||||||
|
final TextStyle? style; |
||||||
|
final double? width; |
||||||
|
final TextOverflow labelOverflow; |
||||||
|
final double? itemHeight; |
||||||
|
final EdgeInsets? itemPadding; |
||||||
|
final Color? defaultItemColor; |
||||||
|
final bool renderItemTextStyle; |
||||||
|
|
||||||
|
QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ |
||||||
|
Color? fillColor, |
||||||
|
double? hoverElevation, |
||||||
|
double? highlightElevation, |
||||||
|
List<PopupMenuEntry<String>>? items, |
||||||
|
ValueChanged<String>? onSelected, |
||||||
|
List<HeaderAttribute>? attributes, |
||||||
|
EdgeInsetsGeometry? padding, |
||||||
|
TextStyle? style, |
||||||
|
double? width, |
||||||
|
TextOverflow? labelOverflow, |
||||||
|
bool? renderFontFamilies, |
||||||
|
bool? overrideTooltipByFontFamily, |
||||||
|
double? itemHeight, |
||||||
|
EdgeInsets? itemPadding, |
||||||
|
Color? defaultItemColor, |
||||||
|
double? iconSize, |
||||||
|
double? iconButtonFactor, |
||||||
|
IconData? iconData, |
||||||
|
VoidCallback? afterButtonPressed, |
||||||
|
String? tooltip, |
||||||
|
QuillIconTheme? iconTheme, |
||||||
|
bool? renderItemTextStyle, |
||||||
|
}) { |
||||||
|
return QuillToolbarSelectHeaderStyleDropdownButtonOptions( |
||||||
|
attributes: attributes ?? this.attributes, |
||||||
|
iconData: iconData ?? this.iconData, |
||||||
|
afterButtonPressed: afterButtonPressed ?? this.afterButtonPressed, |
||||||
|
tooltip: tooltip ?? this.tooltip, |
||||||
|
iconTheme: iconTheme ?? this.iconTheme, |
||||||
|
onSelected: onSelected ?? this.onSelected, |
||||||
|
padding: padding ?? this.padding, |
||||||
|
style: style ?? this.style, |
||||||
|
width: width ?? this.width, |
||||||
|
labelOverflow: labelOverflow ?? this.labelOverflow, |
||||||
|
itemHeight: itemHeight ?? this.itemHeight, |
||||||
|
itemPadding: itemPadding ?? this.itemPadding, |
||||||
|
defaultItemColor: defaultItemColor ?? this.defaultItemColor, |
||||||
|
iconSize: iconSize ?? this.iconSize, |
||||||
|
iconButtonFactor: iconButtonFactor ?? this.iconButtonFactor, |
||||||
|
fillColor: fillColor ?? this.fillColor, |
||||||
|
hoverElevation: hoverElevation ?? this.hoverElevation, |
||||||
|
highlightElevation: highlightElevation ?? this.highlightElevation, |
||||||
|
renderItemTextStyle: renderItemTextStyle ?? this.renderItemTextStyle, |
||||||
|
); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,136 @@ |
|||||||
|
// ignore_for_file: public_member_api_docs, sort_constructors_first |
||||||
|
import 'package:equatable/equatable.dart'; |
||||||
|
import 'package:flutter/foundation.dart' show immutable; |
||||||
|
|
||||||
|
import 'base_button_configurations.dart'; |
||||||
|
import 'buttons/clear_format_configurations.dart'; |
||||||
|
import 'buttons/color_configurations.dart'; |
||||||
|
import 'buttons/custom_button_configurations.dart'; |
||||||
|
import 'buttons/font_family_configurations.dart'; |
||||||
|
import 'buttons/font_size_configurations.dart'; |
||||||
|
import 'buttons/history_configurations.dart'; |
||||||
|
import 'buttons/indent_configurations.dart'; |
||||||
|
import 'buttons/link_style2_configurations.dart'; |
||||||
|
import 'buttons/link_style_configurations.dart'; |
||||||
|
import 'buttons/search_configurations.dart'; |
||||||
|
import 'buttons/select_alignment_configurations.dart'; |
||||||
|
import 'buttons/select_header_style_buttons_configurations.dart'; |
||||||
|
import 'buttons/select_header_style_dropdown_button_configurations.dart'; |
||||||
|
import 'buttons/toggle_check_list_configurations.dart'; |
||||||
|
import 'buttons/toggle_style_configurations.dart'; |
||||||
|
|
||||||
|
export './../../../widgets/toolbar/buttons/search/search_dialog.dart'; |
||||||
|
export 'base_button_configurations.dart'; |
||||||
|
export 'buttons/clear_format_configurations.dart'; |
||||||
|
export 'buttons/color_configurations.dart'; |
||||||
|
export 'buttons/custom_button_configurations.dart'; |
||||||
|
export 'buttons/font_family_configurations.dart'; |
||||||
|
export 'buttons/font_size_configurations.dart'; |
||||||
|
export 'buttons/history_configurations.dart'; |
||||||
|
export 'buttons/indent_configurations.dart'; |
||||||
|
export 'buttons/link_style2_configurations.dart'; |
||||||
|
export 'buttons/link_style_configurations.dart'; |
||||||
|
export 'buttons/search_configurations.dart'; |
||||||
|
export 'buttons/select_alignment_configurations.dart'; |
||||||
|
export 'buttons/select_header_style_buttons_configurations.dart'; |
||||||
|
export 'buttons/select_header_style_dropdown_button_configurations.dart'; |
||||||
|
export 'buttons/toggle_check_list_configurations.dart'; |
||||||
|
export 'buttons/toggle_style_configurations.dart'; |
||||||
|
|
||||||
|
/// The configurations for the buttons of the toolbar widget of flutter quill |
||||||
|
@immutable |
||||||
|
class QuillSimpleToolbarButtonOptions extends Equatable { |
||||||
|
const QuillSimpleToolbarButtonOptions({ |
||||||
|
this.base = const QuillToolbarBaseButtonOptions(), |
||||||
|
this.undoHistory = const QuillToolbarHistoryButtonOptions(), |
||||||
|
this.redoHistory = const QuillToolbarHistoryButtonOptions(), |
||||||
|
this.fontFamily = const QuillToolbarFontFamilyButtonOptions(), |
||||||
|
this.fontSize = const QuillToolbarFontSizeButtonOptions(), |
||||||
|
this.bold = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.subscript = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.superscript = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.italic = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.small = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.underLine = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.strikeThrough = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.inlineCode = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.direction = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.listNumbers = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.listBullets = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.codeBlock = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.quote = const QuillToolbarToggleStyleButtonOptions(), |
||||||
|
this.toggleCheckList = const QuillToolbarToggleCheckListButtonOptions(), |
||||||
|
this.indentIncrease = const QuillToolbarIndentButtonOptions(), |
||||||
|
this.indentDecrease = const QuillToolbarIndentButtonOptions(), |
||||||
|
this.color = const QuillToolbarColorButtonOptions(), |
||||||
|
this.backgroundColor = const QuillToolbarColorButtonOptions(), |
||||||
|
this.clearFormat = const QuillToolbarClearFormatButtonOptions(), |
||||||
|
this.selectAlignmentButtons = |
||||||
|
const QuillToolbarSelectAlignmentButtonOptions(), |
||||||
|
this.search = const QuillToolbarSearchButtonOptions(), |
||||||
|
this.selectHeaderStyleButtons = |
||||||
|
const QuillToolbarSelectHeaderStyleButtonsOptions(), |
||||||
|
this.selectHeaderStyleDropdownButton = |
||||||
|
const QuillToolbarSelectHeaderStyleDropdownButtonOptions(), |
||||||
|
this.linkStyle = const QuillToolbarLinkStyleButtonOptions(), |
||||||
|
this.linkStyle2 = const QuillToolbarLinkStyleButton2Options(), |
||||||
|
this.customButtons = const QuillToolbarCustomButtonOptions(), |
||||||
|
}); |
||||||
|
|
||||||
|
/// The base configurations for all the buttons which will apply to all |
||||||
|
/// but if the options overrided in the spesefic button options |
||||||
|
/// then it will use that instead |
||||||
|
final QuillToolbarBaseButtonOptions base; |
||||||
|
final QuillToolbarHistoryButtonOptions undoHistory; |
||||||
|
final QuillToolbarHistoryButtonOptions redoHistory; |
||||||
|
final QuillToolbarFontFamilyButtonOptions fontFamily; |
||||||
|
final QuillToolbarFontSizeButtonOptions fontSize; |
||||||
|
final QuillToolbarToggleStyleButtonOptions bold; |
||||||
|
final QuillToolbarToggleStyleButtonOptions subscript; |
||||||
|
final QuillToolbarToggleStyleButtonOptions superscript; |
||||||
|
final QuillToolbarToggleStyleButtonOptions italic; |
||||||
|
final QuillToolbarToggleStyleButtonOptions small; |
||||||
|
final QuillToolbarToggleStyleButtonOptions underLine; |
||||||
|
final QuillToolbarToggleStyleButtonOptions strikeThrough; |
||||||
|
final QuillToolbarToggleStyleButtonOptions inlineCode; |
||||||
|
final QuillToolbarToggleStyleButtonOptions direction; |
||||||
|
final QuillToolbarToggleStyleButtonOptions listNumbers; |
||||||
|
final QuillToolbarToggleStyleButtonOptions listBullets; |
||||||
|
final QuillToolbarToggleStyleButtonOptions codeBlock; |
||||||
|
final QuillToolbarToggleStyleButtonOptions quote; |
||||||
|
final QuillToolbarToggleCheckListButtonOptions toggleCheckList; |
||||||
|
final QuillToolbarIndentButtonOptions indentIncrease; |
||||||
|
final QuillToolbarIndentButtonOptions indentDecrease; |
||||||
|
final QuillToolbarColorButtonOptions color; |
||||||
|
final QuillToolbarColorButtonOptions backgroundColor; |
||||||
|
final QuillToolbarClearFormatButtonOptions clearFormat; |
||||||
|
|
||||||
|
/// The reason we call this buttons in the end because this is responsible |
||||||
|
/// for all the alignment buttons and not just one, you still |
||||||
|
/// can customize the icons and tooltips |
||||||
|
/// and you have child builder |
||||||
|
final QuillToolbarSelectAlignmentButtonOptions selectAlignmentButtons; |
||||||
|
|
||||||
|
final QuillToolbarSearchButtonOptions search; |
||||||
|
|
||||||
|
/// The reason we call this buttons in the end because this is responsible |
||||||
|
/// for all the header style buttons and not just one, you still |
||||||
|
/// can customize it and you also have child builder |
||||||
|
final QuillToolbarSelectHeaderStyleButtonsOptions selectHeaderStyleButtons; |
||||||
|
|
||||||
|
/// The reason we call this buttons in the end because this is responsible |
||||||
|
/// for all the header style buttons and not just one, you still |
||||||
|
/// can customize it and you also have child builder |
||||||
|
final QuillToolbarSelectHeaderStyleDropdownButtonOptions |
||||||
|
selectHeaderStyleDropdownButton; |
||||||
|
|
||||||
|
final QuillToolbarLinkStyleButtonOptions linkStyle; |
||||||
|
final QuillToolbarLinkStyleButton2Options linkStyle2; |
||||||
|
|
||||||
|
final QuillToolbarCustomButtonOptions customButtons; |
||||||
|
|
||||||
|
@override |
||||||
|
List<Object?> get props => [ |
||||||
|
base, |
||||||
|
]; |
||||||
|
} |
Loading…
Reference in new issue