How to get a flutter webview to show only a part of the webpage

Viewed 432

I need to interact with a part of a web application through my flutter app so I chose to use flutter webviews but i dont need the hole page i only need to show a div, changing the style of all the DOM elements except the one i want would probably work but that is not a good solution, is there any way to only render the chosen Dom element in a flutter webview Widget?

class Activity extends StatefulWidget {
  const Activity({Key? key}) : super(key: key);

  @override
  _ActivityState createState() => _ActivityState();
}

class _ActivityState extends State<Activity> {
  late WebViewController _controller;
  @override
  Widget build(BuildContext context) {
    return WebView(
      initialUrl: "https://h5p.org/",
      javascriptMode: JavascriptMode.unrestricted,
      onWebViewCreated: (controller) {
        _controller = controller;
      },
      onPageStarted: (url) {
        _controller.evaluateJavascript("/*select all the elements except X*/");
        print("somestuff");
      },
    );
  }
}
0 Answers
Related