Skip to content

Commit

Permalink
feat(ux): automatically collapse header in image translation settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bnyro committed May 2, 2024
1 parent 8dedbdf commit 4bbf47c
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.LargeTopAppBar
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.LaunchedEffect
Expand All @@ -54,6 +55,7 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
Expand Down Expand Up @@ -109,19 +111,24 @@ fun TessSettings(
}
}

val topAppBarBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()

FullscreenDialog(
onDismissRequest = onDismissRequest,
topBar = {
LargeTopAppBar(
title = { Text(stringResource(R.string.image_translation)) },
scrollBehavior = topAppBarBehavior,
navigationIcon = {
StyledIconButton(imageVector = Icons.Default.ArrowBack, onClick = onDismissRequest)
}
)
},
content = {
Column(
modifier = Modifier.fillMaxWidth()
modifier = Modifier
.fillMaxWidth()
.nestedScroll(topAppBarBehavior.nestedScrollConnection)
) {
SelectionContainer(
modifier = Modifier.padding(horizontal = 12.dp)
Expand Down

0 comments on commit 4bbf47c

Please sign in to comment.