From 19187e9c9aae1e8505e0dc1748b5f22c3ad10bd3 Mon Sep 17 00:00:00 2001 From: Adil Hanney Date: Wed, 15 Feb 2023 04:44:42 +0000 Subject: [PATCH] Use correct dividers for vertical toolbar --- lib/src/widgets/toolbar.dart | 52 +++++++++++++++--------------------- 1 file changed, 22 insertions(+), 30 deletions(-) diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 2bc5bb72..9594a048 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -337,11 +337,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), if (showAlignmentButtons) SelectAlignmentButton( controller: controller, @@ -368,11 +364,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), if (showHeaderStyle) SelectHeaderStyleButton( controller: controller, @@ -387,11 +379,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { (isButtonGroupShown[3] || isButtonGroupShown[4] || isButtonGroupShown[5])) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), if (showListNumbers) ToggleStyleButton( attribute: Attribute.ol, @@ -431,11 +419,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { if (showDividers && isButtonGroupShown[3] && (isButtonGroupShown[4] || isButtonGroupShown[5])) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), if (showQuote) ToggleStyleButton( attribute: Attribute.blockQuote, @@ -464,11 +448,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { afterButtonPressed: afterButtonPressed, ), if (showDividers && isButtonGroupShown[4] && isButtonGroupShown[5]) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), if (showLink) LinkStyleButton( controller: controller, @@ -488,11 +468,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ), if (customButtons.isNotEmpty) if (showDividers) - VerticalDivider( - indent: 12, - endIndent: 12, - color: Colors.grey.shade400, - ), + _dividerOnAxis(axis), for (var customButton in customButtons) QuillIconButton( highlightElevation: 0, @@ -507,6 +483,22 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ); } + static Widget _dividerOnAxis(Axis axis) { + if (axis == Axis.horizontal) { + return const VerticalDivider( + indent: 12, + endIndent: 12, + color: Colors.grey, + ); + } else { + return const Divider( + indent: 12, + endIndent: 12, + color: Colors.grey, + ); + } + } + final List children; final Axis axis; final double toolbarSize;