createRenderObject method

  1. @override
RenderObject createRenderObject(
  1. BuildContext context
)
override

Creates an instance of the RenderObject class that this RenderObjectWidget represents, using the configuration described by this RenderObjectWidget.

This method should not do anything with the children of the render object. That should instead be handled by the method that overrides RenderObjectElement.mount in the object rendered by this object's createElement method. See, for example, SingleChildRenderObjectElement.mount.

Implementation

@override
RenderObject createRenderObject(BuildContext context) {
  // Doing this here and not in constructor so it can remain const
  artboard.antialiasing = antialiasing;
  final tickerModeValue = TickerMode.of(context);
  return RiveRenderObject(artboard as RuntimeArtboard)
    ..fit = fit
    ..alignment = alignment
    ..artboardSize = Size(artboard.width, artboard.height)
    ..useArtboardSize = useArtboardSize
    ..clipRect = clipRect
    ..tickerModeEnabled = tickerModeValue
    ..enableHitTests = enablePointerEvents
    ..cursor = cursor
    ..behavior = behavior;
}