From af8146ad45f1f085513136b44a3d0b303ebddab5 Mon Sep 17 00:00:00 2001 From: X Code Date: Sat, 7 May 2022 11:35:11 -0700 Subject: [PATCH] Upgrade to 4.1.8 --- CHANGELOG.md | 3 ++ lib/src/widgets/toolbar.dart | 7 ++-- .../toolbar/quill_dropdown_button.dart | 36 ++++++++++++------- pubspec.yaml | 2 +- 4 files changed, 30 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bb946fd..16fae8ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [4.1.8] +* Update font size dropdown. + # [4.1.7] * Convert FontSize to a Map to allow for named Font Size. diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index b5267125..708f0079 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -153,7 +153,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { //default font size values final fontSizes = fontSizeValues ?? { - 'Default':0, + 'Default': 0, '10': 10, '12': 12, '14': 14, @@ -209,11 +209,10 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { controller .formatSelection(Attribute.fromKeyValue('size', newSize)); } - if (newSize as int == 0) - { + if (newSize as int == 0) { controller .formatSelection(Attribute.fromKeyValue('size', null)); - } + } }, rawitemsmap: fontSizes, initialValue: (initialFontSizeValue != null) && diff --git a/lib/src/widgets/toolbar/quill_dropdown_button.dart b/lib/src/widgets/toolbar/quill_dropdown_button.dart index 7cef095a..ecd582cf 100644 --- a/lib/src/widgets/toolbar/quill_dropdown_button.dart +++ b/lib/src/widgets/toolbar/quill_dropdown_button.dart @@ -54,7 +54,7 @@ class _QuillDropdownButtonState extends State> { widget.controller.removeListener(_didChangeEditingValue); super.dispose(); } - + @override void didUpdateWidget(covariant QuillDropdownButton oldWidget) { super.didUpdateWidget(oldWidget); @@ -64,28 +64,31 @@ class _QuillDropdownButtonState extends State> { //_isToggled = _getIsToggled(_selectionStyle.attributes); } } - + void _didChangeEditingValue() { setState(() => _currentValue = _getKeyName(_selectionStyle.attributes)); } - + String _getKeyName(Map attrs) { if (widget.attribute.key == Attribute.size.key) { final attribute = attrs[widget.attribute.key]; - + if (attribute == null) { - return widget.rawitemsmap.keys.elementAt(widget.initialValue as int).toString(); - } - else { + return widget.rawitemsmap.keys + .elementAt(widget.initialValue as int) + .toString(); + } else { return widget.rawitemsmap.entries .firstWhere((element) => element.value == attribute.value, - orElse: () => widget.rawitemsmap.entries.first) + orElse: () => widget.rawitemsmap.entries.first) .key; } } - return widget.rawitemsmap.keys.elementAt(widget.initialValue as int).toString(); + return widget.rawitemsmap.keys + .elementAt(widget.initialValue as int) + .toString(); } - + @override Widget build(BuildContext context) { return ConstrainedBox( @@ -148,13 +151,20 @@ class _QuillDropdownButtonState extends State> { Widget _buildContent(BuildContext context) { final theme = Theme.of(context); return Padding( - padding: const EdgeInsets.fromLTRB(10,0,0,0), + padding: const EdgeInsets.fromLTRB(10, 0, 0, 0), child: Row( mainAxisSize: MainAxisSize.min, children: [ - Text(_currentValue.toString(), style: TextStyle(fontSize: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color)), + Text(_currentValue.toString(), + style: TextStyle( + fontSize: widget.iconSize / 1.15, + color: widget.iconTheme?.iconUnselectedColor ?? + theme.iconTheme.color)), SizedBox(width: 3), - Icon(Icons.arrow_drop_down, size: widget.iconSize / 1.15, color: widget.iconTheme?.iconUnselectedColor ?? theme.iconTheme.color) + Icon(Icons.arrow_drop_down, + size: widget.iconSize / 1.15, + color: widget.iconTheme?.iconUnselectedColor ?? + theme.iconTheme.color) ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 9a5b1fb0..47300c0f 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.7 +version: 4.1.8 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill