RouletteGroup.uniform constructor

RouletteGroup.uniform(
  1. int itemCount, {
  2. IndexBuilder<String?>? textBuilder,
  3. IndexBuilder<Color>? colorBuilder,
  4. IndexBuilder<TextStyle?>? textStyleBuilder,
})

Helper function to create a even RouletteGroup. itemCount is the number of items in the group. textBuilder is a function that return the text of the unit. colorBuilder is a function that return the color of the unit. textStyleBuilder is a function that return the text style of the unit.

Implementation

factory RouletteGroup.uniform(
  int itemCount, {
  IndexBuilder<String?>? textBuilder,
  IndexBuilder<Color>? colorBuilder,
  IndexBuilder<TextStyle?>? textStyleBuilder,
}) {
  final units = List.generate(
    itemCount,
    (index) => RouletteUnit(
      text: textBuilder?.call(index),
      textStyle: textStyleBuilder?.call(index),
      color: colorBuilder?.call(index) ?? Colors.blue,
      weight: 1,
    ),
  );
  return RouletteGroup(units);
}