how to add Desktop Version of Website in Flutter app? how to add Desktop Version of Website in Flutter app? dart dart

how to add Desktop Version of Website in Flutter app?


i know this late answer but maybe someone will need it

BTW i also face this problem before in flutter

after do this trick it was work for me

just try eval this code JavaScript after your page is Loaded

like this

//to load desktop mode  String js =      "document.querySelector('meta[name=\"viewport\"]').setAttribute('content', 'width=1024px, initial-scale=' + (document.documentElement.clientWidth / 1024));";  @override  Widget build(BuildContext context) {    final flutterWebViewPlugin = new FlutterWebviewPlugin();    flutterWebViewPlugin.onProgressChanged.listen((event) {      debugPrint("Progress $event");        //this will make show in desktop mode         flutterWebViewPlugin.evalJavascript(js);    });    return WebviewScaffold(      appBar: AppBar(        title: Text("Desktop Mode"),      ),      url: "My Url",      withJavascript: true,      useWideViewPort: true,      displayZoomControls: false,      scrollBar: true,      withZoom: true,    );  }  

Link Of WebView Plugin here


Change the user agent parameter from null to the value mentioned below

WebView(              userAgent: "Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.4) Gecko/20100101 Firefox/4.0",              initialUrl: html,              javascriptMode: JavascriptMode.unrestricted,              onWebViewCreated: (WebViewController webViewController) {                _controller.complete(webViewController);              },