10.2 C
London
Wednesday, September 11, 2024

android – How one can look forward to a spinner on a web site when parsing flutter


I’m able to obtain knowledge from the positioning utilizing a selector, however the parser outputs a number of outcomes for every replace, I corrected this in order that it solely receives 1 consequence, however the spinner inside the positioning interferes, how can I look forward to it to shut?

var consequence = await controller.evaluateJavascript(supply: """
                          
  var spinner = doc.querySelector('physique > div.main_app > div:nth-child(6) > div.loader > div');
  var spinnerStyle = window.getComputedStyle(spinner);
  var spinnerVisible = spinnerStyle && spinnerStyle.visibility !== 'hidden' && spinnerStyle.show !== 'none';
  spinnerVisible;
""");
                          debugPrint('loaded');
                          spinnerVisible = (consequence == 'true');

I attempted loads of issues and right here is likely one of the ones I attempted

little one:Scaffold( backgroundColor: Colours.black54,
            physique: Column(youngsters: <Widget>[
            Expanded(
            child: Stack(
              children: [
                const SizedBox(height: 60),
                // Row( children: <Widget>[
                //     _buildProgressBar(),]),
                  InAppWebView(
                    key: webViewKey,
                    initialUrlRequest:
                    URLRequest(url: WebUri("https://sitename")),
                    initialSettings: settings,
                    pullToRefreshController: pullToRefreshController,


                    onWebViewCreated: (InAppWebViewController controller) {
                      webViewController = controller;
                      // contextMenu.menuItems.add(worth)

                    },
                    onUpdateVisitedHistory: (webViewController, url, isReload) async {

                    },
                    // onJsBeforeUnload: ,
                    // onLoadStart: (webViewController, url){
                    //
                    // },
                    onLoadStop: (controller, url) async {
                      //pullToRefreshController?.endRefreshing();

                      // contextMenu.menuItems.add(ContextMenuItem(id: 2, title: "tttt", motion: () async{
                      //   controller.evaluateJavascript(supply: """reply-tooltip.tooltip.flipped.reverse""");
                      // }));
                    },
                    onReceivedError: (controller, request, error) {
                      pullToRefreshController?.endRefreshing();
                    },
                    onProgressChanged: (controller, progress) async {
                      if (progress == 100) {
                        pullToRefreshController?.endRefreshing();
                        if ("https://fixuber.beeline.kz/installer/installersOrders/" != controller.getUrl().toString()){
                          Future<String?> waitForContentLoaded(InAppWebViewController controller) async {
                            bool spinnerVisible = true;
                            String? pageContent;
                            last js = "var progressBar = doc.querySelector('physique > div.main_app > div.blur'); if(progressBar) {if(progressBar.type.show === 'none') {true;} else {false;}} else {false;}";
                            last isProgressBarHidden = await controller.evaluateJavascript(supply: js);

                            if (isProgressBarHidden == "true") {
    String html = await webViewController?.evaluateJavascript(supply: "doc.documentElement.outerHTML");
    RegExp exp = RegExp(r'<div.*?class="order_id">(.*?)</div>');
    Iterable<RegExpMatch> matches = exp.allMatches(html);
    Listing<String> spanList = [];
    for (RegExpMatch match in matches){
    spanList.add(match.group(1)!);
    debugPrint(match.group(1)!);
    debugPrint("its work prime");
    }
    debugPrint(spanList.final);
                            }
                              var consequence = await controller.evaluateJavascript(supply: """
                              
      var spinner = doc.querySelector('physique > div.main_app > div:nth-child(6) > div.loader > div');
      var spinnerStyle = window.getComputedStyle(spinner);
      var spinnerVisible = spinnerStyle && spinnerStyle.visibility !== 'hidden' && spinnerStyle.show !== 'none';
      spinnerVisible;
    """);
                              debugPrint('loaded');
                              spinnerVisible = (consequence == 'true');


                            pageContent = await controller.evaluateJavascript(supply: "doc.documentElement.outerHTML");

                            return pageContent;
                          }
                          String html = await webViewController?.evaluateJavascript(supply: "doc.documentElement.outerHTML");
                          // RegExp exp = RegExp(r'<div[^>]*class="order_id"[^>]*>(.*?)</div>');
                          // RegExp exp = RegExp(r'<div.*?class="order_id">(.*?)</div>');
                          RegExp checker = RegExp(r'<div.*?class="status--success">(.*?)</div>');
                          Iterable<RegExpMatch> checkerMatch = checker.allMatches(html);
                          Listing<String> checkerList = [];
                          Iterable<RegExpMatch> matches = checker.allMatches(html);
                          // Iterable<RegExpMatch> matches = exp.allMatches(html);
                          Listing<String> spanList = [];
                          if (checkerList.size == 0){
                            debugPrint("not match");
                          } else {
                          for (RegExpMatch match in matches){
                            if(match.group(1)!=null){
                            spanList.add(match.group(1)!);}
                            debugPrint(match.group(1)!);debugPrint("!its work bot");
                          }
                          debugPrint(spanList.final);debugPrint("its work bot");}}
                        //this.progress = progress / 100;
                      }
                    },
                  ),
            ]),
            ),
            ])));

That is principally all my code, I will be glad in the event you assist

Latest news
Related news

LEAVE A REPLY

Please enter your comment!
Please enter your name here