Skip to content

Commit 065524a

Browse files
authored
Merge pull request #1 from fluttercommunity/master
Synchronize my fork to original repository
2 parents 7038b22 + 5d5316f commit 065524a

File tree

17 files changed

+1984
-1427
lines changed

17 files changed

+1984
-1427
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DS_Store
22
.atom/
33
.idea
4+
.vscode
45
.packages
56
.pub/
67
build/

CHANGELOG.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
# 0.3.0
2+
3+
- Fixes rect capture issue. Ensures WebView remains in the correct place on screen even when keyboard appears.
4+
- Fixed iOS crash issue with Flutter `>= 0.10.2`.
5+
- Added new `clearCookies` feature.
6+
- Added support for `hidden` and `initialChild` feature to show page loading view.
7+
- Added supportMultipleWindows: enables Multiple Window Support on Android.
8+
- Added appCacheEnabled: enables Application Caches API on Android.
9+
- Added allowFileURLs: allows `file://` local file URLs.
10+
- iOS Now supports: `reload`, `goBack`, and `goForward`.
11+
- iOS Bug fix `didFailNavigation` #77
12+
- Updated Android `compileSdkVersion` to `27` matching offical Flutter plugins.
13+
- Fixed Android `reloadUrl` so settings are not cleared.
14+
- Enabled compatible `Mixed Content Mode` on Android.
15+
116
# 0.2.1
217

318
- Added webview scrolling listener
@@ -57,10 +72,10 @@
5772
- state change event
5873
- embed in rectangle or fullscreen if null
5974
- hidden webview
60-
75+
6176
- Android
6277
- adding Activity in manifest is not needed anymore
63-
78+
6479
- Add `WebviewScaffold`
6580

6681
# 0.0.9

README.md

Lines changed: 107 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
1-
[![pub package](https://img.shields.io/pub/v/flutter_webview_plugin.svg)](https://pub.dartlang.org/packages/flutter_webview_plugin)
1+
<img src="https://img.shields.io/badge/Flutter%20Communityflutter__webview__plugin-blue.svg?style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAD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k2ycFvrTAGkdAeOFG/KKcTq27JxTFhrIWIAxaIUVn5H/aen1qKmwqrJybCAyPOlV86yRIN3QDVdwL9NMDIM1tOWX5fA9JYqgs/peDBifilxqvoZZee1soilGxFhEQUbSJ6f0AERFZCeo3LzCLMMOPQ3BOO8iLekGx8X0y6KcG0GfNH/suXJcljX1Jj7z+YF4GYBEpNd9xEhEc+9MWZhGNQC2usC/CmDZx+74F8dpmkOW3AVXUA1TJe2YRiqf6gNZ1EdCQNBvPM0TijodYHcZaBL4vZXrNREREVEDcWxfnizB6Pu7dP0MQmkeqfQcJaAV5QQeKgn6WCGrTIVDoOg3zpjXZE3EXiTDWhLvArgCBUCykkneeZxUJUzoNG0UY4dUtlyFwZQ1I1r6OBPwOZHn7QF7YheB7gTJFgLuIex7iOHaF7eYf5Yd2qyOqTIZIoL0TtbQK4t6+RMAN8KPgH7+DwMvy9iKvdxuhD84Cnyciv4ONiNt+obnZrEQIhBJ3lE6fMkYCi1hSCfHNl1HBXoUg9JkceZRAYzA74PNFtBsEWBNBBNTdC4zctJF1PZDCjil9S8XwQw/cnei4GqDWNCOQPiM4M7TNSKTNjgR2IkrrM6gjcf/BBzb/sPwNtKb+nr1o4MUuJLUBaO0eA4gDAixFKC1edIujt9Q/omEoYlvm7r8kQKp+WU8iYatLYc+h4qa1e3mLoPNRGiZXnfWSaaIcArZl3sonEuSJOz7GQqz++Mksgl8k8DoRnPOO697weNOr41B9tKDCuokjQjqWZa1gEevfRSIOsi7k+SL60bZjzymBX6iby4S4eS/08lVlr5Es37obReYLxcrqMWVa430UiSmTCIejYNx2YBFuklg/l4mwNIEn7e67cH2yJKa0BnWOIUVC+RV5TssYWokn5Lp2h4aipPfHwPSdL5qe8T+XgeDXeA98zQAAAABJRU5ErkJggg==" width="800">
22

3+
[Flutter Community](https://github.com/fluttercommunity/community)
34

4-
# flutter_webview_plugin
5+
# Flutter WebView Plugin
56

6-
Plugin that allow Flutter to communicate with a native WebView.
7+
[![pub package](https://img.shields.io/pub/v/flutter_webview_plugin.svg)](https://pub.dartlang.org/packages/flutter_webview_plugin)
78

8-
***Warning:***
9+
Plugin that allows Flutter to communicate with a native WebView.
10+
11+
**_Warning:_**
912
The webview is not integrated in the widget tree, it is a native view on top of the flutter view.
1013
you won't be able to use snackbars, dialogs ...
1114

@@ -21,24 +24,57 @@ For help getting started with Flutter, view our online [documentation](http://fl
2124
new MaterialApp(
2225
routes: {
2326
"/": (_) => new WebviewScaffold(
24-
url: "https://www.google.com",
25-
appBar: new AppBar(
26-
title: new Text("Widget webview"),
27-
),
28-
)
27+
url: "https://www.google.com",
28+
appBar: new AppBar(
29+
title: new Text("Widget webview"),
30+
),
31+
),
2932
},
3033
);
3134
```
3235

36+
Optional parameters `hidden` and `initialChild` are available so that you can show something else while waiting for the page to load.
37+
If you set `hidden` to true it will show a default CircularProgressIndicator. If you additionally specify a Widget for initialChild
38+
you can have it display whatever you like till page-load.
39+
40+
e.g. The following will show a read screen with the text 'waiting.....'.
41+
```dart
42+
return new MaterialApp(
43+
title: 'Flutter WebView Demo',
44+
theme: new ThemeData(
45+
primarySwatch: Colors.blue,
46+
),
47+
routes: {
48+
'/': (_) => const MyHomePage(title: 'Flutter WebView Demo'),
49+
'/widget': (_) => new WebviewScaffold(
50+
url: selectedUrl,
51+
appBar: new AppBar(
52+
title: const Text('Widget webview'),
53+
),
54+
withZoom: true,
55+
withLocalStorage: true,
56+
hidden: true,
57+
initialChild: Container(
58+
color: Colors.redAccent,
59+
child: const Center(
60+
child: Text('Waiting.....'),
61+
),
62+
),
63+
),
64+
},
65+
);
66+
```
67+
3368
`FlutterWebviewPlugin` provide a singleton instance linked to one unique webview,
3469
so you can take control of the webview from anywhere in the app
3570

3671
listen for events
72+
3773
```dart
3874
final flutterWebviewPlugin = new FlutterWebviewPlugin();
3975
4076
flutterWebviewPlugin.onUrlChanged.listen((String url) {
41-
77+
4278
});
4379
```
4480

@@ -62,7 +98,7 @@ Note: Do note there is a slight difference is scroll distance between ios and an
6298
#### Hidden WebView
6399
64100
```dart
65-
final flutterWebviewPlugin = new FlutterWebviewPlugin();
101+
final flutterWebviewPlugin = new FlutterWebviewPlugin();
66102
67103
flutterWebviewPlugin.launch(url, hidden: true);
68104
```
@@ -76,58 +112,98 @@ flutterWebviewPlugin.close();
76112
#### Webview inside custom Rectangle
77113

78114
```dart
79-
final flutterWebviewPlugin = new FlutterWebviewPlugin();
115+
final flutterWebviewPlugin = new FlutterWebviewPlugin();
80116
81117
flutterWebviewPlugin.launch(url,
82-
fullScreen: false,
83-
rect: new Rect.fromLTWH(
84-
0.0,
85-
0.0,
86-
MediaQuery.of(context).size.width,
87-
300.0));
118+
fullScreen: false,
119+
rect: new Rect.fromLTWH(
120+
0.0,
121+
0.0,
122+
MediaQuery.of(context).size.width,
123+
300.0,
124+
),
125+
);
88126
```
89127

90128
### Webview Events
91129

92130
- `Stream<Null>` onDestroy
93131
- `Stream<String>` onUrlChanged
94132
- `Stream<WebViewStateChanged>` onStateChanged
133+
- `Stream<double>` onScrollXChanged
134+
- `Stream<double>` onScrollYChanged
95135
- `Stream<String>` onError
96136

97-
***Don't forget to dispose webview***
137+
**_Don't forget to dispose webview_**
98138
`flutterWebviewPlugin.dispose()`
99139

100140
### Webview Functions
101141

102142
```dart
103-
Future<Null> launch(String url,
104-
{Map<String, String> headers: null,
105-
bool withJavascript: true,
106-
bool clearCache: false,
107-
bool clearCookies: false,
108-
bool hidden: false,
109-
bool enableAppScheme: true,
110-
Rect rect: null,
111-
String userAgent: null,
112-
bool withZoom: false,
113-
bool withLocalStorage: true,
114-
bool scrollBar: true});
143+
Future<Null> launch(String url, {
144+
Map<String, String> headers: null,
145+
bool withJavascript: true,
146+
bool clearCache: false,
147+
bool clearCookies: false,
148+
bool hidden: false,
149+
bool enableAppScheme: true,
150+
Rect rect: null,
151+
String userAgent: null,
152+
bool withZoom: false,
153+
bool withLocalStorage: true,
154+
bool withLocalUrl: true,
155+
bool scrollBar: true,
156+
bool supportMultipleWindows: false,
157+
bool appCacheEnabled: false,
158+
bool allowFileURLs: false,
159+
});
115160
```
161+
116162
```dart
117163
Future<String> evalJavascript(String code);
118164
```
165+
119166
```dart
120167
Future<Map<String, dynamic>> getCookies();
121168
```
169+
170+
```dart
171+
Future<Null> cleanCookies();
172+
```
173+
122174
```dart
123175
Future<Null> resize(Rect rect);
124176
```
177+
125178
```dart
126179
Future<Null> show();
127180
```
181+
128182
```dart
129183
Future<Null> hide();
130184
```
185+
131186
```dart
132187
Future<Null> reloadUrl(String url);
133188
```
189+
190+
```dart
191+
Future<Null> close();
192+
```
193+
194+
```dart
195+
Future<Null> reload();
196+
```
197+
198+
```dart
199+
Future<Null> goBack();
200+
```
201+
202+
```dart
203+
Future<Null> goForward();
204+
```
205+
206+
```dart
207+
Future<Null> stopLoading();
208+
```
209+

android/build.gradle

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
group 'com.yourcompany.flutter_webview_plugin'
1+
group 'com.flutter_webview_plugin'
22
version '1.0-SNAPSHOT'
33

44
buildscript {
@@ -8,7 +8,7 @@ buildscript {
88
}
99

1010
dependencies {
11-
classpath 'com.android.tools.build:gradle:3.1.2'
11+
classpath 'com.android.tools.build:gradle:3.2.1'
1212
}
1313
}
1414

@@ -21,11 +21,12 @@ allprojects {
2121
apply plugin: 'com.android.library'
2222

2323
android {
24-
compileSdkVersion 25
25-
buildToolsVersion '27.0.3'
24+
compileSdkVersion 27
2625

2726
defaultConfig {
2827
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
28+
// NOTE(jeffmikels): When targetSdkVersion or minSdkVersion is not set or < 4, gradle adds
29+
// additional scary permissions such as WRITE_EXTERNAL_STORAGE and READ_PHONE_STATE.
2930
minSdkVersion 16
3031
}
3132
lintOptions {
Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
22
package="com.flutter_webview_plugin">
3-
43
</manifest>

0 commit comments

Comments
 (0)