Treatments, Carbs & boluses: the insulin label pushes the bolus type and the NS/pump icons out of the row
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 76/100
Research direction
Read ui/src/commonMain/kotlin/app/aaps/ui/compose/treatments/BolusCarbsScreen.kt, especially the bolus row around lines 243–351, and inspect how its children are measured when an insulin label is shown. Reproduce the reported narrow-row layout, then adjust the row so the label remains readable and the bolus type and both icons remain visible. Done when rows with and without an insulin label fit without wrapping the type or hiding the icons.
Written by the indexing model from the issue text.
Description
Found via AI-assisted code review (Claude) of upstream code, while checking a layout problem in my personal build of dev (current
devplus my own local changes). The point below was checked against nightscout/dev 11681e46fe by reading the code and with a layout measurement test (Robolectric, a copy of the bolusRowwith the same modifiers and text sizes). It was not reproduced on a phone with an upstream build. Please verify independently before acting on it.
Summary
Treatments → Carbs & boluses: when a bolus row shows the insulin label (the bolus insulin is different from the active one), the row does not fit on a normal phone. The bolus type text wraps to two lines, and the Nightscout and pump-history icons get zero width, so they disappear.
After an insulin change (for example a new concentration) every older bolus shows the label, so the whole list before the change is affected.
Where
ui/src/commonMain/kotlin/app/aaps/ui/compose/treatments/BolusCarbsScreen.kt, bolus row:
https://github.com/nightscout/AndroidAPS/blob/11681e46fea66f70e72989e9e521c5cea8a06944/ui/src/commonMain/kotlin/app/aaps/ui/compose/treatments/BolusCarbsScreen.kt#L243-L351
All children of this Row except the spacer have no weight. Compose measures them one after another, each with the width that is still free. The insulin label (lines 289-297) has no weight and no maxLines, so it takes its full width before the type text and the icons are measured. They get what is left, often nothing.
Measurement
Screen 394 dp wide (1280 px, 520 dpi), font scale 1.1, the row copied with the same modifiers and text sizes:
| amount text | insulin label | type text | NS icon | pump icon |
|---|---|---|---|---|
3,60 ед (0,34 ед) |
Апидра 55m 8.5h 100 ед |
70 dp, 2 lines | 0 dp | 0 dp |
3,60 U (0,34 U) |
Lyumjev 45m 7.5h U100 |
76 dp, 1 line | 18 dp | 0 dp |
0,30 ед |
Ринлиз рапид 45m 7.5h 200 ед |
76 dp, 1 line | 21 dp | 3 dp |
2,10 ед (1,05 ед) |
(no label) | 76 dp, 1 line | 21 dp | 21 dp |
Possible fix (only a suggestion)
Put the label on its own line under the time and the amount:
Row(/* same as now */) {
Column(modifier = Modifier.weight(1f)) {
Row(verticalAlignment = Alignment.CenterVertically) {
// time, amount (as now)
}
if (bolus.iCfg.insulinLabel != activeLabel) {
Text(text = bolus.iCfg.insulinLabel, fontSize = 11.sp, color = MaterialTheme.colorScheme.onSurfaceVariant)
}
}
// type text with maxLines = 1, then the icons (as now); the Box spacer is no longer needed
}
With the same measurement every element then keeps its natural width (amount 119 dp, type 76 dp on one line, both icons 21 dp), and the label keeps its full text.
Two variants that look simpler but do not work:
- Shortening the label with an ellipsis in the same line cuts off the end of the label, which is usually the concentration ("100 ед" / "U100"), the part that matters after a change.
- Giving only the time + amount group a weight, with the label still outside it, makes it worse: the amount is squeezed to about 11 dp and is drawn one character per line.
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 7.4k
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 93
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nightscout/AndroidAPS
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nightscout/AndroidAPS#5478 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
nightscout/AndroidAPS#5475 ·
Maintainers usually reply within 1 day
-
enhancement for_discussion minor
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
nightscout/AndroidAPS#5422 ·
Maintainers usually reply within 1 day
-
enhancement for_discussion
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
nightscout/AndroidAPS#5057 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
nightscout/AndroidAPS#5488 ·
Maintainers usually reply within 1 day
All issues in nightscout/AndroidAPS
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
kushagrasinghx/BitChord#1498 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
AChep/keyguard-app#1665 ·
Maintainers usually reply within 1 day
-
needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
neutraltone/settee#157 ·
Maintainers usually reply within 1 day
-
bug 🐞 python 🐍
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
valkey-io/valkey-glide#7560 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
openai/openai-java#1337 ·
Maintainers usually reply within 1 day