Skip to content

Instantly share code, notes, and snippets.

@shreyassanthu77
Created November 11, 2022 13:45
Show Gist options
  • Save shreyassanthu77/0c076fff46608effac182959969e52b4 to your computer and use it in GitHub Desktop.
Save shreyassanthu77/0c076fff46608effac182959969e52b4 to your computer and use it in GitHub Desktop.
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:webview_dart/webview_dart.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData.dark(useMaterial3: true),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatelessWidget {
const MyHomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Webview"),
),
body: Center(
child: ElevatedButton(
child: const Text("Open Browser"),
onPressed: () {
compute((message) {
final w = Webview(true)
.setTitle("title")
.setSize(1280, 800)
.navigate("https://www.google.com")
.run();
}, "start_webview");
},
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment