added custom button widget in toolbar (#1272)

pull/1276/head
Pramod chaurasia 2 years ago committed by GitHub
parent 01b6191908
commit 46ddf13078
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      lib/src/models/themes/quill_custom_button.dart
  2. 25
      lib/src/widgets/toolbar.dart

@ -6,6 +6,7 @@ class QuillCustomButton {
this.iconColor,
this.onTap,
this.tooltip,
this.child,
});
///The icon widget
@ -17,6 +18,9 @@ class QuillCustomButton {
///The function when the icon is tapped
final VoidCallback? onTap;
///The customButton placeholder
final Widget? child;
/// The button tooltip.
final String? tooltip;
}

@ -567,15 +567,22 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
QuillDivider(axis,
color: sectionDividerColor, space: sectionDividerSpace),
for (var customButton in customButtons)
CustomButton(
onPressed: customButton.onTap,
icon: customButton.icon,
iconColor: customButton.iconColor,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
afterButtonPressed: afterButtonPressed,
tooltip: customButton.tooltip,
),
if (customButton.child != null) ...[
InkWell(
onTap: customButton.onTap,
child: customButton.child,
),
] else ...[
CustomButton(
onPressed: customButton.onTap,
icon: customButton.icon,
iconColor: customButton.iconColor,
iconSize: toolbarIconSize,
iconTheme: iconTheme,
afterButtonPressed: afterButtonPressed,
tooltip: customButton.tooltip,
),
],
],
);
}

Loading…
Cancel
Save