diff --git a/lib/widgets/toolbar.dart b/lib/widgets/toolbar.dart index 8abc2c37..e0154263 100644 --- a/lib/widgets/toolbar.dart +++ b/lib/widgets/toolbar.dart @@ -554,6 +554,69 @@ class _BackgroundColorButtonState extends State { } } +class IndentButton extends StatefulWidget { + final IconData icon; + + final QuillController controller; + + IndentButton({Key key, @required this.icon, @required this.controller}) + : assert(icon != null), + assert(controller != null), + super(key: key); + + @override + _IndentButtonState createState() => _IndentButtonState(); +} + +class _IndentButtonState extends State { + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final iconColor = theme.iconTheme.color; + final fillColor = theme.canvasColor; + return QuillIconButton( + highlightElevation: 0, + hoverElevation: 0, + size: 32, + icon: Icon(widget.icon, size: 18, color: iconColor), + fillColor: fillColor, +// onPressed: , + ); + } +} + +class ClearFormatButton extends StatefulWidget { + final IconData icon; + + final QuillController controller; + + ClearFormatButton({Key key, @required this.icon, @required this.controller}) + : assert(icon != null), + assert(controller != null), + super(key: key); + + @override + _ClearFormatButtonState createState() => _ClearFormatButtonState(); +} + +class _ClearFormatButtonState extends State { + @override + Widget build(BuildContext context) { + final theme = Theme.of(context); + final iconColor = theme.iconTheme.color; + final fillColor = theme.canvasColor; + return QuillIconButton( + highlightElevation: 0, + hoverElevation: 0, + size: 32, + icon: Icon(widget.icon, size: 18, color: iconColor), + fillColor: fillColor, +// onPressed: , + ); + } +} + + class QuillToolbar extends StatefulWidget implements PreferredSizeWidget { final List children; @@ -568,11 +631,13 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget { bool showStrikeThrough = true, bool showColorButton = true, bool showBackgroundColorButton = true, + bool showClearFormat = true, bool showHeaderStyle = true, bool showListNumbers = true, bool showListBullets = true, bool showCodeBlock = true, bool showQuote = true, + bool showIndent = true, bool showLink = true, bool showHorizontalRule = false, UploadFileCallback uploadFileCallback}) { @@ -629,6 +694,14 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget { ), ), SizedBox(width: 1), + Visibility( + visible: showClearFormat, + child: ClearFormatButton( + icon: Icons.format_clear, + controller: controller, + ), + ), + SizedBox(width: 1), Visibility( visible: uploadFileCallback != null, child: ImageButton( @@ -692,6 +765,13 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget { icon: Icons.format_quote, ), ), + Visibility( + visible: showIndent, + child: IndentButton( + icon: Icons.format_indent_increase, + controller: controller, + ), + ), Visibility( visible: showQuote, child: VerticalDivider(