From 09cc3860deeaf563d68612aa26cf855119857418 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Wed, 6 Dec 2023 15:24:51 +0100 Subject: [PATCH 01/17] Add `QuillToolbarSelectHeaderStyleDropdownButton` --- lib/src/widgets/toolbar/base_toolbar.dart | 1 + .../buttons/dropdown_header_style.dart | 224 ++++++++++++++++++ 2 files changed, 225 insertions(+) create mode 100644 lib/src/widgets/toolbar/buttons/dropdown_header_style.dart diff --git a/lib/src/widgets/toolbar/base_toolbar.dart b/lib/src/widgets/toolbar/base_toolbar.dart index 5767f0f2f..9d48803dc 100644 --- a/lib/src/widgets/toolbar/base_toolbar.dart +++ b/lib/src/widgets/toolbar/base_toolbar.dart @@ -11,6 +11,7 @@ export '../../models/config/toolbar/toolbar_configurations.dart'; export 'buttons/clear_format.dart'; export 'buttons/color/color.dart'; export 'buttons/custom_button.dart'; +export 'buttons/dropdown_header_style.dart'; export 'buttons/font_family.dart'; export 'buttons/font_size.dart'; export 'buttons/history.dart'; diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart new file mode 100644 index 000000000..afcba1188 --- /dev/null +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -0,0 +1,224 @@ +import 'package:flutter/foundation.dart'; +import 'package:flutter/material.dart'; + +import '../../../../flutter_quill.dart'; +import '../../../../translations.dart'; + +class QuillToolbarSelectHeaderStyleDropdownButton extends StatefulWidget { + const QuillToolbarSelectHeaderStyleDropdownButton({ + required this.controller, + required this.options, + super.key, + }); + + final QuillController controller; + final QuillToolbarSelectHeaderStyleButtonsOptions options; + + @override + State createState() => + _QuillToolbarSelectHeaderStyleDropdownButtonState(); +} + +class _QuillToolbarSelectHeaderStyleDropdownButtonState + extends State { + Attribute? _selectedAttribute; + + Style get _selectionStyle => controller.getSelectionStyle(); + + final _valueToText = { + Attribute.header: 'N', + Attribute.h1: 'H1', + Attribute.h2: 'H2', + Attribute.h3: 'H3', + }; + + QuillToolbarSelectHeaderStyleButtonsOptions get options { + return widget.options; + } + + QuillController get controller { + return widget.controller; + } + + double get iconSize { + final baseFontSize = baseButtonExtraOptions.globalIconSize; + final iconSize = options.iconSize; + return iconSize ?? baseFontSize; + } + + double get iconButtonFactor { + final baseIconFactor = baseButtonExtraOptions.globalIconButtonFactor; + final iconButtonFactor = options.iconButtonFactor; + return iconButtonFactor ?? baseIconFactor; + } + + VoidCallback? get afterButtonPressed { + return options.afterButtonPressed ?? + baseButtonExtraOptions.afterButtonPressed; + } + + QuillIconTheme? get iconTheme { + return options.iconTheme ?? baseButtonExtraOptions.iconTheme; + } + + QuillToolbarBaseButtonOptions get baseButtonExtraOptions { + return context.requireQuillToolbarBaseButtonOptions; + } + + String get tooltip { + return options.tooltip ?? + baseButtonExtraOptions.tooltip ?? + context.loc.headerStyle; + } + + Axis get axis { + return options.axis ?? + context.quillToolbarConfigurations?.axis ?? + context.quillBaseToolbarConfigurations?.axis ?? + (throw ArgumentError( + 'There is no default value for the Axis of the toolbar')); + } + + List get _attrbuites { + return options.attributes ?? + const [ + Attribute.header, + Attribute.h1, + Attribute.h2, + Attribute.h3, + ]; + } + + @override + void dispose() { + controller.removeListener(_didChangeEditingValue); + super.dispose(); + } + + @override + void didUpdateWidget( + covariant QuillToolbarSelectHeaderStyleDropdownButton oldWidget) { + super.didUpdateWidget(oldWidget); + if (oldWidget.controller != controller) { + oldWidget.controller.removeListener(_didChangeEditingValue); + controller.addListener(_didChangeEditingValue); + _selectedAttribute = _getHeaderValue(); + } + } + + @override + void initState() { + super.initState(); + setState(() { + _selectedAttribute = _getHeaderValue(); + }); + controller.addListener(_didChangeEditingValue); + } + + @override + Widget build(BuildContext context) { + assert( + _attrbuites.every( + (element) => _valueToText.keys.contains(element), + ), + 'All attributes must be one of them: header, h1, h2 or h3', + ); + + final style = TextStyle( + fontWeight: FontWeight.w600, + fontSize: iconSize * 0.7, + ); + + final childBuilder = + options.childBuilder ?? baseButtonExtraOptions.childBuilder; + + for (final attribute in _attrbuites) { + if (childBuilder != null) { + return childBuilder( + QuillToolbarSelectHeaderStyleButtonsOptions( + afterButtonPressed: afterButtonPressed, + attributes: _attrbuites, + axis: axis, + iconSize: iconSize, + iconButtonFactor: iconButtonFactor, + iconTheme: iconTheme, + tooltip: tooltip, + ), + QuillToolbarSelectHeaderStyleButtonExtraOptions( + controller: controller, + context: context, + onPressed: () => _sharedOnPressed(attribute), + ), + ); + } + } + + final theme = Theme.of(context); + + return ConstrainedBox( + constraints: BoxConstraints.tightFor( + width: iconSize * iconButtonFactor, + height: iconSize * iconButtonFactor, + ), + child: Tooltip( + message: tooltip, + child: DropdownButtonHideUnderline( + child: DropdownButton( + value: _selectedAttribute, + items: _valueToText.entries + .map((header) => DropdownMenuItem( + value: header.key, + child: Text( + header.value, + style: style, + ), + )) + .toList(), + selectedItemBuilder: (context) => + _valueToText.entries.map((header) { + final isSelected = _selectedAttribute == header.key; + return Text( + header.value, + style: style.copyWith( + color: isSelected + ? (iconTheme?.iconSelectedColor ?? + theme.primaryIconTheme.color) + : (iconTheme?.iconUnselectedColor ?? + theme.iconTheme.color), + ), + ); + }).toList(), + elevation: 0, + borderRadius: BorderRadius.circular(iconTheme?.borderRadius ?? 2), + padding: + const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0), + onChanged: (attribute) => _sharedOnPressed(attribute!), + ), + ), + ), + ); + } + + void _didChangeEditingValue() { + setState(() { + _selectedAttribute = _getHeaderValue(); + }); + } + + Attribute _getHeaderValue() { + final attr = controller.toolbarButtonToggler[Attribute.header.key]; + if (attr != null) { + // checkbox tapping causes controller.selection to go to offset 0 + controller.toolbarButtonToggler.remove(Attribute.header.key); + return attr; + } + return _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header; + } + + void _sharedOnPressed(Attribute attribute) { + final attribute0 = + _selectedAttribute == attribute ? Attribute.header : attribute; + controller.formatSelection(attribute0); + afterButtonPressed?.call(); + } +} From 7f605048d1a8541422ab755830c1031b2a2616f1 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:17:54 +0100 Subject: [PATCH 02/17] Update widget --- .../buttons/dropdown_header_style.dart | 303 +++++++++++++----- 1 file changed, 225 insertions(+), 78 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index afcba1188..6eb92ab18 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -1,8 +1,118 @@ -import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import '../../../../flutter_quill.dart'; import '../../../../translations.dart'; +import '../../../utils/widgets.dart'; + +class QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions + extends QuillToolbarBaseButtonExtraOptions { + const QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions({ + required this.currentValue, + required super.controller, + required super.context, + required super.onPressed, + }); + final Attribute currentValue; +} + +class QuillToolbarSelectHeaderStyleDropdownButtonOptions + extends QuillToolbarBaseButtonOptions< + QuillToolbarSelectHeaderStyleDropdownButtonOptions, + QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions> { + const QuillToolbarSelectHeaderStyleDropdownButtonOptions({ + super.controller, + super.iconData, + super.afterButtonPressed, + super.tooltip, + super.iconTheme, + super.childBuilder, + this.iconSize, + this.iconButtonFactor, + this.fillColor, + this.hoverElevation = 1, + this.highlightElevation = 1, + this.rawItemsMap, + this.onSelected, + this.attributes, + this.padding, + this.style, + this.width, + this.initialValue, + this.labelOverflow = TextOverflow.visible, + this.itemHeight, + this.itemPadding, + this.defaultItemColor, + }); + + final double? iconSize; + final double? iconButtonFactor; + final Color? fillColor; + final double hoverElevation; + final double highlightElevation; + final Map? rawItemsMap; + final ValueChanged? onSelected; + final List? attributes; + final EdgeInsetsGeometry? padding; + final TextStyle? style; + final double? width; + final String? initialValue; + final TextOverflow labelOverflow; + final double? itemHeight; + final EdgeInsets? itemPadding; + final Color? defaultItemColor; + + QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ + Color? fillColor, + double? hoverElevation, + double? highlightElevation, + List>? items, + Map? rawItemsMap, + ValueChanged? onSelected, + List? attributes, + EdgeInsetsGeometry? padding, + TextStyle? style, + double? width, + String? initialValue, + TextOverflow? labelOverflow, + bool? renderFontFamilies, + bool? overrideTooltipByFontFamily, + double? itemHeight, + EdgeInsets? itemPadding, + Color? defaultItemColor, + double? iconSize, + double? iconButtonFactor, + // Add properties to override inherited properties + QuillController? controller, + IconData? iconData, + VoidCallback? afterButtonPressed, + String? tooltip, + QuillIconTheme? iconTheme, + }) { + return QuillToolbarSelectHeaderStyleDropdownButtonOptions( + attributes: attributes ?? this.attributes, + rawItemsMap: rawItemsMap ?? this.rawItemsMap, + controller: controller ?? this.controller, + 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, + initialValue: initialValue ?? this.initialValue, + 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, + ); + } +} class QuillToolbarSelectHeaderStyleDropdownButton extends StatefulWidget { const QuillToolbarSelectHeaderStyleDropdownButton({ @@ -11,8 +121,10 @@ class QuillToolbarSelectHeaderStyleDropdownButton extends StatefulWidget { super.key, }); + /// Since we can't get the state from the instace of the widget for comparing + /// in [didUpdateWidget] then we will have to store reference here final QuillController controller; - final QuillToolbarSelectHeaderStyleButtonsOptions options; + final QuillToolbarSelectHeaderStyleDropdownButtonOptions options; @override State createState() => @@ -26,13 +138,13 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Style get _selectionStyle => controller.getSelectionStyle(); final _valueToText = { - Attribute.header: 'N', + Attribute.header: 'Normal', Attribute.h1: 'H1', Attribute.h2: 'H2', Attribute.h3: 'H3', }; - QuillToolbarSelectHeaderStyleButtonsOptions get options { + QuillToolbarSelectHeaderStyleDropdownButtonOptions get options { return widget.options; } @@ -71,14 +183,6 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState context.loc.headerStyle; } - Axis get axis { - return options.axis ?? - context.quillToolbarConfigurations?.axis ?? - context.quillBaseToolbarConfigurations?.axis ?? - (throw ArgumentError( - 'There is no default value for the Axis of the toolbar')); - } - List get _attrbuites { return options.attributes ?? const [ @@ -109,9 +213,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState @override void initState() { super.initState(); - setState(() { - _selectedAttribute = _getHeaderValue(); - }); + _selectedAttribute = _getHeaderValue(); controller.addListener(_didChangeEditingValue); } @@ -124,76 +226,45 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState 'All attributes must be one of them: header, h1, h2 or h3', ); - final style = TextStyle( - fontWeight: FontWeight.w600, - fontSize: iconSize * 0.7, - ); - + final baseButtonConfigurations = + context.requireQuillToolbarBaseButtonOptions; final childBuilder = - options.childBuilder ?? baseButtonExtraOptions.childBuilder; - - for (final attribute in _attrbuites) { - if (childBuilder != null) { - return childBuilder( - QuillToolbarSelectHeaderStyleButtonsOptions( - afterButtonPressed: afterButtonPressed, - attributes: _attrbuites, - axis: axis, - iconSize: iconSize, - iconButtonFactor: iconButtonFactor, - iconTheme: iconTheme, - tooltip: tooltip, - ), - QuillToolbarSelectHeaderStyleButtonExtraOptions( - controller: controller, - context: context, - onPressed: () => _sharedOnPressed(attribute), - ), - ); - } + options.childBuilder ?? baseButtonConfigurations.childBuilder; + if (childBuilder != null) { + return childBuilder( + options.copyWith( + iconSize: iconSize, + iconTheme: iconTheme, + tooltip: tooltip, + afterButtonPressed: afterButtonPressed, + ), + QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions( + currentValue: _selectedAttribute!, + controller: controller, + context: context, + onPressed: _onPressed, + ), + ); } - final theme = Theme.of(context); - return ConstrainedBox( constraints: BoxConstraints.tightFor( - width: iconSize * iconButtonFactor, - height: iconSize * iconButtonFactor, + height: iconSize * 1.81, + width: options.width, ), - child: Tooltip( + child: UtilityWidgets.maybeTooltip( message: tooltip, - child: DropdownButtonHideUnderline( - child: DropdownButton( - value: _selectedAttribute, - items: _valueToText.entries - .map((header) => DropdownMenuItem( - value: header.key, - child: Text( - header.value, - style: style, - ), - )) - .toList(), - selectedItemBuilder: (context) => - _valueToText.entries.map((header) { - final isSelected = _selectedAttribute == header.key; - return Text( - header.value, - style: style.copyWith( - color: isSelected - ? (iconTheme?.iconSelectedColor ?? - theme.primaryIconTheme.color) - : (iconTheme?.iconUnselectedColor ?? - theme.iconTheme.color), - ), - ); - }).toList(), - elevation: 0, + child: RawMaterialButton( + visualDensity: VisualDensity.compact, + shape: RoundedRectangleBorder( borderRadius: BorderRadius.circular(iconTheme?.borderRadius ?? 2), - padding: - const EdgeInsets.symmetric(horizontal: !kIsWeb ? 1.0 : 5.0), - onChanged: (attribute) => _sharedOnPressed(attribute!), ), + fillColor: options.fillColor, + elevation: 0, + hoverElevation: options.hoverElevation, + highlightElevation: options.hoverElevation, + onPressed: _onPressed, + child: _buildContent(context), ), ), ); @@ -215,9 +286,85 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState return _selectionStyle.attributes[Attribute.header.key] ?? Attribute.header; } - void _sharedOnPressed(Attribute attribute) { + Widget _buildContent(BuildContext context) { + final theme = Theme.of(context); + final hasFinalWidth = options.width != null; + return Padding( + padding: options.padding ?? const EdgeInsets.fromLTRB(10, 0, 0, 0), + child: Row( + mainAxisSize: !hasFinalWidth ? MainAxisSize.min : MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + UtilityWidgets.maybeWidget( + enabled: hasFinalWidth, + wrapper: (child) => Expanded(child: child), + child: Text( + _selectedAttribute!.key, + overflow: options.labelOverflow, + style: options.style ?? + TextStyle( + fontSize: iconSize / 1.15, + color: + iconTheme?.iconUnselectedColor ?? theme.iconTheme.color, + ), + ), + ), + const SizedBox(width: 3), + Icon( + Icons.arrow_drop_down, + size: iconSize / 1.15, + color: iconTheme?.iconUnselectedColor ?? theme.iconTheme.color, + ) + ], + ), + ); + } + + void _onPressed() { + _showMenu(); + options.afterButtonPressed?.call(); + } + + Future _showMenu() async { + final popupMenuTheme = PopupMenuTheme.of(context); + final button = context.findRenderObject() as RenderBox; + final overlay = Overlay.of(context).context.findRenderObject() as RenderBox; + final position = RelativeRect.fromRect( + Rect.fromPoints( + button.localToGlobal(Offset.zero, ancestor: overlay), + button.localToGlobal(button.size.bottomLeft(Offset.zero), + ancestor: overlay), + ), + Offset.zero & overlay.size, + ); + final newValue = await showMenu( + context: context, + elevation: 4, + items: [ + for (final header in _valueToText.entries) + PopupMenuItem( + key: ValueKey(header.value), + value: header.key, + height: options.itemHeight ?? kMinInteractiveDimension, + padding: options.itemPadding, + child: Text( + header.value, + style: TextStyle( + color: header.value == 'N' ? options.defaultItemColor : null, + ), + ), + ), + ], + position: position, + shape: popupMenuTheme.shape, + color: popupMenuTheme.color, + ); + if (newValue == null) { + return; + } + final attribute0 = - _selectedAttribute == attribute ? Attribute.header : attribute; + _selectedAttribute == newValue ? Attribute.header : newValue; controller.formatSelection(attribute0); afterButtonPressed?.call(); } From 8bba10517033f35d4d608081c430e380020b3ae5 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Wed, 6 Dec 2023 17:44:22 +0100 Subject: [PATCH 03/17] File refactoring --- .../buttons/dropdown_header_style.dart | 116 ++++++++++++++++++ .../toolbar/toolbar_configurations.dart | 20 +++ .../buttons/dropdown_header_style.dart | 110 ----------------- 3 files changed, 136 insertions(+), 110 deletions(-) create mode 100644 lib/src/models/config/toolbar/buttons/dropdown_header_style.dart diff --git a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart new file mode 100644 index 000000000..238e7bba1 --- /dev/null +++ b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart @@ -0,0 +1,116 @@ +import 'package:flutter/material.dart'; + +import '../../../../widgets/controller.dart'; +import '../../../documents/attribute.dart'; +import '../../../themes/quill_icon_theme.dart'; +import '../../quill_configurations.dart'; + +class QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions + extends QuillToolbarBaseButtonExtraOptions { + const QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions({ + required this.currentValue, + required super.controller, + required super.context, + required super.onPressed, + }); + final Attribute currentValue; +} + +class QuillToolbarSelectHeaderStyleDropdownButtonOptions + extends QuillToolbarBaseButtonOptions< + QuillToolbarSelectHeaderStyleDropdownButtonOptions, + QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions> { + const QuillToolbarSelectHeaderStyleDropdownButtonOptions({ + super.controller, + super.iconData, + super.afterButtonPressed, + super.tooltip, + super.iconTheme, + super.childBuilder, + this.iconSize, + this.iconButtonFactor, + this.fillColor, + this.hoverElevation = 1, + this.highlightElevation = 1, + this.rawItemsMap, + this.onSelected, + this.attributes, + this.padding, + this.style, + this.width, + this.initialValue, + this.labelOverflow = TextOverflow.visible, + this.itemHeight, + this.itemPadding, + this.defaultItemColor, + }); + + final double? iconSize; + final double? iconButtonFactor; + final Color? fillColor; + final double hoverElevation; + final double highlightElevation; + final Map? rawItemsMap; + final ValueChanged? onSelected; + final List? attributes; + final EdgeInsetsGeometry? padding; + final TextStyle? style; + final double? width; + final String? initialValue; + final TextOverflow labelOverflow; + final double? itemHeight; + final EdgeInsets? itemPadding; + final Color? defaultItemColor; + + QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ + Color? fillColor, + double? hoverElevation, + double? highlightElevation, + List>? items, + Map? rawItemsMap, + ValueChanged? onSelected, + List? attributes, + EdgeInsetsGeometry? padding, + TextStyle? style, + double? width, + String? initialValue, + TextOverflow? labelOverflow, + bool? renderFontFamilies, + bool? overrideTooltipByFontFamily, + double? itemHeight, + EdgeInsets? itemPadding, + Color? defaultItemColor, + double? iconSize, + double? iconButtonFactor, + // Add properties to override inherited properties + QuillController? controller, + IconData? iconData, + VoidCallback? afterButtonPressed, + String? tooltip, + QuillIconTheme? iconTheme, + }) { + return QuillToolbarSelectHeaderStyleDropdownButtonOptions( + attributes: attributes ?? this.attributes, + rawItemsMap: rawItemsMap ?? this.rawItemsMap, + controller: controller ?? this.controller, + 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, + initialValue: initialValue ?? this.initialValue, + 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, + ); + } +} diff --git a/lib/src/models/config/toolbar/toolbar_configurations.dart b/lib/src/models/config/toolbar/toolbar_configurations.dart index e4ccf4ad2..f6ed5f2fb 100644 --- a/lib/src/models/config/toolbar/toolbar_configurations.dart +++ b/lib/src/models/config/toolbar/toolbar_configurations.dart @@ -10,6 +10,7 @@ import 'buttons/base.dart'; import 'buttons/clear_format.dart'; import 'buttons/color.dart'; import 'buttons/custom_button.dart'; +import 'buttons/dropdown_header_style.dart'; import 'buttons/font_family.dart'; import 'buttons/font_size.dart'; import 'buttons/history.dart'; @@ -37,6 +38,7 @@ export './buttons/link_style2.dart'; export './buttons/search.dart'; export './buttons/select_alignment.dart'; export './buttons/select_header_style.dart'; +export './buttons/dropdown_header_style.dart'; export './buttons/toggle_check_list.dart'; export './buttons/toggle_style.dart'; @@ -63,6 +65,17 @@ enum LinkStyleType { bool get isAlternative => this == LinkStyleType.alternative; } +enum HeaderStyleType { + /// Defines the original [QuillToolbarSelectHeaderStyleButtons]. + original, + + /// Defines the alternative [QuillToolbarSelectHeaderStyleDropdownButton]. + dropdown; + + bool get isOriginal => this == HeaderStyleType.original; + bool get isDropdown => this == HeaderStyleType.dropdown; +} + /// The configurations for the toolbar widget of flutter quill @immutable class QuillToolbarConfigurations extends QuillSharedToolbarProperties { @@ -105,6 +118,7 @@ class QuillToolbarConfigurations extends QuillSharedToolbarProperties { this.showSubscript = true, this.showSuperscript = true, this.linkStyleType = LinkStyleType.original, + this.headerStyleType = HeaderStyleType.original, super.customButtons = const [], /// The decoration to use for the toolbar. @@ -208,6 +222,9 @@ class QuillToolbarConfigurations extends QuillSharedToolbarProperties { /// Defines which dialog is used for applying link attribute. final LinkStyleType linkStyleType; + /// Defines which dialog is used for applying header attribute. + final HeaderStyleType headerStyleType; + @override List get props => [ buttonOptions, @@ -255,6 +272,8 @@ class QuillToolbarButtonOptions extends Equatable { this.search = const QuillToolbarSearchButtonOptions(), this.selectHeaderStyleButtons = const QuillToolbarSelectHeaderStyleButtonsOptions(), + this.headerStyleButton = + const QuillToolbarSelectHeaderStyleDropdownButtonOptions(), this.linkStyle = const QuillToolbarLinkStyleButtonOptions(), this.linkStyle2 = const QuillToolbarLinkStyleButton2Options(), this.customButtons = const QuillToolbarCustomButtonOptions(), @@ -300,6 +319,7 @@ class QuillToolbarButtonOptions extends Equatable { /// for all the header style buttons and not just one, you still /// can customize it and you also have child builder final QuillToolbarSelectHeaderStyleButtonsOptions selectHeaderStyleButtons; + final QuillToolbarSelectHeaderStyleDropdownButtonOptions headerStyleButton; final QuillToolbarLinkStyleButtonOptions linkStyle; final QuillToolbarLinkStyleButton2Options linkStyle2; diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 6eb92ab18..5745763c7 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -4,116 +4,6 @@ import '../../../../flutter_quill.dart'; import '../../../../translations.dart'; import '../../../utils/widgets.dart'; -class QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions - extends QuillToolbarBaseButtonExtraOptions { - const QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions({ - required this.currentValue, - required super.controller, - required super.context, - required super.onPressed, - }); - final Attribute currentValue; -} - -class QuillToolbarSelectHeaderStyleDropdownButtonOptions - extends QuillToolbarBaseButtonOptions< - QuillToolbarSelectHeaderStyleDropdownButtonOptions, - QuillToolbarSelectHeaderStyleDropdownButtonExtraOptions> { - const QuillToolbarSelectHeaderStyleDropdownButtonOptions({ - super.controller, - super.iconData, - super.afterButtonPressed, - super.tooltip, - super.iconTheme, - super.childBuilder, - this.iconSize, - this.iconButtonFactor, - this.fillColor, - this.hoverElevation = 1, - this.highlightElevation = 1, - this.rawItemsMap, - this.onSelected, - this.attributes, - this.padding, - this.style, - this.width, - this.initialValue, - this.labelOverflow = TextOverflow.visible, - this.itemHeight, - this.itemPadding, - this.defaultItemColor, - }); - - final double? iconSize; - final double? iconButtonFactor; - final Color? fillColor; - final double hoverElevation; - final double highlightElevation; - final Map? rawItemsMap; - final ValueChanged? onSelected; - final List? attributes; - final EdgeInsetsGeometry? padding; - final TextStyle? style; - final double? width; - final String? initialValue; - final TextOverflow labelOverflow; - final double? itemHeight; - final EdgeInsets? itemPadding; - final Color? defaultItemColor; - - QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ - Color? fillColor, - double? hoverElevation, - double? highlightElevation, - List>? items, - Map? rawItemsMap, - ValueChanged? onSelected, - List? attributes, - EdgeInsetsGeometry? padding, - TextStyle? style, - double? width, - String? initialValue, - TextOverflow? labelOverflow, - bool? renderFontFamilies, - bool? overrideTooltipByFontFamily, - double? itemHeight, - EdgeInsets? itemPadding, - Color? defaultItemColor, - double? iconSize, - double? iconButtonFactor, - // Add properties to override inherited properties - QuillController? controller, - IconData? iconData, - VoidCallback? afterButtonPressed, - String? tooltip, - QuillIconTheme? iconTheme, - }) { - return QuillToolbarSelectHeaderStyleDropdownButtonOptions( - attributes: attributes ?? this.attributes, - rawItemsMap: rawItemsMap ?? this.rawItemsMap, - controller: controller ?? this.controller, - 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, - initialValue: initialValue ?? this.initialValue, - 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, - ); - } -} - class QuillToolbarSelectHeaderStyleDropdownButton extends StatefulWidget { const QuillToolbarSelectHeaderStyleDropdownButton({ required this.controller, From cb77385ad544a5a53ee55e002e9acdda00d4a150 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:01:10 +0100 Subject: [PATCH 04/17] Update header style --- .../l10n/generated/quill_localizations.dart | 42 +++++++++ .../buttons/dropdown_header_style.dart | 4 - lib/src/models/documents/attribute.dart | 12 +++ lib/src/widgets/default_styles.dart | 85 ++++++++++++++++--- .../buttons/dropdown_header_style.dart | 36 ++++---- 5 files changed, 140 insertions(+), 39 deletions(-) diff --git a/lib/src/l10n/generated/quill_localizations.dart b/lib/src/l10n/generated/quill_localizations.dart index f4425f811..3c93f1ec0 100644 --- a/lib/src/l10n/generated/quill_localizations.dart +++ b/lib/src/l10n/generated/quill_localizations.dart @@ -636,6 +636,48 @@ abstract class FlutterQuillLocalizations { /// In en, this message translates to: /// **'Paste a video using a link'** String get pasteAVideoUsingALink; + + /// No description provided for @normal. + /// + /// In en, this message translates to: + /// **'Normal'** + String get normal => 'Normal'; + + /// No description provided for @heading1. + /// + /// In en, this message translates to: + /// **'Heading 1'** + String get heading1 => 'Heading 1'; + + /// No description provided for @heading2. + /// + /// In en, this message translates to: + /// **'Heading 2'** + String get heading2 => 'Heading 2'; + + /// No description provided for @heading3. + /// + /// In en, this message translates to: + /// **'Heading 3'** + String get heading3 => 'Heading 3'; + + /// No description provided for @heading4. + /// + /// In en, this message translates to: + /// **'Heading 4'** + String get heading4 => 'Heading 4'; + + /// No description provided for @heading5. + /// + /// In en, this message translates to: + /// **'Heading 5'** + String get heading5 => 'Heading 5'; + + /// No description provided for @heading6. + /// + /// In en, this message translates to: + /// **'Heading 6'** + String get heading6 => 'Heading 6'; } class _FlutterQuillLocalizationsDelegate diff --git a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart index 238e7bba1..0d81df204 100644 --- a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart @@ -32,7 +32,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions this.fillColor, this.hoverElevation = 1, this.highlightElevation = 1, - this.rawItemsMap, this.onSelected, this.attributes, this.padding, @@ -50,7 +49,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions final Color? fillColor; final double hoverElevation; final double highlightElevation; - final Map? rawItemsMap; final ValueChanged? onSelected; final List? attributes; final EdgeInsetsGeometry? padding; @@ -67,7 +65,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions double? hoverElevation, double? highlightElevation, List>? items, - Map? rawItemsMap, ValueChanged? onSelected, List? attributes, EdgeInsetsGeometry? padding, @@ -91,7 +88,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions }) { return QuillToolbarSelectHeaderStyleDropdownButtonOptions( attributes: attributes ?? this.attributes, - rawItemsMap: rawItemsMap ?? this.rawItemsMap, controller: controller ?? this.controller, iconData: iconData ?? this.iconData, afterButtonPressed: afterButtonPressed ?? this.afterButtonPressed, diff --git a/lib/src/models/documents/attribute.dart b/lib/src/models/documents/attribute.dart index a30f258c3..51fc8af58 100644 --- a/lib/src/models/documents/attribute.dart +++ b/lib/src/models/documents/attribute.dart @@ -158,12 +158,24 @@ class Attribute extends Equatable { Attribute.video.key, }; + /// "attributes":{"header": 1 } static const Attribute h1 = HeaderAttribute(level: 1); + /// "attributes":{"header": 2 } static const Attribute h2 = HeaderAttribute(level: 2); + /// "attributes":{"header": 3 } static const Attribute h3 = HeaderAttribute(level: 3); + /// "attributes":{"header": 4 } + static const Attribute h4 = HeaderAttribute(level: 4); + + /// "attributes":{"header": 5 } + static const Attribute h5 = HeaderAttribute(level: 5); + + /// "attributes":{"header": 6 } + static const Attribute h6 = HeaderAttribute(level: 6); + // "attributes":{"align":"left"} static const Attribute leftAlignment = AlignAttribute('left'); diff --git a/lib/src/widgets/default_styles.dart b/lib/src/widgets/default_styles.dart index 5d5949f8b..e358a9519 100644 --- a/lib/src/widgets/default_styles.dart +++ b/lib/src/widgets/default_styles.dart @@ -144,6 +144,9 @@ class DefaultStyles { this.h1, this.h2, this.h3, + this.h4, + this.h5, + this.h6, this.paragraph, this.bold, this.subscript, @@ -170,6 +173,9 @@ class DefaultStyles { final DefaultTextBlockStyle? h1; final DefaultTextBlockStyle? h2; final DefaultTextBlockStyle? h3; + final DefaultTextBlockStyle? h4; + final DefaultTextBlockStyle? h5; + final DefaultTextBlockStyle? h6; final DefaultTextBlockStyle? paragraph; final TextStyle? bold; final TextStyle? subscript; @@ -220,9 +226,10 @@ class DefaultStyles { h1: DefaultTextBlockStyle( defaultTextStyle.style.copyWith( fontSize: 34, - color: defaultTextStyle.style.color!.withOpacity(0.70), - height: 1.15, - fontWeight: FontWeight.w300, + color: defaultTextStyle.style.color, + letterSpacing: -1, + height: 1, + fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), const VerticalSpacing(16, 0), @@ -230,37 +237,84 @@ class DefaultStyles { null), h2: DefaultTextBlockStyle( defaultTextStyle.style.copyWith( - fontSize: 24, - color: defaultTextStyle.style.color!.withOpacity(0.70), - height: 1.15, - fontWeight: FontWeight.normal, + fontSize: 30, + color: defaultTextStyle.style.color, + letterSpacing: -0.8, + height: 1.067, + fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), const VerticalSpacing(8, 0), const VerticalSpacing(0, 0), null), h3: DefaultTextBlockStyle( + defaultTextStyle.style.copyWith( + fontSize: 24, + color: defaultTextStyle.style.color, + letterSpacing: -0.5, + height: 1.083, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + ), + const VerticalSpacing(8, 0), + const VerticalSpacing(0, 0), + null, + ), + h4: DefaultTextBlockStyle( defaultTextStyle.style.copyWith( fontSize: 20, - color: defaultTextStyle.style.color!.withOpacity(0.70), - height: 1.25, - fontWeight: FontWeight.w500, + color: defaultTextStyle.style.color, + letterSpacing: -0.4, + height: 1.1, + fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), const VerticalSpacing(8, 0), const VerticalSpacing(0, 0), null, ), - paragraph: DefaultTextBlockStyle(baseStyle, const VerticalSpacing(0, 0), - const VerticalSpacing(0, 0), null), + h5: DefaultTextBlockStyle( + defaultTextStyle.style.copyWith( + fontSize: 18, + color: defaultTextStyle.style.color, + letterSpacing: -0.2, + height: 1.11, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + ), + const VerticalSpacing(8, 0), + const VerticalSpacing(0, 0), + null, + ), + h6: DefaultTextBlockStyle( + defaultTextStyle.style.copyWith( + fontSize: 16, + color: defaultTextStyle.style.color, + letterSpacing: -0.1, + height: 1.125, + fontWeight: FontWeight.bold, + decoration: TextDecoration.none, + ), + const VerticalSpacing(8, 0), + const VerticalSpacing(0, 0), + null, + ), + paragraph: DefaultTextBlockStyle( + baseStyle, + const VerticalSpacing(0, 0), + const VerticalSpacing(0, 0), + null, + ), bold: const TextStyle(fontWeight: FontWeight.bold), subscript: const TextStyle( fontFeatures: [ + FontFeature.liningFigures(), FontFeature.subscripts(), ], ), superscript: const TextStyle( fontFeatures: [ + FontFeature.liningFigures(), FontFeature.superscripts(), ], ), @@ -274,9 +328,12 @@ class DefaultStyles { style: inlineCodeStyle, header1: inlineCodeStyle.copyWith( fontSize: 32, - fontWeight: FontWeight.w300, + fontWeight: FontWeight.w500, + ), + header2: inlineCodeStyle.copyWith( + fontSize: 22, + fontWeight: FontWeight.w500, ), - header2: inlineCodeStyle.copyWith(fontSize: 22), header3: inlineCodeStyle.copyWith( fontSize: 18, fontWeight: FontWeight.w500, diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 5745763c7..0ad1b784e 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -27,11 +27,14 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Style get _selectionStyle => controller.getSelectionStyle(); - final _valueToText = { - Attribute.header: 'Normal', - Attribute.h1: 'H1', - Attribute.h2: 'H2', - Attribute.h3: 'H3', + late final _valueToText = { + Attribute.header: context.loc.normal, + Attribute.h1: context.loc.heading1, + Attribute.h2: context.loc.heading2, + Attribute.h3: context.loc.heading3, + Attribute.h4: context.loc.heading4, + Attribute.h5: context.loc.heading5, + Attribute.h6: context.loc.heading6, }; QuillToolbarSelectHeaderStyleDropdownButtonOptions get options { @@ -74,13 +77,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } List get _attrbuites { - return options.attributes ?? - const [ - Attribute.header, - Attribute.h1, - Attribute.h2, - Attribute.h3, - ]; + return options.attributes ?? _valueToText.keys.toList(); } @override @@ -103,18 +100,13 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState @override void initState() { super.initState(); - _selectedAttribute = _getHeaderValue(); controller.addListener(_didChangeEditingValue); + _selectedAttribute = _getHeaderValue(); } @override Widget build(BuildContext context) { - assert( - _attrbuites.every( - (element) => _valueToText.keys.contains(element), - ), - 'All attributes must be one of them: header, h1, h2 or h3', - ); + assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); final baseButtonConfigurations = context.requireQuillToolbarBaseButtonOptions; @@ -189,7 +181,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState enabled: hasFinalWidth, wrapper: (child) => Expanded(child: child), child: Text( - _selectedAttribute!.key, + _valueToText[_selectedAttribute]!, overflow: options.labelOverflow, style: options.style ?? TextStyle( @@ -240,7 +232,9 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState child: Text( header.value, style: TextStyle( - color: header.value == 'N' ? options.defaultItemColor : null, + color: header.key == Attribute.header + ? options.defaultItemColor + : null, ), ), ), From e71289045612211aad98dffb420acb9798913000 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:13:29 +0100 Subject: [PATCH 05/17] Fix argument exception --- lib/src/widgets/raw_editor/raw_editor_state.dart | 7 +++++++ lib/src/widgets/text_block.dart | 12 ++++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/src/widgets/raw_editor/raw_editor_state.dart b/lib/src/widgets/raw_editor/raw_editor_state.dart index dc13082f5..9d7322059 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state.dart @@ -808,6 +808,13 @@ class QuillRawEditorState extends EditorState return defaultStyles!.h2!.verticalSpacing; case 3: return defaultStyles!.h3!.verticalSpacing; + case 4: + return defaultStyles!.h4!.verticalSpacing; + case 5: + return defaultStyles!.h5!.verticalSpacing; + case 6: + return defaultStyles!.h6!.verticalSpacing; + default: throw ArgumentError('Invalid level $level'); } diff --git a/lib/src/widgets/text_block.dart b/lib/src/widgets/text_block.dart index 1f70c9af7..4824bab76 100644 --- a/lib/src/widgets/text_block.dart +++ b/lib/src/widgets/text_block.dart @@ -312,6 +312,18 @@ class EditableTextBlock extends StatelessWidget { top = defaultStyles!.h3!.verticalSpacing.top; bottom = defaultStyles.h3!.verticalSpacing.bottom; break; + case 4: + top = defaultStyles!.h4!.verticalSpacing.top; + bottom = defaultStyles.h4!.verticalSpacing.bottom; + break; + case 5: + top = defaultStyles!.h5!.verticalSpacing.top; + bottom = defaultStyles.h5!.verticalSpacing.bottom; + break; + case 6: + top = defaultStyles!.h6!.verticalSpacing.top; + bottom = defaultStyles.h6!.verticalSpacing.bottom; + break; default: throw ArgumentError('Invalid level $level'); } From a9711b8ce9ae46fab0d5c4adb2cdc6fbcfa8be0a Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:19:27 +0100 Subject: [PATCH 06/17] Implement `renderItemTextStyle` --- .../toolbar/buttons/dropdown_header_style.dart | 5 ++++- .../toolbar/buttons/dropdown_header_style.dart | 18 +++++++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart index 0d81df204..5936c4f82 100644 --- a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart @@ -42,6 +42,7 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions this.itemHeight, this.itemPadding, this.defaultItemColor, + this.renderItemTextStyle = false, }); final double? iconSize; @@ -59,6 +60,7 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions final double? itemHeight; final EdgeInsets? itemPadding; final Color? defaultItemColor; + final bool renderItemTextStyle; QuillToolbarSelectHeaderStyleDropdownButtonOptions copyWith({ Color? fillColor, @@ -79,12 +81,12 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions Color? defaultItemColor, double? iconSize, double? iconButtonFactor, - // Add properties to override inherited properties QuillController? controller, IconData? iconData, VoidCallback? afterButtonPressed, String? tooltip, QuillIconTheme? iconTheme, + bool? renderItemTextStyle, }) { return QuillToolbarSelectHeaderStyleDropdownButtonOptions( attributes: attributes ?? this.attributes, @@ -107,6 +109,7 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions fillColor: fillColor ?? this.fillColor, hoverElevation: hoverElevation ?? this.hoverElevation, highlightElevation: highlightElevation ?? this.highlightElevation, + renderItemTextStyle: renderItemTextStyle ?? this.renderItemTextStyle, ); } } diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 0ad1b784e..25cac7492 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -37,6 +37,8 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Attribute.h6: context.loc.heading6, }; + late final Map _headerTextStyles; + QuillToolbarSelectHeaderStyleDropdownButtonOptions get options { return widget.options; } @@ -102,6 +104,15 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState super.initState(); controller.addListener(_didChangeEditingValue); _selectedAttribute = _getHeaderValue(); + final defaultStyles = QuillStyles.getStyles(context, false); + _headerTextStyles = { + Attribute.h1: defaultStyles!.h1!.style, + Attribute.h2: defaultStyles.h2!.style, + Attribute.h3: defaultStyles.h3!.style, + Attribute.h4: defaultStyles.h4!.style, + Attribute.h5: defaultStyles.h5!.style, + Attribute.h6: defaultStyles.h6!.style, + }; } @override @@ -232,7 +243,12 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState child: Text( header.value, style: TextStyle( - color: header.key == Attribute.header + fontSize: options.renderItemTextStyle + ? _headerTextStyles[header.key]?.fontSize ?? + DefaultTextStyle.of(context).style.fontSize ?? + 14 + : null, + color: header.key == _selectedAttribute ? options.defaultItemColor : null, ), From 520a4e4aacfc533ca58c5b488542f8218a18d378 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:29:57 +0100 Subject: [PATCH 07/17] Fix init of `headerTextStyles` --- .../buttons/dropdown_header_style.dart | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 25cac7492..1abb91ca3 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -37,7 +37,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Attribute.h6: context.loc.heading6, }; - late final Map _headerTextStyles; + Map? _headerTextStyles; QuillToolbarSelectHeaderStyleDropdownButtonOptions get options { return widget.options; @@ -99,20 +99,27 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } } + @override + void didChangeDependencies() { + super.didChangeDependencies(); + if (_headerTextStyles == null) { + final defaultStyles = QuillStyles.getStyles(context, false); + _headerTextStyles = { + Attribute.h1: defaultStyles!.h1!.style, + Attribute.h2: defaultStyles.h2!.style, + Attribute.h3: defaultStyles.h3!.style, + Attribute.h4: defaultStyles.h4!.style, + Attribute.h5: defaultStyles.h5!.style, + Attribute.h6: defaultStyles.h6!.style, + }; + } + } + @override void initState() { super.initState(); controller.addListener(_didChangeEditingValue); _selectedAttribute = _getHeaderValue(); - final defaultStyles = QuillStyles.getStyles(context, false); - _headerTextStyles = { - Attribute.h1: defaultStyles!.h1!.style, - Attribute.h2: defaultStyles.h2!.style, - Attribute.h3: defaultStyles.h3!.style, - Attribute.h4: defaultStyles.h4!.style, - Attribute.h5: defaultStyles.h5!.style, - Attribute.h6: defaultStyles.h6!.style, - }; } @override @@ -244,7 +251,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState header.value, style: TextStyle( fontSize: options.renderItemTextStyle - ? _headerTextStyles[header.key]?.fontSize ?? + ? _headerTextStyles![header.key]!.fontSize ?? DefaultTextStyle.of(context).style.fontSize ?? 14 : null, From 80861b46aae5b90f2d3a90cf7845e1738a489ace Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 10:39:23 +0100 Subject: [PATCH 08/17] Fix getting of `QuillStyles` --- .../buttons/dropdown_header_style.dart | 24 ++++++++----------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 1abb91ca3..cd7e5d6f0 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -100,8 +100,16 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } @override - void didChangeDependencies() { - super.didChangeDependencies(); + void initState() { + super.initState(); + controller.addListener(_didChangeEditingValue); + _selectedAttribute = _getHeaderValue(); + } + + @override + Widget build(BuildContext context) { + assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); + if (_headerTextStyles == null) { final defaultStyles = QuillStyles.getStyles(context, false); _headerTextStyles = { @@ -113,18 +121,6 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Attribute.h6: defaultStyles.h6!.style, }; } - } - - @override - void initState() { - super.initState(); - controller.addListener(_didChangeEditingValue); - _selectedAttribute = _getHeaderValue(); - } - - @override - Widget build(BuildContext context) { - assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); final baseButtonConfigurations = context.requireQuillToolbarBaseButtonOptions; From 49d46797aae9016cb180fd09b27035dc07f90d19 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:23:30 +0100 Subject: [PATCH 09/17] FIx `headerTextStyles` --- .../buttons/dropdown_header_style.dart | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index cd7e5d6f0..f6ef06cbf 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -100,20 +100,12 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState } @override - void initState() { - super.initState(); - controller.addListener(_didChangeEditingValue); - _selectedAttribute = _getHeaderValue(); - } - - @override - Widget build(BuildContext context) { - assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); - + void didChangeDependencies() { + super.didChangeDependencies(); if (_headerTextStyles == null) { - final defaultStyles = QuillStyles.getStyles(context, false); + final defaultStyles = DefaultStyles.getInstance(context); _headerTextStyles = { - Attribute.h1: defaultStyles!.h1!.style, + Attribute.h1: defaultStyles.h1!.style, Attribute.h2: defaultStyles.h2!.style, Attribute.h3: defaultStyles.h3!.style, Attribute.h4: defaultStyles.h4!.style, @@ -121,6 +113,18 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Attribute.h6: defaultStyles.h6!.style, }; } + } + + @override + void initState() { + super.initState(); + controller.addListener(_didChangeEditingValue); + _selectedAttribute = _getHeaderValue(); + } + + @override + Widget build(BuildContext context) { + assert(_attrbuites.every((element) => _valueToText.keys.contains(element))); final baseButtonConfigurations = context.requireQuillToolbarBaseButtonOptions; From 53ae93d55ea0e57d3dbbd6432bb7f752f9747401 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:35:49 +0100 Subject: [PATCH 10/17] Fix `DefaultStyles` --- lib/src/widgets/default_styles.dart | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/src/widgets/default_styles.dart b/lib/src/widgets/default_styles.dart index e358a9519..ed224b78b 100644 --- a/lib/src/widgets/default_styles.dart +++ b/lib/src/widgets/default_styles.dart @@ -269,7 +269,7 @@ class DefaultStyles { fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), - const VerticalSpacing(8, 0), + const VerticalSpacing(6, 0), const VerticalSpacing(0, 0), null, ), @@ -282,7 +282,7 @@ class DefaultStyles { fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), - const VerticalSpacing(8, 0), + const VerticalSpacing(6, 0), const VerticalSpacing(0, 0), null, ), @@ -295,7 +295,7 @@ class DefaultStyles { fontWeight: FontWeight.bold, decoration: TextDecoration.none, ), - const VerticalSpacing(8, 0), + const VerticalSpacing(4, 0), const VerticalSpacing(0, 0), null, ), @@ -410,6 +410,9 @@ class DefaultStyles { h1: other.h1 ?? h1, h2: other.h2 ?? h2, h3: other.h3 ?? h3, + h4: other.h4 ?? h4, + h5: other.h5 ?? h5, + h6: other.h6 ?? h6, paragraph: other.paragraph ?? paragraph, bold: other.bold ?? bold, subscript: other.subscript ?? subscript, From 177afea889ae47da8f797e32dc690557d7b84091 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:46:53 +0100 Subject: [PATCH 11/17] Minor comment change --- lib/src/models/config/toolbar/buttons/select_header_style.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/models/config/toolbar/buttons/select_header_style.dart b/lib/src/models/config/toolbar/buttons/select_header_style.dart index 6e70c9eb6..fb2acc1f3 100644 --- a/lib/src/models/config/toolbar/buttons/select_header_style.dart +++ b/lib/src/models/config/toolbar/buttons/select_header_style.dart @@ -29,12 +29,14 @@ class QuillToolbarSelectHeaderStyleButtonsOptions }); /// Default value: + /// ```dart /// const [ /// Attribute.header, /// Attribute.h1, /// Attribute.h2, /// Attribute.h3, /// ] + /// ``` final List? attributes; /// By default we will the toolbar axis from [QuillToolbarConfigurations] From fd2a941e8c73432e8f64df06902f771bc3857457 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:47:03 +0100 Subject: [PATCH 12/17] Fix headers --- lib/src/widgets/default_styles.dart | 28 +++++++++++++++++-- .../widgets/raw_editor/raw_editor_state.dart | 15 ++++++++++ lib/src/widgets/text_line.dart | 3 ++ 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/lib/src/widgets/default_styles.dart b/lib/src/widgets/default_styles.dart index ed224b78b..0c7f7c9e6 100644 --- a/lib/src/widgets/default_styles.dart +++ b/lib/src/widgets/default_styles.dart @@ -67,6 +67,9 @@ class InlineCodeStyle { this.header1, this.header2, this.header3, + this.header4, + this.header5, + this.header6, this.backgroundColor, this.radius, }); @@ -83,6 +86,15 @@ class InlineCodeStyle { /// Style override for inline code in headings level 3. final TextStyle? header3; + /// Style override for inline code in headings level 4. + final TextStyle? header4; + + /// Style override for inline code in headings level 5. + final TextStyle? header5; + + /// Style override for inline code in headings level 6. + final TextStyle? header6; + /// Background color for inline code. final Color? backgroundColor; @@ -101,6 +113,15 @@ class InlineCodeStyle { if (lineStyle.containsKey(Attribute.h3.key)) { return header3 ?? style; } + if (lineStyle.containsKey(Attribute.h4.key)) { + return header4 ?? style; + } + if (lineStyle.containsKey(Attribute.h5.key)) { + return header5 ?? style; + } + if (lineStyle.containsKey(Attribute.h6.key)) { + return header6 ?? style; + } return style; } @@ -116,13 +137,16 @@ class InlineCodeStyle { other.header1 == header1 && other.header2 == header2 && other.header3 == header3 && + other.header4 == header4 && + other.header5 == header5 && + other.header6 == header6 && other.backgroundColor == backgroundColor && other.radius == radius; } @override - int get hashCode => - Object.hash(style, header1, header2, header3, backgroundColor, radius); + int get hashCode => Object.hash(style, header1, header2, header3, header4, + header5, header6, backgroundColor, radius); } @immutable diff --git a/lib/src/widgets/raw_editor/raw_editor_state.dart b/lib/src/widgets/raw_editor/raw_editor_state.dart index 9d7322059..4a9cf67cb 100644 --- a/lib/src/widgets/raw_editor/raw_editor_state.dart +++ b/lib/src/widgets/raw_editor/raw_editor_state.dart @@ -448,6 +448,21 @@ class QuillRawEditorState extends EditorState control: !isDesktopMacOS, meta: isDesktopMacOS, ): const QuillEditorApplyHeaderIntent(Attribute.h3), + SingleActivator( + LogicalKeyboardKey.digit4, + control: !isDesktopMacOS, + meta: isDesktopMacOS, + ): const QuillEditorApplyHeaderIntent(Attribute.h4), + SingleActivator( + LogicalKeyboardKey.digit5, + control: !isDesktopMacOS, + meta: isDesktopMacOS, + ): const QuillEditorApplyHeaderIntent(Attribute.h5), + SingleActivator( + LogicalKeyboardKey.digit6, + control: !isDesktopMacOS, + meta: isDesktopMacOS, + ): const QuillEditorApplyHeaderIntent(Attribute.h6), SingleActivator( LogicalKeyboardKey.digit0, control: !isDesktopMacOS, diff --git a/lib/src/widgets/text_line.dart b/lib/src/widgets/text_line.dart index c79e8da33..24a0f03d1 100644 --- a/lib/src/widgets/text_line.dart +++ b/lib/src/widgets/text_line.dart @@ -271,6 +271,9 @@ class _TextLineState extends State { Attribute.h1: defaultStyles.h1!.style, Attribute.h2: defaultStyles.h2!.style, Attribute.h3: defaultStyles.h3!.style, + Attribute.h4: defaultStyles.h4!.style, + Attribute.h5: defaultStyles.h5!.style, + Attribute.h6: defaultStyles.h6!.style, }; textStyle = textStyle.merge(m[header] ?? defaultStyles.paragraph!.style); From a2cc5d2c7b61d25b3a97f8254dcd403b85058d3b Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 11:52:08 +0100 Subject: [PATCH 13/17] Remove `initialValue` --- .../models/config/toolbar/buttons/dropdown_header_style.dart | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart index 5936c4f82..7bdb201f7 100644 --- a/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/models/config/toolbar/buttons/dropdown_header_style.dart @@ -37,7 +37,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions this.padding, this.style, this.width, - this.initialValue, this.labelOverflow = TextOverflow.visible, this.itemHeight, this.itemPadding, @@ -55,7 +54,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions final EdgeInsetsGeometry? padding; final TextStyle? style; final double? width; - final String? initialValue; final TextOverflow labelOverflow; final double? itemHeight; final EdgeInsets? itemPadding; @@ -72,7 +70,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions EdgeInsetsGeometry? padding, TextStyle? style, double? width, - String? initialValue, TextOverflow? labelOverflow, bool? renderFontFamilies, bool? overrideTooltipByFontFamily, @@ -99,7 +96,6 @@ class QuillToolbarSelectHeaderStyleDropdownButtonOptions padding: padding ?? this.padding, style: style ?? this.style, width: width ?? this.width, - initialValue: initialValue ?? this.initialValue, labelOverflow: labelOverflow ?? this.labelOverflow, itemHeight: itemHeight ?? this.itemHeight, itemPadding: itemPadding ?? this.itemPadding, From 9966d17851e5540f1b7a606ce18cb1b1dd803aa5 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:16:37 +0100 Subject: [PATCH 14/17] Add asseert for header style --- lib/src/widgets/toolbar/buttons/dropdown_header_style.dart | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index f6ef06cbf..36600716d 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -251,7 +251,7 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState header.value, style: TextStyle( fontSize: options.renderItemTextStyle - ? _headerTextStyles![header.key]!.fontSize ?? + ? _headerStyle(header.key).fontSize ?? DefaultTextStyle.of(context).style.fontSize ?? 14 : null, @@ -275,4 +275,9 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState controller.formatSelection(attribute0); afterButtonPressed?.call(); } + + TextStyle _headerStyle(Attribute attribute) { + assert(_headerTextStyles!.containsKey(attribute)); + return _headerTextStyles![attribute]!; + } } From e748ad7f3d1d1ac3a50f2f68fb2300c153367867 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:24:48 +0100 Subject: [PATCH 15/17] Fix _headerTextStyles --- lib/src/widgets/toolbar/buttons/dropdown_header_style.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 36600716d..1ce78a88a 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -105,6 +105,8 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState if (_headerTextStyles == null) { final defaultStyles = DefaultStyles.getInstance(context); _headerTextStyles = { + Attribute.header: + widget.options.style ?? defaultStyles.paragraph!.style, Attribute.h1: defaultStyles.h1!.style, Attribute.h2: defaultStyles.h2!.style, Attribute.h3: defaultStyles.h3!.style, From b4b917f531b0808fb9b64cdd1eda6e3e6e61cb59 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:28:23 +0100 Subject: [PATCH 16/17] Change heading sorting in editor --- lib/src/widgets/toolbar/buttons/dropdown_header_style.dart | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart index 1ce78a88a..322cb1256 100644 --- a/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart +++ b/lib/src/widgets/toolbar/buttons/dropdown_header_style.dart @@ -28,13 +28,13 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState Style get _selectionStyle => controller.getSelectionStyle(); late final _valueToText = { - Attribute.header: context.loc.normal, Attribute.h1: context.loc.heading1, Attribute.h2: context.loc.heading2, Attribute.h3: context.loc.heading3, Attribute.h4: context.loc.heading4, Attribute.h5: context.loc.heading5, Attribute.h6: context.loc.heading6, + Attribute.header: context.loc.normal, }; Map? _headerTextStyles; @@ -105,14 +105,14 @@ class _QuillToolbarSelectHeaderStyleDropdownButtonState if (_headerTextStyles == null) { final defaultStyles = DefaultStyles.getInstance(context); _headerTextStyles = { - Attribute.header: - widget.options.style ?? defaultStyles.paragraph!.style, Attribute.h1: defaultStyles.h1!.style, Attribute.h2: defaultStyles.h2!.style, Attribute.h3: defaultStyles.h3!.style, Attribute.h4: defaultStyles.h4!.style, Attribute.h5: defaultStyles.h5!.style, Attribute.h6: defaultStyles.h6!.style, + Attribute.header: + widget.options.style ?? defaultStyles.paragraph!.style, }; } } From 70e954f545df2962891ab7e6198b627419b92432 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Thu, 7 Dec 2023 12:44:31 +0100 Subject: [PATCH 17/17] Update russian and ukrainian translations --- .../generated/quill_localizations_ru.dart | 33 ++++++++++++++---- .../generated/quill_localizations_uk.dart | 34 +++++++++++++++---- 2 files changed, 55 insertions(+), 12 deletions(-) diff --git a/lib/src/l10n/generated/quill_localizations_ru.dart b/lib/src/l10n/generated/quill_localizations_ru.dart index 96a9314b8..b300aaf0b 100644 --- a/lib/src/l10n/generated/quill_localizations_ru.dart +++ b/lib/src/l10n/generated/quill_localizations_ru.dart @@ -229,22 +229,43 @@ class FlutterQuillLocalizationsRu extends FlutterQuillLocalizations { String get insertImage => 'Вставить изображение'; @override - String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery'; + String get pickAPhotoFromYourGallery => 'Выберите фотографю из вашей галереи'; @override String get takeAPhotoUsingYourCamera => - 'Take a photo using your phone camera'; + 'Создайте фотографю, использую фотокамеру'; @override - String get pasteAPhotoUsingALink => 'Paste a photo using a link'; + String get pasteAPhotoUsingALink => 'Вставьте фотографию, используя ссылку'; @override - String get pickAVideoFromYourGallery => 'Pick a video from your gallery'; + String get pickAVideoFromYourGallery => 'Выберете видео из вашей галереи'; @override String get recordAVideoUsingYourCamera => - 'Record a video using your phone camera'; + 'Запишите видео, используя вдеокамеру'; @override - String get pasteAVideoUsingALink => 'Paste a video using a link'; + String get pasteAVideoUsingALink => 'Вставьте видео, используя ссылку'; + + @override + String get normal => 'Обычный'; + + @override + String get heading1 => 'Заголовок 1'; + + @override + String get heading2 => 'Заголовок 2'; + + @override + String get heading3 => 'Заголовок 3'; + + @override + String get heading4 => 'Заголовок 4'; + + @override + String get heading5 => 'Заголовок 5'; + + @override + String get heading6 => 'Заголовок 6'; } diff --git a/lib/src/l10n/generated/quill_localizations_uk.dart b/lib/src/l10n/generated/quill_localizations_uk.dart index f7a273a5a..d187de800 100644 --- a/lib/src/l10n/generated/quill_localizations_uk.dart +++ b/lib/src/l10n/generated/quill_localizations_uk.dart @@ -231,22 +231,44 @@ class FlutterQuillLocalizationsUk extends FlutterQuillLocalizations { String get insertImage => 'Вставити зображення'; @override - String get pickAPhotoFromYourGallery => 'Pick a photo from your gallery'; + String get pickAPhotoFromYourGallery => 'Оберіть фотографію з вашої галереї'; @override String get takeAPhotoUsingYourCamera => - 'Take a photo using your phone camera'; + 'Створіть фотографію, використовуючи фотокамеру'; @override - String get pasteAPhotoUsingALink => 'Paste a photo using a link'; + String get pasteAPhotoUsingALink => + 'Вставте фотографію, використовуючи посилання'; @override - String get pickAVideoFromYourGallery => 'Pick a video from your gallery'; + String get pickAVideoFromYourGallery => 'Оберіть відео з вашої галереї'; @override String get recordAVideoUsingYourCamera => - 'Record a video using your phone camera'; + 'Запишіть відео, використовуючи відеокамеру'; @override - String get pasteAVideoUsingALink => 'Paste a video using a link'; + String get pasteAVideoUsingALink => 'Вставте відео, використовуючи посилання'; + + @override + String get normal => 'Звичайний'; + + @override + String get heading1 => 'Заголовок 1'; + + @override + String get heading2 => 'Заголовок 2'; + + @override + String get heading3 => 'Заголовок 3'; + + @override + String get heading4 => 'Заголовок 4'; + + @override + String get heading5 => 'Заголовок 5'; + + @override + String get heading6 => 'Заголовок 6'; }