items method

Implementation

SingleChildRenderObjectWidget items(void Function(FHorizontalSizeMeasurerItems e) fn) {
  _isHaveSize = false;
  pipe.update(-1);

  final e = FHorizontalSizeMeasurerItems._();
  fn(e);

  Widget getWidget(List<dynamic> ls) {
    Widget widget = ls[0];
    bool isFittedBox = ls[1];

    if (!visible) {
      widget = SizedBox(height: widgetHeight, child: widget);
    }
    if (isFittedBox) {
      widget = FittedBox(child: widget);
    }
    return widget;
  }

  // Measure size all widget with height = 1
  // Wrap will stack vertically if width not enough
  // Not visible but still take the space of parent
  return FSizeMeasure(
      onChange: (size) {
        _isHaveSize = size.height != -1;
        pipe.update(size.height);
      },
      child: Visibility(
        visible: visible,
        maintainSize: true,
        maintainAnimation: true,
        maintainState: true,
        child: Wrap(
          direction: Axis.horizontal,
          alignment: WrapAlignment.start,
          children: [for (var item in e._items) getWidget(item)],
        ),
      ));
}