|
|
|
@ -4,6 +4,7 @@ import 'package:flutter/material.dart'; |
|
|
|
|
import '../../models/documents/attribute.dart'; |
|
|
|
|
import '../../models/documents/style.dart'; |
|
|
|
|
import '../../models/themes/quill_icon_theme.dart'; |
|
|
|
|
import '../../utils/widgets.dart'; |
|
|
|
|
import '../controller.dart'; |
|
|
|
|
import '../toolbar.dart'; |
|
|
|
|
|
|
|
|
@ -17,6 +18,7 @@ class SelectAlignmentButton extends StatefulWidget { |
|
|
|
|
this.showRightAlignment, |
|
|
|
|
this.showJustifyAlignment, |
|
|
|
|
this.afterButtonPressed, |
|
|
|
|
this.tooltip, |
|
|
|
|
Key? key, |
|
|
|
|
}) : super(key: key); |
|
|
|
|
|
|
|
|
@ -29,6 +31,7 @@ class SelectAlignmentButton extends StatefulWidget { |
|
|
|
|
final bool? showRightAlignment; |
|
|
|
|
final bool? showJustifyAlignment; |
|
|
|
|
final VoidCallback? afterButtonPressed; |
|
|
|
|
final String? tooltip; |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
_SelectAlignmentButtonState createState() => _SelectAlignmentButtonState(); |
|
|
|
@ -93,6 +96,8 @@ class _SelectAlignmentButtonState extends State<SelectAlignmentButton> { |
|
|
|
|
width: widget.iconSize * kIconButtonFactor, |
|
|
|
|
height: widget.iconSize * kIconButtonFactor, |
|
|
|
|
), |
|
|
|
|
child: UtilityWidgets.maybeTooltip( |
|
|
|
|
message: widget.tooltip, |
|
|
|
|
child: RawMaterialButton( |
|
|
|
|
hoverElevation: 0, |
|
|
|
|
highlightElevation: 0, |
|
|
|
@ -108,9 +113,10 @@ class _SelectAlignmentButtonState extends State<SelectAlignmentButton> { |
|
|
|
|
theme.canvasColor), |
|
|
|
|
onPressed: () { |
|
|
|
|
_valueAttribute[index] == Attribute.leftAlignment |
|
|
|
|
? widget.controller |
|
|
|
|
.formatSelection(Attribute.clone(Attribute.align, null)) |
|
|
|
|
: widget.controller.formatSelection(_valueAttribute[index]); |
|
|
|
|
? widget.controller.formatSelection( |
|
|
|
|
Attribute.clone(Attribute.align, null)) |
|
|
|
|
: widget.controller |
|
|
|
|
.formatSelection(_valueAttribute[index]); |
|
|
|
|
widget.afterButtonPressed?.call(); |
|
|
|
|
}, |
|
|
|
|
child: Icon( |
|
|
|
@ -118,7 +124,8 @@ class _SelectAlignmentButtonState extends State<SelectAlignmentButton> { |
|
|
|
|
? Icons.format_align_left |
|
|
|
|
: _valueString[index] == Attribute.centerAlignment.value |
|
|
|
|
? Icons.format_align_center |
|
|
|
|
: _valueString[index] == Attribute.rightAlignment.value |
|
|
|
|
: _valueString[index] == |
|
|
|
|
Attribute.rightAlignment.value |
|
|
|
|
? Icons.format_align_right |
|
|
|
|
: Icons.format_align_justify, |
|
|
|
|
size: widget.iconSize, |
|
|
|
@ -130,6 +137,7 @@ class _SelectAlignmentButtonState extends State<SelectAlignmentButton> { |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
); |
|
|
|
|
}), |
|
|
|
|
); |
|
|
|
|