Update check list button

pull/635/head
X Code 3 years ago
parent 18ebe4a6ef
commit 57f81efab6
  1. 1
      lib/src/widgets/raw_editor.dart
  2. 14
      lib/src/widgets/toolbar/toggle_check_list_button.dart

@ -764,6 +764,7 @@ class RawEditorState extends EditorState
// https://github.com/singerdmx/flutter-quill/issues/619 // https://github.com/singerdmx/flutter-quill/issues/619
// We cannot treat {"list": "checked"} and {"list": "unchecked"} as // We cannot treat {"list": "checked"} and {"list": "unchecked"} as
// block of the same style // block of the same style
// This causes controller.selection to go to offset 0
bool _disableScrollControllerAnimateOnce = false; bool _disableScrollControllerAnimateOnce = false;
void _showCaretOnScreen() { void _showCaretOnScreen() {

@ -55,15 +55,13 @@ class _ToggleCheckListButtonState extends State<ToggleCheckListButton> {
} }
bool _getIsToggled(Map<String, Attribute> attrs) { bool _getIsToggled(Map<String, Attribute> attrs) {
if (widget.attribute.key == Attribute.list.key) { final attribute = attrs[Attribute.list.key];
final attribute = attrs[widget.attribute.key];
if (attribute == null) { if (attribute == null) {
return false; return false;
}
return attribute.value == widget.attribute.value ||
attribute.value == Attribute.checked.value;
} }
return attrs.containsKey(widget.attribute.key); return attribute.value == Attribute.unchecked.value ||
attribute.value == Attribute.checked.value;
} }
@override @override

Loading…
Cancel
Save