Skip to content

Commit

Permalink
Fixes for step 2 update (#1449)
Browse files Browse the repository at this point in the history
* Improve main workflow

* Fixes

* Bug fixes

* Edit toolbar configurations

* Fix conflicts

* Bug fixes
  • Loading branch information
EchoEllet authored Oct 21, 2023
1 parent 7033d80 commit 55f5101
Show file tree
Hide file tree
Showing 44 changed files with 301 additions and 170 deletions.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@ Closes #IssueNumber
- [ ] I have run `dart format .`` on the project <!-- REQUIRED -->
- [ ] I have run `dart fix --apply` on the project <!-- REQUIRED -->
- [ ] I have run `flutter test` and `flutter analyze` and it passed successfully <!-- REQUIRED -->
- [ ] I have run `./before-push.sh` and everything is fine <!-- Optional >
- [ ] I have run `./before-push.sh` and everything is fine <!-- Optional -->
27 changes: 21 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,24 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter --version
- run: flutter pub get
- run: flutter pub get -C flutter_quill_extensions
- run: flutter analyze
- run: flutter test
- run: flutter pub publish --dry-run

- name: Check flutter version
run: flutter --version

- name: Install dependencies
run: flutter pub get

- name: Install flutter_quill_extensions dependencies
run: flutter pub get -C flutter_quill_extensions

- name: Run flutter analysis
run: flutter analyze

- name: Check dart code formatting
run: dart format --set-exit-if-changed .

- name: Check if package is ready for publishing
run: flutter pub publish --dry-run

- name: Run flutter tests
run: flutter test
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [7.6.1]

- Bug fixes

## [7.6.0]

- **Breaking change**: To customize the buttons in the toolbar, you can do that in the `QuillProvider`
Expand Down
4 changes: 4 additions & 0 deletions before-push.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ dart fix --apply
echo "Running 'dart format .'"
dart format .

# Check dart code formatting
echo "Running `dart format --set-exit-if-changed .`"
dart format --set-exit-if-changed .

echo "Script completed."
3 changes: 2 additions & 1 deletion example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down Expand Up @@ -215,6 +215,7 @@
files = (
);
inputPaths = (
"${TARGET_BUILD_DIR}/${INFOPLIST_PATH}",
);
name = "Thin Binary";
outputPaths = (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion flutter_quill_extensions/lib/embeds/builders.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_quill/extensions.dart' as base;
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:math_keyboard/math_keyboard.dart';
import 'package:universal_html/html.dart' as html;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import 'dart:io' show File;
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import 'dart:ui';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_quill/extensions.dart';
import 'package:flutter_quill/flutter_quill.dart' hide Text;
import 'package:flutter_quill/flutter_quill.dart';
import 'package:flutter_quill/translations.dart';
import 'package:image_picker/image_picker.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/flutter_quill.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ export 'src/models/themes/quill_icon_theme.dart';
export 'src/utils/embeds.dart';
export 'src/widgets/controller.dart';
export 'src/widgets/default_styles.dart';
export 'src/widgets/editor.dart';
export 'src/widgets/editor/editor.dart';
export 'src/widgets/embeds.dart';
export 'src/widgets/link.dart' show LinkActionPickerDelegate, LinkMenuAction;
export 'src/widgets/style_widgets/style_widgets.dart';
export 'src/widgets/toolbar.dart';
export 'src/widgets/toolbar/enum.dart';
export 'src/widgets/toolbar/toolbar.dart';
export 'src/widgets/utils/provider.dart';
9 changes: 8 additions & 1 deletion lib/src/models/config/editor/configurations.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;

/// The configurations for the quill editor widget of flutter quill
@immutable
class QuillEditorConfigurations {
class QuillEditorConfigurations extends Equatable {
const QuillEditorConfigurations({
this.placeholder,
this.readOnly = false,
Expand All @@ -18,4 +19,10 @@ class QuillEditorConfigurations {
///
/// Defaults to `false`. Must not be `null`.
final bool readOnly;

@override
List<Object?> get props => [
placeholder,
readOnly,
];
}
10 changes: 9 additions & 1 deletion lib/src/models/config/quill_configurations.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;

import '../../../flutter_quill.dart';
Expand All @@ -7,7 +8,7 @@ export './shared_configurations.dart';
export './toolbar/configurations.dart';

@immutable
class QuillConfigurations {
class QuillConfigurations extends Equatable {
const QuillConfigurations({
required this.controller,
this.editorConfigurations = const QuillEditorConfigurations(),
Expand All @@ -32,4 +33,11 @@ class QuillConfigurations {
/// The shared configurations between [QuillEditorConfigurations] and
/// [QuillToolbarConfigurations] so we don't duplicate things
final QuillSharedConfigurations sharedConfigurations;

@override
List<Object?> get props => [
editorConfigurations,
toolbarConfigurations,
sharedConfigurations,
];
}
9 changes: 8 additions & 1 deletion lib/src/models/config/shared_configurations.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/material.dart' show Color, Colors, Locale;
import './editor/configurations.dart' show QuillEditorConfigurations;
import './toolbar/configurations.dart' show QuillToolbarConfigurations;

/// The shared configurations between [QuillEditorConfigurations] and
/// [QuillToolbarConfigurations] so we don't duplicate things
class QuillSharedConfigurations {
class QuillSharedConfigurations extends Equatable {
const QuillSharedConfigurations({
this.dialogBarrierColor = Colors.black54,
this.locale,
Expand All @@ -18,4 +19,10 @@ class QuillSharedConfigurations {
/// The locale to use for the editor and toolbar, defaults to system locale
/// More https://github.com/singerdmx/flutter-quill#translation
final Locale? locale;

@override
List<Object?> get props => [
dialogBarrierColor,
locale,
];
}
14 changes: 13 additions & 1 deletion lib/src/models/config/toolbar/buttons/base.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show VoidCallback, immutable;
import 'package:flutter/widgets.dart' show IconData, Widget;

Expand All @@ -9,7 +10,7 @@ import '../../quill_configurations.dart' show kDefaultIconSize;
/// it's used in [childBuilder] so the developer can custmize this when using it
/// The [I] is extra options for the button, usually for it's state
@immutable
class QuillToolbarBaseButtonOptions<T, I> {
class QuillToolbarBaseButtonOptions<T, I> extends Equatable {
const QuillToolbarBaseButtonOptions({
this.iconData,
this.globalIconSize = kDefaultIconSize,
Expand Down Expand Up @@ -45,4 +46,15 @@ class QuillToolbarBaseButtonOptions<T, I> {
/// By default it will be from the one in [QuillProvider]
/// To override it you must pass not null controller
final QuillController? controller;

@override
List<Object?> get props => [
iconData,
globalIconSize,
afterButtonPressed,
tooltip,
iconTheme,
childBuilder,
controller,
];
}
2 changes: 1 addition & 1 deletion lib/src/models/config/toolbar/buttons/font_family.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QuillToolbarFontFamilyButtonOptions extends QuillToolbarBaseButtonOptions<
QuillToolbarFontFamilyButtonOptions,
QuillToolbarFontFamilyButtonExtraOptions> {
const QuillToolbarFontFamilyButtonOptions({
required this.attribute,
this.attribute = Attribute.font,
this.rawItemsMap,
super.controller,
super.iconData,
Expand Down
68 changes: 68 additions & 0 deletions lib/src/models/config/toolbar/buttons/font_size.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import 'package:flutter/foundation.dart' show immutable;
import 'package:flutter/material.dart'
show Colors, PopupMenuEntry, ValueChanged;
import 'package:flutter/widgets.dart'
show
Color,
EdgeInsetsGeometry,
TextStyle,
VoidCallback,
TextOverflow,
EdgeInsets;

import '../../../../widgets/controller.dart';
import '../../../documents/attribute.dart';
import '../../../themes/quill_icon_theme.dart';
import '../../quill_configurations.dart';

@immutable
class QuillToolbarFontSizeButtonOptions extends QuillToolbarBaseButtonOptions {
const QuillToolbarFontSizeButtonOptions({
this.iconSize,
this.fillColor,
this.hoverElevation = 1,
this.highlightElevation = 1,
this.items,
this.rawItemsMap,
this.onSelected,
this.iconTheme,
this.attribute = Attribute.size,
this.controller,
this.afterButtonPressed,
this.tooltip,
this.padding,
this.style,
this.width,
this.initialValue,
this.labelOverflow = TextOverflow.visible,
this.itemHeight,
this.itemPadding,
this.defaultItemColor = Colors.red,
});

final double? iconSize;
final Color? fillColor;
final double hoverElevation;
final double highlightElevation;
@Deprecated('It is not required because of `rawItemsMap`')
final List<PopupMenuEntry<String>>? items;
final Map<String, String>? rawItemsMap;
final ValueChanged<String>? onSelected;
@override
final QuillIconTheme? iconTheme;
final Attribute attribute;
@override
final QuillController? controller;
@override
final VoidCallback? afterButtonPressed;
@override
final String? tooltip;
final EdgeInsetsGeometry? padding;
final TextStyle? style;
final double? width;
final String? initialValue;
final TextOverflow labelOverflow;
final double? itemHeight;
final EdgeInsets? itemPadding;
final Color? defaultItemColor;
}
48 changes: 33 additions & 15 deletions lib/src/models/config/toolbar/configurations.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import 'package:equatable/equatable.dart';
import 'package:flutter/foundation.dart' show immutable;

import '../../documents/attribute.dart';
import 'buttons/base.dart';
import 'buttons/font_family.dart';
// import 'buttons/font_size.dart';
import 'buttons/history.dart';

export './buttons/base.dart';
export './buttons/font_family.dart';
export './buttons/font_size.dart';
export './buttons/history.dart';
export './buttons/toggle_style.dart';

Expand All @@ -23,7 +26,7 @@ const double kToolbarSectionSpacing = 4;

/// The configurations for the toolbar widget of flutter quill
@immutable
class QuillToolbarConfigurations {
class QuillToolbarConfigurations extends Equatable {
const QuillToolbarConfigurations({
this.buttonOptions = const QuillToolbarButtonOptions(),
this.multiRowsDisplay = true,
Expand All @@ -44,7 +47,7 @@ class QuillToolbarConfigurations {
if (alternativeToolbarSize != null) {
return alternativeToolbarSize;
}
return buttonOptions.baseButtonOptions.globalIconSize * 2;
return buttonOptions.base.globalIconSize * 2;
}

/// If you want change spesefic buttons or all of them
Expand All @@ -67,27 +70,42 @@ class QuillToolbarConfigurations {
/// };
/// ```
final Map<String, String>? fontFamilyValues;

@override
List<Object?> get props => [
buttonOptions,
multiRowsDisplay,
fontFamilyValues,
toolbarSize,
];
}

/// The configurations for the buttons of the toolbar widget of flutter quill
@immutable
class QuillToolbarButtonOptions {
class QuillToolbarButtonOptions extends Equatable {
const QuillToolbarButtonOptions({
this.baseButtonOptions = const QuillToolbarBaseButtonOptions(),
this.undoHistoryButtonOptions = const QuillToolbarHistoryButtonOptions(
this.base = const QuillToolbarBaseButtonOptions(),
this.undoHistory = const QuillToolbarHistoryButtonOptions(
isUndo: true,
),
this.redoHistoryButtonOptions = const QuillToolbarHistoryButtonOptions(
this.redoHistory = const QuillToolbarHistoryButtonOptions(
isUndo: false,
),
this.fontFamilyButtonOptions = const QuillToolbarFontFamilyButtonOptions(
attribute: Attribute.font,
),
this.fontFamily = const QuillToolbarFontFamilyButtonOptions(),
// this.fontSize = const QuillToolbarFontSizeButtonOptions(),
});

/// The base configurations for all the buttons
final QuillToolbarBaseButtonOptions baseButtonOptions;
final QuillToolbarHistoryButtonOptions undoHistoryButtonOptions;
final QuillToolbarHistoryButtonOptions redoHistoryButtonOptions;
final QuillToolbarFontFamilyButtonOptions fontFamilyButtonOptions;
/// The base configurations for all the buttons which will apply to all
/// but if the options overrided in the spesefic button options
/// then it will use that instead
final QuillToolbarBaseButtonOptions base;
final QuillToolbarHistoryButtonOptions undoHistory;
final QuillToolbarHistoryButtonOptions redoHistory;
final QuillToolbarFontFamilyButtonOptions fontFamily;
// final QuillToolbarFontSizeButtonOptions fontSize;

@override
List<Object?> get props => [
base,
];
}
Loading

0 comments on commit 55f5101

Please sign in to comment.