簡體   English   中英

Flutter 中帶有 webview 的后退按鈕

[英]Back button with webview in Flutter

我正在嘗試在我的屏幕上使用 webview 實現后退按鈕,但不確定為什么它看起來像這樣,所以如果我能得到任何幫助或建議,我將不勝感激。

  Widget build(BuildContext context) {
    return Scaffold(
      body: Container(

        padding: EdgeInsets.symmetric(horizontal: 20),
        child: Column(
          children: [
            Container(
              margin: EdgeInsets.only(top: 50, bottom: 20),
              child: Row(
                crossAxisAlignment: CrossAxisAlignment.center,
                children: [
                  InkWell(
                    onTap: () => Navigator.pop(context),
                    child: SvgPicture.asset(
                      iconsPath + "arrow-left.svg",
                      color:  Color(0xFF282828),
                      width: 20,
                    ),
                  ),
                  SizedBox(width: 20),

                ],
                
              ),
              
            ),
            Container(
              color: Colors.blue,
              child: WebView(initialUrl: "https://google.com", javascriptMode: JavascriptMode.unrestricted
            )
            )],
         
        ),
      ),
      
    );
  }

在此處輸入圖像描述

獲取Container高度和寬度值。

將您的代碼更改為此。

            Container(
              color: Colors.blue,
              height: 200,
              width: double.infinity,
              child: WebView(
                initialUrl: "https://google.com",
                javascriptMode: JavascriptMode.unrestricted,
              ),
            ),

暫無
暫無

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

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