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]
* 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
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) &&

@ -54,7 +54,7 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
widget.controller.removeListener(_didChangeEditingValue);
super.dispose();
}
@override
void didUpdateWidget(covariant QuillDropdownButton<T> oldWidget) {
super.didUpdateWidget(oldWidget);
@ -64,28 +64,31 @@ class _QuillDropdownButtonState<T> extends State<QuillDropdownButton<T>> {
//_isToggled = _getIsToggled(_selectionStyle.attributes);
}
}
void _didChangeEditingValue() {
setState(() => _currentValue = _getKeyName(_selectionStyle.attributes));
}
String _getKeyName(Map<String, Attribute> 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<T> extends State<QuillDropdownButton<T>> {
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)
],
),
);

@ -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

Loading…
Cancel
Save