Skip to content

Commit

Permalink
flutter quill ujpdates part 3
Browse files Browse the repository at this point in the history
  • Loading branch information
thelukewalton committed Jan 11, 2024
1 parent fd9693e commit 0bac939
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 134 deletions.
28 changes: 25 additions & 3 deletions example/lib/pages/components/quill_editor_demo.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:flutter_quill/flutter_quill.dart';
// import 'package:flutter_quill/flutter_quill.dart';
import 'package:zds_flutter/zds_flutter.dart';

///Example for htmlEditor
Expand All @@ -27,15 +26,37 @@ class _QuillEditorDemoState extends State<QuillEditorDemo> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Quill Editor')),
appBar: AppBar(
title: const Text('Quill Editor'),
actions: [
IconButton(
icon: const Icon(Icons.html),
onPressed: () {
showDialog(
context: context,
builder: (context) {
return ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.7),
child: Dialog(
child: ZdsCard(
child: Text(ZdsQuillDelta(document: controller.document).toHtml()),
),
),
);
},
);
},
),
],
),
floatingActionButton: FloatingActionButton(
child: const Icon(Icons.edit),
onPressed: () {
ZdsQuillEditorPage.edit(
context,
title: 'Edit Notes',
initialDelta: ZdsQuillDelta(document: controller.document),
charLimit: 200,
charLimit: 20000,
).then((value) {
if (value != null) {
controller.document = value.document;
Expand All @@ -52,6 +73,7 @@ class _QuillEditorDemoState extends State<QuillEditorDemo> {
controller: controller,
readOnly: true,
),
focusNode: FocusNode(canRequestFocus: false),
),
),
],
Expand Down
83 changes: 0 additions & 83 deletions example/lib/pages/quill_editor_demo.dart

This file was deleted.

2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import device_info_plus
import file_selector_macos
import flutter_image_compress_macos
import flutter_inappwebview_macos
import gal
import irondash_engine_context
import package_info_plus
import path_provider_foundation
Expand All @@ -25,6 +26,7 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
FlutterImageCompressMacosPlugin.register(with: registry.registrar(forPlugin: "FlutterImageCompressMacosPlugin"))
InAppWebViewFlutterPlugin.register(with: registry.registrar(forPlugin: "InAppWebViewFlutterPlugin"))
GalPlugin.register(with: registry.registrar(forPlugin: "GalPlugin"))
IrondashEngineContextPlugin.register(with: registry.registrar(forPlugin: "IrondashEngineContextPlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
Expand Down
3 changes: 3 additions & 0 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ dependencies:
zds_flutter:
path: ../
flutter_quill: ^9.2.2
flutter_localizations:
sdk: flutter
zeta_flutter: ^0.1.1+1

flutter:
uses-material-design: true
Expand Down
6 changes: 6 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,21 @@
#include "generated_plugin_registrant.h"

#include <file_selector_windows/file_selector_windows.h>
#include <gal/gal_plugin_c_api.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>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
GalPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("GalPluginCApi"));
IrondashEngineContextPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("IrondashEngineContextPluginCApi"));
PermissionHandlerWindowsPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PermissionHandlerWindowsPlugin"));
SuperNativeExtensionsPluginCApiRegisterWithRegistrar(
registry->GetRegistrarForPlugin("SuperNativeExtensionsPluginCApi"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
2 changes: 2 additions & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
gal
irondash_engine_context
permission_handler_windows
super_native_extensions
url_launcher_windows
)
Expand Down
1 change: 0 additions & 1 deletion lib/src/components/molecules/block_table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ class _BlockTable extends State<ZdsBlockTable> with WidgetsBindingObserver {
alignment: Alignment.center,
width: _getDayColumnWidth(),
height: 28,
// height: 28 * MediaQuery.of(context).textScaleFactor,
color: themeData.colorScheme.surface,
child: Text(
items[index].text,
Expand Down
57 changes: 12 additions & 45 deletions lib/src/components/organisms/quill_editor/quill_toolbar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ class ZdsQuillToolbar extends QuillToolbar {
///```
///
/// To disable tooltips just pass empty map as well.
Map<dynamic, String>? tooltips,
Map<ToolbarButtons, String>? tooltips,

/// The locale to use for the editor toolbar, defaults to system locale
/// More at https://github.com/singerdmx/flutter-quill#translation
Expand Down Expand Up @@ -345,7 +345,7 @@ class ZdsQuillToolbar extends QuillToolbar {
// default button tooltips
final buttonTooltips = tooltips ??
<ToolbarButtons, String>{
ToolbarButtons.undo: context.loc.undo, // 'Undo'.i18n,
ToolbarButtons.undo: context.loc.undo,
ToolbarButtons.redo: context.loc.redo,
ToolbarButtons.fontFamily: context.loc.fontFamily,
ToolbarButtons.fontSize: context.loc.fontSize,
Expand Down Expand Up @@ -376,6 +376,7 @@ class ZdsQuillToolbar extends QuillToolbar {
ToolbarButtons.link: context.loc.link,
ToolbarButtons.search: context.loc.search,
};

return Container(
decoration: configurations.decoration ?? BoxDecoration(color: configurations.color),
constraints: BoxConstraints.tightFor(
Expand Down Expand Up @@ -482,7 +483,7 @@ class ZdsQuillToolbar extends QuillToolbar {
iconSize: toolbarIconSize,
iconTheme: iconTheme,
afterButtonPressed: afterButtonPressed,
// tooltip: buttonTooltips[ToolbarButtons.underline],
tooltip: buttonTooltips[ToolbarButtons.underline],
),
),
if (showStrikeThrough)
Expand Down Expand Up @@ -723,52 +724,18 @@ class ZdsQuillToolbar extends QuillToolbar {
tooltip: buttonTooltips[ToolbarButtons.search],
),
),
if (showFontFamily)
QuillToolbarFontFamilyButton(
if (customButtons.isNotEmpty)
if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace),
for (final customButton in customButtons)
QuillToolbarCustomButton(
options: customButton.options,
controller: controller,
options: QuillToolbarFontFamilyButtonOptions(
iconTheme: iconTheme,
iconSize: toolbarIconSize,
afterButtonPressed: afterButtonPressed,
// rawItemsMap: fontFamilies,TODO:
),
),
if (showFontSize)
QuillToolbarFontSizeButton(
for (final customButton in configurations.customButtons)
QuillToolbarCustomButton(
options: customButton,
controller: controller,
options: QuillToolbarFontSizeButtonOptions(
iconSize: toolbarIconSize,
afterButtonPressed: afterButtonPressed,
// iconTheme: iconTheme,
// rawItemsMap: fontSizes,TODO:
tooltip: buttonTooltips[ToolbarButtons.fontSize],
),
),
if (customButtons.isNotEmpty)
if (showDividers) QuillToolbarDivider(axis, color: sectionDividerColor, space: sectionDividerSpace),
for (final QuillToolbarCustomButton? customButton in customButtons)
if (customButton != null) ...<Widget>[
InkWell(
// onTap: customButton.onTap,
// child: customButton.child,
),
] else ...<Widget>[
// QuillToolbarCustomButton(
// controller: controller,
// options: customButton!.options,

// // options: QuillToolbarCustomButtonOptions(
// // onPressed: customButton.onTap,
// // icon: customButton.icon,
// // // iconColor: customButton.iconColor,
// // // iconSize: toolbarIconSize,

// // iconTheme: iconTheme,
// // afterButtonPressed: afterButtonPressed,
// // tooltip: customButton.tooltip,
// // ),
// ),
],
],
),
);
Expand Down
2 changes: 1 addition & 1 deletion lib/zds_flutter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ export 'src/utils/localizations.dart';
export 'src/utils/theme.dart';
export 'src/utils/tools.dart';

/// Name of package ttttttttt
/// Name of package
const String packageName = 'zds_flutter';
3 changes: 2 additions & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ dependencies:
flutter_localizations:
sdk: flutter
flutter_quill: ^9.2.2
flutter_quill_extensions: ^9.2.2
flutter_slidable: ^3.0.0
flutter_svg: ^2.0.7
flutter_swipe_action_cell: ^3.0.2
Expand Down Expand Up @@ -69,7 +70,7 @@ dependencies:
dev_dependencies:
flutter_test:
sdk: flutter
lottie: ^2.1.0
lottie: ^3.0.0
zds_analysis: ^1.0.0

flutter:
Expand Down

0 comments on commit 0bac939

Please sign in to comment.