-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnews_webview.dart
41 lines (35 loc) · 950 Bytes
/
news_webview.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import 'package:flutter/material.dart';
import 'package:share/share.dart';
import 'package:webview_flutter/webview_flutter.dart';
class NewsWebview extends StatefulWidget {
final String url;
NewsWebview(this.url);
@override
createState() => _NewsWebviewState(this.url);
}
// Webview page i
class _NewsWebviewState extends State<NewsWebview> {
final String _url;
final _key = UniqueKey();
_NewsWebviewState(this._url);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
actions: [
IconButton(
icon: Icon(Icons.share), onPressed: () => Share.share(_url))
],
),
body: Column(
children: [
Expanded(
child: WebView(
key: _key,
javascriptMode: JavascriptMode.unrestricted,
initialUrl: _url),
)
],
));
}
}