Hi
im attempting to build a jetpack compose generic Ui element to support the placing of max of 5 icons
i have defined 11 cells that can each hold one icon and want to create an enum that defines each of the 11 cells
in a descriptive way to help the developers that use this Ui Component understand which cell is which, i have the following
so far and feel sure i can improve on it, any suggestions?
enum class FooterCell(val index: Int, val description: String) {
Left1(1, "Far left"),
Left2(2, "Second from left"),
Left3(3, "Third from left"),
Left4(4, "Fourth from left"),
Left5(5, "Fifth from left"),
Centre(6, "Middle / centre cell"),
Right5(7, "Fifth from right"),
Right4(8, "Fourth from right"),
Right3(9, "Third from right"),
Right2(10, "Second from right"),
Right1(11, "Far right");
companion object {
fun fromIndex(index: Int): FooterCell =
entries.firstOrNull { it.index == index }
?: throw IllegalArgumentException("Invalid cell index: $index")
}
}