Skip to content

Commit

Permalink
Fix scroll on save key (#894)
Browse files Browse the repository at this point in the history
**Background**

Right now long keys don't show the save button

**Changes**

- Add scroll to key card

**Test plan**

Try open large key
  • Loading branch information
LionZXY authored Jul 16, 2024
1 parent e5af4c3 commit 2d35b47
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
- [FIX] Paddings for update button
- [FIX] Crash on app startup with WearOS app
- [FIX] Expand verify signal bottom sheet only after signal is dispatched
- [FIX] Fix scroll on save edit screen
- [CI] Add https://github.com/LionZXY/detekt-decompose-rule
- [CI] Enabling detekt module for android and kmp modules
- [CI] Bump target SDK to 34
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package com.flipperdevices.keyedit.impl.composable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -22,6 +24,7 @@ fun ComposableEditScreen(
when (state) {
KeyEditState.Loading,
is KeyEditState.Saving -> ComposableEditScreenLoading()

is KeyEditState.Editing -> ComposableEditScreenEditing(
onNameChange = onNameChange,
onNoteChange = onNoteChange,
Expand All @@ -30,6 +33,7 @@ fun ComposableEditScreen(
onCancel = onBack,
onSave = onSave
)

KeyEditState.Failed -> onBack()
}
}
Expand All @@ -51,14 +55,18 @@ private fun ComposableEditScreenEditing(
title: String?,
state: KeyEditState.Editing,
onCancel: () -> Unit,
onSave: () -> Unit
onSave: () -> Unit,
modifier: Modifier = Modifier
) {
val buttonState = if (state.savingKeyActive) {
SaveButtonState.ENABLED
} else {
SaveButtonState.DISABLED
}
Column {
Column(
modifier = modifier
.verticalScroll(rememberScrollState())
) {
ComposableEditAppBar(
title = title,
saveButtonState = buttonState,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
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.material.CircularProgressIndicator
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
Expand All @@ -26,10 +28,15 @@ fun ComposableKeySaveScreen(
onCancel: () -> Unit,
modifier: Modifier = Modifier,
) {
Column(modifier) {
Column(
modifier
) {
ComposableKeySaveBar(onCancel)
keyScreenApi.KeyCard(
modifier = Modifier.padding(start = 24.dp, end = 24.dp, bottom = 24.dp),
modifier = Modifier
.weight(1f)
.verticalScroll(rememberScrollState())
.padding(start = 24.dp, end = 24.dp, bottom = 12.dp),
key = keyParsed,
deleted = false
)
Expand All @@ -44,7 +51,9 @@ fun ComposableKeySaveScreen(
}
} else {
ComposableFlipperButton(
modifier = Modifier.fillMaxWidth(),
modifier = Modifier
.fillMaxWidth()
.padding(top = 12.dp, bottom = 24.dp),
text = stringResource(R.string.receive_save_btn),
onClick = onSave
)
Expand Down

0 comments on commit 2d35b47

Please sign in to comment.