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.
final Size size = controller.value.size;
return new ClipRect(
child: new OverflowBox(
child: new FittedBox(
child: new Container(
child: new VideoPlayer(controller)
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.