show static method

void show({
  1. required String identify,
  2. required BuildContext context,
  3. required GameComponent target,
  4. required Widget child,
  5. Offset offset = Offset.zero,
  6. AlignmentGeometry? alignment,
})

Use this method to show a widget what follow the component

Implementation

static void show({
  required String identify,
  required BuildContext context,
  required GameComponent target,
  required Widget child,
  Offset offset = Offset.zero,
  AlignmentGeometry? alignment,
}) {
  final overlay = OverlayEntry(
    builder: (context) {
      return FollowerWidget(
        target: target,
        offset: offset,
        alignment: alignment,
        child: child,
      );
    },
  );
  // ignore: invalid_null_aware_operator
  Overlay.of(context)?.let((over) {
    over.insert(overlay);
    _mapOverlayEntry[identify] = overlay;
  });
}