How can you center crop a Widget in Flutter?

Posted by Ramesh Singh | Updated on

Want to center crop a Widget in Flutter? There were a few missing pieces:

1. I needed an OverflowBox with no restrictions so that my child could grow as large as needed.
2. I needed the child of FittedBox to actually enforce a size to stop the layout system from crashing.
3. Now that my widget will paint outside of its bounds, we also want to put a ClipRect in there to stop this from happening.

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers