-
Notifications
You must be signed in to change notification settings - Fork 845
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: replace flutter_keyboard_visibility with flutter_keyboard_visibi…
…lity_temp_fork to support Flutter/Wasm target (#2293) * fix: replace flutter_keyboard_visibility with flutter_keyboard_visibility_temp_fork to support wasm and be able to target the latest version of compileSdkVersion on Android * fix(example): remove hydrated_bloc to run Flutter/Wasm * fix(wasm): avoid using quill_controller_web_stub.dart for web which will throw exception due to usage of dart.library.html in a conditional check * chore: remove web package as no longer used * chore: add related comments to quill_controller_web_real.dart and quill_controller_web_stub.dart * chore: format quill_controller_web_real.dart and quill_controller_web_stub.dart
- Loading branch information
Showing
8 changed files
with
59 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,15 @@ | ||
import 'package:flutter/material.dart' show ThemeMode; | ||
import 'package:flutter_bloc/flutter_bloc.dart'; | ||
import 'package:freezed_annotation/freezed_annotation.dart'; | ||
import 'package:hydrated_bloc/hydrated_bloc.dart' show HydratedCubit; | ||
|
||
part 'settings_state.dart'; | ||
part 'settings_cubit.freezed.dart'; | ||
part 'settings_cubit.g.dart'; | ||
|
||
class SettingsCubit extends HydratedCubit<SettingsState> { | ||
class SettingsCubit extends Cubit<SettingsState> { | ||
SettingsCubit() : super(const SettingsState()); | ||
|
||
void updateSettings(SettingsState newSettingsState) { | ||
emit(newSettingsState); | ||
} | ||
|
||
@override | ||
SettingsState? fromJson(Map<String, dynamic> json) { | ||
return SettingsState.fromJson(json); | ||
} | ||
|
||
@override | ||
Map<String, dynamic>? toJson(SettingsState state) { | ||
return state.toJson(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,42 @@ | ||
// TODO: This might be removed from here or moved to quill_native_bridge | ||
// commented in https://github.com/singerdmx/flutter-quill/pull/2293 | ||
// removed due to bug https://github.com/singerdmx/flutter-quill/issues/2220 | ||
// added to solve https://github.com/singerdmx/flutter-quill/issues/1998#issuecomment-2361599854 | ||
|
||
// This file should not be exported as the APIs in it are meant for internal usage only | ||
|
||
import 'dart:async' show StreamSubscription; | ||
// import 'dart:async' show StreamSubscription; | ||
|
||
import 'package:web/web.dart'; | ||
// import 'package:web/web.dart'; | ||
|
||
import '../quill_controller.dart'; | ||
// ignore: unused_import | ||
import '../quill_controller_rich_paste.dart'; | ||
// import '../quill_controller.dart'; | ||
// // ignore: unused_import | ||
// import '../quill_controller_rich_paste.dart'; | ||
|
||
/// Paste event for the web. | ||
/// | ||
/// Will be `null` when [QuillControllerWeb.initializeWebPasteEvent] was not called | ||
/// or the subscription was canceled due to calling [QuillControllerWeb.cancelWebPasteEvent] | ||
/// | ||
/// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event | ||
StreamSubscription? _webPasteEventSubscription; | ||
// /// Paste event for the web. | ||
// /// | ||
// /// Will be `null` when [QuillControllerWeb.initializeWebPasteEvent] was not called | ||
// /// or the subscription was canceled due to calling [QuillControllerWeb.cancelWebPasteEvent] | ||
// /// | ||
// /// See: https://developer.mozilla.org/en-US/docs/Web/API/Element/paste_event | ||
// StreamSubscription? _webPasteEventSubscription; | ||
|
||
extension QuillControllerWeb on QuillController { | ||
void initializeWebPasteEvent() { | ||
_webPasteEventSubscription = | ||
EventStreamProviders.pasteEvent.forTarget(window.document).listen((e) { | ||
// TODO: See if we can support markdown paste | ||
final html = e.clipboardData?.getData('text/html'); | ||
if (html == null) { | ||
return; | ||
} | ||
// TODO: Temporarily disable the rich text pasting feature as a workaround | ||
// due to issue https://github.com/singerdmx/flutter-quill/issues/2220 | ||
// pasteHTML(html: html); | ||
}); | ||
} | ||
// extension QuillControllerWeb on QuillController { | ||
// void initializeWebPasteEvent() { | ||
// _webPasteEventSubscription = | ||
// EventStreamProviders.pasteEvent.forTarget(window.document).listen((e) { | ||
// final html = e.clipboardData?.getData('text/html'); | ||
// if (html == null) { | ||
// return; | ||
// } | ||
// // TODO: Temporarily disable the rich text pasting feature as a workaround | ||
// // due to issue https://github.com/singerdmx/flutter-quill/issues/2220 | ||
// // pasteHTML(html: html); | ||
// }); | ||
// } | ||
|
||
void cancelWebPasteEvent() { | ||
_webPasteEventSubscription?.cancel(); | ||
_webPasteEventSubscription = null; | ||
} | ||
} | ||
// void cancelWebPasteEvent() { | ||
// _webPasteEventSubscription?.cancel(); | ||
// _webPasteEventSubscription = null; | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,23 @@ | ||
// This file should not be exported as the APIs in it are meant for internal usage only | ||
// See quill_controller_web_real.dart if you want to know why this is not removed yet | ||
// will be addressed in future releases. | ||
|
||
import '../quill_controller.dart'; | ||
// // This file should not be exported as the APIs in it are meant for internal usage only | ||
|
||
// This is a mock implementation to compile the app on non-web platforms. | ||
// The real implementation is quill_controller_web_real.dart | ||
// import '../quill_controller.dart'; | ||
|
||
extension QuillControllerWeb on QuillController { | ||
void initializeWebPasteEvent() { | ||
throw UnsupportedError( | ||
'The initializeWebPasteEvent() method should be called only on web.', | ||
); | ||
} | ||
// // This is a mock implementation to compile the app on non-web platforms. | ||
// // The real implementation is quill_controller_web_real.dart | ||
|
||
void cancelWebPasteEvent() { | ||
throw UnsupportedError( | ||
'The closeWebPasteEvent() method should be called only on web.', | ||
); | ||
} | ||
} | ||
// extension QuillControllerWeb on QuillController { | ||
// void initializeWebPasteEvent() { | ||
// throw UnsupportedError( | ||
// 'The initializeWebPasteEvent() method should be called only on web.', | ||
// ); | ||
// } | ||
|
||
// void cancelWebPasteEvent() { | ||
// throw UnsupportedError( | ||
// 'The closeWebPasteEvent() method should be called only on web.', | ||
// ); | ||
// } | ||
// } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters