pull/1602/head
Ellet 1 year ago
parent 15bf6c7fb5
commit 717ecc2aaa
No known key found for this signature in database
GPG Key ID: C488CC70BBCEF0D1
  1. 2
      CHANGELOG.md
  2. 16
      example/lib/presentation/quill/my_quill_editor.dart
  3. 14
      example/lib/presentation/quill/quill_screen.dart
  4. 8
      lib/src/models/config/editor/elements/list/ordered_list.dart
  5. 8
      lib/src/models/config/editor/elements/list/unordered_list.dart
  6. 30
      lib/src/widgets/quill/text_block.dart

@ -6,7 +6,7 @@ All notable changes to this project will be documented in this file.
* Add the new translations for ru, uk arb files by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575) * Add the new translations for ru, uk arb files by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575)
* Add a new dropdown button by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575) * Add a new dropdown button by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575)
* Update the default style values by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575) * Update the default style values by [#1575](https://github.com/singerdmx/flutter-quill/pull/1575)
* Fix bug [#1562](https://github.com/singerdmx/flutter-quill/issues/1562)
## 9.0.2-dev.1 ## 9.0.2-dev.1
* Add configurations for the new dropdown `QuillToolbarSelectHeaderStyleButton`, you can use the orignal one or this * Add configurations for the new dropdown `QuillToolbarSelectHeaderStyleButton`, you can use the orignal one or this

@ -33,6 +33,22 @@ class MyQuillEditor extends StatelessWidget {
scrollController: scrollController, scrollController: scrollController,
focusNode: focusNode, focusNode: focusNode,
configurations: configurations.copyWith( configurations: configurations.copyWith(
elementOptions: const QuillEditorElementOptions(
codeBlock: QuillEditorCodeBlockElementOptions(
enableLineNumbers: true,
),
// orderedList: QuillEditorOrderedListElementOptions(
// backgroundColor: Colors.amber,
// fontColor: Colors.black,
// ),
// unorderedList: QuillEditorUnOrderedListElementOptions(
// backgroundColor: Colors.green,
// fontColor: Colors.red,
// ),
unorderedList: QuillEditorUnOrderedListElementOptions(
useTextColorForDot: false,
),
),
customStyles: const DefaultStyles( customStyles: const DefaultStyles(
h1: DefaultTextBlockStyle( h1: DefaultTextBlockStyle(
TextStyle( TextStyle(

@ -126,20 +126,6 @@ class _QuillScreenState extends State<QuillScreen> {
sharedConfigurations: _sharedConfigurations, sharedConfigurations: _sharedConfigurations,
controller: _controller, controller: _controller,
readOnly: _isReadOnly, readOnly: _isReadOnly,
customStyles: const DefaultStyles(),
elementOptions: const QuillEditorElementOptions(
codeBlock: QuillEditorCodeBlockElementOptions(
enableLineNumbers: true,
),
// orderedList: QuillEditorOrderedListElementOptions(
// backgroundColor: Colors.amber,
// fontColor: Colors.black,
// ),
// unorderedList: QuillEditorUnOrderedListElementOptions(
// backgroundColor: Colors.green,
// fontColor: Colors.red,
// ),
),
), ),
scrollController: _editorScrollController, scrollController: _editorScrollController,
focusNode: _editorFocusNode, focusNode: _editorFocusNode,

@ -4,11 +4,15 @@ import 'package:flutter/widgets.dart' show Color;
@immutable @immutable
class QuillEditorOrderedListElementOptions extends Equatable { class QuillEditorOrderedListElementOptions extends Equatable {
const QuillEditorOrderedListElementOptions( const QuillEditorOrderedListElementOptions({
{this.backgroundColor, this.fontColor}); this.backgroundColor,
this.fontColor,
this.useTextColorForDot = true,
});
final Color? backgroundColor; final Color? backgroundColor;
final Color? fontColor; final Color? fontColor;
final bool useTextColorForDot;
@override @override
List<Object?> get props => []; List<Object?> get props => [];
} }

@ -4,11 +4,15 @@ import 'package:flutter/widgets.dart' show Color;
@immutable @immutable
class QuillEditorUnOrderedListElementOptions extends Equatable { class QuillEditorUnOrderedListElementOptions extends Equatable {
const QuillEditorUnOrderedListElementOptions( const QuillEditorUnOrderedListElementOptions({
{this.backgroundColor, this.fontColor}); this.backgroundColor,
this.fontColor,
this.useTextColorForDot = true,
});
final Color? backgroundColor; final Color? backgroundColor;
final Color? fontColor; final Color? fontColor;
final bool useTextColorForDot;
@override @override
List<Object?> get props => []; List<Object?> get props => [];
} }

@ -17,6 +17,7 @@ import '../others/text_selection.dart';
import '../style_widgets/bullet_point.dart'; import '../style_widgets/bullet_point.dart';
import '../style_widgets/checkbox_point.dart'; import '../style_widgets/checkbox_point.dart';
import '../style_widgets/number_point.dart'; import '../style_widgets/number_point.dart';
import '../toolbar/base_toolbar.dart';
import 'quill_controller.dart'; import 'quill_controller.dart';
import 'text_line.dart'; import 'text_line.dart';
@ -211,12 +212,29 @@ class EditableTextBlock extends StatelessWidget {
final fontSize = defaultStyles.paragraph?.style.fontSize ?? 16; final fontSize = defaultStyles.paragraph?.style.fontSize ?? 16;
final attrs = line.style.attributes; final attrs = line.style.attributes;
final fontColor =
line.toDelta().operations.first.attributes?[Attribute.color.key] != null
? hexToColor(
line
.toDelta()
.operations
.first
.attributes?[Attribute.color.key],
)
: null;
if (attrs[Attribute.list.key] == Attribute.ol) { if (attrs[Attribute.list.key] == Attribute.ol) {
return QuillEditorNumberPoint( return QuillEditorNumberPoint(
index: index, index: index,
indentLevelCounts: indentLevelCounts, indentLevelCounts: indentLevelCounts,
count: count, count: count,
style: defaultStyles.leading!.style, style: defaultStyles.leading!.style.copyWith(
color: context.quillEditorElementOptions?.orderedList
.useTextColorForDot ==
true
? fontColor
: null,
),
attrs: attrs, attrs: attrs,
width: _numberPointWidth(fontSize, count), width: _numberPointWidth(fontSize, count),
padding: fontSize / 2, padding: fontSize / 2,
@ -225,8 +243,14 @@ class EditableTextBlock extends StatelessWidget {
if (attrs[Attribute.list.key] == Attribute.ul) { if (attrs[Attribute.list.key] == Attribute.ul) {
return QuillEditorBulletPoint( return QuillEditorBulletPoint(
style: style: defaultStyles.leading!.style.copyWith(
defaultStyles.leading!.style.copyWith(fontWeight: FontWeight.bold), fontWeight: FontWeight.bold,
color: context.quillEditorElementOptions?.unorderedList
.useTextColorForDot ==
true
? fontColor
: null,
),
width: fontSize * 2, width: fontSize * 2,
padding: fontSize / 2, padding: fontSize / 2,
); );

Loading…
Cancel
Save