Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I want to show Loading first before the web view data is displayed on the screen. How can do that using the flutter_inappwebview package?

This is my code:

  home: Scaffold(
    body: Stack(
      children: [
        isLoading
            ? const Center(child: CircularProgressIndicator())
            : const SizedBox(),
        Column(
          children: [
            const SizedBox(height: 30),
            Expanded(
              child: InAppWebView(
                key: _key,
                onLoadStop: (controller, url) {
                  setState(() {
                    isLoading = false;
                initialUrlRequest: URLRequest(
                    url: Uri.parse('https://example.com/')),
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(
                    mediaPlaybackRequiresUserGesture: false,
                androidOnPermissionRequest:
                    (InAppWebViewController controller, String origin,
                        List<String> resources) async {
                  return PermissionRequestResponse(
                    resources: resources,
                    action: PermissionRequestResponseAction.GRANT,

Adding to @user18309290 answer:

Make sure that the order of the widgets that appear in your Stack is correct. My second problem was that the InAppWebView (which is cover the whole screen), was above my CircularProgressIndicator widget. Reordering the Stack of widgets solved the issue.

Here is the correct working code:

Stack(
      children: [
        isLoading
            ? const Center(child: CircularProgressIndicator())
            : const SizedBox(),
        Column(
          children: [
            const SizedBox(height: 30),
            Expanded(
              child: InAppWebView(
                key: _key,
                onLoadStop: (controller, url) {
                  setState(() {
                    isLoading = false;
                initialUrlRequest: URLRequest(
                    url: Uri.parse('https://example.com/')),
                initialOptions: InAppWebViewGroupOptions(
                  crossPlatform: InAppWebViewOptions(
                    mediaPlaybackRequiresUserGesture: false,
                androidOnPermissionRequest:
                    (InAppWebViewController controller, String origin,
                        List<String> resources) async {
                  return PermissionRequestResponse(
                    resources: resources,
                    action: PermissionRequestResponseAction.GRANT,
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.