Support Multi Row Toolbar

pull/273/head
florianh01 4 years ago
parent 40d853e631
commit 6c98d43a6b
  1. 23
      lib/src/widgets/toolbar.dart

@ -49,6 +49,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
this.toolBarHeight = 36, this.toolBarHeight = 36,
this.color, this.color,
this.filePickImpl, this.filePickImpl,
this.multiRowsDisplay,
Key? key, Key? key,
}) : super(key: key); }) : super(key: key);
@ -72,6 +73,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
bool showLink = true, bool showLink = true,
bool showHistory = true, bool showHistory = true,
bool showHorizontalRule = false, bool showHorizontalRule = false,
bool multiRowsDisplay = false,
OnImagePickCallback? onImagePickCallback, OnImagePickCallback? onImagePickCallback,
FilePickImpl? filePickImpl, FilePickImpl? filePickImpl,
WebImagePickImpl? webImagePickImpl, WebImagePickImpl? webImagePickImpl,
@ -96,6 +98,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
return QuillToolbar( return QuillToolbar(
key: key, key: key,
toolBarHeight: toolbarIconSize * 2, toolBarHeight: toolbarIconSize * 2,
multiRowsDisplay: multiRowsDisplay,
children: [ children: [
if (showHistory) if (showHistory)
HistoryButton( HistoryButton(
@ -282,6 +285,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
final List<Widget> children; final List<Widget> children;
final double toolBarHeight; final double toolBarHeight;
final bool? multiRowsDisplay;
/// The color of the toolbar. /// The color of the toolbar.
/// ///
@ -296,10 +300,19 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Container( if (multiRowsDisplay ?? false) {
constraints: BoxConstraints.tightFor(height: preferredSize.height), return Wrap(
color: color ?? Theme.of(context).canvasColor, alignment: WrapAlignment.center,
child: ArrowIndicatedButtonList(buttons: children), 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),
);
}
} }
} }

Loading…
Cancel
Save