Created
November 11, 2022 13:45
-
-
Save shreyassanthu77/0c076fff46608effac182959969e52b4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/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