getWebViewWidget static method

Widget getWebViewWidget(
  1. String? body,
  2. String? textColor, {
  3. WebViewController? tourWebViewController,
  4. String? contentHeight,
  5. String? contentwidth,
  6. StepModel? step,
  7. GlobalKey<State<StatefulWidget>>? targetKey,
})

Implementation

static Widget getWebViewWidget(String? body, String? textColor,
    {WebViewController? tourWebViewController,
    String? contentHeight,
    String? contentwidth,
    StepModel? step,
    GlobalKey? targetKey}) {
  return body.toString().startsWith(WebviewUtil.bodyStartsWithHtmlString)
      ? contentHeight == null || contentHeight == "0"
          ? ValueListenableBuilder<Map<String, double>>(
              valueListenable: sizeNotifier,
              builder: (context, size, child) {
                return TooltipWithFlushArrow(
                  showArrow: step?.isCaret == true,
                  targetKey: targetKey ?? GlobalKey(),
                  pointerPosition: step?.position.toString() == "bottom"
                      ? PointerPosition.top
                      : step?.position.toString() == "bottom-left"
                          ? PointerPosition.topRight
                          : step?.position.toString() == "bottom-right"
                              ? PointerPosition.topLeft
                              : step?.position.toString() == "top"
                                  ? PointerPosition.bottom
                                  : step?.position.toString() == "top-left"
                                      ? PointerPosition.bottomLeft
                                      : step?.position.toString() ==
                                              "top-right"
                                          ? PointerPosition.bottomRight
                                          : step?.position.toString() ==
                                                  "left"
                                              ? PointerPosition.right
                                              : step?.position.toString() ==
                                                      "right"
                                                  ? PointerPosition.left
                                                  : PointerPosition.bottom,
                  color: Util.hexToColor(step?.backgroundColor ?? "#000000"),
                  height: size["height"] ?? 0,
                  child: Container(
                    color:
                        Util.hexToColor(step?.backgroundColor ?? "#000000"),
                    height: size["height"],
                    // width: size["width"],
                    width: MediaQuery.of(context).size.width * 0.8,
                    child: WebViewWidget(
                        controller: tourWebViewController ?? controller!),
                  ),
                );
              },
            )
          : TooltipWithFlushArrow(
              showArrow: step?.isCaret == true,
              targetKey: targetKey ?? GlobalKey(),
              pointerPosition: step?.position.toString() == "bottom"
                  ? PointerPosition.top
                  : step?.position.toString() == "bottom-left"
                      ? PointerPosition.topRight
                      : step?.position.toString() == "bottom-right"
                          ? PointerPosition.topLeft
                          : step?.position.toString() == "top"
                              ? PointerPosition.bottom
                              : step?.position.toString() == "top-left"
                                  ? PointerPosition.bottomLeft
                                  : step?.position.toString() == "top-right"
                                      ? PointerPosition.bottomRight
                                      : step?.position.toString() == "left"
                                          ? PointerPosition.right
                                          : step?.position.toString() ==
                                                  "right"
                                              ? PointerPosition.left
                                              : PointerPosition.bottom,
              color: Util.hexToColor(step?.backgroundColor ?? "#000000"),
              height: double.tryParse(
                      contentHeight.toString().replaceAll("px", "")) ??
                  200,
              child: SizedBox(
                height: double.tryParse(
                        contentHeight.toString().replaceAll("px", "")) ??
                    200,
                width: double.tryParse(
                        contentwidth.toString().replaceAll("px", "")) ??
                    200,
                child: WebViewWidget(
                    controller: tourWebViewController ?? controller!),
              ),
            )
      : Text(
          body.toString(),
          overflow: TextOverflow.clip,
          style: TextStyle(
            color: textColor != null ? Util.hexToColor(textColor) : null,
          ),
        );
}