Want to center only one element in a row of 2 elements in Flutter? You can simply use Expanded and Spacer widgets on left/right side and put your widget inside the Expanded:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Spacer(), framedContainerWithText, Expanded( child: Align( alignment: Alignment.centerLeft, child: IconButton( icon: Icon(Icons.delete), color: Colors.red, onPressed: () {}, ), ), ), ], ), |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.