diff --git a/README.md b/README.md index 7e7d77c8..97bf0312 100644 --- a/README.md +++ b/README.md @@ -112,12 +112,12 @@ fontSizeValues: const {'Small': '8', 'Medium': '24.5', 'Large': '46', 'Clear': ' ### Font Family To use your own fonts, update your [assets folder](https://github.com/singerdmx/flutter-quill/tree/master/example/assets/fonts) and pass in `fontFamilyValues`. More details at [this change](https://github.com/singerdmx/flutter-quill/commit/71d06f6b7be1b7b6dba2ea48e09fed0d7ff8bbaa), [this article](https://stackoverflow.com/questions/55075834/fontfamily-property-not-working-properly-in-flutter) and [this](https://www.flutterbeads.com/change-font-family-flutter/). -### Custom Icons -You may add custom icons to the _end_ of the toolbar, via the `customIcons` option, which is a `List` of `QuillCustomIcon`. +### Custom Buttons +You may add custom buttons to the _end_ of the toolbar, via the `customButtons` option, which is a `List` of `QuillCustomButton`. -To add an Icon, we should use a new QuillCustomIcon class +To add an Icon, we should use a new QuillCustomButton class ``` - QuillCustomIcon( + QuillCustomButton( icon:Icons.ac_unit, onTap: () { debugPrint('snowflake'); @@ -125,26 +125,26 @@ To add an Icon, we should use a new QuillCustomIcon class ), ``` -Each `QuillCustomIcon` is used as part of the `customIcons` option as follows: +Each `QuillCustomButton` is used as part of the `customButtons` option as follows: ``` QuillToolbar.basic( (...), - customIcons: [ - QuillCustomIcon( + customButtons: [ + QuillCustomButton( icon:Icons.ac_unit, onTap: () { debugPrint('snowflake1'); } ), - QuillCustomIcon( + QuillCustomButton( icon:Icons.ac_unit, onTap: () { debugPrint('snowflake2'); } ), - QuillCustomIcon( + QuillCustomButton( icon:Icons.ac_unit, onTap: () { debugPrint('snowflake3'); diff --git a/lib/flutter_quill.dart b/lib/flutter_quill.dart index 4ff26faa..228778be 100644 --- a/lib/flutter_quill.dart +++ b/lib/flutter_quill.dart @@ -6,7 +6,7 @@ export 'src/models/documents/nodes/embeddable.dart'; export 'src/models/documents/nodes/leaf.dart'; export 'src/models/documents/style.dart'; export 'src/models/quill_delta.dart'; -export 'src/models/themes/quill_custom_icon.dart'; +export 'src/models/themes/quill_custom_button.dart'; export 'src/models/themes/quill_dialog_theme.dart'; export 'src/models/themes/quill_icon_theme.dart'; export 'src/utils/embeds.dart'; diff --git a/lib/src/models/themes/quill_custom_icon.dart b/lib/src/models/themes/quill_custom_button.dart similarity index 67% rename from lib/src/models/themes/quill_custom_icon.dart rename to lib/src/models/themes/quill_custom_button.dart index 9ad75901..0dbac618 100644 --- a/lib/src/models/themes/quill_custom_icon.dart +++ b/lib/src/models/themes/quill_custom_button.dart @@ -1,7 +1,7 @@ import 'package:flutter/material.dart'; -class QuillCustomIcon { - const QuillCustomIcon({this.icon, this.onTap}); +class QuillCustomButton { + const QuillCustomButton({this.icon, this.onTap}); ///The icon widget final IconData? icon; diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 549511b5..8db79096 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; import 'package:i18n_extension/i18n_widget.dart'; import '../models/documents/attribute.dart'; -import '../models/themes/quill_custom_icon.dart'; +import '../models/themes/quill_custom_button.dart'; import '../models/themes/quill_dialog_theme.dart'; import '../models/themes/quill_icon_theme.dart'; import '../translations/toolbar.i18n.dart'; @@ -68,7 +68,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { this.multiRowsDisplay = true, this.color, this.filePickImpl, - this.customIcons = const [], + this.customButtons = const [], this.locale, Key? key, }) : super(key: key); @@ -116,7 +116,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { FilePickImpl? filePickImpl, WebImagePickImpl? webImagePickImpl, WebVideoPickImpl? webVideoPickImpl, - List customIcons = const [], + List customButtons = const [], ///Map of font sizes in string Map? fontSizeValues, @@ -185,7 +185,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { toolbarSectionSpacing: toolbarSectionSpacing, toolbarIconAlignment: toolbarIconAlignment, multiRowsDisplay: multiRowsDisplay, - customIcons: customIcons, + customButtons: customButtons, locale: locale, children: [ if (showUndo) @@ -492,21 +492,21 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { iconTheme: iconTheme, dialogTheme: dialogTheme, ), - if (customIcons.isNotEmpty) + if (customButtons.isNotEmpty) if (showDividers) VerticalDivider( indent: 12, endIndent: 12, color: Colors.grey.shade400, ), - for (var customIcon in customIcons) + for (var customButton in customButtons) QuillIconButton( highlightElevation: 0, hoverElevation: 0, size: toolbarIconSize * kIconButtonFactor, - icon: Icon(customIcon.icon, size: toolbarIconSize), + icon: Icon(customButton.icon, size: toolbarIconSize), borderRadius: iconTheme?.borderRadius ?? 2, - onPressed: customIcon.onTap), + onPressed: customButton.onTap), ], ); } @@ -529,8 +529,8 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { /// More https://github.com/singerdmx/flutter-quill#translation final Locale? locale; - /// List of custom icons - final List customIcons; + /// List of custom buttons + final List customButtons; @override Size get preferredSize => Size.fromHeight(toolbarHeight);