Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix errors when not in a View #1315

Merged
merged 2 commits into from
Jul 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions example/linux/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,14 @@

#include "generated_plugin_registrant.h"

#include <file_selector_linux/file_selector_plugin.h>
#include <pasteboard/pasteboard_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>

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 =
fl_plugin_registry_get_registrar_for_plugin(registry, "PasteboardPlugin");
pasteboard_plugin_register_with_registrar(pasteboard_registrar);
Expand Down
1 change: 1 addition & 0 deletions example/linux/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
file_selector_linux
pasteboard
url_launcher_linux
)
Expand Down
2 changes: 2 additions & 0 deletions example/macos/Flutter/GeneratedPluginRegistrant.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import FlutterMacOS
import Foundation

import device_info_plus
import file_selector_macos
import pasteboard
import path_provider_foundation
import url_launcher_macos

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
DeviceInfoPlusMacosPlugin.register(with: registry.registrar(forPlugin: "DeviceInfoPlusMacosPlugin"))
FileSelectorPlugin.register(with: registry.registrar(forPlugin: "FileSelectorPlugin"))
PasteboardPlugin.register(with: registry.registrar(forPlugin: "PasteboardPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
Expand Down
3 changes: 3 additions & 0 deletions example/windows/flutter/generated_plugin_registrant.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,13 @@

#include "generated_plugin_registrant.h"

#include <file_selector_windows/file_selector_windows.h>
#include <pasteboard/pasteboard_plugin.h>
#include <url_launcher_windows/url_launcher_windows.h>

void RegisterPlugins(flutter::PluginRegistry* registry) {
FileSelectorWindowsRegisterWithRegistrar(
registry->GetRegistrarForPlugin("FileSelectorWindows"));
PasteboardPluginRegisterWithRegistrar(
registry->GetRegistrarForPlugin("PasteboardPlugin"));
UrlLauncherWindowsRegisterWithRegistrar(
Expand Down
1 change: 1 addition & 0 deletions example/windows/flutter/generated_plugins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#

list(APPEND FLUTTER_PLUGIN_LIST
file_selector_windows
pasteboard
url_launcher_windows
)
Expand Down
4 changes: 2 additions & 2 deletions lib/src/widgets/editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -478,8 +478,8 @@ class QuillEditorState extends State<QuillEditor>
selectionColor = selectionTheme.selectionColor ??
cupertinoTheme.primaryColor.withOpacity(0.40);
cursorRadius ??= const Radius.circular(2);
cursorOffset =
Offset(iOSHorizontalOffset / View.of(context).devicePixelRatio, 0);
cursorOffset = Offset(
iOSHorizontalOffset / MediaQuery.of(context).devicePixelRatio, 0);
} else {
textSelectionControls = materialTextSelectionControls;
paintCursorAboveText = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/raw_editor.dart
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,7 @@ class RawEditorState extends EditorState
widget.selectionColor,
widget.enableInteractiveSelection,
_hasFocus,
View.of(context).devicePixelRatio,
MediaQuery.of(context).devicePixelRatio,
_cursorCont);
return editableTextLine;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/src/widgets/text_block.dart
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ class EditableTextBlock extends StatelessWidget {
color,
enableInteractiveSelection,
hasFocus,
View.of(context).devicePixelRatio,
MediaQuery.of(context).devicePixelRatio,
cursorCont);
final nodeTextDirection = getDirectionOfNode(line);
children.add(Directionality(
Expand Down
2 changes: 1 addition & 1 deletion test/widgets/controller_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void main() {
test('getAllIndividualSelectionStylesAndEmbed', () {
controller
..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),
ChangeSource.REMOTE);
final result = controller.getAllIndividualSelectionStylesAndEmbed();
Expand Down