mirror of
https://github.com/priyanshujain/sanderling.git
synced 2026-10-02 11:07:10 +00:00
fix(folio): move balance into the header, one compact line under the account name
This commit is contained in:
1 parent
00a651b612
commit
cb480d5b28
2 files changed
+10
-7
No files matched your search
+8
-7
@@ -68,6 +68,14 @@ fun AddTransactionScreen(state: AddTransactionUiState, onEvent: (AddTransactionE
|
|||||||
Header(
|
Header(
|
||||||
title = "Add transaction",
|
title = "Add transaction",
|
||||||
subtitle = account.name,
|
subtitle = account.name,
|
||||||
|
detail = {
|
||||||
|
Text(
|
||||||
|
"Balance: ${formatCents(state.balanceCents)}",
|
||||||
|
style = Type.caption,
|
||||||
|
color = LocalTokens.current.textMuted,
|
||||||
|
modifier = Modifier.testTag("TxnCurrentBalance"),
|
||||||
|
)
|
||||||
|
},
|
||||||
left = { BackButton { onEvent(AddTransactionEvent.Back) } },
|
left = { BackButton { onEvent(AddTransactionEvent.Back) } },
|
||||||
)
|
)
|
||||||
},
|
},
|
||||||
@@ -81,17 +89,10 @@ fun AddTransactionScreen(state: AddTransactionUiState, onEvent: (AddTransactionE
|
|||||||
)
|
)
|
||||||
},
|
},
|
||||||
) {
|
) {
|
||||||
val t = LocalTokens.current
|
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
modifier = Modifier.fillMaxWidth().padding(vertical = 8.dp),
|
||||||
verticalArrangement = Arrangement.spacedBy(16.dp),
|
verticalArrangement = Arrangement.spacedBy(16.dp),
|
||||||
) {
|
) {
|
||||||
Text(
|
|
||||||
"Balance: ${formatCents(state.balanceCents)}",
|
|
||||||
style = Type.body,
|
|
||||||
color = t.textMuted,
|
|
||||||
modifier = Modifier.testTag("TxnCurrentBalance"),
|
|
||||||
)
|
|
||||||
Segmented(
|
Segmented(
|
||||||
selected = if (state.type == TxnType.credit) 0 else 1,
|
selected = if (state.type == TxnType.credit) 0 else 1,
|
||||||
labels = listOf("Credit", "Debit"),
|
labels = listOf("Credit", "Debit"),
|
||||||
|
|||||||
+2
@@ -19,6 +19,7 @@ import app.folio.ui.theme.Type
|
|||||||
fun Header(
|
fun Header(
|
||||||
title: String,
|
title: String,
|
||||||
subtitle: String? = null,
|
subtitle: String? = null,
|
||||||
|
detail: @Composable (() -> Unit)? = null,
|
||||||
left: @Composable (() -> Unit)? = null,
|
left: @Composable (() -> Unit)? = null,
|
||||||
right: @Composable (() -> Unit)? = null,
|
right: @Composable (() -> Unit)? = null,
|
||||||
) {
|
) {
|
||||||
@@ -42,6 +43,7 @@ fun Header(
|
|||||||
if (subtitle != null) {
|
if (subtitle != null) {
|
||||||
Text(subtitle, style = Type.caption, color = t.textMuted)
|
Text(subtitle, style = Type.caption, color = t.textMuted)
|
||||||
}
|
}
|
||||||
|
if (detail != null) detail()
|
||||||
}
|
}
|
||||||
if (right != null) right()
|
if (right != null) right()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user