diff --git a/lib/src/widgets/toolbar/select_alignment_button.dart b/lib/src/widgets/toolbar/select_alignment_button.dart index 7d25d0a4..5ae67ae7 100644 --- a/lib/src/widgets/toolbar/select_alignment_button.dart +++ b/lib/src/widgets/toolbar/select_alignment_button.dart @@ -12,8 +12,9 @@ class SelectAlignmentButton extends StatefulWidget { required this.controller, this.iconSize = kDefaultIconSize, this.iconTheme, - this.showJustifyAlignment, + this.showCenterAlignment, this.showRightAlignment, + this.showJustifyAlignment, Key? key, }) : super(key: key); @@ -21,8 +22,9 @@ class SelectAlignmentButton extends StatefulWidget { final double iconSize; final QuillIconTheme? iconTheme; - final bool? showJustifyAlignment; + final bool? showCenterAlignment; final bool? showRightAlignment; + final bool? showJustifyAlignment; @override _SelectAlignmentButtonState createState() => _SelectAlignmentButtonState(); @@ -54,20 +56,20 @@ class _SelectAlignmentButtonState extends State { final _valueAttribute = [ Attribute.leftAlignment, - Attribute.centerAlignment, + if (widget.showCenterAlignment!) Attribute.centerAlignment, if (widget.showRightAlignment!) Attribute.rightAlignment, if (widget.showJustifyAlignment!) Attribute.justifyAlignment ]; final _valueString = [ Attribute.leftAlignment.value!, - Attribute.centerAlignment.value!, + if (widget.showCenterAlignment!) Attribute.centerAlignment.value!, if (widget.showRightAlignment!) Attribute.rightAlignment.value!, if (widget.showJustifyAlignment!) Attribute.justifyAlignment.value!, ]; final theme = Theme.of(context); - final buttonCount = 2 + ((widget.showRightAlignment!) ? 1 : 0) + ((widget.showJustifyAlignment!) ? 1 : 0); + final buttonCount = 1 + ((widget.showCenterAlignment!) ? 1 : 0) + ((widget.showRightAlignment!) ? 1 : 0) + ((widget.showJustifyAlignment!) ? 1 : 0); return Row( mainAxisSize: MainAxisSize.min,