Skip to content

Commit

Permalink
Fix bug to remember expanded relay cell
Browse files Browse the repository at this point in the history
  • Loading branch information
MaryamShaghaghi committed Dec 1, 2023
1 parent b9b0e63 commit 946f749
Showing 1 changed file with 3 additions and 2 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 @@ -164,7 +164,8 @@ fun RelayLocationCell(
RelayItemType.Relay -> Dimens.relayRowPadding
}
val selected = selectedItem?.code == relay.code
val expanded = remember(key1 = relay.expanded.toString()) { mutableStateOf(relay.expanded) }
val expanded =
rememberSaveable(key = relay.expanded.toString()) { mutableStateOf(relay.expanded) }
val backgroundColor =
when {
selected -> MaterialTheme.colorScheme.inversePrimary
Expand Down

0 comments on commit 946f749

Please sign in to comment.