onInit method

  1. @override
void onInit()
override

Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.

Implementation

@override
void onInit() {
  double floatingSize = (size.shortestSide *
          (size.aspectRatio > 2 || size.aspectRatio < 0.5 ? 0.45 : 0.33))
      .clamp(_minHeight, 250);
  width = RxDouble(floatingSize);
  height = RxDouble(floatingSize);

  if (intersection != null) {
    _relocateWorker = ever(intersection!, (_) => relocate());
  }

  SchedulerBinding.instance.addPostFrameCallback((_) => relocate());

  super.onInit();
}