Upgrade to 4.1.8

pull/802/head
X Code 3 years ago
parent 3909365252
commit af8146ad45
  1. 3
      CHANGELOG.md
  2. 7
      lib/src/widgets/toolbar.dart
  3. 36
      lib/src/widgets/toolbar/quill_dropdown_button.dart
  4. 2
      pubspec.yaml

@ -1,3 +1,6 @@
# [4.1.8]
* Update font size dropdown.
# [4.1.7] # [4.1.7]
* Convert FontSize to a Map to allow for named Font Size. * Convert FontSize to a Map to allow for named Font Size.

@ -153,7 +153,7 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
//default font size values //default font size values
final fontSizes = fontSizeValues ?? final fontSizes = fontSizeValues ??
{ {
'Default':0, 'Default': 0,
'10': 10, '10': 10,
'12': 12, '12': 12,
'14': 14, '14': 14,
@ -209,11 +209,10 @@ class QuillToolbar extends StatelessWidget implements PreferredSizeWidget {
controller controller
.formatSelection(Attribute.fromKeyValue('size', newSize)); .formatSelection(Attribute.fromKeyValue('size', newSize));
} }
if (newSize as int == 0) if (newSize as int == 0) {
{
controller controller
.formatSelection(Attribute.fromKeyValue('size', null)); .formatSelection(Attribute.fromKeyValue('size', null));
} }
}, },
rawitemsmap: fontSizes, rawitemsmap: fontSizes,
initialValue: (initialFontSizeValue != null) && initialValue: (initialFontSizeValue != null) &&

@ -54,7 +54,7 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
widget.controller.removeListener(_didChangeEditingValue); widget.controller.removeListener(_didChangeEditingValue);
super.dispose(); super.dispose();
} }
@override @override
void didUpdateWidget(covariant QuillDropdownButton<T> oldWidget) { void didUpdateWidget(covariant QuillDropdownButton<T> oldWidget) {
super.didUpdateWidget(oldWidget); super.didUpdateWidget(oldWidget);
@ -64,28 +64,31 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
//_isToggled = _getIsToggled(_selectionStyle.attributes); //_isToggled = _getIsToggled(_selectionStyle.attributes);
} }
} }
void _didChangeEditingValue() { void _didChangeEditingValue() {
setState(() => _currentValue = _getKeyName(_selectionStyle.attributes)); setState(() => _currentValue = _getKeyName(_selectionStyle.attributes));
} }
String _getKeyName(Map<String, Attribute> attrs) { String _getKeyName(Map<String, Attribute> attrs) {
if (widget.attribute.key == Attribute.size.key) { if (widget.attribute.key == Attribute.size.key) {
final attribute = attrs[widget.attribute.key]; final attribute = attrs[widget.attribute.key];
if (attribute == null) { if (attribute == null) {
return widget.rawitemsmap.keys.elementAt(widget.initialValue as int).toString(); return widget.rawitemsmap.keys
} .elementAt(widget.initialValue as int)
else { .toString();
} else {
return widget.rawitemsmap.entries return widget.rawitemsmap.entries
.firstWhere((element) => element.value == attribute.value, .firstWhere((element) => element.value == attribute.value,
orElse: () => widget.rawitemsmap.entries.first) orElse: () => widget.rawitemsmap.entries.first)
.key; .key;
} }
} }
return widget.rawitemsmap.keys.elementAt(widget.initialValue as int).toString(); return widget.rawitemsmap.keys
.elementAt(widget.initialValue as int)
.toString();
} }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ConstrainedBox( return ConstrainedBox(
@ -148,13 +151,20 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
Widget _buildContent(BuildContext context) { Widget _buildContent(BuildContext context) {
final theme = Theme.of(context); final theme = Theme.of(context);
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB(10,0,0,0), padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Row( child: Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ 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), 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)
], ],
), ),
); );

@ -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.7 version: 4.1.8
#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