added disposable internal class, fixed some docs
This commit is contained in:
parent
0dd9dfbff6
commit
c81cfc964c
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,6 @@ import 'dart:async';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/widgets.dart';
|
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,53 @@ import '../in_app_webview/android/in_app_webview_options.dart';
|
||||||
import 'apple/in_app_browser_options.dart';
|
import 'apple/in_app_browser_options.dart';
|
||||||
import '../in_app_webview/apple/in_app_webview_options.dart';
|
import '../in_app_webview/apple/in_app_webview_options.dart';
|
||||||
|
|
||||||
|
///Class that represents the settings that can be used for an [InAppBrowser] instance.
|
||||||
|
class InAppBrowserClassSettings {
|
||||||
|
///Browser settings.
|
||||||
|
late InAppBrowserSettings browserSettings;
|
||||||
|
|
||||||
|
///WebView settings.
|
||||||
|
late InAppWebViewSettings webViewSettings;
|
||||||
|
|
||||||
|
InAppBrowserClassSettings(
|
||||||
|
{InAppBrowserSettings? browserSettings,
|
||||||
|
InAppWebViewSettings? webViewSettings}) {
|
||||||
|
this.browserSettings = browserSettings ?? InAppBrowserSettings();
|
||||||
|
this.webViewSettings = webViewSettings ?? InAppWebViewSettings();
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
Map<String, dynamic> options = {};
|
||||||
|
|
||||||
|
options.addAll(browserSettings.toMap());
|
||||||
|
options.addAll(webViewSettings.toMap());
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
factory InAppBrowserClassSettings.fromMap(Map<String, dynamic> options,
|
||||||
|
{InAppBrowserClassSettings? instance}) {
|
||||||
|
if (instance == null) {
|
||||||
|
instance = InAppBrowserClassSettings();
|
||||||
|
}
|
||||||
|
instance.browserSettings = InAppBrowserSettings.fromMap(options);
|
||||||
|
instance.webViewSettings = InAppWebViewSettings.fromMap(options);
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
InAppBrowserClassSettings copy() {
|
||||||
|
return InAppBrowserClassSettings.fromMap(toMap());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class BrowserOptions {
|
class BrowserOptions {
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {};
|
return {};
|
||||||
|
@ -36,54 +83,6 @@ class BrowserOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the settings that can be used for an [InAppBrowser] instance.
|
|
||||||
class InAppBrowserClassSettings {
|
|
||||||
///Browser settings.
|
|
||||||
late InAppBrowserSettings browserSettings;
|
|
||||||
|
|
||||||
///WebView settings.
|
|
||||||
late InAppWebViewSettings webViewSettings;
|
|
||||||
|
|
||||||
InAppBrowserClassSettings(
|
|
||||||
{InAppBrowserSettings? browserSettings,
|
|
||||||
InAppWebViewSettings? webViewSettings}) {
|
|
||||||
this.browserSettings = browserSettings ?? InAppBrowserSettings();
|
|
||||||
this.webViewSettings = webViewSettings ?? InAppWebViewSettings();
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
Map<String, dynamic> options = {};
|
|
||||||
|
|
||||||
options.addAll(this.browserSettings.toMap());
|
|
||||||
options.addAll(this.webViewSettings.toMap());
|
|
||||||
|
|
||||||
return options;
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return this.toMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return toMap().toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
static InAppBrowserClassSettings fromMap(Map<String, dynamic> options,
|
|
||||||
{InAppBrowserClassSettings? instance}) {
|
|
||||||
if (instance == null) {
|
|
||||||
instance = InAppBrowserClassSettings();
|
|
||||||
}
|
|
||||||
instance.browserSettings = InAppBrowserSettings.fromMap(options);
|
|
||||||
instance.webViewSettings = InAppWebViewSettings.fromMap(options);
|
|
||||||
return instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
InAppBrowserClassSettings copy() {
|
|
||||||
return InAppBrowserClassSettings.fromMap(this.toMap());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///This class represents all [InAppBrowser] settings available.
|
///This class represents all [InAppBrowser] settings available.
|
||||||
class InAppBrowserSettings
|
class InAppBrowserSettings
|
||||||
implements BrowserOptions, AndroidOptions, IosOptions {
|
implements BrowserOptions, AndroidOptions, IosOptions {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import 'in_app_webview_settings.dart';
|
||||||
import '../pull_to_refresh/pull_to_refresh_controller.dart';
|
import '../pull_to_refresh/pull_to_refresh_controller.dart';
|
||||||
import '../pull_to_refresh/pull_to_refresh_settings.dart';
|
import '../pull_to_refresh/pull_to_refresh_settings.dart';
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
///Class that represents a WebView in headless mode.
|
///Class that represents a WebView in headless mode.
|
||||||
///It can be used to run a WebView in background without attaching an `InAppWebView` to the widget tree.
|
///It can be used to run a WebView in background without attaching an `InAppWebView` to the widget tree.
|
||||||
|
@ -24,7 +25,7 @@ import '../util.dart';
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
///- Web
|
///- Web
|
||||||
class HeadlessInAppWebView implements WebView {
|
class HeadlessInAppWebView implements WebView, Disposable {
|
||||||
///View ID.
|
///View ID.
|
||||||
late final String id;
|
late final String id;
|
||||||
|
|
||||||
|
@ -227,6 +228,7 @@ class HeadlessInAppWebView implements WebView {
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
///- Web
|
///- Web
|
||||||
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
if (!_running) {
|
if (!_running) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import 'dart:ui';
|
import 'dart:ui';
|
||||||
|
|
||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter_inappwebview/flutter_inappwebview.dart';
|
|
||||||
|
|
||||||
import 'android/in_app_webview_options.dart';
|
import 'android/in_app_webview_options.dart';
|
||||||
import 'apple/in_app_webview_options.dart';
|
import 'apple/in_app_webview_options.dart';
|
||||||
|
@ -11,32 +10,8 @@ import '../util.dart';
|
||||||
import '../in_app_browser/in_app_browser_settings.dart';
|
import '../in_app_browser/in_app_browser_settings.dart';
|
||||||
import 'webview.dart';
|
import 'webview.dart';
|
||||||
|
|
||||||
class WebViewOptions {
|
|
||||||
Map<String, dynamic> toMap() {
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static WebViewOptions fromMap(Map<String, dynamic> map) {
|
|
||||||
return WebViewOptions();
|
|
||||||
}
|
|
||||||
|
|
||||||
WebViewOptions copy() {
|
|
||||||
return WebViewOptions.fromMap(this.toMap());
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
|
||||||
return this.toMap();
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
|
||||||
return toMap().toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///This class represents all the WebView settings available.
|
///This class represents all the WebView settings available.
|
||||||
class InAppWebViewSettings
|
class InAppWebViewSettings {
|
||||||
implements WebViewOptions, BrowserOptions, AndroidOptions, IosOptions {
|
|
||||||
///Set to `true` to be able to listen at the [WebView.shouldOverrideUrlLoading] event. The default value is `false`.
|
///Set to `true` to be able to listen at the [WebView.shouldOverrideUrlLoading] event. The default value is `false`.
|
||||||
///
|
///
|
||||||
///**Supported Platforms/Implementations**:
|
///**Supported Platforms/Implementations**:
|
||||||
|
@ -139,7 +114,7 @@ class InAppWebViewSettings
|
||||||
///- Web
|
///- Web
|
||||||
bool horizontalScrollBarEnabled;
|
bool horizontalScrollBarEnabled;
|
||||||
|
|
||||||
///List of custom schemes that the WebView must handle. Use the [WebView.onLoadResourceCustomScheme] event to intercept resource requests with custom scheme.
|
///List of custom schemes that the WebView must handle. Use the [WebView.onLoadResourceWithCustomScheme] event to intercept resource requests with custom scheme.
|
||||||
///
|
///
|
||||||
///**NOTE**: available on iOS 11.0+.
|
///**NOTE**: available on iOS 11.0+.
|
||||||
///
|
///
|
||||||
|
@ -949,7 +924,7 @@ class InAppWebViewSettings
|
||||||
///- [WebView.onAjaxProgress]
|
///- [WebView.onAjaxProgress]
|
||||||
///- [WebView.shouldInterceptFetchRequest]
|
///- [WebView.shouldInterceptFetchRequest]
|
||||||
///- [WebView.onConsoleMessage]
|
///- [WebView.onConsoleMessage]
|
||||||
///- [WebView.onPrint]
|
///- [WebView.onPrintRequest]
|
||||||
///- [WebView.onWindowFocus]
|
///- [WebView.onWindowFocus]
|
||||||
///- [WebView.onWindowBlur]
|
///- [WebView.onWindowBlur]
|
||||||
///- [WebView.onFindResultReceived]
|
///- [WebView.onFindResultReceived]
|
||||||
|
@ -1200,7 +1175,6 @@ class InAppWebViewSettings
|
||||||
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"));
|
allowingReadAccessTo == null || allowingReadAccessTo!.isScheme("file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
List<Map<String, Map<String, dynamic>>> contentBlockersMapList = [];
|
List<Map<String, Map<String, dynamic>>> contentBlockersMapList = [];
|
||||||
contentBlockers.forEach((contentBlocker) {
|
contentBlockers.forEach((contentBlocker) {
|
||||||
|
@ -1343,7 +1317,8 @@ class InAppWebViewSettings
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
static InAppWebViewSettings fromMap(Map<String, dynamic> map) {
|
///Gets a [InAppWebViewSettings] instance from a [Map] value.
|
||||||
|
factory InAppWebViewSettings.fromMap(Map<String, dynamic> map) {
|
||||||
List<ContentBlocker> contentBlockers = [];
|
List<ContentBlocker> contentBlockers = [];
|
||||||
List<dynamic>? contentBlockersMapList = map["contentBlockers"];
|
List<dynamic>? contentBlockersMapList = map["contentBlockers"];
|
||||||
if (contentBlockersMapList != null) {
|
if (contentBlockersMapList != null) {
|
||||||
|
@ -1537,20 +1512,17 @@ class InAppWebViewSettings
|
||||||
return settings;
|
return settings;
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
InAppWebViewSettings copy() {
|
||||||
Map<String, dynamic> toJson() {
|
return InAppWebViewSettings.fromMap(toMap());
|
||||||
return this.toMap();
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
String toString() {
|
||||||
return toMap().toString();
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
InAppWebViewSettings copy() {
|
|
||||||
return InAppWebViewSettings.fromMap(this.toMap());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///Class that represents the options that can be used for a [WebView].
|
///Class that represents the options that can be used for a [WebView].
|
||||||
|
@ -1615,6 +1587,29 @@ class InAppWebViewGroupOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class WebViewOptions {
|
||||||
|
Map<String, dynamic> toMap() {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
static WebViewOptions fromMap(Map<String, dynamic> map) {
|
||||||
|
return WebViewOptions();
|
||||||
|
}
|
||||||
|
|
||||||
|
WebViewOptions copy() {
|
||||||
|
return WebViewOptions.fromMap(this.toMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return this.toMap();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return toMap().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///Use [InAppWebViewSettings] instead.
|
///Use [InAppWebViewSettings] instead.
|
||||||
@Deprecated('Use InAppWebViewSettings instead')
|
@Deprecated('Use InAppWebViewSettings instead')
|
||||||
class InAppWebViewOptions
|
class InAppWebViewOptions
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import '../types/print_job_info.dart';
|
import '../types/print_job_info.dart';
|
||||||
import '../in_app_webview/in_app_webview_controller.dart';
|
import '../in_app_webview/in_app_webview_controller.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
///A completion handler for the [PrintJobController].
|
///A completion handler for the [PrintJobController].
|
||||||
typedef PrintJobCompletionHandler = Future<void> Function(bool completed, String? error)?;
|
typedef PrintJobCompletionHandler = Future<void> Function(bool completed, String? error)?;
|
||||||
|
|
||||||
///Class representing a print job eventually returned by [InAppWebViewController.printCurrentPage].
|
///Class representing a print job eventually returned by [InAppWebViewController.printCurrentPage].
|
||||||
class PrintJobController {
|
class PrintJobController implements Disposable {
|
||||||
///Print job ID.
|
///Print job ID.
|
||||||
final String id;
|
final String id;
|
||||||
|
|
||||||
|
@ -96,6 +97,7 @@ class PrintJobController {
|
||||||
///**Supported Platforms/Implementations**:
|
///**Supported Platforms/Implementations**:
|
||||||
///- Android native WebView
|
///- Android native WebView
|
||||||
///- iOS
|
///- iOS
|
||||||
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
await _channel.invokeMethod('dispose', args);
|
await _channel.invokeMethod('dispose', args);
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter_inappwebview/src/types/print_job_media_size.dart';
|
|
||||||
|
|
||||||
import '../types/main.dart';
|
import '../types/main.dart';
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
|
@ -178,37 +177,36 @@ class PrintJobSettings {
|
||||||
this.footerHeight,
|
this.footerHeight,
|
||||||
this.headerHeight});
|
this.headerHeight});
|
||||||
|
|
||||||
///Gets a possible [PrintJobSettings] instance from a [Map] value.
|
///Gets a [PrintJobSettings] instance from a [Map] value.
|
||||||
static PrintJobSettings fromMap(Map<String, dynamic> map) {
|
factory PrintJobSettings.fromMap(Map<String, dynamic> map) {
|
||||||
var settings = PrintJobSettings();
|
return PrintJobSettings(
|
||||||
settings.handledByClient = map["handledByClient"];
|
handledByClient: map["handledByClient"],
|
||||||
settings.jobName = map["jobName"];
|
jobName: map["jobName"],
|
||||||
settings.animated = map["animated"];
|
animated: map["animated"],
|
||||||
settings.orientation = PrintJobOrientation.fromValue(map["orientation"]);
|
orientation: PrintJobOrientation.fromValue(map["orientation"]),
|
||||||
settings.numberOfPages = map["numberOfPages"];
|
numberOfPages: map["numberOfPages"],
|
||||||
settings.forceRenderingQuality =
|
forceRenderingQuality:
|
||||||
PrintJobRenderingQuality.fromValue(map["forceRenderingQuality"]);
|
PrintJobRenderingQuality.fromValue(map["forceRenderingQuality"]),
|
||||||
settings.margins =
|
margins:
|
||||||
MapEdgeInsets.fromMap(map["margins"]?.cast<String, dynamic>());
|
MapEdgeInsets.fromMap(map["margins"]?.cast<String, dynamic>()),
|
||||||
settings.mediaSize =
|
mediaSize:
|
||||||
PrintJobMediaSize.fromMap(map["mediaSize"]?.cast<String, dynamic>());
|
PrintJobMediaSize.fromMap(map["mediaSize"]?.cast<String, dynamic>()),
|
||||||
settings.colorMode = PrintJobColorMode.fromValue(map["colorMode"]);
|
colorMode: PrintJobColorMode.fromValue(map["colorMode"]),
|
||||||
settings.duplexMode = PrintJobDuplexMode.fromNativeValue(map["duplexMode"]);
|
duplexMode: PrintJobDuplexMode.fromNativeValue(map["duplexMode"]),
|
||||||
settings.outputType = PrintJobOutputType.fromValue(map["outputType"]);
|
outputType: PrintJobOutputType.fromValue(map["outputType"]),
|
||||||
settings.resolution =
|
resolution:
|
||||||
PrintJobResolution.fromMap(map["resolution"]?.cast<String, dynamic>());
|
PrintJobResolution.fromMap(map["resolution"]?.cast<String, dynamic>()),
|
||||||
settings.showsNumberOfCopies = map["showsNumberOfCopies"];
|
showsNumberOfCopies: map["showsNumberOfCopies"],
|
||||||
settings.showsPaperSelectionForLoadedPapers =
|
showsPaperSelectionForLoadedPapers:
|
||||||
map["showsPaperSelectionForLoadedPapers"];
|
map["showsPaperSelectionForLoadedPapers"],
|
||||||
settings.showsPaperOrientation = map["showsPaperOrientation"];
|
showsPaperOrientation: map["showsPaperOrientation"],
|
||||||
settings.maximumContentHeight = map["maximumContentHeight"];
|
maximumContentHeight: map["maximumContentHeight"],
|
||||||
settings.maximumContentWidth = map["maximumContentWidth"];
|
maximumContentWidth: map["maximumContentWidth"],
|
||||||
settings.footerHeight = map["footerHeight"];
|
footerHeight: map["footerHeight"],
|
||||||
settings.headerHeight = map["headerHeight"];
|
headerHeight: map["headerHeight"],
|
||||||
return settings;
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
///Converts instance to a map.
|
|
||||||
Map<String, dynamic> toMap() {
|
Map<String, dynamic> toMap() {
|
||||||
return {
|
return {
|
||||||
"handledByClient": handledByClient,
|
"handledByClient": handledByClient,
|
||||||
|
@ -233,18 +231,15 @@ class PrintJobSettings {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
///Gets a copy of the current instance.
|
|
||||||
PrintJobSettings copy() {
|
PrintJobSettings copy() {
|
||||||
return PrintJobSettings.fromMap(this.toMap());
|
return PrintJobSettings.fromMap(toMap());
|
||||||
}
|
}
|
||||||
|
|
||||||
///Converts instance to a map.
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
|
||||||
String toString() {
|
String toString() {
|
||||||
return toMap().toString();
|
return toMap().toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -55,7 +55,7 @@ class PullToRefreshSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return this.toMap();
|
return toMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|
|
@ -2,7 +2,7 @@ import 'dart:typed_data';
|
||||||
|
|
||||||
import '../in_app_webview/webview.dart';
|
import '../in_app_webview/webview.dart';
|
||||||
|
|
||||||
///Class representing the response returned by the [WebView.onLoadResourceCustomScheme] event.
|
///Class representing the response returned by the [WebView.onLoadResourceWithCustomScheme] event.
|
||||||
///It allows to load a specific resource. The resource data must be encoded to `base64`.
|
///It allows to load a specific resource. The resource data must be encoded to `base64`.
|
||||||
class CustomSchemeResponse {
|
class CustomSchemeResponse {
|
||||||
///Data enconded to 'base64'.
|
///Data enconded to 'base64'.
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
abstract class Disposable {
|
||||||
|
void dispose();
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
import 'print_job_state.dart';
|
|
||||||
import '../print_job/main.dart';
|
import '../print_job/main.dart';
|
||||||
import '../types/main.dart';
|
import '../types/main.dart';
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,9 @@ import 'package:flutter/widgets.dart';
|
||||||
|
|
||||||
import 'in_app_web_view_web_element.dart';
|
import 'in_app_web_view_web_element.dart';
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
class HeadlessInAppWebViewWebElement {
|
class HeadlessInAppWebViewWebElement implements Disposable {
|
||||||
String id;
|
String id;
|
||||||
late BinaryMessenger _messenger;
|
late BinaryMessenger _messenger;
|
||||||
InAppWebViewWebElement? webView;
|
InAppWebViewWebElement? webView;
|
||||||
|
@ -55,6 +56,7 @@ class HeadlessInAppWebViewWebElement {
|
||||||
webView?.iframe.style.height = size.height.toString() + "px";
|
webView?.iframe.style.height = size.height.toString() + "px";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_channel?.setMethodCallHandler(null);
|
_channel?.setMethodCallHandler(null);
|
||||||
_channel = null;
|
_channel = null;
|
||||||
|
|
|
@ -8,8 +8,9 @@ import 'dart:js' as js;
|
||||||
import 'web_platform_manager.dart';
|
import 'web_platform_manager.dart';
|
||||||
import '../in_app_webview/in_app_webview_settings.dart';
|
import '../in_app_webview/in_app_webview_settings.dart';
|
||||||
import '../types/main.dart';
|
import '../types/main.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
class InAppWebViewWebElement {
|
class InAppWebViewWebElement implements Disposable {
|
||||||
late dynamic _viewId;
|
late dynamic _viewId;
|
||||||
late BinaryMessenger _messenger;
|
late BinaryMessenger _messenger;
|
||||||
late IFrameElement iframe;
|
late IFrameElement iframe;
|
||||||
|
@ -540,6 +541,7 @@ class InAppWebViewWebElement {
|
||||||
await _channel?.invokeMethod("onInjectedScriptError", [id]);
|
await _channel?.invokeMethod("onInjectedScriptError", [id]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_channel?.setMethodCallHandler(null);
|
_channel?.setMethodCallHandler(null);
|
||||||
_channel = null;
|
_channel = null;
|
||||||
|
|
|
@ -4,8 +4,9 @@ import 'package:flutter/services.dart';
|
||||||
import 'dart:js' as js;
|
import 'dart:js' as js;
|
||||||
|
|
||||||
import 'web_platform_manager.dart';
|
import 'web_platform_manager.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
class PlatformUtil {
|
class PlatformUtil implements Disposable {
|
||||||
late BinaryMessenger _messenger;
|
late BinaryMessenger _messenger;
|
||||||
late MethodChannel? _channel;
|
late MethodChannel? _channel;
|
||||||
|
|
||||||
|
@ -41,6 +42,7 @@ class PlatformUtil {
|
||||||
return bridgeJsObject.callMethod("getCookieExpirationDate", [timestamp]);
|
return bridgeJsObject.callMethod("getCookieExpirationDate", [timestamp]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
_channel?.setMethodCallHandler(null);
|
_channel?.setMethodCallHandler(null);
|
||||||
_channel = null;
|
_channel = null;
|
||||||
|
|
|
@ -24,8 +24,11 @@ class FlutterInAppWebViewWebPlatform {
|
||||||
}
|
}
|
||||||
|
|
||||||
static void registerWith(Registrar registrar) {
|
static void registerWith(Registrar registrar) {
|
||||||
|
// ignore: unused_local_variable
|
||||||
final pluginInstance = FlutterInAppWebViewWebPlatform(registrar);
|
final pluginInstance = FlutterInAppWebViewWebPlatform(registrar);
|
||||||
|
// ignore: unused_local_variable
|
||||||
final platformUtil = PlatformUtil(messenger: registrar);
|
final platformUtil = PlatformUtil(messenger: registrar);
|
||||||
|
// ignore: unused_local_variable
|
||||||
final headlessManager = HeadlessInAppWebViewManager(messenger: registrar);
|
final headlessManager = HeadlessInAppWebViewManager(messenger: registrar);
|
||||||
_nativeCommunication = allowInterop(_dartNativeCommunication);
|
_nativeCommunication = allowInterop(_dartNativeCommunication);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
|
||||||
import '../util.dart';
|
import '../util.dart';
|
||||||
import '../debug_logging_settings.dart';
|
import '../debug_logging_settings.dart';
|
||||||
import '../types/main.dart';
|
import '../types/main.dart';
|
||||||
|
import '../types/disposable.dart';
|
||||||
|
|
||||||
import 'web_authenticate_session_settings.dart';
|
import 'web_authenticate_session_settings.dart';
|
||||||
|
|
||||||
|
@ -32,7 +33,7 @@ typedef WebAuthenticationSessionCompletionHandler = Future<void> Function(Uri? u
|
||||||
///
|
///
|
||||||
///**Supported Platforms/Implementations**:
|
///**Supported Platforms/Implementations**:
|
||||||
///- iOS
|
///- iOS
|
||||||
class WebAuthenticationSession {
|
class WebAuthenticationSession implements Disposable {
|
||||||
///Debug settings.
|
///Debug settings.
|
||||||
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
|
static DebugLoggingSettings debugLoggingSettings = DebugLoggingSettings();
|
||||||
|
|
||||||
|
@ -175,6 +176,7 @@ class WebAuthenticationSession {
|
||||||
///
|
///
|
||||||
///**Supported Platforms/Implementations**:
|
///**Supported Platforms/Implementations**:
|
||||||
///- iOS
|
///- iOS
|
||||||
|
@override
|
||||||
Future<void> dispose() async {
|
Future<void> dispose() async {
|
||||||
Map<String, dynamic> args = <String, dynamic>{};
|
Map<String, dynamic> args = <String, dynamic>{};
|
||||||
await _channel.invokeMethod("dispose", args);
|
await _channel.invokeMethod("dispose", args);
|
||||||
|
|
Loading…
Reference in New Issue