build method

  1. @override
Widget build(
  1. BuildContext context,
  2. int index,
  3. int itemCount
)
inherited

Implementation

@override
Widget build(BuildContext context, int index, int itemCount) {
  if (itemCount == 1) return const SizedBox(width: .0, height: .0);

  var children = List.generate(itemCount, (_index) {
    Color color = itemColor;
    if (_index == index) {
      color = itemActiveColor ?? Theme.of(context).colorScheme.secondary;
    }
    return Container(
      width: itemWidth,
      height: itemHeight,
      decoration: BoxDecoration(color: color, shape: itemShape),
    );
  });
  return Padding(
    padding: padding ?? const EdgeInsets.all(10.0),
    child: Wrap(
      runSpacing: spacing,
      spacing: spacing,
      children: children,
    ),
  );
}