How to add a Webview in Flutter?

前端 未结 7 1610
逝去的感伤
逝去的感伤 2020-12-15 17:43

I know its possible to add a WebView as a full page but couldn\'t find any sample code to do it. I assume you could use a PageView as it\'s base but not sure how to call the

7条回答
  •  天涯浪人
    2020-12-15 18:29

    You can use https://pub.dartlang.org/packages/webview_flutter

    example

    import 'package:webview_flutter/webview_flutter.dart';
    
    return Scaffold(
          appBar: AppBar(
            title: const Text('Flutter WebView example'),
          ),
          body: const WebView(
            initialUrl: 'https://flutter.io',
            javascriptMode: JavascriptMode.unrestricted,
          ),
        );
    

提交回复
热议问题