Update toolbar

pull/13/head
singerdmx 4 years ago
parent 9f171f1b88
commit a1bebb3e25
  1. 50
      lib/widgets/toolbar.dart

@ -379,20 +379,20 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
factory QuillToolbar.basic( factory QuillToolbar.basic(
{Key key, {Key key,
@required QuillController controller, @required QuillController controller,
bool hideBoldButton = false, bool showBoldButton = true,
bool hideItalicButton = false, bool showItalicButton = true,
bool hideUnderLineButton = false, bool showUnderLineButton = true,
bool hideStrikeThrough = false, bool showStrikeThrough = true,
bool hideHeadingStyle = false, bool showHeadingStyle = true,
bool hideListNumbers = false, bool showListNumbers = true,
bool hideListBullets = false, bool showListBullets = true,
bool hideCodeBlock = false, bool showCodeBlock = true,
bool hideQuote = false, bool showQuote = true,
bool hideLink = false, bool showLink = true,
bool hideHorizontalRule = false}) { bool showHorizontalRule = true}) {
return QuillToolbar(key: key, children: [ return QuillToolbar(key: key, children: [
Visibility( Visibility(
visible: hideBoldButton, visible: showBoldButton,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.bold, attribute: Attribute.bold,
icon: Icons.format_bold, icon: Icons.format_bold,
@ -401,7 +401,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
SizedBox(width: 1), SizedBox(width: 1),
Visibility( Visibility(
visible: hideItalicButton, visible: showItalicButton,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.italic, attribute: Attribute.italic,
icon: Icons.format_italic, icon: Icons.format_italic,
@ -410,7 +410,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
SizedBox(width: 1), SizedBox(width: 1),
Visibility( Visibility(
visible: hideUnderLineButton, visible: showUnderLineButton,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.underline, attribute: Attribute.underline,
icon: Icons.format_underline, icon: Icons.format_underline,
@ -419,7 +419,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
SizedBox(width: 1), SizedBox(width: 1),
Visibility( Visibility(
visible: hideStrikeThrough, visible: showStrikeThrough,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.strikeThrough, attribute: Attribute.strikeThrough,
icon: Icons.format_strikethrough, icon: Icons.format_strikethrough,
@ -427,15 +427,15 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
), ),
Visibility( Visibility(
visible: hideHeadingStyle, visible: showHeadingStyle,
child: VerticalDivider( child: VerticalDivider(
indent: 16, endIndent: 16, color: Colors.grey.shade400)), indent: 16, endIndent: 16, color: Colors.grey.shade400)),
Visibility( Visibility(
visible: hideHeadingStyle, visible: showHeadingStyle,
child: SelectHeadingStyleButton(controller: controller)), child: SelectHeadingStyleButton(controller: controller)),
VerticalDivider(indent: 16, endIndent: 16, color: Colors.grey.shade400), VerticalDivider(indent: 16, endIndent: 16, color: Colors.grey.shade400),
Visibility( Visibility(
visible: hideListNumbers, visible: showListNumbers,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.ol, attribute: Attribute.ol,
controller: controller, controller: controller,
@ -443,7 +443,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
), ),
Visibility( Visibility(
visible: hideListBullets, visible: showListBullets,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.ul, attribute: Attribute.ul,
controller: controller, controller: controller,
@ -451,7 +451,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
), ),
Visibility( Visibility(
visible: hideCodeBlock, visible: showCodeBlock,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.codeBlock, attribute: Attribute.codeBlock,
controller: controller, controller: controller,
@ -459,11 +459,11 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
), ),
Visibility( Visibility(
visible: !hideListNumbers && !hideListBullets && !hideCodeBlock, visible: !showListNumbers && !showListBullets && !showCodeBlock,
child: VerticalDivider( child: VerticalDivider(
indent: 16, endIndent: 16, color: Colors.grey.shade400)), indent: 16, endIndent: 16, color: Colors.grey.shade400)),
Visibility( Visibility(
visible: hideQuote, visible: showQuote,
child: ToggleStyleButton( child: ToggleStyleButton(
attribute: Attribute.blockQuote, attribute: Attribute.blockQuote,
controller: controller, controller: controller,
@ -471,13 +471,13 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
), ),
), ),
Visibility( Visibility(
visible: hideQuote, visible: showQuote,
child: VerticalDivider( child: VerticalDivider(
indent: 16, endIndent: 16, color: Colors.grey.shade400)), indent: 16, endIndent: 16, color: Colors.grey.shade400)),
Visibility( Visibility(
visible: hideLink, child: LinkStyleButton(controller: controller)), visible: showLink, child: LinkStyleButton(controller: controller)),
Visibility( Visibility(
visible: hideHorizontalRule, visible: showHorizontalRule,
child: InsertEmbedButton( child: InsertEmbedButton(
controller: controller, controller: controller,
icon: Icons.horizontal_rule, icon: Icons.horizontal_rule,

Loading…
Cancel
Save