Skip to content

Instantly share code, notes, and snippets.

@YoshihitoAso
Last active February 15, 2022 01:33
Show Gist options
  • Save YoshihitoAso/f1a4a5632f3cf8641276134fbb9ae44c to your computer and use it in GitHub Desktop.
Save YoshihitoAso/f1a4a5632f3cf8641276134fbb9ae44c to your computer and use it in GitHub Desktop.
Flutter WebView Sample
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"),
),
);
}
}
@Moix1
Copy link

Moix1 commented Nov 19, 2019

image

i'm facing this error, can you please tell me i have to create dart secondscreen?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment