-
Notifications
You must be signed in to change notification settings - Fork 0
feat: fix font size being too large #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -19,12 +19,12 @@ package com.k689.identid.ui.common.pin | |||||
| import android.content.Context | ||||||
| import androidx.compose.foundation.layout.Arrangement | ||||||
| import androidx.compose.foundation.layout.Column | ||||||
| import androidx.compose.foundation.layout.ColumnScope | ||||||
| import androidx.compose.foundation.layout.PaddingValues | ||||||
| import androidx.compose.foundation.layout.Spacer | ||||||
| import androidx.compose.foundation.layout.fillMaxSize | ||||||
| import androidx.compose.foundation.layout.fillMaxWidth | ||||||
| import androidx.compose.foundation.layout.padding | ||||||
| import androidx.compose.foundation.rememberScrollState | ||||||
| import androidx.compose.foundation.verticalScroll | ||||||
| import androidx.compose.material3.ExperimentalMaterial3Api | ||||||
| import androidx.compose.material3.MaterialTheme | ||||||
| import androidx.compose.material3.SheetState | ||||||
|
|
@@ -39,9 +39,11 @@ import androidx.compose.ui.Modifier | |||||
| import androidx.compose.ui.platform.LocalContext | ||||||
| import androidx.compose.ui.platform.testTag | ||||||
| import androidx.compose.ui.res.stringResource | ||||||
| import androidx.compose.ui.text.font.FontWeight | ||||||
| import androidx.compose.ui.text.input.PasswordVisualTransformation | ||||||
| import androidx.compose.ui.text.style.TextAlign | ||||||
| import androidx.compose.ui.unit.TextUnit | ||||||
| import androidx.compose.ui.unit.dp | ||||||
| import androidx.compose.ui.unit.sp | ||||||
| import androidx.lifecycle.compose.collectAsStateWithLifecycle | ||||||
| import androidx.navigation.NavController | ||||||
| import com.k689.identid.R | ||||||
|
|
@@ -122,38 +124,40 @@ fun PinScreen( | |||||
| } | ||||||
| }, | ||||||
| ) { paddingValues -> | ||||||
| Content( | ||||||
| state = state, | ||||||
| effectFlow = viewModel.effect, | ||||||
| onEventSend = { event -> viewModel.setEvent(event) }, | ||||||
| onNavigationRequested = { navigationEffect -> | ||||||
| handleNavigationEffect( | ||||||
| context, | ||||||
| navigationEffect, | ||||||
| navController, | ||||||
| ) | ||||||
| }, | ||||||
| paddingValues = paddingValues, | ||||||
| coroutineScope = scope, | ||||||
| modalBottomSheetState = bottomSheetState, | ||||||
| ) | ||||||
|
|
||||||
| if (isBottomSheetOpen) { | ||||||
| WrapModalBottomSheet( | ||||||
| onDismissRequest = { | ||||||
| viewModel.setEvent( | ||||||
| Event.BottomSheet.UpdateBottomSheetState( | ||||||
| isOpen = false, | ||||||
| ), | ||||||
| Column { | ||||||
| Content( | ||||||
| state = state, | ||||||
| effectFlow = viewModel.effect, | ||||||
| onEventSend = { event -> viewModel.setEvent(event) }, | ||||||
| onNavigationRequested = { navigationEffect -> | ||||||
| handleNavigationEffect( | ||||||
| context, | ||||||
| navigationEffect, | ||||||
| navController, | ||||||
| ) | ||||||
| }, | ||||||
| sheetState = bottomSheetState, | ||||||
| ) { | ||||||
| SheetContent( | ||||||
| onEventSent = { | ||||||
| viewModel.setEvent(it) | ||||||
| paddingValues = paddingValues, | ||||||
| coroutineScope = scope, | ||||||
| modalBottomSheetState = bottomSheetState, | ||||||
| ) | ||||||
|
|
||||||
| if (isBottomSheetOpen) { | ||||||
| WrapModalBottomSheet( | ||||||
| onDismissRequest = { | ||||||
| viewModel.setEvent( | ||||||
| Event.BottomSheet.UpdateBottomSheetState( | ||||||
| isOpen = false, | ||||||
| ), | ||||||
| ) | ||||||
| }, | ||||||
| ) | ||||||
| sheetState = bottomSheetState, | ||||||
| ) { | ||||||
| SheetContent( | ||||||
| onEventSent = { | ||||||
| viewModel.setEvent(it) | ||||||
| }, | ||||||
| ) | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
@@ -189,21 +193,22 @@ private fun handleNavigationEffect( | |||||
|
|
||||||
| @OptIn(ExperimentalMaterial3Api::class) | ||||||
| @Composable | ||||||
| private fun Content( | ||||||
| private fun ColumnScope.Content( | ||||||
| state: State, | ||||||
| effectFlow: Flow<Effect>, | ||||||
| onEventSend: (Event) -> Unit, | ||||||
| onNavigationRequested: (Effect.Navigation) -> Unit, | ||||||
| paddingValues: PaddingValues, | ||||||
| coroutineScope: CoroutineScope, | ||||||
| modalBottomSheetState: SheetState, | ||||||
| textFontSize: TextUnit = 16.sp, | ||||||
| ) { | ||||||
| Column( | ||||||
| modifier = | ||||||
| Modifier | ||||||
| .fillMaxSize() | ||||||
|
||||||
| .fillMaxSize() | |
| .fillMaxWidth() |
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content no longer scrolls. If the available height is smaller than the combined height of the header texts + PIN field (e.g., small devices, landscape, or large accessibility font), the content can become clipped with no way to reach it. Consider restoring a verticalScroll(rememberScrollState()) (or using a LazyColumn) so the PIN entry remains reachable in constrained layouts.
Copilot
AI
Apr 2, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spacer(modifier = Modifier.weight(2.8f)) introduces a hard-to-reason-about magic ratio in the layout. Consider replacing this with a named constant (documenting the intent) or using a more deterministic arrangement (e.g., verticalArrangement = Arrangement.SpaceBetween/Center) to avoid future layout regressions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
MainContentintroducestextFontSize, but the only call site in this file (Body→MainContent(state, onEventSent)) doesn’t pass it, so it will always be the default. Either pass a value fromstate/config (e.g.,state.titleFontSize) or remove this parameter to avoid dead customization points.