Skip to content

Commit

Permalink
fix: TimerCreationScreen
Browse files Browse the repository at this point in the history
  • Loading branch information
y9vad9 committed Jan 5, 2024
1 parent 1068669 commit 5989726
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ class TimerCreationUseCase(
sealed class Result {
data class Failure(val exception: Throwable) : Result()

object Success : Result()
data object Success : Result()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.rounded.ArrowBack
import androidx.compose.material3.Checkbox
Expand Down Expand Up @@ -105,9 +108,12 @@ fun TimerCreationScreen(
Column(
modifier = Modifier.fillMaxSize()
.padding(rootPaddings)
.padding(16.dp),
.padding(horizontal = 16.dp)
.verticalScroll(rememberScrollState()),
verticalArrangement = Arrangement.spacedBy(8.dp),
) {
Spacer(Modifier.height(4.dp))

SizedOutlinedTextField(
modifier = Modifier.fillMaxWidth(),
value = state.name,
Expand Down Expand Up @@ -158,7 +164,11 @@ fun TimerCreationScreen(
modifier = Modifier
.weight(1f),
value = state.workTime.toInt(unit = DurationUnit.MINUTES).toString(),
onValueChange = { stateMachine.dispatchEvent(Event.WorkTimeIsChanged(it.toInt().minutes)) },
onValueChange = {
stateMachine.dispatchEvent(
Event.WorkTimeIsChanged(it.toIntOrNull()?.minutes ?: state.workTime)
)
},
label = { Text(LocalStrings.current.workTime) },
singleLine = true,
enabled = !state.isLoading,
Expand Down Expand Up @@ -289,6 +299,8 @@ fun TimerCreationScreen(
Text(LocalStrings.current.save)
}
}

Spacer(Modifier.height(16.dp))
}
}
}

0 comments on commit 5989726

Please sign in to comment.