Skip to content

Conversation

@mymemorycard
Copy link
Owner

No description provided.

Copy link

@WordyArc WordyArc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 + 3 + 0 + 0 = 7, принято

Что хорошо сделано:
Нормальный UiState sealed interface, Input/Result разделены
SplitCalculation считает derived-поля через get() - нормально, нет дублирования.
navigateToInput() действительно реализует “Back to edit” корректно(я уже успел повстречать работы где это было не так)
Навигация через Screen sealed class - плюс.

onBackToEdit: () -> Unit,
onNewCalculation: () -> Unit
) {
val calculations by viewModel.calculations.collectAsState()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Для чего это?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Убрать "мертвый код"

onBackToEdit()
},
onNewCalculationClicked = {
viewModel.startNewCalculation()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

тут и в SplitMateNavigation в onNewCalculation двойной вызов startNewCalculation.
Или “UI вызывает VM и говорит навигации куда идти”
Или “навигация дергает VM”
Но не оба одновременно.

val calculations by viewModel.calculations.collectAsState()
val uiState by viewModel.uiState.collectAsState()

LaunchedEffect(calculationId) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Очень странная логика.
если calculation == null - вы вообще ничего не показываете.
when/else ветки пустые (else -> {}) - так делать нельзя.

Если calcId не найден - показать UI “Расчёт не найден” + кнопка “На главный/к вводу”.

Упростить: ResultScreen должен опираться на calcId и доставать calculation напрямую, без плясок вокруг uiState. uiState тут вообще лишний - маршрут уже говорит, что мы на Result.

value = state.totalAmount,
onValueChange = onTotalAmountChanged,
label = { Text("Полная сумма счета (₽)") },
keyboardOptions = KeyboardOptions(keyboardType = KeyboardType.Number),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totalAmount - Double

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants