Add empty InsertImageButton

pull/13/head
singerdmx 4 years ago
parent 7f798e8e50
commit 2ffc01ec29
  1. 40
      lib/widgets/toolbar.dart

@ -369,6 +369,37 @@ Widget _selectHeadingStyleButtonBuilder(
); );
} }
class InsertImageButton extends StatefulWidget {
final IconData icon;
final QuillController controller;
InsertImageButton({Key key, @required this.icon, @required this.controller})
: assert(icon != null),
assert(controller != null),
super(key: key);
@override
_InsertImageButtonState createState() => _InsertImageButtonState();
}
class _InsertImageButtonState extends State<InsertImageButton> {
@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: ,
);
}
}
/// Controls color styles. /// Controls color styles.
/// ///
/// When pressed, this button displays overlay toolbar with /// When pressed, this button displays overlay toolbar with
@ -438,6 +469,7 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
bool showStrikeThrough = true, bool showStrikeThrough = true,
bool showColorButton = true, bool showColorButton = true,
bool showBackgroundColorButton = true, bool showBackgroundColorButton = true,
bool showInsertImageButton = true,
bool showHeaderStyle = true, bool showHeaderStyle = true,
bool showListNumbers = true, bool showListNumbers = true,
bool showListBullets = true, bool showListBullets = true,
@ -498,6 +530,14 @@ class QuillToolbar extends StatefulWidget implements PreferredSizeWidget {
controller: controller, controller: controller,
), ),
), ),
SizedBox(width: 1),
Visibility(
visible: showInsertImageButton,
child: InsertImageButton(
icon: Icons.image,
controller: controller,
),
),
Visibility( Visibility(
visible: showHeaderStyle, visible: showHeaderStyle,
child: VerticalDivider( child: VerticalDivider(

Loading…
Cancel
Save