updated README.md

This commit is contained in:
pichillilorenzo 2018-09-14 02:41:43 +02:00
parent 155ffa8198
commit 7482e809ae
4 changed files with 147 additions and 63 deletions

6
.idea/vcs.xml Normal file
View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@ -1,7 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ChangeListManager">
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="" />
<list default="true" id="9b41f7a2-a71e-4923-91fb-249d7815b3e7" name="Default" comment="">
<change beforePath="" afterPath="$PROJECT_DIR$/.idea/vcs.xml" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" afterPath="$PROJECT_DIR$/.idea/workspace.xml" />
<change beforePath="$PROJECT_DIR$/README.md" afterPath="$PROJECT_DIR$/README.md" />
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" afterPath="$PROJECT_DIR$/example/lib/main.dart" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
<ignored path="$PROJECT_DIR$/.pub/" />
@ -17,12 +22,14 @@
</component>
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file leaf-file-name="main.dart" pinned="false" current-in-tab="false">
<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 relative-caret-position="0">
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" />
<folding />
<state relative-caret-position="151">
<caret line="14" column="26" lean-forward="true" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -40,11 +47,11 @@
</provider>
</entry>
</file>
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="true">
<file leaf-file-name="pubspec.yaml" pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="133" lean-forward="true" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="133" />
<caret line="1" column="133" lean-forward="false" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="133" />
<folding />
</state>
</provider>
@ -54,19 +61,29 @@
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="60">
<caret line="4" column="66" lean-forward="true" selection-start-line="4" selection-start-column="66" selection-end-line="4" selection-end-column="66" />
<first_editor relative-caret-position="559">
<caret line="266" column="0" lean-forward="true" selection-start-line="266" selection-start-column="0" selection-end-line="266" selection-end-column="0" />
<folding>
<marker date="1536884362681" expanded="true" signature="1034:1527" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1082:1150" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1196:1263" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1339:1427" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1459:1522" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1519:1522" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9770:9803" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9922:9954" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10114:10146" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10242:10267" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="933:1031" ph="..." />
<marker date="1536885650164" expanded="true" signature="1075:1558" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1121:1189" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1233:1300" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1374:1462" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1492:1555" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1685:1750" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1791:2302" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1825:1853" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1904:2300" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1932:2295" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="1958:2288" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="1986:2069" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2015:2058" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2095:2279" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2130:2268" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="10492:10525" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10644:10676" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10836:10868" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10964:10989" ph="{...}" />
</folding>
</first_editor>
<second_editor />
@ -122,6 +139,9 @@
<replace>flutter_inappbrowser</replace>
</replaceStrings>
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GradleLocalSettings">
<option name="externalProjectsViewState">
<projects_view />
@ -150,9 +170,9 @@
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowserClient.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.java" />
<option value="$PROJECT_DIR$/lib/flutter_inappbrowser.dart" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/pubspec.yaml" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
</list>
</option>
</component>
@ -161,6 +181,7 @@
<option name="width" value="1920" />
<option name="height" value="1057" />
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages />
@ -380,6 +401,7 @@
</component>
<component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="1057" extended-state="0" />
<editor active="true" />
<layout>
<window_info id="Android Profiler" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Build Variants" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="true" content_ui="tabs" />
@ -398,8 +420,8 @@
<window_info id="Image Layers" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Capture Analysis" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
<window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.26198083" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="false" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="true" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3290735" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.3290735" sideWeight="0.5" order="7" side_tool="false" content_ui="tabs" />
<window_info id="Captures" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
<window_info id="Project" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" show_stripe_button="true" weight="0.18317358" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
<window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" show_stripe_button="true" weight="0.3290735" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
@ -456,7 +478,9 @@
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135">
<caret line="9" column="34" lean-forward="true" selection-start-line="9" selection-start-column="34" selection-end-line="9" selection-end-column="34" />
<folding />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
@ -724,14 +748,46 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0">
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" />
<state relative-caret-position="15">
<caret line="1" column="133" lean-forward="false" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="133" />
<folding />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="559">
<caret line="266" column="0" lean-forward="true" selection-start-line="266" selection-start-column="0" selection-end-line="266" selection-end-column="0" />
<folding>
<marker date="1536885650164" expanded="true" signature="933:1031" ph="..." />
<marker date="1536885650164" expanded="true" signature="1075:1558" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1121:1189" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1233:1300" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1374:1462" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1492:1555" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1685:1750" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1791:2302" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1825:1853" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1904:2300" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="1932:2295" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="1958:2288" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="1986:2069" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2015:2058" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2095:2279" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="2130:2268" ph="(...)" />
<marker date="1536885650164" expanded="true" signature="10492:10525" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10644:10676" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10836:10868" ph="{...}" />
<marker date="1536885650164" expanded="true" signature="10964:10989" ph="{...}" />
</folding>
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2760">
@ -743,33 +799,13 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT">
<first_editor relative-caret-position="60">
<caret line="4" column="66" lean-forward="true" selection-start-line="4" selection-start-column="66" selection-end-line="4" selection-end-column="66" />
<folding>
<marker date="1536884362681" expanded="true" signature="1034:1527" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1082:1150" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1196:1263" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1339:1427" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1459:1522" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1519:1522" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9770:9803" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9922:9954" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10114:10146" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10242:10267" ph="{...}" />
</folding>
</first_editor>
<second_editor />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/pubspec.yaml">
<entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15">
<caret line="1" column="133" lean-forward="true" selection-start-line="1" selection-start-column="13" selection-end-line="1" selection-end-column="133" />
<folding />
<state relative-caret-position="151">
<caret line="14" column="26" lean-forward="true" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
<folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state>
</provider>
</entry>

View File

@ -21,37 +21,72 @@ First, add `flutter_inappbrowser` as a [dependency in your pubspec.yaml file](ht
Create a Class that extends the `InAppBrowser` Class in order to override the callbacks to manage the browser events.
Example:
```dart
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
class MyInAppBrowser extends InAppBrowser {
@override
void onLoadStart(String url) {
super.onLoadStart(url);
print("\n\nStarted $url\n\n");
}
@override
void onLoadStop(String url) {
super.onLoadStop(url);
print("\n\nStopped $url\n\n");
}
@override
void onLoadError(String url, String code, String message) {
super.onLoadStop(url);
print("\n\nCan't load $url.. Error: $message\n\n");
}
@override
void onExit() {
super.onExit();
print("\n\nBrowser closed!\n\n");
}
}
MyInAppBrowser inAppBrowser = new MyInAppBrowser();
void main() => runApp(new MyApp());
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => new _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: const Text('Flutter InAppBrowser Plugin example app'),
),
body: new Center(
child: new RaisedButton(onPressed: () {
inAppBrowser.open("https://flutter.io/");
},
child: Text("Open InAppBrowser")
),
),
),
);
}
}
```
### InAppBrowser.open
@ -199,7 +234,7 @@ Injects JavaScript code into the `InAppBrowser` window. (Only available when the
Example:
```dart
inAppBrowser.injectScriptCode("""
alert("JavaScript injected");
alert("JavaScript injected");
""");
```
@ -222,9 +257,9 @@ Injects CSS into the `InAppBrowser` window. (Only available when the target is s
Example:
```dart
inAppBrowser.injectStyleCode("""
body {
background-color: #3c3c3c;
}
body {
background-color: #3c3c3c;
}
""");
```
@ -237,3 +272,10 @@ Example:
inAppBrowser.injectStyleFile("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css");
```
## Screenshots:
iOS:
![ios](https://user-images.githubusercontent.com/5956938/45523056-52c7c980-b7c7-11e8-8bf1-488c9c8033bf.gif)
Android:
![android](https://user-images.githubusercontent.com/5956938/45523058-55c2ba00-b7c7-11e8-869c-c1738711933f.gif)

View File

@ -61,7 +61,7 @@ class _MyAppState extends State<MyApp> {
return new MaterialApp(
home: new Scaffold(
appBar: new AppBar(
title: const Text('Plugin example app'),
title: const Text('Flutter InAppBrowser Plugin example app'),
),
body: new Center(
child: new RaisedButton(onPressed: () {