reBuildChild method

  1. @override
void reBuildChild(
  1. BuildContext context,
  2. Vector2 bounds
)
override

Used to build this child, override to disable if you don't require (re)build

Implementation

@override
void reBuildChild(BuildContext context, Vector2 bounds) {
  updateData(bounds, context, null);
  final List<FlameWidget> flatChildren =
      children.expand((element) => element).toList();
  childrenBuild
    ..forEach((row) => row
      ..forEach((element) =>
          flatChildren.contains(element) ? null : element.dispose())
      ..clear())
    ..clear();
  children.forEach((row) => row.forEach((child) =>
      child.updateData(childSize + Vector2.all(0.2), context, this)));
  childrenBuild.addAll(children
      .map((row) => row.map((child) => child.build(context)).toList()));
  childrenBuild.forEach((row) => row.forEach(
      (child) => child.reBuildChild(context, childSize + Vector2.all(0.2))));
}