Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jet10000/e66ddb0bc21f497f16e3579499f1fa76 to your computer and use it in GitHub Desktop.
Save jet10000/e66ddb0bc21f497f16e3579499f1fa76 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"),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment