From 79aa997ce113bbbccdff49827fcb0a7abf53dd3f Mon Sep 17 00:00:00 2001 From: mark8044 <87546778+mark8044@users.noreply.github.com> Date: Sun, 14 Nov 2021 09:41:35 -0800 Subject: [PATCH] Update select_alignment_button.dart --- lib/src/widgets/toolbar/select_alignment_button.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/src/widgets/toolbar/select_alignment_button.dart b/lib/src/widgets/toolbar/select_alignment_button.dart index 5ae67ae7..df3abb8b 100644 --- a/lib/src/widgets/toolbar/select_alignment_button.dart +++ b/lib/src/widgets/toolbar/select_alignment_button.dart @@ -12,6 +12,7 @@ class SelectAlignmentButton extends StatefulWidget { required this.controller, this.iconSize = kDefaultIconSize, this.iconTheme, + this.showLeftAlignment, this.showCenterAlignment, this.showRightAlignment, this.showJustifyAlignment, @@ -22,6 +23,7 @@ class SelectAlignmentButton extends StatefulWidget { final double iconSize; final QuillIconTheme? iconTheme; + final bool? showLeftAlignment; final bool? showCenterAlignment; final bool? showRightAlignment; final bool? showJustifyAlignment; @@ -48,20 +50,20 @@ class _SelectAlignmentButtonState extends State { @override Widget build(BuildContext context) { final _valueToText = { - Attribute.leftAlignment: Attribute.leftAlignment.value!, - Attribute.centerAlignment: Attribute.centerAlignment.value!, + if (widget.showLeftAlignment!) Attribute.leftAlignment: Attribute.leftAlignment.value!, + if (widget.showCenterAlignment!) Attribute.centerAlignment: Attribute.centerAlignment.value!, if (widget.showRightAlignment!) Attribute.rightAlignment: Attribute.rightAlignment.value!, if (widget.showJustifyAlignment!) Attribute.justifyAlignment: Attribute.justifyAlignment.value!, }; final _valueAttribute = [ - Attribute.leftAlignment, + if (widget.showLeftAlignment!) Attribute.leftAlignment, if (widget.showCenterAlignment!) Attribute.centerAlignment, if (widget.showRightAlignment!) Attribute.rightAlignment, if (widget.showJustifyAlignment!) Attribute.justifyAlignment ]; final _valueString = [ - Attribute.leftAlignment.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!, @@ -69,7 +71,7 @@ class _SelectAlignmentButtonState extends State { final theme = Theme.of(context); - final buttonCount = 1 + ((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); return Row( mainAxisSize: MainAxisSize.min,