diff --git a/lib/src/widgets/toolbar/buttons/alignment/select_alignment_button_original.dart b/lib/src/widgets/toolbar/buttons/alignment/select_alignment_button_original.dart index 6789feba..9edd0f4a 100644 --- a/lib/src/widgets/toolbar/buttons/alignment/select_alignment_button_original.dart +++ b/lib/src/widgets/toolbar/buttons/alignment/select_alignment_button_original.dart @@ -13,11 +13,11 @@ import '../../../quill/quill_controller.dart'; class QuillToolbarSelectAlignmentButton extends StatefulWidget { const QuillToolbarSelectAlignmentButton({ required this.controller, - required this.options, - this.showLeftAlignment, - this.showCenterAlignment, - this.showRightAlignment, - this.showJustifyAlignment, + this.options = const QuillToolbarSelectAlignmentButtonOptions(), + this.showLeftAlignment = true, + this.showCenterAlignment = true, + this.showRightAlignment = true, + this.showJustifyAlignment = true, this.padding, super.key, }); @@ -25,10 +25,10 @@ class QuillToolbarSelectAlignmentButton extends StatefulWidget { final QuillController controller; final QuillToolbarSelectAlignmentButtonOptions options; - final bool? showLeftAlignment; - final bool? showCenterAlignment; - final bool? showRightAlignment; - final bool? showJustifyAlignment; + final bool showLeftAlignment; + final bool showCenterAlignment; + final bool showRightAlignment; + final bool showJustifyAlignment; final EdgeInsetsGeometry? padding; @override @@ -156,27 +156,27 @@ class QuillToolbarSelectAlignmentButtonState @override Widget build(BuildContext context) { final valueToText = { - if (widget.showLeftAlignment!) + if (widget.showLeftAlignment) Attribute.leftAlignment: Attribute.leftAlignment.value!, - if (widget.showCenterAlignment!) + if (widget.showCenterAlignment) Attribute.centerAlignment: Attribute.centerAlignment.value!, - if (widget.showRightAlignment!) + if (widget.showRightAlignment) Attribute.rightAlignment: Attribute.rightAlignment.value!, - if (widget.showJustifyAlignment!) + if (widget.showJustifyAlignment) Attribute.justifyAlignment: Attribute.justifyAlignment.value!, }; final valueAttribute = [ - if (widget.showLeftAlignment!) Attribute.leftAlignment, - if (widget.showCenterAlignment!) Attribute.centerAlignment, - if (widget.showRightAlignment!) Attribute.rightAlignment, - if (widget.showJustifyAlignment!) Attribute.justifyAlignment + if (widget.showLeftAlignment) Attribute.leftAlignment, + if (widget.showCenterAlignment) Attribute.centerAlignment, + if (widget.showRightAlignment) Attribute.rightAlignment, + if (widget.showJustifyAlignment) Attribute.justifyAlignment ]; final valueString = [ - if (widget.showLeftAlignment!) Attribute.leftAlignment.value!, - if (widget.showCenterAlignment!) Attribute.centerAlignment.value!, - if (widget.showRightAlignment!) Attribute.rightAlignment.value!, - if (widget.showJustifyAlignment!) Attribute.justifyAlignment.value!, + if (widget.showLeftAlignment) Attribute.leftAlignment.value!, + if (widget.showCenterAlignment) Attribute.centerAlignment.value!, + if (widget.showRightAlignment) Attribute.rightAlignment.value!, + if (widget.showJustifyAlignment) Attribute.justifyAlignment.value!, ]; // final _valueToButtons = { // if (widget.showLeftAlignment!) @@ -189,10 +189,10 @@ class QuillToolbarSelectAlignmentButtonState // Attribute.justifyAlignment: ToolbarButtons.justifyAlignment, // }; - final buttonCount = ((widget.showLeftAlignment!) ? 1 : 0) + - ((widget.showCenterAlignment!) ? 1 : 0) + - ((widget.showRightAlignment!) ? 1 : 0) + - ((widget.showJustifyAlignment!) ? 1 : 0); + final buttonCount = ((widget.showLeftAlignment) ? 1 : 0) + + ((widget.showCenterAlignment) ? 1 : 0) + + ((widget.showRightAlignment) ? 1 : 0) + + ((widget.showJustifyAlignment) ? 1 : 0); final childBuilder = options.childBuilder ?? baseButtonExtraOptions.childBuilder; diff --git a/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart b/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart index 9a7c7290..ef62e6b4 100644 --- a/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart +++ b/lib/src/widgets/toolbar/buttons/hearder_style/select_header_style_dropdown_button.dart @@ -14,7 +14,7 @@ import '../../../quill/quill_controller.dart'; class QuillToolbarSelectHeaderStyleDropdownButton extends StatefulWidget { const QuillToolbarSelectHeaderStyleDropdownButton({ required this.controller, - required this.options, + this.options = const QuillToolbarSelectHeaderStyleDropdownButtonOptions(), super.key, });