Update QuillCustomButton

pull/1518/head
Ellet 1 year ago committed by Ellet
parent e7e71f1cb2
commit 0632090f44
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 21
      lib/src/models/themes/quill_custom_button.dart
  2. 1
      lib/src/widgets/toolbar/buttons/custom_button.dart
  3. 17
      lib/src/widgets/toolbar/toolbar.dart

@ -2,6 +2,7 @@
// import '../../widgets/toolbar/base_toolbar.dart';
<<<<<<< HEAD
// class QuillCustomButton extends QuillToolbarBaseButtonOptions {
// const QuillCustomButton({
// this.icon,
@ -20,3 +21,23 @@
// /// The customButton placeholder
// final Widget? child;
// }
=======
class QuillCustomButton extends QuillToolbarBaseButtonOptions {
const QuillCustomButton({
this.icon,
this.onTap,
super.tooltip,
this.child,
super.iconTheme,
});
/// The icon widget
final Widget? icon;
/// The function when the icon is tapped
final VoidCallback? onTap;
/// The customButton placeholder
final Widget? child;
}
>>>>>>> ad642da (Update QuillCustomButton)

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import '../../../models/config/toolbar/buttons/custom_button.dart';
import '../../../models/themes/quill_icon_theme.dart';
import '../../../utils/extensions/build_context.dart';
import '../../controller.dart';

@ -411,6 +411,7 @@ class QuillToolbar extends StatelessWidget {
space: configurations.sectionDividerSpace,
),
for (final customButton in configurations.customButtons)
<<<<<<< HEAD
QuillToolbarCustomButton(
options: customButton,
controller: customButton.controller ?? globalController,
@ -429,6 +430,22 @@ class QuillToolbar extends StatelessWidget {
// globalController,
// ),
// ],
=======
if (customButton.child != null) ...[
InkWell(
onTap: customButton.onTap,
child: customButton.child,
),
] else ...[
QuillToolbarCustomButton(
options:
toolbarConfigurations.buttonOptions.customButtons,
controller: toolbarConfigurations
.buttonOptions.customButtons.controller ??
globalController,
),
],
>>>>>>> ad642da (Update QuillCustomButton)
spacerWidget,
],
];

Loading…
Cancel
Save