From 6c98d43a6ba9551c9a0a4bd00a5dffc8269edbfc Mon Sep 17 00:00:00 2001 From: florianh01 Date: Thu, 24 Jun 2021 21:05:12 +0200 Subject: [PATCH] Support Multi Row Toolbar --- lib/src/widgets/toolbar.dart | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index d5db8774..d22cc6a5 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -49,6 +49,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { this.toolBarHeight = 36, this.color, this.filePickImpl, + this.multiRowsDisplay, Key? key, }) : super(key: key); @@ -72,6 +73,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { bool showLink = true, bool showHistory = true, bool showHorizontalRule = false, + bool multiRowsDisplay = false, OnImagePickCallback? onImagePickCallback, FilePickImpl? filePickImpl, WebImagePickImpl? webImagePickImpl, @@ -96,6 +98,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { return QuillToolbar( key: key, toolBarHeight: toolbarIconSize * 2, + multiRowsDisplay: multiRowsDisplay, children: [ if (showHistory) HistoryButton( @@ -282,6 +285,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { final List children; final double toolBarHeight; + final bool? multiRowsDisplay; /// The color of the toolbar. /// @@ -296,10 +300,19 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { @override Widget build(BuildContext context) { - return Container( - constraints: BoxConstraints.tightFor(height: preferredSize.height), - color: color ?? Theme.of(context).canvasColor, - child: ArrowIndicatedButtonList(buttons: children), - ); + if (multiRowsDisplay ?? false) { + return Wrap( + alignment: WrapAlignment.center, + runSpacing: 4, + spacing: 4, + children: children, + ); + } else { + return Container( + constraints: BoxConstraints.tightFor(height: preferredSize.height), + color: color ?? Theme.of(context).canvasColor, + child: ArrowIndicatedButtonList(buttons: children), + ); + } } }