How to center one widget among three in a Row?

mainAxisAlignment to center causes all 3 widgets as one to become centered.

How do I center the 2nd widget only, and keep the other two widgets beside the middle 2nd widget?

>Solution :

create 4 rows , center the middle one with its own alignment. something like this …

Row(
    mainAxisAlignment: MainAxisAlignment.spaceEvenly
  children: 
  [
    Row(children: [...]), // start or end align here if needed
    Row(mainAxisAlignment: MainAxisAlignment.center, children: [...] ),
    Row(children: [...]), // start or end align here if needed
  ],
 ),

Leave a Reply