Skip to content

Commit

Permalink
Merge remote-tracking branch 'maryam/wip_relay_location_cell_bugs'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Dec 1, 2023
2 parents 9fcd047 + 946f749 commit 5b232d6
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.saveable.rememberSaveable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.alpha
Expand Down Expand Up @@ -163,8 +163,9 @@ fun RelayLocationCell(
RelayItemType.City -> Dimens.cityRowPadding
RelayItemType.Relay -> Dimens.relayRowPadding
}
val selected = selectedItem == relay
val expanded = remember(key1 = relay.expanded.toString()) { mutableStateOf(relay.expanded) }
val selected = selectedItem?.code == relay.code
val expanded =
rememberSaveable(key = relay.expanded.toString()) { mutableStateOf(relay.expanded) }
val backgroundColor =
when {
selected -> MaterialTheme.colorScheme.inversePrimary
Expand Down

0 comments on commit 5b232d6

Please sign in to comment.