add back button to player
This commit is contained in:
@@ -9,7 +9,6 @@ import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.navigationBars
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.shape.CircleShape
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material3.ExperimentalMaterial3Api
|
||||
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
|
||||
@@ -49,7 +48,6 @@ import androidx.compose.ui.graphics.painter.Painter
|
||||
import androidx.compose.ui.input.nestedscroll.nestedScroll
|
||||
import androidx.compose.ui.unit.dp
|
||||
import ru.shadowsparky.ui.nav.Route
|
||||
import ru.shadowsparky.ui.theme.focusBorder
|
||||
|
||||
@Immutable
|
||||
data class NavigationEntry<out T : Route>(
|
||||
@@ -159,6 +157,7 @@ private fun <T : Route> DynamicNavigationScaffold(
|
||||
) {
|
||||
val entries = navigationEntries.orEmpty()
|
||||
val railState = rememberWideNavigationRailState(WideNavigationRailValue.Collapsed)
|
||||
val isExpanded = railState.targetValue == WideNavigationRailValue.Expanded
|
||||
var railHasFocus by remember { mutableStateOf(false) }
|
||||
LaunchedEffect(railHasFocus) {
|
||||
if (railHasFocus) railState.expand() else railState.collapse()
|
||||
@@ -168,26 +167,17 @@ private fun <T : Route> DynamicNavigationScaffold(
|
||||
navigationSuite = {
|
||||
WideNavigationRail(
|
||||
state = railState,
|
||||
modifier = Modifier.onFocusChanged { railHasFocus = it.hasFocus }
|
||||
.focusGroup(),
|
||||
modifier = Modifier.onFocusChanged { railHasFocus = it.hasFocus }.focusGroup()
|
||||
) {
|
||||
entries.forEach { entry ->
|
||||
WideNavigationRailItem(
|
||||
railExpanded =
|
||||
railState.targetValue == WideNavigationRailValue.Expanded,
|
||||
railExpanded = isExpanded,
|
||||
selected = currentRoute == entry.route,
|
||||
onClick = {
|
||||
onSelectNavigation?.invoke(entry.route)
|
||||
},
|
||||
icon = {
|
||||
Icon(entry.painter, entry.title)
|
||||
},
|
||||
onClick = { onSelectNavigation?.invoke(entry.route) },
|
||||
icon = { Icon(entry.painter, entry.title) },
|
||||
label = {
|
||||
if (railState.currentValue == WideNavigationRailValue.Expanded) {
|
||||
Text(entry.title)
|
||||
}
|
||||
},
|
||||
modifier = Modifier.focusBorder(false, CircleShape)
|
||||
if (isExpanded) Text(entry.title)
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user