getBackGround method

List<String> getBackGround(
  1. int length
)

Implementation

List<String> getBackGround(int length) {
  if (length <= backgroundImages.length) {
    return backgroundImages.sublist(0, length);
  } else {
    List<String> newList = [];
    for (int i = 0; i < backgroundImages.length; i++) {
      newList.add(backgroundImages[i]);
      if (i == backgroundImages.length - 1) {
        i = 0;
      }
      if (newList.length == length) {
        break;
      }
    }

    return newList;
  }
}