Skip to content

Commit

Permalink
Prepare dev version 6
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellet committed Dec 6, 2023
1 parent 5e6115d commit 3be21fb
Show file tree
Hide file tree
Showing 20 changed files with 117 additions and 28 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ All notable changes to this project will be documented in this file.
## 9.0.0-dev-6
* Move the `child` from `QuillToolbarConfigurations` into `QuillToolbar` directly
* Bug fixes
* Add the ability to change the background and font color of the ol/ul elements dots and numbers
* Flutter Quill Extensions:
* **Breaking Change**: The `imageProviderBuilder`is now providing the context and image url

Expand Down
13 changes: 13 additions & 0 deletions example/lib/presentation/quill/quill_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ class _QuillScreenState extends State<QuillScreen> {
sharedConfigurations: _sharedConfigurations,
controller: _controller,
readOnly: _isReadOnly,
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,
focusNode: _editorFocusNode,
Expand Down
7 changes: 7 additions & 0 deletions flutter_quill_extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## 9.0.0-dev-6
* Move the `child` from `QuillToolbarConfigurations` into `QuillToolbar` directly
* Bug fixes
* Add the ability to change the background and font color of the ol/ul elements dots and numbers
* Flutter Quill Extensions:
* **Breaking Change**: The `imageProviderBuilder`is now providing the context and image url

## 9.0.0-dev-5
* The `QuillToolbar` is now accepting only `child` with no configurations so you can customize everything you wants, the `QuillToolbar.simple()` or `QuillSimpleToolbar` implements a simple toolbar that is based on `QuillToolbar`, you are free to use it but it just an example and not standard
* Flutter Quill Extensions:
Expand Down
2 changes: 1 addition & 1 deletion flutter_quill_extensions/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_quill_extensions
description: Embed extensions for flutter_quill including image, video, formula and etc.
version: 9.0.0-dev-5
version: 9.0.0-dev-6
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_extensions/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
Expand Down
7 changes: 7 additions & 0 deletions flutter_quill_test/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## 9.0.0-dev-6
* Move the `child` from `QuillToolbarConfigurations` into `QuillToolbar` directly
* Bug fixes
* Add the ability to change the background and font color of the ol/ul elements dots and numbers
* Flutter Quill Extensions:
* **Breaking Change**: The `imageProviderBuilder`is now providing the context and image url

## 9.0.0-dev-5
* The `QuillToolbar` is now accepting only `child` with no configurations so you can customize everything you wants, the `QuillToolbar.simple()` or `QuillSimpleToolbar` implements a simple toolbar that is based on `QuillToolbar`, you are free to use it but it just an example and not standard
* Flutter Quill Extensions:
Expand Down
2 changes: 1 addition & 1 deletion flutter_quill_test/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_quill_test
description: Test utilities for flutter_quill which includes methods to simplify interacting with the editor in test cases.
version: 9.0.0-dev-5
version: 9.0.0-dev-6
homepage: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
repository: https://github.com/singerdmx/flutter-quill/tree/master/flutter_quill_test/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
Expand Down
12 changes: 6 additions & 6 deletions lib/src/extensions/quill_configurations_ext.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ extension QuillSharedExt on BuildContext {
extension QuillEditorExt on BuildContext {
/// return [QuillEditorConfigurations] as not null
QuillEditorConfigurations get requireQuillEditorConfigurations {
return QuillEditorProvider.ofNotNull(this).editorConfigurations;
return QuillEditorProvider.of(this).editorConfigurations;
}

/// return nullable [QuillEditorConfigurations]
QuillEditorConfigurations? get quillEditorConfigurations {
return QuillEditorProvider.of(this)?.editorConfigurations;
return QuillEditorProvider.maybeOf(this)?.editorConfigurations;
}

/// return nullable [QuillToolbarBaseButtonOptions]. Since the quill
Expand All @@ -57,12 +57,12 @@ extension QuillEditorExt on BuildContext {
extension QuillSimpleToolbarExt on BuildContext {
/// return [QuillSimpleToolbarConfigurations] as not null
QuillSimpleToolbarConfigurations get requireQuillSimpleToolbarConfigurations {
return QuillSimpleToolbarProvider.ofNotNull(this).toolbarConfigurations;
return QuillSimpleToolbarProvider.of(this).toolbarConfigurations;
}

/// return nullable [QuillSimpleToolbarConfigurations]
QuillSimpleToolbarConfigurations? get quillSimpleToolbarConfigurations {
return QuillSimpleToolbarProvider.of(this)?.toolbarConfigurations;
return QuillSimpleToolbarProvider.maybeOf(this)?.toolbarConfigurations;
}

/// return nullable [QuillToolbarBaseButtonOptions].
Expand All @@ -83,11 +83,11 @@ extension QuillSimpleToolbarExt on BuildContext {
extension QuillToolbarExt on BuildContext {
/// return [QuillToolbarConfigurations] as not null
QuillToolbarConfigurations get requireQuillToolbarConfigurations {
return QuillToolbarProvider.ofNotNull(this).toolbarConfigurations;
return QuillToolbarProvider.of(this).toolbarConfigurations;
}

/// return nullable [QuillToolbarConfigurations].
QuillToolbarConfigurations? get quillToolbarConfigurations {
return QuillToolbarProvider.of(this)?.toolbarConfigurations;
return QuillToolbarProvider.maybeOf(this)?.toolbarConfigurations;
}
}
9 changes: 9 additions & 0 deletions lib/src/models/config/editor/element_options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,25 @@ import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;

import 'elements/code_block.dart';
import 'elements/list/ordered_list.dart';
import 'elements/list/unordered_list.dart';

export 'elements/code_block.dart';
export 'elements/list/ordered_list.dart';
export 'elements/list/unordered_list.dart';

@immutable
class QuillEditorElementOptions extends Equatable {
const QuillEditorElementOptions({
this.codeBlock = const QuillEditorCodeBlockElementOptions(),
this.orderedList = const QuillEditorOrderedListElementOptions(),
this.unorderedList = const QuillEditorUnOrderedListElementOptions(),
});

final QuillEditorCodeBlockElementOptions codeBlock;

final QuillEditorOrderedListElementOptions orderedList;
final QuillEditorUnOrderedListElementOptions unorderedList;
@override
List<Object?> get props => [
codeBlock,
Expand Down
14 changes: 14 additions & 0 deletions lib/src/models/config/editor/elements/list/ordered_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/widgets.dart' show Color;

@immutable
class QuillEditorOrderedListElementOptions extends Equatable {
const QuillEditorOrderedListElementOptions(
{this.backgroundColor, this.fontColor});

final Color? backgroundColor;
final Color? fontColor;
@override
List<Object?> get props => [];
}
14 changes: 14 additions & 0 deletions lib/src/models/config/editor/elements/list/unordered_list.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/widgets.dart' show Color;

@immutable
class QuillEditorUnOrderedListElementOptions extends Equatable {
const QuillEditorUnOrderedListElementOptions(
{this.backgroundColor, this.fontColor});

final Color? backgroundColor;
final Color? fontColor;
@override
List<Object?> get props => [];
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class QuillToolbarIndentButtonExtraOptions
}

@immutable
class QuillToolbarIndentButtonOptions extends QuillToolbarBaseButtonOptions {
class QuillToolbarIndentButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarIndentButtonOptions, QuillToolbarIndentButtonExtraOptions> {
const QuillToolbarIndentButtonOptions({
super.iconData,
super.afterButtonPressed,
Expand Down
10 changes: 9 additions & 1 deletion lib/src/widgets/style_widgets/bullet_point.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:flutter/material.dart';

import '../../extensions/quill_configurations_ext.dart';

class QuillEditorBulletPoint extends StatelessWidget {
const QuillEditorBulletPoint({
required this.style,
Expand All @@ -18,7 +20,13 @@ class QuillEditorBulletPoint extends StatelessWidget {
alignment: AlignmentDirectional.topEnd,
width: width,
padding: EdgeInsetsDirectional.only(end: padding),
child: Text('•', style: style),
color: context.quillEditorElementOptions?.unorderedList.backgroundColor,
child: Text(
'•',
style: style.copyWith(
color: context.quillEditorElementOptions?.unorderedList.fontColor,
),
),
);
}
}
9 changes: 8 additions & 1 deletion lib/src/widgets/style_widgets/number_point.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';

import '../../extensions/quill_configurations_ext.dart';
import '../../models/documents/attribute.dart';
import '../others/text_block.dart';

Expand Down Expand Up @@ -67,7 +68,13 @@ class QuillEditorNumberPoint extends StatelessWidget {
alignment: AlignmentDirectional.topEnd,
width: width,
padding: EdgeInsetsDirectional.only(end: padding),
child: Text(withDot ? '$s.' : s, style: style),
color: context.quillEditorElementOptions?.orderedList.backgroundColor,
child: Text(
withDot ? '$s.' : s,
style: style.copyWith(
color: context.quillEditorElementOptions?.orderedList.fontColor,
),
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class QuillToolbarSelectHeaderStyleButton extends StatefulWidget {
});

final QuillController controller;
// TODO: Needs to be reviewed
final QuillToolbarSelectHeaderStyleButtonsOptions options;

@override
Expand Down
10 changes: 5 additions & 5 deletions lib/src/widgets/toolbar/buttons/toggle_style_button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,12 @@ class QuillToolbarToggleStyleButtonState

VoidCallback? get afterButtonPressed {
return options.afterButtonPressed ??
context.requireQuillToolbarBaseButtonOptions.afterButtonPressed;
context.quillToolbarBaseButtonOptions?.afterButtonPressed;
}

QuillIconTheme? get iconTheme {
return options.iconTheme ??
context.requireQuillToolbarBaseButtonOptions.iconTheme;
context.quillToolbarBaseButtonOptions?.iconTheme;
}

(String, IconData) get _defaultTooltipAndIconData {
Expand Down Expand Up @@ -132,13 +132,13 @@ class QuillToolbarToggleStyleButtonState

String? get tooltip {
return options.tooltip ??
context.requireQuillToolbarBaseButtonOptions.tooltip ??
context.quillToolbarBaseButtonOptions?.tooltip ??
_defaultTooltipAndIconData.$1;
}

IconData get iconData {
return options.iconData ??
context.requireQuillToolbarBaseButtonOptions.iconData ??
context.quillToolbarBaseButtonOptions?.iconData ??
_defaultTooltipAndIconData.$2;
}

Expand All @@ -150,7 +150,7 @@ class QuillToolbarToggleStyleButtonState
@override
Widget build(BuildContext context) {
final childBuilder = options.childBuilder ??
context.requireQuillToolbarBaseButtonOptions.childBuilder;
context.quillToolbarBaseButtonOptions?.childBuilder;
if (childBuilder != null) {
return childBuilder(
QuillToolbarToggleStyleButtonOptions(
Expand Down
18 changes: 9 additions & 9 deletions lib/src/widgets/utils/provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ class QuillSimpleToolbarProvider extends InheritedWidget {
return oldWidget.toolbarConfigurations != toolbarConfigurations;
}

static QuillSimpleToolbarProvider? of(BuildContext context) {
static QuillSimpleToolbarProvider? maybeOf(BuildContext context) {
/// The configurations for the quill editor widget of flutter quill
return context
.dependOnInheritedWidgetOfExactType<QuillSimpleToolbarProvider>();
}

static QuillSimpleToolbarProvider ofNotNull(BuildContext context) {
final provider = of(context);
static QuillSimpleToolbarProvider of(BuildContext context) {
final provider = maybeOf(context);
if (provider == null) {
if (kDebugMode) {
debugPrint(
Expand Down Expand Up @@ -79,13 +79,13 @@ class QuillToolbarProvider extends InheritedWidget {
return oldWidget.toolbarConfigurations != toolbarConfigurations;
}

static QuillToolbarProvider? of(BuildContext context) {
static QuillToolbarProvider? maybeOf(BuildContext context) {
/// The configurations for the quill editor widget of flutter quill
return context.dependOnInheritedWidgetOfExactType<QuillToolbarProvider>();
}

static QuillToolbarProvider ofNotNull(BuildContext context) {
final provider = of(context);
static QuillToolbarProvider of(BuildContext context) {
final provider = maybeOf(context);
if (provider == null) {
if (kDebugMode) {
debugPrint(
Expand Down Expand Up @@ -136,13 +136,13 @@ class QuillEditorProvider extends InheritedWidget {
return oldWidget.editorConfigurations != editorConfigurations;
}

static QuillEditorProvider? of(BuildContext context) {
static QuillEditorProvider? maybeOf(BuildContext context) {
/// The configurations for the quill editor widget of flutter quill
return context.dependOnInheritedWidgetOfExactType<QuillEditorProvider>();
}

static QuillEditorProvider ofNotNull(BuildContext context) {
final provider = of(context);
static QuillEditorProvider of(BuildContext context) {
final provider = maybeOf(context);
if (provider == null) {
if (kDebugMode) {
debugPrint(
Expand Down
7 changes: 7 additions & 0 deletions packages/quill_html_converter/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

All notable changes to this project will be documented in this file.

## 9.0.0-dev-6
* Move the `child` from `QuillToolbarConfigurations` into `QuillToolbar` directly
* Bug fixes
* Add the ability to change the background and font color of the ol/ul elements dots and numbers
* Flutter Quill Extensions:
* **Breaking Change**: The `imageProviderBuilder`is now providing the context and image url

## 9.0.0-dev-5
* The `QuillToolbar` is now accepting only `child` with no configurations so you can customize everything you wants, the `QuillToolbar.simple()` or `QuillSimpleToolbar` implements a simple toolbar that is based on `QuillToolbar`, you are free to use it but it just an example and not standard
* Flutter Quill Extensions:
Expand Down
2 changes: 1 addition & 1 deletion packages/quill_html_converter/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: quill_html_converter
description: A extension for flutter_quill package to add support for dealing with conversion to/from html
version: 9.0.0-dev-5
version: 9.0.0-dev-6
homepage: https://github.com/singerdmx/flutter-quill/tree/master/packages/quill_html_converter/
repository: https://github.com/singerdmx/flutter-quill/tree/master/packages/quill_html_converter/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: flutter_quill
description: A rich text editor built for the modern Android, iOS, web and desktop platforms. It is the WYSIWYG editor and a Quill component for Flutter.
version: 9.0.0-dev-5
version: 9.0.0-dev-6
homepage: https://1o24bbs.com/c/bulletjournal/108/
repository: https://github.com/singerdmx/flutter-quill/
issue_tracker: https://github.com/singerdmx/flutter-quill/issues/
Expand Down
2 changes: 1 addition & 1 deletion version.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
const version = '9.0.0-dev-5';
const version = '9.0.0-dev-6';

0 comments on commit 3be21fb

Please sign in to comment.