Last active
February 15, 2022 01:33
-
-
Save YoshihitoAso/f1a4a5632f3cf8641276134fbb9ae44c 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
i'm facing this error, can you please tell me i have to create dart secondscreen?