added WebHistory and WebHistoryItem class, added getCopyBackForwardList, goBackOrForward, canGoBackOrForward and goTo methods for InAppWebView and InAppBrowser, updated docs
This commit is contained in:
parent
ab7b1b68ad
commit
305c726274
|
@ -17,16 +17,15 @@
|
|||
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/CHANGELOG.md" beforeDir="false" afterPath="$PROJECT_DIR$/CHANGELOG.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/FlutterWebView.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserActivity.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserFlutterPlugin.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" beforeDir="false" afterPath="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppWebView/InAppWebView.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppBrowserWebViewController.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppBrowserWebViewController.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/InAppWebView.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/ios/Classes/SwiftFlutterPlugin.swift" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/SwiftFlutterPlugin.swift" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
|
||||
</list>
|
||||
<ignored path="$PROJECT_DIR$/.dart_tool/" />
|
||||
<ignored path="$PROJECT_DIR$/.idea/" />
|
||||
|
@ -46,8 +45,8 @@
|
|||
<file leaf-file-name="flutter_inappbrowser.dart" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="561">
|
||||
<caret line="1037" column="43" selection-start-line="1037" selection-start-column="21" selection-end-line="1037" selection-end-column="43" />
|
||||
<state relative-caret-position="337">
|
||||
<caret line="1101" column="17" selection-start-line="1101" selection-start-column="17" selection-end-line="1101" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -58,8 +57,8 @@
|
|||
<file leaf-file-name="README.md" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="351">
|
||||
<caret line="48" column="126" selection-start-line="48" selection-start-column="126" selection-end-line="48" selection-end-column="126" />
|
||||
<state relative-caret-position="-534">
|
||||
<caret line="16" column="3" selection-start-line="16" selection-start-column="3" selection-end-line="16" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
|
@ -72,8 +71,8 @@
|
|||
<file leaf-file-name="main.dart" pinned="false" current-in-tab="true">
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret line="234" selection-start-line="234" selection-end-line="234" />
|
||||
<state relative-caret-position="449">
|
||||
<caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
@ -84,8 +83,8 @@
|
|||
<file leaf-file-name="CHANGELOG.md" pinned="false" current-in-tab="false">
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
||||
<state relative-caret-position="120">
|
||||
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
|
@ -173,9 +172,9 @@
|
|||
<option value="$PROJECT_DIR$/example/ios/Flutter/Generated.xcconfig" />
|
||||
<option value="$PROJECT_DIR$/example/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/pubspec.yaml" />
|
||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/README.md" />
|
||||
<option value="$PROJECT_DIR$/CHANGELOG.md" />
|
||||
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
|
||||
<option value="$PROJECT_DIR$/example/lib/main.dart" />
|
||||
</list>
|
||||
</option>
|
||||
|
@ -383,16 +382,16 @@
|
|||
<layout>
|
||||
<window_info anchor="bottom" id="Android Profiler" order="7" show_stripe_button="false" />
|
||||
<window_info anchor="bottom" id="TODO" order="6" />
|
||||
<window_info active="true" anchor="bottom" id="Messages" order="12" visible="true" weight="0.23594266" />
|
||||
<window_info anchor="bottom" id="Messages" order="12" weight="0.23594266" />
|
||||
<window_info anchor="right" id="Palette	" order="9" />
|
||||
<window_info id="Image Layers" order="7" />
|
||||
<window_info id="Build Variants" order="3" side_tool="true" />
|
||||
<window_info anchor="right" id="Capture Analysis" order="4" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5043937" side_tool="true" weight="0.30650496" />
|
||||
<window_info anchor="bottom" id="Event Log" order="8" sideWeight="0.5052169" side_tool="true" weight="0.34068358" />
|
||||
<window_info anchor="bottom" id="Dart Analysis" order="14" weight="0.3276414" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49644473" weight="0.34068358" />
|
||||
<window_info anchor="bottom" id="Run" order="2" sideWeight="0.49478307" weight="0.34068358" />
|
||||
<window_info anchor="bottom" id="Version Control" order="9" />
|
||||
<window_info anchor="bottom" id="Terminal" order="10" sideWeight="0.49560633" weight="0.20066153" />
|
||||
<window_info active="true" anchor="bottom" id="Terminal" order="10" sideWeight="0.49533224" visible="true" weight="0.20066153" />
|
||||
<window_info anchor="right" id="Flutter Outline" order="6" weight="0.32922077" />
|
||||
<window_info anchor="bottom" id="Logcat" order="11" />
|
||||
<window_info id="Captures" order="4" weight="0.32936507" />
|
||||
|
@ -658,25 +657,6 @@
|
|||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="90">
|
||||
<caret line="6" selection-start-line="6" selection-end-line="6" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="351">
|
||||
<caret line="48" column="126" selection-start-line="48" selection-start-column="126" selection-end-line="48" selection-end-column="126" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="75">
|
||||
|
@ -686,18 +666,37 @@
|
|||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="561">
|
||||
<caret line="1037" column="43" selection-start-line="1037" selection-start-column="21" selection-end-line="1037" selection-end-column="43" />
|
||||
<state relative-caret-position="337">
|
||||
<caret line="1101" column="17" selection-start-line="1101" selection-start-column="17" selection-end-line="1101" selection-end-column="17" />
|
||||
<folding>
|
||||
<element signature="e#814#831#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/README.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="-534">
|
||||
<caret line="16" column="3" selection-start-line="16" selection-start-column="3" selection-end-line="16" selection-end-column="3" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
<element signature="e#0#39#0" expanded="true" />
|
||||
</folding>
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/CHANGELOG.md">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state relative-caret-position="120">
|
||||
<caret line="8" lean-forward="true" selection-start-line="8" selection-end-line="8" />
|
||||
</state>
|
||||
</provider>
|
||||
</entry>
|
||||
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
|
||||
<provider selected="true" editor-type-id="text-editor">
|
||||
<state>
|
||||
<caret line="234" selection-start-line="234" selection-end-line="234" />
|
||||
<state relative-caret-position="449">
|
||||
<caret line="30" lean-forward="true" selection-start-line="30" selection-end-line="30" />
|
||||
<folding>
|
||||
<element signature="e#0#20#0" expanded="true" />
|
||||
</folding>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
## 0.5.4
|
||||
|
||||
- added `WebHistory` and `WebHistoryItem` class
|
||||
- added `getCopyBackForwardList` method for `InAppWebView` and `InAppBrowser`
|
||||
- added `getCopyBackForwardList`, `goBackOrForward`, `canGoBackOrForward` and `goTo` methods for `InAppWebView` and `InAppBrowser`
|
||||
|
||||
## 0.5.3
|
||||
|
||||
|
|
|
@ -162,6 +162,14 @@ public class FlutterWebView implements PlatformView, MethodCallHandler {
|
|||
case "canGoForward":
|
||||
result.success((webView != null) && webView.canGoForward());
|
||||
break;
|
||||
case "goBackOrForward":
|
||||
if (webView != null)
|
||||
webView.goBackOrForward((Integer) call.argument("steps"));
|
||||
result.success(true);
|
||||
break;
|
||||
case "canGoBackOrForward":
|
||||
result.success((webView != null) && webView.canGoBackOrForward((Integer) call.argument("steps")));
|
||||
break;
|
||||
case "stopLoading":
|
||||
if (webView != null)
|
||||
webView.stopLoading();
|
||||
|
|
|
@ -238,17 +238,32 @@ public class InAppBrowserActivity extends AppCompatActivity {
|
|||
webView.goBack();
|
||||
}
|
||||
|
||||
public boolean canGoBack() {
|
||||
if (webView != null)
|
||||
return webView.canGoBack();
|
||||
return false;
|
||||
}
|
||||
|
||||
public void goForward() {
|
||||
if (webView != null && canGoForward())
|
||||
webView.goForward();
|
||||
}
|
||||
|
||||
public boolean canGoBack() {
|
||||
return webView.canGoBack();
|
||||
public boolean canGoForward() {
|
||||
if (webView != null)
|
||||
return webView.canGoForward();
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean canGoForward() {
|
||||
return webView.canGoForward();
|
||||
public void goBackOrForward(int steps) {
|
||||
if (webView != null && canGoBackOrForward(steps))
|
||||
webView.goBackOrForward(steps);
|
||||
}
|
||||
|
||||
public boolean canGoBackOrForward(int steps) {
|
||||
if (webView != null)
|
||||
return webView.canGoBackOrForward(steps);
|
||||
return false;
|
||||
}
|
||||
|
||||
public void hide() {
|
||||
|
|
|
@ -233,6 +233,13 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
|
|||
case "canGoForward":
|
||||
result.success(canGoForward(uuid));
|
||||
break;
|
||||
case "goBackOrForward":
|
||||
goBackOrForward(uuid, (Integer) call.argument("steps"));
|
||||
result.success(true);
|
||||
break;
|
||||
case "canGoBackOrForward":
|
||||
result.success(canGoBackOrForward(uuid, (Integer) call.argument("steps")));
|
||||
break;
|
||||
case "stopLoading":
|
||||
stopLoading(uuid);
|
||||
result.success(true);
|
||||
|
@ -497,6 +504,18 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void goBackOrForward(String uuid, int steps) {
|
||||
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
|
||||
if (inAppBrowserActivity != null)
|
||||
inAppBrowserActivity.goBackOrForward(steps);
|
||||
}
|
||||
|
||||
public boolean canGoBackOrForward(String uuid, int steps) {
|
||||
InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
|
||||
if (inAppBrowserActivity != null)
|
||||
return inAppBrowserActivity.canGoBackOrForward(steps);
|
||||
return false;
|
||||
}
|
||||
|
||||
public static void close(final String uuid, final Result result) {
|
||||
final InAppBrowserActivity inAppBrowserActivity = webViewActivities.get(uuid);
|
||||
|
|
|
@ -97,6 +97,12 @@ public class InAppWebView extends WebView {
|
|||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void reload() {
|
||||
super.reload();
|
||||
Log.d(LOG_TAG, "RELOAD");
|
||||
}
|
||||
|
||||
public void prepare() {
|
||||
|
||||
boolean isFromInAppBrowserActivity = inAppBrowserActivity != null;
|
||||
|
|
|
@ -16,12 +16,21 @@ class MyInAppBrowser extends InAppBrowser {
|
|||
Future onLoadStop(String url) async {
|
||||
print("\n\nStopped $url\n\n");
|
||||
|
||||
WebHistory history = await this.webViewController.getCopyBackForwardList();
|
||||
print(history.list.length);
|
||||
print(history.list[history.currentIndex].url);
|
||||
for(WebHistoryItem item in history.list) {
|
||||
print(item.title);
|
||||
}
|
||||
// WebHistory history = await this.webViewController.getCopyBackForwardList();
|
||||
// print(history.list.length);
|
||||
// print(history.currentIndex);
|
||||
// print(history.list[history.currentIndex].url);
|
||||
// for(WebHistoryItem item in history.list) {
|
||||
// print(item.title);
|
||||
// }
|
||||
//
|
||||
// print(await this.webViewController.canGoBackOrForward(1));
|
||||
// if (await this.webViewController.canGoBackOrForward(-2)) {
|
||||
// this.webViewController.goTo(history.list[0]);
|
||||
// }
|
||||
|
||||
// await this.webViewController.goBackOrForward(-1);
|
||||
|
||||
// print(await this.webViewController.canGoBack());
|
||||
// print(await this.webViewController.canGoForward());
|
||||
|
||||
|
|
|
@ -481,13 +481,20 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
})
|
||||
}
|
||||
|
||||
@objc func goBack() {
|
||||
if canGoBack() {
|
||||
webView.goBack()
|
||||
updateUrlTextField(url: (webView?.url?.absoluteString)!)
|
||||
}
|
||||
}
|
||||
|
||||
func canGoBack() -> Bool {
|
||||
return webView.canGoBack
|
||||
}
|
||||
|
||||
@objc func goBack() {
|
||||
if canGoBack() {
|
||||
webView.goBack()
|
||||
@objc func goForward() {
|
||||
if canGoForward() {
|
||||
webView.goForward()
|
||||
updateUrlTextField(url: (webView?.url?.absoluteString)!)
|
||||
}
|
||||
}
|
||||
|
@ -496,11 +503,13 @@ class InAppBrowserWebViewController: UIViewController, WKUIDelegate, WKNavigatio
|
|||
return webView.canGoForward
|
||||
}
|
||||
|
||||
@objc func goForward() {
|
||||
if canGoForward() {
|
||||
webView.goForward()
|
||||
updateUrlTextField(url: (webView?.url?.absoluteString)!)
|
||||
}
|
||||
@objc func goBackOrForward(steps: Int) {
|
||||
webView.goBackOrForward(steps: steps)
|
||||
updateUrlTextField(url: (webView?.url?.absoluteString)!)
|
||||
}
|
||||
|
||||
func canGoBackOrForward(steps: Int) -> Bool {
|
||||
return webView.canGoBackOrForward(steps: steps)
|
||||
}
|
||||
|
||||
func updateUrlTextField(url: String) {
|
||||
|
|
|
@ -10,4 +10,25 @@ import WebKit
|
|||
|
||||
public class InAppWebView: WKWebView {
|
||||
|
||||
public func goBackOrForward(steps: Int) {
|
||||
if canGoBackOrForward(steps: steps) {
|
||||
if (steps > 0) {
|
||||
let index = steps - 1
|
||||
go(to: self.backForwardList.forwardList[index])
|
||||
}
|
||||
else if (steps < 0){
|
||||
let backListLength = self.backForwardList.backList.count
|
||||
let index = backListLength + steps
|
||||
go(to: self.backForwardList.backList[index])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public func canGoBackOrForward(steps: Int) -> Bool {
|
||||
let currentIndex = self.backForwardList.backList.count
|
||||
return (steps >= 0)
|
||||
? steps <= self.backForwardList.forwardList.count
|
||||
: currentIndex + steps >= 0
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -129,6 +129,22 @@ public class SwiftFlutterPlugin: NSObject, FlutterPlugin {
|
|||
result(false)
|
||||
}
|
||||
break
|
||||
case "goBackOrForward":
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
let steps = arguments!["steps"] as! Int
|
||||
webViewController?.goBackOrForward(steps: steps)
|
||||
}
|
||||
result(true)
|
||||
break
|
||||
case "canGoBackOrForward":
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
let steps = arguments!["steps"] as! Int
|
||||
result(webViewController?.canGoBackOrForward(steps: steps) ?? false)
|
||||
}
|
||||
else {
|
||||
result(false)
|
||||
}
|
||||
break
|
||||
case "isLoading":
|
||||
if let webViewController = self.webViewControllers[uuid] {
|
||||
result((webViewController?.webView.isLoading ?? false) == true)
|
||||
|
|
|
@ -903,6 +903,37 @@ class InAppWebViewController {
|
|||
return await _channel.invokeMethod('canGoForward', args);
|
||||
}
|
||||
|
||||
///Goes to the history item that is the number of steps away from the current item. Steps is negative if backward and positive if forward.
|
||||
Future<void> goBackOrForward(int steps) async {
|
||||
assert(steps != null);
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
if (_inAppBrowserUuid != null) {
|
||||
_inAppBrowser._throwIsNotOpened();
|
||||
args.putIfAbsent('uuid', () => _inAppBrowserUuid);
|
||||
}
|
||||
args.putIfAbsent('steps', () => steps);
|
||||
await _channel.invokeMethod('goBackOrForward', args);
|
||||
}
|
||||
|
||||
///Gets whether the page can go back or forward the given number of steps.
|
||||
Future<bool> canGoBackOrForward(int steps) async {
|
||||
assert(steps != null);
|
||||
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
if (_inAppBrowserUuid != null) {
|
||||
_inAppBrowser._throwIsNotOpened();
|
||||
args.putIfAbsent('uuid', () => _inAppBrowserUuid);
|
||||
}
|
||||
args.putIfAbsent('steps', () => steps);
|
||||
return await _channel.invokeMethod('canGoBackOrForward', args);
|
||||
}
|
||||
|
||||
///Navigates to an item from the back-forward list and sets it as the current item.
|
||||
Future<void> goTo(WebHistoryItem historyItem) async {
|
||||
await goBackOrForward(historyItem.offset);
|
||||
}
|
||||
|
||||
///Check if the Web View of the [InAppWebView] instance is in a loading state.
|
||||
Future<bool> isLoading() async {
|
||||
Map<String, dynamic> args = <String, dynamic>{};
|
||||
|
@ -1050,8 +1081,9 @@ class InAppWebViewController {
|
|||
int currentIndex = result["currentIndex"];
|
||||
|
||||
List<WebHistoryItem> historyList = List();
|
||||
for(LinkedHashMap<dynamic, dynamic> historyItem in historyListMap) {
|
||||
historyList.add(WebHistoryItem(historyItem["originalUrl"], historyItem["title"], historyItem["url"]));
|
||||
for(var i = 0; i < historyListMap.length; i++) {
|
||||
LinkedHashMap<dynamic, dynamic> historyItem = historyListMap[i];
|
||||
historyList.add(WebHistoryItem(historyItem["originalUrl"], historyItem["title"], historyItem["url"], i, i - currentIndex));
|
||||
}
|
||||
return WebHistory(historyList, currentIndex);
|
||||
}
|
||||
|
@ -1067,7 +1099,9 @@ class InAppWebViewController {
|
|||
///This class contains a snapshot of the current back/forward list for a WebView.
|
||||
class WebHistory {
|
||||
List<WebHistoryItem> _list;
|
||||
///List of all [WebHistoryItem]s.
|
||||
List<WebHistoryItem> get list => _list;
|
||||
///Index of the current [WebHistoryItem].
|
||||
int currentIndex;
|
||||
|
||||
WebHistory(this._list, this.currentIndex);
|
||||
|
@ -1077,11 +1111,18 @@ class WebHistory {
|
|||
///
|
||||
///A convenience class for accessing fields in an entry in the back/forward list of a WebView. Each WebHistoryItem is a snapshot of the requested history item.
|
||||
class WebHistoryItem {
|
||||
///Original url of this history item.
|
||||
String originalUrl;
|
||||
///Document title of this history item.
|
||||
String title;
|
||||
///Url of this history item.
|
||||
String url;
|
||||
///0-based position index in the back-forward [WebHistory.list].
|
||||
int index;
|
||||
///Position offset respect to the currentIndex of the back-forward [WebHistory.list].
|
||||
int offset;
|
||||
|
||||
WebHistoryItem(this.originalUrl, this.title, this.url);
|
||||
WebHistoryItem(this.originalUrl, this.title, this.url, this.index, this.offset);
|
||||
}
|
||||
|
||||
///InAppLocalhostServer class.
|
||||
|
|
Loading…
Reference in New Issue