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"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ChangeListManager"> <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$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" /> <ignored path="$PROJECT_DIR$/.idea/" />
<ignored path="$PROJECT_DIR$/.pub/" /> <ignored path="$PROJECT_DIR$/.pub/" />
@ -17,12 +22,14 @@
</component> </component>
<component name="FileEditorManager"> <component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300"> <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"> <entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="151">
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" /> <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 /> <folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>
@ -40,11 +47,11 @@
</provider> </provider>
</entry> </entry>
</file> </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"> <entry file="file://$PROJECT_DIR$/pubspec.yaml">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15"> <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 /> <folding />
</state> </state>
</provider> </provider>
@ -54,19 +61,29 @@
<entry file="file://$PROJECT_DIR$/README.md"> <entry file="file://$PROJECT_DIR$/README.md">
<provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]"> <provider selected="true" editor-type-id="split-provider[text-editor;markdown-preview-editor]">
<state split_layout="SPLIT"> <state split_layout="SPLIT">
<first_editor relative-caret-position="60"> <first_editor relative-caret-position="559">
<caret line="4" column="66" lean-forward="true" selection-start-line="4" selection-start-column="66" selection-end-line="4" selection-end-column="66" /> <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> <folding>
<marker date="1536884362681" expanded="true" signature="1034:1527" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="933:1031" ph="..." />
<marker date="1536884362681" expanded="true" signature="1082:1150" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1075:1558" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1196:1263" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1121:1189" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1339:1427" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1233:1300" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1459:1522" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1374:1462" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="1519:1522" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1492:1555" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9770:9803" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1685:1750" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="9922:9954" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1791:2302" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10114:10146" ph="{...}" /> <marker date="1536885650164" expanded="true" signature="1825:1853" ph="{...}" />
<marker date="1536884362681" expanded="true" signature="10242:10267" 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> </folding>
</first_editor> </first_editor>
<second_editor /> <second_editor />
@ -122,6 +139,9 @@
<replace>flutter_inappbrowser</replace> <replace>flutter_inappbrowser</replace>
</replaceStrings> </replaceStrings>
</component> </component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="GradleLocalSettings"> <component name="GradleLocalSettings">
<option name="externalProjectsViewState"> <option name="externalProjectsViewState">
<projects_view /> <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/InAppBrowserClient.java" />
<option value="$PROJECT_DIR$/android/src/main/java/com/pichillilorenzo/flutter_inappbrowser/InAppBrowser.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$/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$/pubspec.yaml" />
<option value="$PROJECT_DIR$/README.md" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
</list> </list>
</option> </option>
</component> </component>
@ -161,6 +181,7 @@
<option name="width" value="1920" /> <option name="width" value="1920" />
<option name="height" value="1057" /> <option name="height" value="1057" />
</component> </component>
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectView"> <component name="ProjectView">
<navigator currentView="ProjectPane" proportions="" version="1"> <navigator currentView="ProjectPane" proportions="" version="1">
<flattenPackages /> <flattenPackages />
@ -380,6 +401,7 @@
</component> </component>
<component name="ToolWindowManager"> <component name="ToolWindowManager">
<frame x="0" y="23" width="1920" height="1057" extended-state="0" /> <frame x="0" y="23" width="1920" height="1057" extended-state="0" />
<editor active="true" />
<layout> <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="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" /> <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="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="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="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="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="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="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="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="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" /> <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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="135"> <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" /> <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> </state>
</provider> </provider>
</entry> </entry>
@ -724,14 +748,46 @@
</state> </state>
</provider> </provider>
</entry> </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"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="0"> <state relative-caret-position="15">
<caret line="0" column="38" lean-forward="false" selection-start-line="0" selection-start-column="38" selection-end-line="0" selection-end-column="38" /> <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 /> <folding />
</state> </state>
</provider> </provider>
</entry> </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"> <entry file="file://$PROJECT_DIR$/lib/flutter_inappbrowser.dart">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="2760"> <state relative-caret-position="2760">
@ -743,33 +799,13 @@
</state> </state>
</provider> </provider>
</entry> </entry>
<entry file="file://$PROJECT_DIR$/README.md"> <entry file="file://$PROJECT_DIR$/example/lib/main.dart">
<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">
<provider selected="true" editor-type-id="text-editor"> <provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="15"> <state relative-caret-position="151">
<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="14" column="26" lean-forward="true" selection-start-line="14" selection-start-column="26" selection-end-line="14" selection-end-column="26" />
<folding /> <folding>
<element signature="e#0#39#0" expanded="true" />
</folding>
</state> </state>
</provider> </provider>
</entry> </entry>

View File

@ -21,6 +21,8 @@ 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. Create a Class that extends the `InAppBrowser` Class in order to override the callbacks to manage the browser events.
Example: Example:
```dart ```dart
import 'package:flutter/material.dart';
import 'package:flutter_inappbrowser/flutter_inappbrowser.dart'; import 'package:flutter_inappbrowser/flutter_inappbrowser.dart';
class MyInAppBrowser extends InAppBrowser { class MyInAppBrowser extends InAppBrowser {
@ -52,6 +54,39 @@ class MyInAppBrowser extends InAppBrowser {
} }
MyInAppBrowser inAppBrowser = new MyInAppBrowser(); 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 ### InAppBrowser.open
@ -199,7 +234,7 @@ Injects JavaScript code into the `InAppBrowser` window. (Only available when the
Example: Example:
```dart ```dart
inAppBrowser.injectScriptCode(""" 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: Example:
```dart ```dart
inAppBrowser.injectStyleCode(""" inAppBrowser.injectStyleCode("""
body { body {
background-color: #3c3c3c; background-color: #3c3c3c;
} }
"""); """);
``` ```
@ -237,3 +272,10 @@ Example:
inAppBrowser.injectStyleFile("https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css"); 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( return new MaterialApp(
home: new Scaffold( home: new Scaffold(
appBar: new AppBar( appBar: new AppBar(
title: const Text('Plugin example app'), title: const Text('Flutter InAppBrowser Plugin example app'),
), ),
body: new Center( body: new Center(
child: new RaisedButton(onPressed: () { child: new RaisedButton(onPressed: () {