Commit 7482e809 authored by pichillilorenzo's avatar pichillilorenzo

updated README.md

parent 155ffa81
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
\ No newline at end of file
This diff is collapsed.
...@@ -21,6 +21,8 @@ First, add `flutter_inappbrowser` as a [dependency in your pubspec.yaml file](ht ...@@ -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 { ...@@ -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 ...@@ -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 ...@@ -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: ...@@ -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)
...@@ -61,7 +61,7 @@ class _MyAppState extends State<MyApp> { ...@@ -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: () {
......
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