From 6ac59dcfbb81961e42773bf6edff58c2f7847ae5 Mon Sep 17 00:00:00 2001 From: X Code Date: Thu, 5 May 2022 20:37:51 -0700 Subject: [PATCH] Upgrade to 4.1.5 --- CHANGELOG.md | 3 ++ lib/src/widgets/toolbar.dart | 50 ++++++++----------- .../toolbar/quill_dropdown_button.dart | 7 ++- pubspec.yaml | 2 +- 4 files changed, 27 insertions(+), 35 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ede30782..e836d508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [4.1.5] +* Add Font Size dropdown to the toolbar. + # [4.1.4] * New borderRadius for iconTheme. diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 972bdc1c..c3277865 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -113,7 +113,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ///List of font sizes in [int] List? fontSizeValues, int? initialFontSizeValue, - + ///The theme to use for the icons in the toolbar, uses type [QuillIconTheme] QuillIconTheme? iconTheme, @@ -127,8 +127,8 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { Key? key, }) { final isButtonGroupShown = [ - showFontSize || - showBoldButton || + showFontSize || + showBoldButton || showItalicButton || showSmallButton || showUnderLineButton || @@ -151,19 +151,9 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ]; //default font size values - final fontSizes = fontSizeValues ?? [ - 10, - 12, - 14, - 16, - 18, - 20, - 24, - 28, - 32, - 48 - ]; - + final fontSizes = + fontSizeValues ?? [10, 12, 14, 16, 18, 20, 24, 28, 32, 48]; + return QuillToolbar( key: key, toolbarHeight: toolbarIconSize * 2, @@ -189,24 +179,24 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { iconTheme: iconTheme, ), if (showFontSize) - QuillDropdownButton( - iconTheme: iconTheme, - height:toolbarIconSize*2, - items:[ - for (var fontSize in fontSizes) + QuillDropdownButton( + iconTheme: iconTheme, + height: toolbarIconSize * 2, + items: [ + for (var fontSize in fontSizes) PopupMenuItem( value: fontSize, child: Text(fontSize.toString()), ), - ], - onSelected:(newSize){ - if (newSize != null) - { - controller.formatSelection(Attribute.fromKeyValue('size', newSize)); - } - }, - initialValue: fontSizes[initialFontSizeValue ?? 0], - ), + ], + onSelected: (newSize) { + if (newSize != null) { + controller + .formatSelection(Attribute.fromKeyValue('size', newSize)); + } + }, + initialValue: fontSizes[initialFontSizeValue ?? 0], + ), if (showBoldButton) ToggleStyleButton( attribute: Attribute.bold, diff --git a/lib/src/widgets/toolbar/quill_dropdown_button.dart b/lib/src/widgets/toolbar/quill_dropdown_button.dart index de6a5165..01d297db 100644 --- a/lib/src/widgets/toolbar/quill_dropdown_button.dart +++ b/lib/src/widgets/toolbar/quill_dropdown_button.dart @@ -29,14 +29,13 @@ class QuillDropdownButton extends StatefulWidget { // ignore: deprecated_member_use_from_same_package class _QuillDropdownButtonState extends State> { - int _currentValue = 0; @override - void initState(){ - _currentValue = widget.initialValue as int; + void initState() { + _currentValue = widget.initialValue as int; } - + @override Widget build(BuildContext context) { return ConstrainedBox( diff --git a/pubspec.yaml b/pubspec.yaml index 7e35d6f6..d370589f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: flutter_quill description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) -version: 4.1.4 +version: 4.1.5 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill