Little adjusments && Update CHANGELOG.md

pull/1467/head
Ahmed Hnewa 2 years ago
parent cb6ef72b85
commit 16aa851c04
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 2
      CHANGELOG.md
  2. 1
      lib/src/widgets/editor/editor.dart
  3. 8
      lib/src/widgets/toolbar/buttons/clear_format.dart
  4. 4
      lib/src/widgets/toolbar/buttons/color.dart
  5. 4
      lib/src/widgets/toolbar/buttons/custom_button.dart
  6. 1
      lib/src/widgets/toolbar/buttons/font_size.dart
  7. 8
      lib/src/widgets/toolbar/buttons/history.dart
  8. 30
      lib/src/widgets/toolbar/buttons/indent.dart
  9. 11
      lib/src/widgets/toolbar/buttons/link_style.dart
  10. 12
      lib/src/widgets/toolbar/buttons/search/search.dart
  11. 4
      lib/src/widgets/toolbar/buttons/select_alignment.dart
  12. 2
      lib/src/widgets/toolbar/buttons/select_header_style.dart
  13. 24
      lib/src/widgets/toolbar/buttons/toggle_style.dart
  14. 1
      lib/src/widgets/toolbar/toolbar.dart

@ -1,5 +1,7 @@
## [7.10.1]
- Fixes and use the new parameters
- You don't need to use MaterialApp to use most of the toolbar buttons childBuilder anymore
- Compatibility with [fresh_quill_extensions](https://pub.dev/packages/fresh_quill_extensions) which is temporary alternative to [flutter_quill_extensions](https://pub.dev/packages/flutter_quill_extensions)
## [7.10.0]
- **Breaking change**: `QuillToolbar.basic()` can be accessed from `QuillToolbar()` directly and the old `QuillToolbar` can be accessed from `QuillBaseToolbar`

@ -15,7 +15,6 @@ import 'package:i18n_extension/i18n_widget.dart';
import '../../../flutter_quill.dart';
import '../../models/documents/nodes/container.dart' as container_node;
import '../../utils/extensions/build_context.dart';
import '../../utils/platform.dart';
import '../box.dart';
import '../cursor.dart';

@ -66,10 +66,7 @@ class QuillToolbarClearFormatButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final iconTheme = _iconTheme(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final fillColor = iconTheme?.iconUnselectedFillColor ?? theme.canvasColor;
final tooltip = _tooltip(context);
final iconSize = _iconSize(context);
final iconData = _iconData(context);
@ -99,6 +96,11 @@ class QuillToolbarClearFormatButton extends StatelessWidget {
);
}
final theme = Theme.of(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final fillColor = iconTheme?.iconUnselectedFillColor ?? theme.canvasColor;
return QuillToolbarIconButton(
tooltip: tooltip,
highlightElevation: 0,

@ -157,6 +157,8 @@ class _QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions.childBuilder;
if (childBuilder != null) {
// if the caller using Cupertino app he might need to wrap the builder
// with Material() widget
return childBuilder(
options,
QuillToolbarColorButtonExtraOptions(
@ -166,7 +168,7 @@ class _QuillToolbarColorButtonState extends State<QuillToolbarColorButton> {
_showColorPicker();
afterButtonPressed?.call();
},
iconColor: iconColor,
iconColor: null,
iconColorBackground: iconColorBackground,
fillColor: fillColor,
fillColorBackground: fillColorBackground,

@ -12,8 +12,8 @@ class CustomButton extends StatelessWidget {
this.iconTheme,
this.afterButtonPressed,
this.tooltip,
Key? key,
}) : super(key: key);
super.key,
});
final VoidCallback? onPressed;
final IconData? icon;

@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import '../../../../extensions.dart';
import '../../../../flutter_quill.dart';
import '../../../translations/toolbar.i18n.dart';
import '../../../utils/extensions/build_context.dart';
import '../../../utils/font.dart';
class QuillToolbarFontSizeButton extends StatefulWidget {

@ -49,8 +49,6 @@ class _QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
@override
Widget build(BuildContext context) {
theme = Theme.of(context);
final baseButtonConfigurations =
context.requireQuillToolbarBaseButtonOptions;
final tooltip = options.tooltip ??
@ -65,8 +63,6 @@ class _QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
context.requireQuillToolbarBaseButtonOptions.globalIconSize;
final iconTheme = options.iconTheme ?? baseButtonConfigurations.iconTheme;
final fillColor = iconTheme?.iconUnselectedFillColor ?? theme.canvasColor;
final afterButtonPressed = options.afterButtonPressed ??
baseButtonConfigurations.afterButtonPressed;
@ -92,6 +88,10 @@ class _QuillToolbarHistoryButtonState extends State<QuillToolbarHistoryButton> {
),
);
}
theme = Theme.of(context);
final fillColor = iconTheme?.iconUnselectedFillColor ?? theme.canvasColor;
return QuillToolbarIconButton(
tooltip: tooltip,
highlightElevation: 0,

@ -70,8 +70,34 @@ class _QuillToolbarIndentButtonState extends State<QuillToolbarIndentButton> {
(widget.isIncrease ? 'Increase indent'.i18n : 'Decrease indent'.i18n);
}
void _sharedOnPressed() {
widget.controller.indentSelection(widget.isIncrease);
}
@override
Widget build(BuildContext context) {
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions.childBuilder;
if (childBuilder != null) {
return childBuilder(
QuillToolbarIndentButtonOptions(
afterButtonPressed: afterButtonPressed,
iconData: iconData,
iconSize: iconSize,
iconTheme: iconTheme,
tooltip: tooltip,
),
QuillToolbarIndentButtonExtraOptions(
controller: controller,
context: context,
onPressed: () {
_sharedOnPressed();
afterButtonPressed?.call();
},
),
);
}
final theme = Theme.of(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
@ -85,9 +111,7 @@ class _QuillToolbarIndentButtonState extends State<QuillToolbarIndentButton> {
icon: Icon(iconData, size: iconSize, color: iconColor),
fillColor: iconFillColor,
borderRadius: iconTheme?.borderRadius ?? 2,
onPressed: () {
widget.controller.indentSelection(widget.isIncrease);
},
onPressed: _sharedOnPressed,
afterPressed: afterButtonPressed,
);
}

@ -19,15 +19,6 @@ class QuillToolbarLinkStyleButton extends StatefulWidget {
});
final QuillController controller;
// final IconData? icon;
// final double iconSize;
// final QuillIconTheme? iconTheme;
// final QuillDialogTheme? dialogTheme;
// final VoidCallback? afterButtonPressed;
// final String? tooltip;
// final RegExp? linkRegExp;
// final LinkDialogAction? linkDialogAction;
// final Color dialogBarrierColor;
final QuillToolbarLinkStyleButtonOptions options;
@override
@ -110,7 +101,6 @@ class _QuillToolbarLinkStyleButtonState
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final isToggled = _getLinkAttributeValue() != null;
final pressedHandler = () => _openLinkDialog(context);
@ -140,6 +130,7 @@ class _QuillToolbarLinkStyleButtonState
),
);
}
final theme = Theme.of(context);
return QuillToolbarIconButton(
tooltip: tooltip,
highlightElevation: 0,

@ -64,18 +64,12 @@ class QuillToolbarSearchButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final iconTheme = _iconTheme(context);
final tooltip = _tooltip(context);
final iconData = _iconData(context);
final iconSize = _iconSize(context);
final afterButtonPressed = _afterButtonPressed(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final iconFillColor = iconTheme?.iconUnselectedFillColor ??
(options.fillColor ?? theme.canvasColor);
final childBuilder =
options.childBuilder ?? baseButtonExtraOptions(context).childBuilder;
@ -103,6 +97,12 @@ class QuillToolbarSearchButton extends StatelessWidget {
);
}
final theme = Theme.of(context);
final iconColor = iconTheme?.iconUnselectedColor ?? theme.iconTheme.color;
final iconFillColor = iconTheme?.iconUnselectedFillColor ??
(options.fillColor ?? theme.canvasColor);
return QuillToolbarIconButton(
tooltip: tooltip,
icon: Icon(

@ -183,8 +183,6 @@ class _QuillToolbarSelectAlignmentButtonState
// Attribute.justifyAlignment: ToolbarButtons.justifyAlignment,
// };
final theme = Theme.of(context);
final buttonCount = ((widget.showLeftAlignment!) ? 1 : 0) +
((widget.showCenterAlignment!) ? 1 : 0) +
((widget.showRightAlignment!) ? 1 : 0) +
@ -200,6 +198,8 @@ class _QuillToolbarSelectAlignmentButtonState
);
}
final theme = Theme.of(context);
return Row(
mainAxisSize: MainAxisSize.min,
children: List.generate(buttonCount, (index) {

@ -99,7 +99,6 @@ class _QuillToolbarSelectHeaderStyleButtonsState
'All attributes must be one of them: header, h1, h2 or h3',
);
final theme = Theme.of(context);
final style = TextStyle(
fontWeight: FontWeight.w600,
fontSize: iconSize * 0.7,
@ -114,6 +113,7 @@ class _QuillToolbarSelectHeaderStyleButtonsState
' is not supported. Yet but we will work on that soon.',
);
}
final theme = Theme.of(context);
final children = options.attributes.map((attribute) {
final isSelected = _selectedAttribute == attribute;

@ -26,37 +26,13 @@ class QuillToolbarToggleStyleButton extends StatefulWidget {
required this.options,
required this.controller,
required this.attribute,
// required this.icon,
// required this.controller,
// this.iconSize = kDefaultIconSize,
// this.fillColor,
// this.childBuilder = defaultToggleStyleButtonBuilder,
// this.iconTheme,
// this.afterButtonPressed,
// this.tooltip,
super.key,
});
final Attribute attribute;
// final IconData icon;
// final double iconSize;
// final Color? fillColor;
// final QuillController controller;
// final ToggleStyleButtonBuilder childBuilder;
// ///Specify an icon theme for the icons in the toolbar
// final QuillIconTheme? iconTheme;
// final VoidCallback? afterButtonPressed;
// final String? tooltip;
final QuillToolbarToggleStyleButtonOptions options;
/// 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;
@override

@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import '../../../flutter_quill.dart';
import '../../utils/extensions/build_context.dart';
class QuillToolbar extends StatelessWidget {
const QuillToolbar({

Loading…
Cancel
Save