Skip to content

Commit

Permalink
quill refactor part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jan 11, 2024
1 parent 805ba4d commit fd9693e
Show file tree
Hide file tree
Showing 7 changed files with 536 additions and 441 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
ref: ${{ github.head_ref }}
- uses: subosito/flutter-action@v2
with:
flutter-version: "3.13.x"
flutter-version: "3.16.x"
channel: "stable"
- name: Setup flutter
run: flutter pub get
Expand Down
1 change: 0 additions & 1 deletion example/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ migrate_working_dir/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols
Expand Down
4 changes: 4 additions & 0 deletions example/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
* https://developer.mozilla.org/en-US/doc/Web/HTML/Element/base
-->
<base href="$FLUTTER_BASE_HREF">
<script type="application/javascript" src="/assets/packages/flutter_inappwebview/assets/web/web_support.js"
defer></script>

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
Expand All @@ -31,6 +33,8 @@
<link rel="manifest" href="manifest.json">
<script type="application/javascript" src="assets/packages/flutter_inappwebview/assets/web/web_support.js"
defer=""></script>
<script type="application/javascript" src="/assets/packages/flutter_inappwebview_web/assets/web/web_support.js"
defer></script>
</head>

<body>
Expand Down
3 changes: 0 additions & 3 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

#include <file_selector_windows/file_selector_windows.h>
#include <irondash_engine_context/irondash_engine_context_plugin_c_api.h>
#include <permission_handler_windows/permission_handler_windows_plugin.h>
#include <super_native_extensions/super_native_extensions_plugin_c_api.h>
#include <url_launcher_windows/url_launcher_windows.h>

Expand All @@ -17,8 +16,6 @@ void RegisterPlugins(flutter::PluginRegistry* registry) {
registry->GetRegistrarForPlugin("FileSelectorWindows"));
IrondashEngineContextPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
1 change: 0 additions & 1 deletion example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
irondash_engine_context
permission_handler_windows
super_native_extensions
url_launcher_windows
)
Expand Down
33 changes: 14 additions & 19 deletions lib/src/components/organisms/quill_editor/quill_editor_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ import 'package:flutter_quill/quill_delta.dart';
import '../../../../zds_flutter.dart';
import 'quill_toolbar.dart';

/// Default options for ZDS Quill Toolbar
final zdsQuillToolbarOptions = QuillToolbarOption.values.toSet()
..remove(QuillToolbarOption.redo)
..remove(QuillToolbarOption.undo)
..remove(QuillToolbarOption.fontFamily)
..remove(QuillToolbarOption.fontSize);

/// Represents a Quill editor page.
class ZdsQuillEditorPage extends StatefulWidget {
/// Constructs a [ZdsQuillEditorPage] with private constructor.
Expand All @@ -20,7 +27,7 @@ class ZdsQuillEditorPage extends StatefulWidget {
required this.readOnly,
required this.showClearFormatAsFloating,
this.quillToolbarPosition,
this.toolbarIconSize = 24,
this.toolbarIconSize = kDefaultIconSize,
this.langCode,
this.charLimit = 10000,
this.placeholder = '',
Expand Down Expand Up @@ -70,7 +77,7 @@ class ZdsQuillEditorPage extends StatefulWidget {
int charLimit = 10000,
bool readOnly = false,
ZdsQuillDelta? initialDelta,
double toolbarIconSize = 24,
double toolbarIconSize = kDefaultIconSize,
bool fullscreenDialog = true,
bool showClearFormatAsFloating = true,
Set<QuillToolbarOption>? toolbarOptions,
Expand All @@ -88,7 +95,7 @@ class ZdsQuillEditorPage extends StatefulWidget {
toolbarIconSize: toolbarIconSize,
quillToolbarPosition: quillToolbarPosition,
showClearFormatAsFloating: showClearFormatAsFloating,
toolbarOptions: toolbarOptions ?? QuillToolbarOption.values.toSet(),
toolbarOptions: toolbarOptions ?? zdsQuillToolbarOptions,
langCode: langCode ?? ComponentStrings.of(context).locale.toString(),
initialDelta: initialDelta?.copyWith(document: initialDelta.document),
);
Expand Down Expand Up @@ -376,9 +383,7 @@ class _ZdsQuillEditorState extends State<ZdsQuillEditorPage> with FrameCallbackM
toolbarIconSize: widget.toolbarIconSize,
quillToolbarPosition: widget.quillToolbarPosition,
toolbarColor: Theme.of(context).colorScheme.surface,
toolbarOptions: <QuillToolbarOption>{...widget.toolbarOptions}
..remove(QuillToolbarOption.redo)
..remove(QuillToolbarOption.undo),
toolbarOptions: <QuillToolbarOption>{...widget.toolbarOptions},
);
}

Expand Down Expand Up @@ -544,24 +549,14 @@ class _HistoryButtonState extends State<_HistoryButton> {
widget.controller.changes.listen((quill.DocChange event) async {
_setIconColor();
});

return quill.QuillToolbarIconButton(
onPressed: _changeHistory,
icon: Icon(
widget.icon,
size: widget.iconSize * kIconButtonFactor,
color: _iconColor,
),
isSelected: false,
iconTheme: const quill.QuillIconTheme(),
icon: Icon(widget.icon, size: widget.iconSize, color: _iconColor),
onPressed: _changeHistory,
afterPressed: widget.afterPressed,
);
// return quill.QuillToolbarHistoryButton(controller: controller, isUndo: isUndo)

// return quill.QuillIconButton(
// highlightElevation: 0,
// hoverElevation: 0,
// fillColor: Colors.transparent,
// );
}

void _setIconColor() {
Expand Down
Loading

0 comments on commit fd9693e

Please sign in to comment.