Fix errors when not in a View (#1315)

pull/1316/head
Adil Hanney 2 years ago committed by GitHub
parent 5ff09327db
commit adb06b009a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      example/linux/flutter/generated_plugin_registrant.cc
  2. 1
      example/linux/flutter/generated_plugins.cmake
  3. 2
      example/macos/Flutter/GeneratedPluginRegistrant.swift
  4. 3
      example/windows/flutter/generated_plugin_registrant.cc
  5. 1
      example/windows/flutter/generated_plugins.cmake
  6. 4
      lib/src/widgets/editor.dart
  7. 2
      lib/src/widgets/raw_editor.dart
  8. 2
      lib/src/widgets/text_block.dart
  9. 2
      test/widgets/controller_test.dart

@ -6,10 +6,14 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_selector_linux/file_selector_plugin.h>
#include <pasteboard/pasteboard_plugin.h> #include <pasteboard/pasteboard_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h> #include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) { void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) file_selector_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "FileSelectorPlugin");
file_selector_plugin_register_with_registrar(file_selector_linux_registrar);
g_autoptr(FlPluginRegistrar) pasteboard_registrar = g_autoptr(FlPluginRegistrar) pasteboard_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin"); fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin");
pasteboard_plugin_register_with_registrar(pasteboard_registrar); pasteboard_plugin_register_with_registrar(pasteboard_registrar);

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
pasteboard pasteboard
url_launcher_linux url_launcher_linux
) )

@ -6,12 +6,14 @@ import FlutterMacOS
import Foundation import Foundation
import device_info_plus import device_info_plus
import file_selector_macos
import pasteboard import pasteboard
import path_provider_foundation import path_provider_foundation
import url_launcher_macos import url_launcher_macos
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin")) DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin")) PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))

@ -6,10 +6,13 @@
#include "generated_plugin_registrant.h" #include "generated_plugin_registrant.h"
#include <file_selector_windows/file_selector_windows.h>
#include <pasteboard/pasteboard_plugin.h> #include <pasteboard/pasteboard_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h> #include <url_launcher_windows/url_launcher_windows.h>
void RegisterPlugins(flutter::PluginRegistry* registry) { void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
PasteboardPluginRegisterWithRegistrar( PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin")); registry->GetRegistrarForPlugin("PasteboardPlugin"));
UrlLauncherWindowsRegisterWithRegistrar( UrlLauncherWindowsRegisterWithRegistrar(

@ -3,6 +3,7 @@
# #
list(APPEND FLUTTER_PLUGIN_LIST list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
pasteboard pasteboard
url_launcher_windows url_launcher_windows
) )

@ -478,8 +478,8 @@ class QuillEditorState extends State<QuillEditor>
selectionColor = selectionTheme.selectionColor ?? selectionColor = selectionTheme.selectionColor ??
cupertinoTheme.primaryColor.withOpacity(0.40); cupertinoTheme.primaryColor.withOpacity(0.40);
cursorRadius ??= const Radius.circular(2); cursorRadius ??= const Radius.circular(2);
cursorOffset = cursorOffset = Offset(
Offset(iOSHorizontalOffset / View.of(context).devicePixelRatio, 0); iOSHorizontalOffset / MediaQuery.of(context).devicePixelRatio, 0);
} else { } else {
textSelectionControls = materialTextSelectionControls; textSelectionControls = materialTextSelectionControls;
paintCursorAboveText = false; paintCursorAboveText = false;

@ -973,7 +973,7 @@ class RawEditorState extends EditorState
widget.selectionColor, widget.selectionColor,
widget.enableInteractiveSelection, widget.enableInteractiveSelection,
_hasFocus, _hasFocus,
View.of(context).devicePixelRatio, MediaQuery.of(context).devicePixelRatio,
_cursorCont); _cursorCont);
return editableTextLine; return editableTextLine;
} }

@ -159,7 +159,7 @@ class EditableTextBlock extends StatelessWidget {
color, color,
enableInteractiveSelection, enableInteractiveSelection,
hasFocus, hasFocus,
View.of(context).devicePixelRatio, MediaQuery.of(context).devicePixelRatio,
cursorCont); cursorCont);
final nodeTextDirection = getDirectionOfNode(line); final nodeTextDirection = getDirectionOfNode(line);
children.add(Directionality( children.add(Directionality(

@ -104,7 +104,7 @@ void main() {
test('getAllIndividualSelectionStylesAndEmbed', () { test('getAllIndividualSelectionStylesAndEmbed', () {
controller controller
..formatText(0, 2, Attribute.bold) ..formatText(0, 2, Attribute.bold)
..replaceText(2, 2, BlockEmbed.image('/test'),null) ..replaceText(2, 2, BlockEmbed.image('/test'), null)
..updateSelection(const TextSelection(baseOffset: 0, extentOffset: 4), ..updateSelection(const TextSelection(baseOffset: 0, extentOffset: 4),
ChangeSource.REMOTE); ChangeSource.REMOTE);
final result = controller.getAllIndividualSelectionStylesAndEmbed(); final result = controller.getAllIndividualSelectionStylesAndEmbed();

Loading…
Cancel
Save