fluttercommunity / fluttercommunity/flutter_webview_plugin

Android layout problem. 1px white line at right and bottom

オープン
#654 コメント 2 件 リアクション 5 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
1.5k
フォーク
938
PR マージ指標
30日以内にマージされた PR はありません

説明

## System info

Issue occurs on: Android
Plugin version: 0.3.10+1
Flutter doctor output:

```
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel dev, v1.14.4, on Mac OS X 10.15.2 19C57, locale en)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
[✓] Xcode - develop for iOS and macOS (Xcode 11.3.1)
[✓] Android Studio (version 3.5)
[✓] Connected device (2 available)

• No issues found!
```

## Steps to Reproduce

1. create a fresh project with only WebviewScaffold
2. enter a dark webpage url for ex. (https://www.blakeallendesign.com/)
3. voila. There is a 1px white line at right and there is 1px white line at bottom

## The layout of the webview scaffold is set in this file

_/Users/edex/.pub-cache/hosted/pub.dartlang.org/flutter_webview_plugin-0.3.10+1/android/src/main/java/com/flutter_webview_plugin/FlutterWebviewPlugin.java_

I think its a _pixel density calculation_' problem

```java
FrameLayout.LayoutParams params;
if (rc != null) {
params = new FrameLayout.LayoutParams(
dp2px(activity, rc.get("width").intValue() +1),
dp2px(activity, rc.get("height").intValue() +1)
);

params.setMargins(
dp2px(activity, rc.get("left").intValue()),
dp2px(activity, rc.get("top").intValue()),
0,0
);
```

### 0.5f is the default offset value I've tested with these values
0.0f lines become thicker 2x
1.0f lines appears at left and top this time
0.9f same as 0.5
0.99f same as 0.5
-0.5 same as 0.0f

```java
private int dp2px(Context context, float dp) {
final float scale = context.getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0.5f);
}
```

#### The solution is to add +1 to width and heigh then the fractions doesnt matter
```
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

android/src/main/java/com/flutter_webview_plugin/FlutterWebviewPlugin.java から始め、レポートに示されている WebView scaffold のレイアウトパラメータと dp2px 変換に注目してください。新しい Flutter プロジェクト、WebviewScaffold、およびリンク先の例のような暗い Web ページを使って再現してください。Android WebView が scaffold 全体を埋め、右端と下端に 1px の白い線が表示されなければ完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
android, flutter, java
領域
mobile
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。