1

I am a newbie for Flutter Development, I have created a sample demo to get JSON from Server and Bind in ListView, I have done it successfully.

Now I want to show CircularProgressIndicator() in the center of the screen while loading the list.

I have tried many ways like Expanded, Flexible, Stack but didn't get succeed.

You can check the full code here: main.dart

Here is the screenshot.

enter image description here

Can anyone help me to keep CircularProgressIndicator in the center?

CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
Pratik Butani
  • 60,504
  • 58
  • 273
  • 437

2 Answers2

2

Use this approach:

Column(
  children: [
    TextField(),  // Your text field. 
    Expanded(
      child: Center(
        child: CircularProgressIndicator(),
      ),
    ),
  ],
)
CopsOnRoad
  • 237,138
  • 77
  • 654
  • 440
0

This is an alternative approach:

        Column(
          children: [
            TextField(), // Your text field.
            Spacer(),
            CircularProgressIndicator(),
            Spacer(),
          ],
        ),
SLendeR
  • 839
  • 7
  • 25