Forked from YoshihitoAso/0_Flutter_WebView_Sample.md
Created
September 29, 2019 21:01
-
-
Save jet10000/e66ddb0bc21f497f16e3579499f1fa76 to your computer and use it in GitHub Desktop.
Flutter WebView Sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_webview_plugin/flutter_webview_plugin.dart'; | |
void main() => runApp(new MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return new MaterialApp( | |
home: FirstScreen(), | |
); | |
} | |
} | |
class FirstScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar( | |
title: Text('WebView Sample'), | |
), | |
body: Center( | |
child: RaisedButton( | |
child: Text('Launch WebView'), | |
onPressed: () { | |
Navigator.push( | |
context, | |
MaterialPageRoute(builder: (context) => SecondScreen()), | |
); | |
}, | |
), | |
), | |
); | |
} | |
} | |
class SecondScreen extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return WebviewScaffold( | |
url: "https://flutter.io/", | |
appBar: new AppBar( | |
title: new Text("Widget WebView"), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment