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,
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<SelectAlignmentButton> {
final _valueAttribute = <Attribute>[
Attribute.leftAlignment,
Attribute.centerAlignment,
if (widget.showCenterAlignment!) Attribute.centerAlignment,
if (widget.showRightAlignment!) Attribute.rightAlignment,
if (widget.showJustifyAlignment!) Attribute.justifyAlignment
];
final _valueString = <String>[
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,

Loading…
Cancel
Save