added custom button widget in toolbar

pull/1272/head
Pramod 2 years ago
parent 1f42da82fb
commit 463ecaba6e
  1. 5
      lib/src/models/themes/quill_custom_button.dart
  2. 10
      lib/src/widgets/toolbar.dart

@ -1,11 +1,14 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
class QuillCustomButton { class QuillCustomButton {
const QuillCustomButton({this.icon, this.onTap}); const QuillCustomButton({this.icon, this.onTap, this.child});
///The icon widget ///The icon widget
final IconData? icon; final IconData? icon;
///The function when the icon is tapped ///The function when the icon is tapped
final VoidCallback? onTap; final VoidCallback? onTap;
///The customButton placeholder
final Widget? child;
} }

@ -485,7 +485,13 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
endIndent: 12, endIndent: 12,
color: Colors.grey.shade400, color: Colors.grey.shade400,
), ),
for (var customButton in customButtons) for (var customButton in customButtons) ...[
if (customButton.child != null) ...[
InkWell(
onTap: customButton.onTap,
child: customButton.child,
),
] else ...[
QuillIconButton( QuillIconButton(
highlightElevation: 0, highlightElevation: 0,
hoverElevation: 0, hoverElevation: 0,
@ -496,6 +502,8 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
afterPressed: afterButtonPressed, afterPressed: afterButtonPressed,
), ),
], ],
],
],
); );
} }

Loading…
Cancel
Save