Widget getGoogleGraph()

in frontend/frontend-flutter/lib/screens/bot.dart [1007:1050]


  Widget getGoogleGraph(dynamic dataViz) {
    print(" bot: getGoogleGraph() : START");
    Container container;

    if (dataViz!["chart_div"]! != null) {
      print(
          'bot: getGoogleGraph() : dataViz!["chart_div"]! = ${dataViz!["chart_div"]!}');

      String htmlPre = """<html>
                          <head>
                            <!--Load the AJAX API-->
                            <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
                            <script type="text/javascript"> """;
      String htmlPost = """</script>
                          </head>
                        
                          <body>
                            <!--Div that will hold the pie chart-->
                            <div id="chart_div"></div>
                          </body>
                        </html>""";

      container =  Container(
        child: InAppWebView(
          initialData: InAppWebViewInitialData(
              data: htmlPre + "\n" + dataViz!["chart_div"]!.replaceAll('width: 600,','width: 1200,').replaceAll('height: 300,', 'height: 600,') + htmlPost + "\n"),
          onWebViewCreated: (controller) {
            webViewController = controller;
          },
        ),
      );

      isGraphKeyAdded = true;
      graphContainer = container;

      return container;
    } else {
      return Text("No Chart",
          style: TextStyle(
              fontSize: 16,
              color: Colors.indigoAccent,
              fontWeight: FontWeight.bold));
    }
  }