|
1 | 1 | package cz.frantisekmasa.wfrp_master.common.compendium.career |
2 | 2 |
|
3 | 3 | import androidx.compose.foundation.clickable |
| 4 | +import androidx.compose.foundation.layout.Box |
4 | 5 | import androidx.compose.foundation.layout.Column |
5 | 6 | import androidx.compose.foundation.layout.PaddingValues |
6 | 7 | import androidx.compose.foundation.layout.fillMaxWidth |
7 | 8 | import androidx.compose.foundation.layout.padding |
8 | 9 | import androidx.compose.foundation.lazy.LazyColumn |
| 10 | +import androidx.compose.foundation.rememberScrollState |
| 11 | +import androidx.compose.foundation.verticalScroll |
9 | 12 | import androidx.compose.material.Card |
10 | 13 | import androidx.compose.material.FloatingActionButton |
11 | 14 | import androidx.compose.material.Icon |
@@ -261,110 +264,112 @@ private fun LevelList( |
261 | 264 | return |
262 | 265 | } |
263 | 266 |
|
264 | | - DraggableListFor( |
265 | | - items = levels, |
266 | | - onReorder = if (isGameMaster) onReorder else ({}), |
267 | | - ) { levelIndex, level, isDragged -> |
268 | | - val modifier = Modifier.fillMaxWidth() |
269 | | - |
270 | | - Card( |
271 | | - elevation = if (isDragged) 6.dp else 2.dp, |
272 | | - modifier = if (isGameMaster) |
273 | | - modifier.clickable { onClick(level) } |
274 | | - else modifier |
275 | | - ) { |
276 | | - ListItem( |
277 | | - modifier = Modifier.padding(Spacing.medium), |
278 | | - text = { |
279 | | - Text( |
280 | | - buildAnnotatedString { |
281 | | - withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
282 | | - append((levelIndex + 1).toString()) |
283 | | - append(". ") |
284 | | - append(level.name) |
285 | | - } |
286 | | - |
287 | | - append(" — ") |
288 | | - append(level.status.tier.localizedName) |
289 | | - append(' ') |
290 | | - append(level.status.standing.toString()) |
291 | | - } |
292 | | - ) |
293 | | - }, |
294 | | - secondaryText = { |
295 | | - Column { |
| 267 | + Box(Modifier.verticalScroll(rememberScrollState())) { |
| 268 | + DraggableListFor( |
| 269 | + items = levels, |
| 270 | + onReorder = if (isGameMaster) onReorder else ({}), |
| 271 | + ) { levelIndex, level, isDragged -> |
| 272 | + val modifier = Modifier.fillMaxWidth() |
| 273 | + |
| 274 | + Card( |
| 275 | + elevation = if (isDragged) 6.dp else 2.dp, |
| 276 | + modifier = if (isGameMaster) |
| 277 | + modifier.clickable { onClick(level) } |
| 278 | + else modifier |
| 279 | + ) { |
| 280 | + ListItem( |
| 281 | + modifier = Modifier.padding(Spacing.medium), |
| 282 | + text = { |
296 | 283 | Text( |
297 | 284 | buildAnnotatedString { |
298 | 285 | withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
299 | | - append(LocalStrings.current.skills.titleSkills) |
300 | | - append(": ") |
| 286 | + append((levelIndex + 1).toString()) |
| 287 | + append(". ") |
| 288 | + append(level.name) |
301 | 289 | } |
302 | 290 |
|
303 | | - if (level.skills.isEmpty()) { |
304 | | - append("—") |
305 | | - } |
| 291 | + append(" — ") |
| 292 | + append(level.status.tier.localizedName) |
| 293 | + append(' ') |
| 294 | + append(level.status.standing.toString()) |
| 295 | + } |
| 296 | + ) |
| 297 | + }, |
| 298 | + secondaryText = { |
| 299 | + Column { |
| 300 | + Text( |
| 301 | + buildAnnotatedString { |
| 302 | + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
| 303 | + append(LocalStrings.current.skills.titleSkills) |
| 304 | + append(": ") |
| 305 | + } |
| 306 | + |
| 307 | + if (level.skills.isEmpty()) { |
| 308 | + append("—") |
| 309 | + } |
306 | 310 |
|
307 | | - derivedStateOf { level.skills.sortedBy { it.expression.lowercase() } }.value |
308 | | - .forEachIndexed { index, skill -> |
309 | | - if (skill.isIncomeSkill) { |
310 | | - withStyle(SpanStyle(fontStyle = FontStyle.Italic)) { |
| 311 | + derivedStateOf { level.skills.sortedBy { it.expression.lowercase() } }.value |
| 312 | + .forEachIndexed { index, skill -> |
| 313 | + if (skill.isIncomeSkill) { |
| 314 | + withStyle(SpanStyle(fontStyle = FontStyle.Italic)) { |
| 315 | + append(skill.expression) |
| 316 | + } |
| 317 | + } else { |
311 | 318 | append(skill.expression) |
312 | 319 | } |
313 | | - } else { |
314 | | - append(skill.expression) |
315 | | - } |
316 | 320 |
|
317 | | - if (index != level.skills.lastIndex) { |
318 | | - append(", ") |
| 321 | + if (index != level.skills.lastIndex) { |
| 322 | + append(", ") |
| 323 | + } |
319 | 324 | } |
320 | | - } |
321 | | - } |
322 | | - ) |
323 | | - Text( |
324 | | - buildAnnotatedString { |
325 | | - withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
326 | | - append(LocalStrings.current.talents.titleTalents) |
327 | | - append(": ") |
328 | 325 | } |
| 326 | + ) |
| 327 | + Text( |
| 328 | + buildAnnotatedString { |
| 329 | + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
| 330 | + append(LocalStrings.current.talents.titleTalents) |
| 331 | + append(": ") |
| 332 | + } |
329 | 333 |
|
330 | | - if (level.talents.isEmpty()) { |
331 | | - append("—") |
332 | | - } |
| 334 | + if (level.talents.isEmpty()) { |
| 335 | + append("—") |
| 336 | + } |
333 | 337 |
|
334 | | - derivedStateOf { level.talents.sortedBy { it.lowercase() } }.value |
335 | | - .forEachIndexed { index, talent -> |
336 | | - append(talent) |
| 338 | + derivedStateOf { level.talents.sortedBy { it.lowercase() } }.value |
| 339 | + .forEachIndexed { index, talent -> |
| 340 | + append(talent) |
337 | 341 |
|
338 | | - if (index != level.talents.lastIndex) { |
339 | | - append(", ") |
| 342 | + if (index != level.talents.lastIndex) { |
| 343 | + append(", ") |
| 344 | + } |
340 | 345 | } |
341 | | - } |
342 | | - } |
343 | | - ) |
344 | | - |
345 | | - Text( |
346 | | - buildAnnotatedString { |
347 | | - withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
348 | | - append(LocalStrings.current.trappings.title) |
349 | | - append(": ") |
350 | 346 | } |
| 347 | + ) |
351 | 348 |
|
352 | | - if (level.trappings.isEmpty()) { |
353 | | - append("—") |
354 | | - } |
| 349 | + Text( |
| 350 | + buildAnnotatedString { |
| 351 | + withStyle(SpanStyle(fontWeight = FontWeight.Bold)) { |
| 352 | + append(LocalStrings.current.trappings.title) |
| 353 | + append(": ") |
| 354 | + } |
355 | 355 |
|
356 | | - level.trappings.forEachIndexed { index, talent -> |
357 | | - append(talent) |
| 356 | + if (level.trappings.isEmpty()) { |
| 357 | + append("—") |
| 358 | + } |
358 | 359 |
|
359 | | - if (index != level.trappings.lastIndex) { |
360 | | - append(", ") |
| 360 | + level.trappings.forEachIndexed { index, talent -> |
| 361 | + append(talent) |
| 362 | + |
| 363 | + if (index != level.trappings.lastIndex) { |
| 364 | + append(", ") |
| 365 | + } |
361 | 366 | } |
362 | 367 | } |
363 | | - } |
364 | | - ) |
| 368 | + ) |
| 369 | + } |
365 | 370 | } |
366 | | - } |
367 | | - ) |
| 371 | + ) |
| 372 | + } |
368 | 373 | } |
369 | 374 | } |
370 | 375 | } |
0 commit comments