diff --git a/CHANGELOG.md b/CHANGELOG.md index 9aea94dd..4bb946fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# [4.1.7] +* Convert FontSize to a Map to allow for named Font Size. + # [4.1.6] * Update quill_dropdown_button.dart. diff --git a/lib/src/translations/toolbar.i18n.dart b/lib/src/translations/toolbar.i18n.dart index 36fb7905..3506903d 100644 --- a/lib/src/translations/toolbar.i18n.dart +++ b/lib/src/translations/toolbar.i18n.dart @@ -395,7 +395,7 @@ extension Localization on String { 'Gallery': 'गैलरी', 'Link': 'लिंक', 'Please first select some text to transform into a link.': - 'लिंक में बदलने के लिए कृपया पहले कुछ शब्द चुनें।', + 'लिंक में बदलने के लिए कृपया पहले कुछ शब्द चुनें।', 'Open': 'खोलें', 'Copy': 'कॉपी करें', 'Remove': 'हटाएं', diff --git a/lib/src/widgets/toolbar.dart b/lib/src/widgets/toolbar.dart index 9b9c587c..a53bae78 100644 --- a/lib/src/widgets/toolbar.dart +++ b/lib/src/widgets/toolbar.dart @@ -151,8 +151,19 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { ]; //default font size values - final fontSizes = - fontSizeValues ?? {'10':10, '12':12, '14':14, '16':16, '18':18, '20':20, '24':24, '28':28, '32':32, '48':48}; + final fontSizes = fontSizeValues ?? + { + '10': 10, + '12': 12, + '14': 14, + '16': 16, + '18': 18, + '20': 20, + '24': 24, + '28': 28, + '32': 32, + '48': 48 + }; return QuillToolbar( key: key, @@ -181,9 +192,9 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { if (showFontSize) QuillDropdownButton( iconTheme: iconTheme, - height: (toolbarIconSize * 2)-(toolbarIconSize / 3), + height: (toolbarIconSize * 2) - (toolbarIconSize / 3), items: [ - for(MapEntry fontSize in fontSizes.entries) + for (MapEntry fontSize in fontSizes.entries) PopupMenuItem( key: ValueKey(fontSize.key), value: fontSize.value, @@ -197,7 +208,10 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget { } }, rawitemsmap: fontSizes, - initialValue: (initialFontSizeValue != null) && (initialFontSizeValue <= fontSizes.length - 1) ? initialFontSizeValue : 0, + initialValue: (initialFontSizeValue != null) && + (initialFontSizeValue <= fontSizes.length - 1) + ? initialFontSizeValue + : 0, ), if (showBoldButton) ToggleStyleButton( diff --git a/lib/src/widgets/toolbar/quill_dropdown_button.dart b/lib/src/widgets/toolbar/quill_dropdown_button.dart index 55900415..cf2c652e 100644 --- a/lib/src/widgets/toolbar/quill_dropdown_button.dart +++ b/lib/src/widgets/toolbar/quill_dropdown_button.dart @@ -21,7 +21,7 @@ class QuillDropdownButton extends StatefulWidget { final double highlightElevation; final T initialValue; final List> items; - final Map rawitemsmap; + final Map rawitemsmap; final ValueChanged onSelected; final QuillIconTheme? iconTheme; @@ -36,7 +36,8 @@ class _QuillDropdownButtonState extends State> { @override void initState() { super.initState(); - _currentValue = widget.rawitemsmap.keys.elementAt(widget.initialValue as int); + _currentValue = + widget.rawitemsmap.keys.elementAt(widget.initialValue as int); } @override @@ -89,7 +90,10 @@ class _QuillDropdownButtonState extends State> { return null; } setState(() { - _currentValue = widget.rawitemsmap.entries.firstWhere((element) => element.value==newValue, orElse: () => widget.rawitemsmap.entries.first).key; + _currentValue = widget.rawitemsmap.entries + .firstWhere((element) => element.value == newValue, + orElse: () => widget.rawitemsmap.entries.first) + .key; widget.onSelected(newValue); }); }); @@ -97,15 +101,15 @@ class _QuillDropdownButtonState extends State> { Widget _buildContent(BuildContext context) { return Padding( - padding: const EdgeInsets.symmetric(horizontal: 10), - child: Row( - mainAxisSize: MainAxisSize.min, - children: [ - Text(_currentValue.toString()), - SizedBox(width:6), - const Icon(Icons.arrow_drop_down, size: 17) - ], - ), - ); + padding: const EdgeInsets.symmetric(horizontal: 10), + child: Row( + mainAxisSize: MainAxisSize.min, + children: [ + Text(_currentValue.toString()), + SizedBox(width: 6), + const Icon(Icons.arrow_drop_down, size: 17) + ], + ), + ); } } diff --git a/pubspec.yaml b/pubspec.yaml index 136a8abd..9a5b1fb0 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.6 +version: 4.1.7 #author: bulletjournal homepage: https://bulletjournal.us/home/index.html repository: https://github.com/singerdmx/flutter-quill