What's the difference between
CustomPaint or
RenderObject and which approach is right for us? First of all
CustomPaint is a widget and can be used right away, but to deal with
RenderObject we need a help of
RenderObjectWidget which API allows to create it.
RenderObject is used by the Flutter Framework to actually render widget's that are supposed to be layout and paint, because not each widget requires this, there are other types:
- Composable containers, like StatefulWidget/StatelessWidget — to add our widget to the tree
- 'Meta' widgets, like Theme, MediaQuery etc.
Those above types are not associated with
RenderObject. In Flutter Framework
RenderObject is responsible for on-screen rendering of UI components: their sizing, layout, painting and compositioning.