buildButtonWith method

Widget buildButtonWith(
  1. int value
)

Implementation

Widget buildButtonWith(int value) {
  // In the arrays, element at index 0 correspond to Sunday...
  final arrayIndex = value % 7;
  // ...but in the onChanged method, we want to let users of this package use
  // the DateTime.monday, ..., DateTime.sunday constants.
  final dateTimeDay = arrayIndex == 0 ? DateTime.sunday : arrayIndex;
  return WeekdayButton(
    text: shortWeekdays[arrayIndex],
    selected: values[arrayIndex],
    tooltip: weekdays[arrayIndex],
    onPressed:
        values[arrayIndex] == null ? null : () => onChanged!(dateTimeDay),
    enableFeedback: enableFeedback,
    color: color,
    selectedColor: selectedColor,
    disabledColor: disabledColor,
    fillColor: fillColor,
    selectedFillColor: selectedFillColor,
    disabledFillColor: disabledFillColor,
    elevation: elevation,
    selectedElevation: selectedElevation,
    disabledElevation: disabledElevation,
    focusColor: focusColor,
    selectedFocusColor: selectedFocusColor,
    hoverColor: hoverColor,
    selectedHoverColor: selectedHoverColor,
    splashColor: splashColor,
    selectedSplashColor: selectedSplashColor,
    textStyle: textStyle,
    selectedTextStyle: selectedTextStyle,
    disabledTextStyle: disabledTextStyle,
    shape: shape,
    selectedShape: selectedShape,
    disabledShape: disabledShape,
  );
}