1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

FlutterアプリへWebViewを追加する方法

Posted at

1,やり方

1-1,
pubspec.yamlにwebview_flutter: ^1.0.7
を追加

dependencies:
  flutter:
    sdk: flutter
 ### 省略 ###
  webview_flutter: ^1.0.7

1-2,
flutter pub getします。

2,使い方

使い方はimportしてWebViewウィジェットとして使用します。
下記のサンプルコードでは、
BOTTOM OVERFLOWED BY ** PIXELS
(黄色と黒の斜線)というエラーを回避するために
resizeToAvoidBottomPadding: false,
を付与してあります。

hoge.dart
import 'package:webview_flutter/webview_flutter.dart';

// インスタの埋め込み
@override
  Widget build(BuildContext context) {
    return Scaffold(
      resizeToAvoidBottomPadding: false,
      body:WebView(
              initialUrl: 'https://www.instagram.com', 
              javascriptMode: JavascriptMode.unrestricted
      ),
    );
  }
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?