title: CircularprogressIndicator while loading the home screen during logging in app in flutter
body: <p>I was looking to show circularprogressindicator while user is being logged into device.I saw various methods online one of them was by using bool _isloading like <a href="https://stackoverflow.com/questions/59507960/async-await-to-do-circularprogressindicator-in-a-login-page-in-flutter">here</a> but here it replaced my button with curcularprogressindicator and not logged in too + I want the indicator in center of screen and other was while using futurebuilder which i don't require. So, i thinked a lot and couldn't find anything ,so if you can help me it will be very greatful.</p>
  <p>My code:</p>
  <pre><code>import 'dart:convert';
  
  import 'package:flutter/material.dart';
  import 'package:flutter_secure_storage/flutter_secure_storage.dart';
  import 'package:green_earth/mainpage.dart';
  import 'package:http/http.dart' as http;
  
  Future&lt;void&gt; attemptSignUp(String username, String password,BuildContext context) async {
    final http.Response res = await http.post(
            'https://green-earth.herokuapp.com/signup',
          headers: &lt;String, String&gt;{
            'Content-Type': 'application/json; charset=UTF-8',
          },
          body:jsonEncode(&lt;String, String&gt;{
          &quot;email&quot;:username,
          &quot;password&quot;:password
        }),
    );
    CircularProgressIndicator();
    if (res.statusCode==200){
      Navigator.of(context).pushNamed('/home');
    }
    else{
      _showMyDialog(context,res.statusCode);
    }
  }
  // print(&quot;res status code=${res.statusCode}  $username $password ${jsonDecode(res.body)}&quot;)
  Future&lt;void&gt; _showMyDialog(BuildContext context,int statuscode) async {
    return showDialog&lt;void&gt;(
      context: context,
      barrierDismissible: false, // user must tap button!
      builder: (BuildContext context) {
        return AlertDialog(
          title: Text('Error'),
          content: SingleChildScrollView(
            child: ListBody(
              children: &lt;Widget&gt;[
                statuscode==422?Text('Email ID is already taken. Please try again!'):Text('Authorisation was failed with status code $statuscode'),
              ],
            ),
          ),
          actions: &lt;Widget&gt;[
            TextButton(
              child: Text('OK'),
              onPressed: () {
                Navigator.of(context).pop();
              },
            ),
          ],
        );
      },
    );
  }
  </code></pre>
  <p>calling function</p>
  <pre><code>GestureDetector(
                      onTap:(){
                        if(formkey2.currentState.validate()==true){
                          signupUsername=signupUsernameController.text;
                          signupPassword=signupPasswordController.text;
                          attemptSignUp(signupUsername, signupPassword,context);
  
                        }
                      },
                      child: PrimaryButton(
                        btnText: &quot;Create Account&quot;,
                      ),
                    ),
  </code></pre>