Flutter show progress/loading indicator

When a button is pressed, call the following to show a progress/loading indicator.

showDialog(
  context: context,
  barrierDismissible: false,
  builder: (BuildContext context) {
    return Dialog(
      child: Row(
        mainAxisSize: MainAxisSize.min,
        children: const [
          Padding(padding: EdgeInsets.all(16.0), child: CircularProgressIndicator(),),
          Text("Loading"),
        ],
      ),
    );
  },
);

To dismiss the progress indicator.

Future.delayed(const Duration(seconds: 3), () {
  Navigator.pop(context); //pop dialog
  Navigator.pop(context); //pop current page
});

Search within Codexpedia

Custom Search

Search the entire web

Custom Search