Issue
Container(
height: 150,
width: 150,
child: _loading
? Container(
height: 50,
width: 50,
child: CircularProgressIndicator(),
)
: ElevatedButton(
style: ButtonStyle(
backgroundColor: MaterialStateProperty.all<Color>(Colors.blue)),
onPressed: () {},
child: Text('update'),
),
);
I am trying to switch button to the CircularProgressIndicator()
like the above code. However, the indicator's size does not set to the parent's container size (width height 50), but it is set to the grandpa Container (width height 150)
. Is there any way that I can set the size to 50 px container?
Solution
Wrap the CircularProgressIndicator
in a FittedBox
Like so:
Container(
height: 50,
width: 50,
child: FittedBox(child: CircularProgressIndicator()),
)
Answered By - Josteve
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.