build method

  1. @override
Widget build(
  1. BuildContext context
)
override

This function returns a Scaffold with a WebView and a cancel button, and shows a loading indicator while the WebView is loading.

Args: context (BuildContext): The BuildContext is a required parameter in the build method of a widget in Flutter. It represents the location of the widget in the widget tree and is used to obtain information about the current theme, media query, and other contextual information. It is typically used to build child widgets or to access services such

Returns: A [Scaffold[ widget with a [Stack[ as its body, containing a [WebView[ widget, a [Container[ widget with a [Row[ of [InkWell[ widgets, and a [Visibility[ widget with a [CircularProgressIndicator[.

Implementation

@override
Widget build(BuildContext context) {
  return Scaffold(
    body: Stack(
      children: [
        Padding(
          padding: const EdgeInsets.only(top: 25.0),
          child: Builder(builder: (BuildContext context) {
            return WebViewWidget(
              controller: webViewController,
            );
          }),
        ),
        Container(
          height: 75,
          padding: const EdgeInsets.fromLTRB(24, 20, 24, 0),
          width: double.infinity,
          color: Colors.transparent,
          alignment: Alignment.bottomCenter,
          child: Row(
            mainAxisAlignment: MainAxisAlignment.spaceBetween,
            children: [
              InkWell(
                onTap: () async {
                  // await controllerGlobal.canGoBack().then((canGo) {
                  //   if (canGo) {
                  //     controllerGlobal.goBack();
                  //   } else {
                  //     Navigator.of(context).pop();
                  //   }
                  // });
                },
                child: const Icon(
                  Icons.arrow_back_ios,
                  color: Colors.transparent,
                ),
              ),
              InkWell(
                onTap: () {
                  _handleNavigation('');
                },
                child: const Icon(
                  Icons.cancel_outlined,
                  color: Colors.red,
                ),
              ),
            ],
          ),
        ),
        ValueListenableBuilder(
            valueListenable: _isLoading,
            builder: (context, value, child) {
              return Visibility(
                visible: value,
                child: const Center(
                  child: CircularProgressIndicator(
                    strokeWidth: 2,
                    color: Colors.purple,
                  ),
                ),
              );
            }),
      ],
    ),
  );
}