---
# System prepended metadata

title: 『Flutter』 WebView 問題集
tags: [Flutter]

---

# 『Flutter』 WebView 問題集
###### tags: `Flutter`
## 1. ERR_cleartext_not_permitted

android文件新增
```
<application  android:usesCleartextTraffic="true">
```
位置 android\app\src\main\AndroidManifest.xml
```=
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.name">
    <uses-permission android:name="android.permission.INTERNET"/>

    <application  android:usesCleartextTraffic="true">
    </application>
</manifest>
```

Debug模式在debug文件內修改


## 2. Webview_flutter 長按問題
android 長按問題 

解決辦法

* 註解或重寫長按判斷

webview_flutter => webview_android.dart
```=
//onLongPress:(){}
```
* 使用
```=
gestureRecognizers: Platform.isAndroid ? {Factory(() => EagerGestureRecognizer())} : null
```

參考
https://github.com/flutter/flutter/issues/37927
https://github.com/flutter/flutter/issues/43792



## 3. 動畫問題
測試webview_flutter物件多時稍微不順
第三方flutter_webview_plugin和原生速度一樣

參考
https://stackoverflow.com/questions/55587918/web-view-is-too-slow
https://github.com/flutter/flutter/issues/54810
https://github.com/flutter/flutter/issues/52211