簡體   English   中英

flutter 布局appbar bottombar溢出

[英]flutter layout appbar bottombar overflow

我的應用程序的每個頁面都有一個 appbar 和一個 bottombar 小部件。

在其中一個頁面中,我想在一列中顯示一個 Text 小部件和一個 WebView 小部件,其中 Text 小部件的高度為 30dp,而 WebView 用於填充剩余的空間。

但是,考慮到 appbar 和 bottombar 的大小,我想不出一種方法來填充 WebView。

          return Column(
            children: [
              Container(
                height: 30,
                child: Text(
                  "alarm : ${_Message().toString()}",
                  style: TextStyle(fontSize: 15),
                ),
              ),
              Container(
                height: MediaQuery.of(context).size.height * 0.7, <- hard coded
                child: WebView(
                  initialUrl:
                      url,
                  javascriptMode: JavascriptMode.unrestricted,
                  onWebViewCreated:
                      (WebViewController webViewController) async {
                    _controller.complete(webViewController);
                  },
                ),
              )
            ],
          );

現在 webview 是硬編碼的。

我應該如何更改代碼?

      return Column(
                children: [
                  Container(
                    height: 30,
                    child: Text(
                      "alarm : ${_Message().toString()}",
                      style: TextStyle(fontSize: 15),
                    ),
                  ),
                 Expanded(
                    child:Container(
                      child: WebView(
                      initialUrl:
                          url,
                      javascriptMode: JavascriptMode.unrestricted,
                      onWebViewCreated:
                          (WebViewController webViewController) async {
                        _controller.complete(webViewController);
                      },
                    ),
                  ),)
                ],
              );

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM