showMoveTo function Null safety

Future<int?> showMoveTo(
  1. BuildContext context,
  2. int length,
  3. int actualIndex,
  4. {ModernFormPopupMenuLocation? menuLocation}
)

Implementation

Future<int?> showMoveTo(
  BuildContext context,
  int length,
  int actualIndex, {
  menu.ModernFormPopupMenuLocation? menuLocation,
}) async {
  List<ModernFormBottomSheetModel<int>> status =
      <ModernFormBottomSheetModel<int>>[];

  for (var i = 0; i < length; i++) {
    Color? textColor;
    if (i == actualIndex) {
      textColor = Colors.green;
    }

    status.add(ModernFormBottomSheetModel<int>(
      text: "${i + 1}",
      value: i,
      textColor: textColor,
    ));
  }

  int? value = await showModernFormFilterPopupMenu<int>(
    context,
    list: status,
    title: "Selecione a posição",
    forceMenu: true,
    menuLocation: menuLocation,
  );

  return value;
}