亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

如何在移動應用程序中隱藏顫動的 webview

如何在移動應用程序中隱藏顫動的 webview

鴻蒙傳說 2022-11-11 16:35:19
我可以在我的移動應用程序中使用 javascript 執行代碼和庫。我使用 webview_flutter 來做到這一點。但我不想在我的 UI 中顯示 webview。我只想在隱藏 webview 的情況下執行庫。我怎么能在顫動中做到這一點?
查看完整描述

1 回答

?
繁花如伊

TA貢獻2012條經驗 獲得超12個贊

我找到了解決我自己問題的方法。我改用 webview_flutter_plus: ^0.1.1+9 和具有適當屬性的 Visibility 小部件??梢栽谙旅娴拇a片段中看到。


  @override

  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(

        title: Text('Webview counter: ' + scounter),

      ),

      body: Column(

        children: <Widget>[

          Visibility(

            visible: false,

            maintainState: true,

            child: SizedBox(

              height: 1,

              child: WebViewPlus(

                onWebViewCreated: (controller) {

                  this._webViewController = controller;

                  controller.loadUrl("files/test.html");

                },

                onPageFinished: (url) {

                  _webViewController.getHeight().then((double height) {

                    print("height: " + height.toString());

                    setState(() {

                      _height = height;

                    });

                  });

                },

                javascriptMode: JavascriptMode.unrestricted,

                javascriptChannels: <JavascriptChannel>[_counterx()].toSet(),

              ),

            ),

          ),

          Text("Webview above"),

        ],

      ),

      floatingActionButton: FloatingActionButton(

        child: const Icon(Icons.add),

        onPressed: () {

          _webViewController.evaluateJavascript('reset()');

        },

      ),

    );

  }


查看完整回答
反對 回復 2022-11-11
  • 1 回答
  • 0 關注
  • 99 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號