Upgrade to 4.1.7

pull/796/head
X Code 3 years ago
parent b30fee9ae4
commit 9a62ee79f9
  1. 3
      CHANGELOG.md
  2. 2
      lib/src/translations/toolbar.i18n.dart
  3. 24
      lib/src/widgets/toolbar.dart
  4. 30
      lib/src/widgets/toolbar/quill_dropdown_button.dart
  5. 2
      pubspec.yaml

@ -1,3 +1,6 @@
# [4.1.7]
* Convert FontSize to a Map to allow for named Font Size.
# [4.1.6] # [4.1.6]
* Update quill_dropdown_button.dart. * Update quill_dropdown_button.dart.

@ -395,7 +395,7 @@ extension Localization on String {
'Gallery': 'लर', 'Gallery': 'लर',
'Link': 'ि', 'Link': 'ि',
'Please first select some text to transform into a link.': 'Please first select some text to transform into a link.':
'िक म बदलनिए कपय पहलछ शबद च', 'िक म बदलनिए कपय पहलछ शबद च',
'Open': '', 'Open': '',
'Copy': ' कर', 'Copy': ' कर',
'Remove': 'हट', 'Remove': 'हट',

@ -151,8 +151,19 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
]; ];
//default font size values //default font size values
final fontSizes = final fontSizes = fontSizeValues ??
fontSizeValues ?? {'10':10, '12':12, '14':14, '16':16, '18':18, '20':20, '24':24, '28':28, '32':32, '48':48}; {
'10': 10,
'12': 12,
'14': 14,
'16': 16,
'18': 18,
'20': 20,
'24': 24,
'28': 28,
'32': 32,
'48': 48
};
return QuillToolbar( return QuillToolbar(
key: key, key: key,
@ -181,9 +192,9 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
if (showFontSize) if (showFontSize)
QuillDropdownButton( QuillDropdownButton(
iconTheme: iconTheme, iconTheme: iconTheme,
height: (toolbarIconSize * 2)-(toolbarIconSize / 3), height: (toolbarIconSize * 2) - (toolbarIconSize / 3),
items: [ items: [
for(MapEntry<String, int> fontSize in fontSizes.entries) for (MapEntry<String, int> fontSize in fontSizes.entries)
PopupMenuItem<int>( PopupMenuItem<int>(
key: ValueKey(fontSize.key), key: ValueKey(fontSize.key),
value: fontSize.value, value: fontSize.value,
@ -197,7 +208,10 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
} }
}, },
rawitemsmap: fontSizes, rawitemsmap: fontSizes,
initialValue: (initialFontSizeValue != null) && (initialFontSizeValue <= fontSizes.length - 1) ? initialFontSizeValue : 0, initialValue: (initialFontSizeValue != null) &&
(initialFontSizeValue <= fontSizes.length - 1)
? initialFontSizeValue
: 0,
), ),
if (showBoldButton) if (showBoldButton)
ToggleStyleButton( ToggleStyleButton(

@ -21,7 +21,7 @@ class QuillDropdownButton<T> extends StatefulWidget {
final double highlightElevation; final double highlightElevation;
final T initialValue; final T initialValue;
final List<PopupMenuEntry<T>> items; final List<PopupMenuEntry<T>> items;
final Map<String,int> rawitemsmap; final Map<String, int> rawitemsmap;
final ValueChanged<T> onSelected; final ValueChanged<T> onSelected;
final QuillIconTheme? iconTheme; final QuillIconTheme? iconTheme;
@ -36,7 +36,8 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_currentValue = widget.rawitemsmap.keys.elementAt(widget.initialValue as int); _currentValue =
widget.rawitemsmap.keys.elementAt(widget.initialValue as int);
} }
@override @override
@ -89,7 +90,10 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
return null; return null;
} }
setState(() { 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); widget.onSelected(newValue);
}); });
}); });
@ -97,15 +101,15 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
return Padding( return Padding(
padding: const EdgeInsets.symmetric(horizontal: 10), padding: const EdgeInsets.symmetric(horizontal: 10),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text(_currentValue.toString()), Text(_currentValue.toString()),
SizedBox(width:6), SizedBox(width: 6),
const Icon(Icons.arrow_drop_down, size: 17) const Icon(Icons.arrow_drop_down, size: 17)
], ],
), ),
); );
} }
} }

@ -1,6 +1,6 @@
name: flutter_quill name: flutter_quill
description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us) description: A rich text editor supporting mobile and web (Demo App @ bulletjournal.us)
version: 4.1.6 version: 4.1.7
#author: bulletjournal #author: bulletjournal
homepage: https://bulletjournal.us/home/index.html homepage: https://bulletjournal.us/home/index.html
repository: https://github.com/singerdmx/flutter-quill repository: https://github.com/singerdmx/flutter-quill

Loading…
Cancel
Save