Thomas Banderas
Thomas Banderas

Reputation: 1739

Pretty way to show widget in list on condition

I try to show/hide widget in a list depends on the condition.

All I have come up with is that:

return Row(
  children: [
    ...isLoading ? [CircularProgressIndicator()] : []
  ]
);

May you know a prettier way?

Upvotes: 0

Views: 39

Answers (1)

M Alkhatib
M Alkhatib

Reputation: 727

for one child

return Row(
 children: [
   if(isLoading)   
     CircularProgressIndicator() , 
 ]
);

for many child try this

return Row(
  children: [
    if(isLoading) 
       ...[CircularProgressIndicator() ,CircularProgressIndicator()  ] ,  
  ]
);

Upvotes: 1

Related Questions