0

Flutter のPerspectives Pageviewライブラリを使用して、水平方向のカルーセルを実装しています。Containers画像やテキストなどで定期的にレンダリングしているときは、すべて正常に機能します。

ここに画像の説明を入力

ただし、WebView を埋め込むと、親コンテナーを超えてオーバーフローし、ウィジェットを移動するとサイズが変更されます。

ここに画像の説明を入力

これの原因と、他の要素のように親の中にとどまるように修正する方法がわかりません。

私のコード:

Container(
      child: Center(
        // Adding Child Widget of Perspective PageView
        child: PerspectivePageView(
          hasShadow: true, // Enable-Disable Shadow
          shadowColor: Colors.black12,
          children: <Widget>[
            Container(
                child: Column(
                  children: [
                    Expanded(
                      child: Container(
                        color: Colors.black54,
                        child: Container(
                            color: Colors.white,
                            child: Column(
                              children: [
                                Expanded(
                                  child: WebViewPlus(
                                    onWebViewCreated: (controller) {
                                      this._controller = controller;
                                      controller
                                          .loadString(_htmlForCardsList[0]);
                                    },
                                    javascriptMode: JavascriptMode.unrestricted,
                                  ),
                                )
                              ],
                            )),
                        padding: EdgeInsets.all(2),
                      ),
                    ),
                    Container(
                      child: Row(
                        mainAxisAlignment: MainAxisAlignment.center,
                        children: [
                          Text(
                            "View Next",
                            style: TextStyle(
                                fontSize: 24.0,
                                fontWeight: FontWeight.w400,
                                color: Colors.orange),
                          ),
                        ],
                      ),
                      height: 60,
                      decoration: BoxDecoration(
                        color: Colors.white,
                        border: Border(
                          top: BorderSide(color: Colors.black54, width: .3),
                          bottom: BorderSide(color: Colors.black54, width: 1.5),
                          left: BorderSide(color: Colors.black54, width: 1.5),
                          right: BorderSide(color: Colors.black54, width: 1.5),
                        ),
                      ),
                    ),
                  ],
                ),
                color: Colors.orange)])))

Expandedまた、の親をに置き換えてみましWebView

Container(
          width: 300,
          height: 200,
          child: WebViewPlus(
          ...

私は同じ問題に遭遇します。カルーセルを水平方向にスクロールすると、カルーセル内に含まれる他のコンテンツとは異なり、WebView のサイズが変化します。

洞察に感謝します。

4

1 に答える 1