Set the maximum width of mostly empty list screens to a lower value

This commit is contained in:
Artem Chepurnoy 2024-02-19 15:28:44 +02:00
parent 50448c195a
commit 99af43928d
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
10 changed files with 47 additions and 9 deletions

View File

@ -5,6 +5,7 @@ import androidx.compose.runtime.remember
import com.artemchep.keyguard.feature.duplicates.list.DuplicatesListRoute
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun DuplicatesScreen(
@ -19,6 +20,9 @@ fun DuplicatesScreen(
id = DuplicatesRoute.ROUTER_NAME,
initial = initialRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.generator.wordlist.list.WordlistListRoute
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun WordlistsScreen() {
@ -11,6 +12,9 @@ fun WordlistsScreen() {
id = WordlistsRoute.ROUTER_NAME,
initial = WordlistListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -5,6 +5,7 @@ import androidx.compose.runtime.CompositionLocalProvider
import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun SettingsScreen() {
@ -21,7 +22,10 @@ fun SettingsScreen() {
id = SettingsRoute.ROUTER_NAME,
initial = SettingListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}
}

View File

@ -4,6 +4,7 @@ import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun AccountsScreen() {
@ -20,7 +21,10 @@ fun AccountsScreen() {
id = "accounts",
initial = AccountListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
// }
}

View File

@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justdeleteme.directory
import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun TwoFaServicesScreen() {
@ -10,6 +11,9 @@ fun TwoFaServicesScreen() {
id = JustDeleteMeServicesRoute.ROUTER_NAME,
initial = JustDeleteMeServiceListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.justgetdata.directory
import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun JustGetMyDataServicesScreen() {
@ -10,6 +11,9 @@ fun JustGetMyDataServicesScreen() {
id = JustGetMyDataServicesRoute.ROUTER_NAME,
initial = JustGetMyDataListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.passkeys.directory
import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun TwoFaServicesScreen() {
@ -10,6 +11,9 @@ fun TwoFaServicesScreen() {
id = PasskeysServicesRoute.ROUTER_NAME,
initial = PasskeysServiceListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -3,6 +3,7 @@ package com.artemchep.keyguard.feature.tfa.directory
import androidx.compose.runtime.Composable
import com.artemchep.keyguard.feature.navigation.NavigationRouter
import com.artemchep.keyguard.feature.twopane.TwoPaneNavigationContent
import com.artemchep.keyguard.ui.screenMaxWidthCompact
@Composable
fun TwoFaServicesScreen() {
@ -10,6 +11,9 @@ fun TwoFaServicesScreen() {
id = TwoFaServicesRoute.ROUTER_NAME,
initial = TwoFaServiceListRoute,
) { backStack ->
TwoPaneNavigationContent(backStack)
TwoPaneNavigationContent(
backStack,
detailPaneMaxWidth = screenMaxWidthCompact,
)
}
}

View File

@ -2,17 +2,22 @@ package com.artemchep.keyguard.feature.twopane
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.unit.Dp
import com.artemchep.keyguard.feature.navigation.LocalNavigationNodeVisualStack
import com.artemchep.keyguard.feature.navigation.NavigationEntry
import com.artemchep.keyguard.feature.navigation.NavigationNode
import com.artemchep.keyguard.ui.screenMaxWidth
import kotlinx.collections.immutable.PersistentList
import kotlinx.collections.immutable.persistentListOf
@Composable
fun TwoPaneNavigationContent(
backStack: PersistentList<NavigationEntry>,
detailPaneMaxWidth: Dp = screenMaxWidth,
) {
TwoPaneScaffold {
TwoPaneScaffold(
detailPaneMaxWidth = detailPaneMaxWidth,
) {
if (backStack.isEmpty()) {
// Nothing to draw, the back stack is empty.
return@TwoPaneScaffold

View File

@ -84,6 +84,7 @@ import kotlinx.collections.immutable.ImmutableList
import kotlin.math.log10
val screenMaxWidth = 768.dp
val screenMaxWidthCompact = 480.dp
private val screenPaddingTop = 8.dp
private val screenPaddingBottom = 8.dp