Commit db65f7a0 authored by pichillilorenzo's avatar pichillilorenzo

updated README.md and documentation

parent b3cdd8bf
This diff is collapsed.
## 0.2.0
- added support of Chrome CustomTabs for android
- added support of Chrome CustomTabs for Android
- added support of SFSafariViewController for iOS
- added the ability to create multiple instances of browsers
......
This diff is collapsed.
......@@ -485,6 +485,7 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
public static void close(final String uuid) {
final WebViewActivity webViewActivity = webViewActivities.get(uuid);
if (webViewActivity != null) {
registrar.activity().runOnUiThread(new Runnable() {
@Override
public void run() {
......@@ -511,4 +512,5 @@ public class InAppBrowserFlutterPlugin implements MethodCallHandler {
}
});
}
}
}
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
class MyInAppBrowser extends InAppBrowser {
@override
Future onLoadStart(String url) async {
print("\n\nStarted aaa $url\n\n");
inAppBrowserFallback2.open("https://www.google.com", options: {
"hidden": true
});
print("\n\nStarted $url\n\n");
//print("\n\n ${await this.isHidden()} \n\n");
}
@override
Future onLoadStop(String url) async {
print("\n\nStopped aaa $url\n\n");
inAppBrowserFallback2.show();
print("\n\nStopped $url\n\n");
// print(await this.injectScriptCode("document.body.innerHTML"));
// print(await this.injectScriptCode("3"));
// print(await this.injectScriptCode("""
......@@ -65,40 +60,10 @@ class MyInAppBrowser extends InAppBrowser {
}
}
class MyInAppBrowser2 extends InAppBrowser {
@override
Future onLoadStart(String url) async {
print("\n\nStarted $url\n\n");
//print("\n\n ${await this.isHidden()} \n\n");
}
@override
Future onLoadStop(String url) async {
print("\n\nStopped $url\n\n");
}
@override
void onLoadError(String url, int code, String message) {
print("\n\nCan't load $url.. Error: $message\n\n");
}
@override
void onExit() {
print("\n\nBrowser closed!\n\n");
}
@override
void shouldOverrideUrlLoading(String url) {
print("\n\n override $url\n\n");
this.loadUrl(url);
}
}
MyInAppBrowser inAppBrowserFallback = new MyInAppBrowser();
MyInAppBrowser2 inAppBrowserFallback2 = new MyInAppBrowser2();
class MyChromeSafariBrowser extends ChromeSafariBrowser {
MyChromeSafariBrowser(browserFallback) : super(browserFallback);
@override
......@@ -114,7 +79,6 @@ class MyChromeSafariBrowser extends ChromeSafariBrowser {
@override
void onClosed() {
print("ChromeSafari browser closed");
inAppBrowserFallback.open("https://flutter.io/");
}
}
......@@ -143,20 +107,7 @@ class _MyAppState extends State<MyApp> {
),
body: new Center(
child: new RaisedButton(onPressed: () {
chromeSafariBrowser.open("https://flutter.io/", options: {
"addShareButton": false,
"toolbarBackgroundColor": "#000000",
"dismissButtonStyle": 1,
"preferredBarTintColor": "#000000",
},
optionsFallback: {
"hidden": true,
//"toolbarTopFixedTitle": "Fixed title",
//"useShouldOverrideUrlLoading": true
//"hideUrlBar": true,
//"toolbarTop": false,
//"toolbarBottom": false
});
chromeSafariBrowser.open("https://flutter.io/");
// inAppBrowserFallback.open("https://flutter.io/", options: {
// //"hidden": true,
// //"toolbarTopFixedTitle": "Fixed title",
......
......@@ -15,6 +15,8 @@ public class SafariBrowserOptions: Options {
var dismissButtonStyle = 0 //done
var preferredBarTintColor = ""
var preferredControlTintColor = ""
var presentationStyle = 0 //fullscreen
var transitionStyle = 0 //crossDissolve
override init(){
super.init()
......
......@@ -34,6 +34,9 @@ class SafariViewController: SFSafariViewController, SFSafariViewControllerDelega
self.preferredControlTintColor = color(fromHexString: (safariOptions?.preferredControlTintColor)!)
}
}
self.modalPresentationStyle = UIModalPresentationStyle(rawValue: (safariOptions?.presentationStyle)!)!
self.modalTransitionStyle = UIModalTransitionStyle(rawValue: (safariOptions?.transitionStyle)!)!
}
func close() {
......
......@@ -303,7 +303,7 @@ class ChromeSafariBrowser {
String uuid;
InAppBrowser browserFallback;
///
///Initialize the [ChromeSafariBrowser] instance with a [InAppBrowser] fallback instance or `null`.
ChromeSafariBrowser (bf) {
uuid = uuidGenerator.v4();
browserFallback = bf;
......@@ -325,7 +325,33 @@ class ChromeSafariBrowser {
return new Future.value("");
}
///Opens an [url] in a new [ChromeSafariBrowser] instance or the system browser.
///
///- [url]: The [url] to load. Call [encodeUriComponent()] on this if the [url] contains Unicode characters.
///
///- [options]: Options for the [ChromeSafariBrowser].
///
///- [headersFallback]: The additional header of the [InAppBrowser] instance fallback to be used in the HTTP request for this URL, specified as a map from name to value.
///
///- [optionsFallback]: Options used by the [InAppBrowser] instance fallback.
///
///**Android** supports these options:
///
///- __addShareButton__: Set to `false` if you don't want the default share button. The default value is `true`.
///- __showTitle__: Set to `false` if the title shouldn't be shown in the custom tab. The default value is `true`.
///- __toolbarBackgroundColor__: Set the custom background color of the toolbar.
///- __enableUrlBarHiding__: Set to `true` to enable the url bar to hide as the user scrolls down on the page. The default value is `false`.
///- __instantAppsEnabled__: Set to `true` to enable Instant Apps. The default value is `false`.
///
///**iOS** supports these options:
///
///- __entersReaderIfAvailable__: Set to `true` if Reader mode should be entered automatically when it is available for the webpage. The default value is `false`.
///- __barCollapsingEnabled__: Set to `true` to enable bar collapsing. The default value is `false`.
///- __dismissButtonStyle__: Set the custom style for the dismiss button. The default value is `0 //done`. See [SFSafariViewController.DismissButtonStyle](https://developer.apple.com/documentation/safariservices/sfsafariviewcontroller/dismissbuttonstyle) for all the available styles.
///- __preferredBarTintColor__: Set the custom background color of the navigation bar and the toolbar.
///- __preferredControlTintColor__: Set the custom color of the control buttons on the navigation bar and the toolbar.
///- __presentationStyle__: Set the custom modal presentation style when presenting the WebView. The default value is `0 //fullscreen`. See [UIModalPresentationStyle](https://developer.apple.com/documentation/uikit/uimodalpresentationstyle) for all the available styles.
///- __transitionStyle__: Set to the custom transition style when presenting the WebView. The default value is `0 //crossDissolve`. See [UIModalTransitionStyle](https://developer.apple.com/documentation/uikit/uimodaltransitionStyle) for all the available styles.
Future<void> open(String url, {Map<String, dynamic> options = const {}, Map<String, String> headersFallback = const {}, Map<String, dynamic> optionsFallback = const {}}) async {
Map<String, dynamic> args = <String, dynamic>{};
args.putIfAbsent('uuid', () => uuid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment