How to open browser with Webview in Flutter?

Viewed 491

I have a list of item, and in the list I have integrated a webview to display my own ads (HTML and JS). It's working fine but When I click on the ads (to go to the website of the brand for example) it doesn't open a browser but it open in the webview.

   ListView.separated(
    padding: EdgeInsets.zero,
    itemCount: (data.articles == null) ? data.totalResults: data.articles.length,
    separatorBuilder: (context, index) {
    if (index % 5 == 2) {
      return Card(
        child: Container(  
                 
           height: _height,
             child: WebViewPlus(
              onWebViewCreated: (controller) {
              this._controller = controller;
            controller.loadAsset('assets/pages/exemple.html');
            },
         
      onPageFinished: (url) {
        _controller.getWebviewPlusHeight().then((double height) {
          print("Height:  " + height.toString());
           print("URL:  " + url);
          setState(() {
            _height = height;
          });
        });
      },
      javascriptMode: JavascriptMode.unrestricted,
             ),)
        
         ,);

      }
      return Divider(
        color: Colors.redAccent,
      );
    },

I use the webview_flutter_plus it can manage the size of the container. Can anyone help me ? Thank you.

0 Answers
Related