getStarWidgets method

List<Widget> getStarWidgets()

Implementation

List<Widget> getStarWidgets() {
  _result.clear();
  int sum = widget.sumStar;

  for (int index = 0; index < sum; ++index) {
    _result.add(GestureDetector(
      onTap: () {
        if (!isEnable()) {
          return;
        }

        final int label = index;
        int oldValue = widget.value;
        widget.value = label + 1;
        FormUtil.notifyValueChanged(
            widget.onChanged, context, oldValue, widget.value);
        setState(() {});
      },
      child: Container(
        padding: (index == sum - 1)
            ? const EdgeInsets.only(left: 8, top: 5, bottom: 5)
            : const EdgeInsets.symmetric(horizontal: 8, vertical: 5),
        child: getStar(index, widget.value, sum),
      ),
    ));
  }

  return _result;
}