Update select_alignment_button.dart

pull/459/head
mark8044 4 years ago committed by GitHub
parent 7974815690
commit 1b23492841
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 12
      lib/src/widgets/toolbar/select_alignment_button.dart

@ -12,8 +12,9 @@ class SelectAlignmentButton extends StatefulWidget {
required this.controller, required this.controller,
this.iconSize = kDefaultIconSize, this.iconSize = kDefaultIconSize,
this.iconTheme, this.iconTheme,
this.showJustifyAlignment, this.showCenterAlignment,
this.showRightAlignment, this.showRightAlignment,
this.showJustifyAlignment,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -21,8 +22,9 @@ class SelectAlignmentButton extends StatefulWidget {
final double iconSize; final double iconSize;
final QuillIconTheme? iconTheme; final QuillIconTheme? iconTheme;
final bool? showJustifyAlignment; final bool? showCenterAlignment;
final bool? showRightAlignment; final bool? showRightAlignment;
final bool? showJustifyAlignment;
@override @override
_SelectAlignmentButtonState createState() => _SelectAlignmentButtonState(); _SelectAlignmentButtonState createState() => _SelectAlignmentButtonState();
@ -54,20 +56,20 @@ class _SelectAlignmentButtonState extends State<SelectAlignmentButton> {
final _valueAttribute = <Attribute>[ final _valueAttribute = <Attribute>[
Attribute.leftAlignment, Attribute.leftAlignment,
Attribute.centerAlignment, if (widget.showCenterAlignment!) Attribute.centerAlignment,
if (widget.showRightAlignment!) Attribute.rightAlignment, if (widget.showRightAlignment!) Attribute.rightAlignment,
if (widget.showJustifyAlignment!) Attribute.justifyAlignment if (widget.showJustifyAlignment!) Attribute.justifyAlignment
]; ];
final _valueString = <String>[ final _valueString = <String>[
Attribute.leftAlignment.value!, Attribute.leftAlignment.value!,
Attribute.centerAlignment.value!, if (widget.showCenterAlignment!) Attribute.centerAlignment.value!,
if (widget.showRightAlignment!) Attribute.rightAlignment.value!, if (widget.showRightAlignment!) Attribute.rightAlignment.value!,
if (widget.showJustifyAlignment!) Attribute.justifyAlignment.value!, if (widget.showJustifyAlignment!) Attribute.justifyAlignment.value!,
]; ];
final theme = Theme.of(context); 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( return Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,

Loading…
Cancel
Save