How to center a Widget vertically in PreferredSizeWidget?

Posted by Andre Scott | Updated on

Want to center a Widget vertically in PreferredSizeWidget? PreferredSizeWidget does not impose a size constraint on its child, so you must wrap the Column in a widget with defined height in order to add alignment.

Also, mainAxisAlignment should be used, since this is the vertical alignment in a Column.


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.

Related Questions & Answers