From b56f8e8cbda58865367519206c37d3fa089e42d6 Mon Sep 17 00:00:00 2001 From: Aleksei <130981115+MacDeveloper1@users.noreply.github.com> Date: Mon, 8 May 2023 16:34:49 +0200 Subject: [PATCH] Rename `_AxisDivider` to `QuillDivider` and make it public --- lib/src/widgets/toolbar.dart | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index c8a534c6..f1cb3d96 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -409,7 +409,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), if (showAlignmentButtons) SelectAlignmentButton( @@ -445,7 +445,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), if (showHeaderStyle) SelectHeaderStyleButton( @@ -462,7 +462,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { (isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), if (showListNumbers) ToggleStyleButton( @@ -507,7 +507,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { if (showDividers && isButtonGroupShown[3] && (isButtonGroupShown[4] || isButtonGroupShown[5])) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), if (showQuote) ToggleStyleButton( @@ -540,7 +540,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { afterButtonPressed: afterButtonPressed, ), if (showDividers && isButtonGroupShown[4] && isButtonGroupShown[5]) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), if (showLink) LinkStyleButton( @@ -563,7 +563,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ), if (customButtons.isNotEmpty) if (showDividers) - _AxisDivider(axis, + QuillDivider(axis, color: sectionDividerColor, space: sectionDividerSpace), for (var customButton in customButtons) QuillIconButton( @@ -643,16 +643,33 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { } } -class _AxisDivider extends StatelessWidget { - const _AxisDivider( +/// The divider which is used for separation of buttons in the toolbar. +/// +/// It can be used outside of this package, for example when user does not use +/// [QuillToolbar.basic] and compose toolbat's children on its own. +class QuillDivider extends StatelessWidget { + const QuillDivider( this.axis, { Key? key, this.color, this.space, }) : super(key: key); + /// Provides a horizonal divider for vertical toolbar. + const QuillDivider.horizontal({Color? color, double? space}) + : this(Axis.horizontal, color: color, space: space); + + /// Provides a horizonal divider for horizontal toolbar. + const QuillDivider.vertical({Color? color, double? space}) + : this(Axis.vertical, color: color, space: space); + + /// The axis along which the toolbar is. final Axis axis; + + /// The color to use when painting this divider's line. final Color? color; + + /// The divider's space (width or height) depending of [axis]. final double? space; @override