Dart and Flutter Web View

import 'dart:async'; import 'package:flutter/material.dart'; import 'package:webview_flutter/webview_flutter.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { // This widget is the root of your application. final Completer<WebViewController> _controller = Completer<WebViewController>(); @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( backgroundColor: Colors.black, appBar: AppBar( centerTitle: true, title: Text( 'APPBAR TITLE', style: TextStyle( fontFamily: 'Montserrat', color: Colors.teal.shade100, fontSize: 14.0, letterSpacing: 2.5, fontWeight: FontWeight.normal, ), ), backgroundColor: Colors.black, ), body: WebView( initialUrl: "https://www.url.com", javascriptMode: JavascriptMode.unrestricted, onWebViewCreated: (WebViewController webViewController) { _controller.complete(webViewController); }), ), ); } } class MyHomePage extends StatefulWidget { @override _MyHomePageState createState() => _MyHomePageState(); } class _MyHomePageState extends State<MyHomePage> { @override Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.black, body: Center(), ); } }
Starting Dart file for Web View

1 Response

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.