|
|
@ -4,46 +4,34 @@ import '../../../../models/documents/attribute.dart'; |
|
|
|
import '../../../quill/quill_controller.dart'; |
|
|
|
import '../../../quill/quill_controller.dart'; |
|
|
|
import '../../base_toolbar.dart'; |
|
|
|
import '../../base_toolbar.dart'; |
|
|
|
|
|
|
|
|
|
|
|
enum _AlignmentOptions { |
|
|
|
|
|
|
|
left(attribute: Attribute.leftAlignment), |
|
|
|
|
|
|
|
center(attribute: Attribute.centerAlignment), |
|
|
|
|
|
|
|
right(attribute: Attribute.rightAlignment), |
|
|
|
|
|
|
|
justifyMinWidth(attribute: Attribute.justifyAlignment); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const _AlignmentOptions({required this.attribute}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
final Attribute attribute; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class QuillToolbarSelectAlignmentButtons extends StatelessWidget { |
|
|
|
class QuillToolbarSelectAlignmentButtons extends StatelessWidget { |
|
|
|
const QuillToolbarSelectAlignmentButtons({ |
|
|
|
const QuillToolbarSelectAlignmentButtons({ |
|
|
|
required this.controller, |
|
|
|
required this.controller, |
|
|
|
this.options = const QuillToolbarSelectAlignmentButtonOptions(), |
|
|
|
this.options = const QuillToolbarSelectAlignmentButtonOptions(), |
|
|
|
this.showLeftAlignment, |
|
|
|
|
|
|
|
this.showCenterAlignment, |
|
|
|
|
|
|
|
this.showRightAlignment, |
|
|
|
|
|
|
|
this.showJustifyAlignment, |
|
|
|
|
|
|
|
this.padding, |
|
|
|
|
|
|
|
super.key, |
|
|
|
super.key, |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
final QuillController controller; |
|
|
|
final QuillController controller; |
|
|
|
final QuillToolbarSelectAlignmentButtonOptions options; |
|
|
|
final QuillToolbarSelectAlignmentButtonOptions options; |
|
|
|
|
|
|
|
|
|
|
|
final bool? showLeftAlignment; |
|
|
|
List<Attribute> get _attrbuites { |
|
|
|
final bool? showCenterAlignment; |
|
|
|
return options.attributes ?? |
|
|
|
final bool? showRightAlignment; |
|
|
|
[ |
|
|
|
final bool? showJustifyAlignment; |
|
|
|
if (options.showLeftAlignment) Attribute.leftAlignment, |
|
|
|
final EdgeInsetsGeometry? padding; |
|
|
|
if (options.showCenterAlignment) Attribute.centerAlignment, |
|
|
|
|
|
|
|
if (options.showRightAlignment) Attribute.rightAlignment, |
|
|
|
|
|
|
|
if (options.showJustifyAlignment) Attribute.justifyAlignment, |
|
|
|
|
|
|
|
]; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return Row( |
|
|
|
return Row( |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
mainAxisSize: MainAxisSize.min, |
|
|
|
children: _AlignmentOptions.values |
|
|
|
children: _attrbuites |
|
|
|
.map((e) => QuillToolbarToggleStyleButton( |
|
|
|
.map((e) => QuillToolbarToggleStyleButton( |
|
|
|
controller: controller, |
|
|
|
controller: controller, |
|
|
|
attribute: e.attribute, |
|
|
|
attribute: e, |
|
|
|
options: QuillToolbarToggleStyleButtonOptions( |
|
|
|
options: QuillToolbarToggleStyleButtonOptions( |
|
|
|
iconData: options.iconData, |
|
|
|
iconData: options.iconData, |
|
|
|
iconSize: options.iconSize, |
|
|
|
iconSize: options.iconSize, |
|
|
|