Some update UI 2
This commit is contained in:
@@ -218,9 +218,17 @@ fun ScheduleScreen(
|
||||
|
||||
val day = weekDays.getOrNull(page)
|
||||
|
||||
if (day == null ||
|
||||
day.intervals.all { it.lessons.isEmpty() }
|
||||
) {
|
||||
val visibleIntervals = day?.intervals
|
||||
?.withIndex()
|
||||
?.filter { (_, slot) ->
|
||||
slot.lessons.any { lesson ->
|
||||
!lesson.subject.isNullOrBlank() ||
|
||||
lesson.raw.isNotBlank()
|
||||
}
|
||||
}
|
||||
.orEmpty()
|
||||
|
||||
if (visibleIntervals.isEmpty()) {
|
||||
ScheduleEmptyDay()
|
||||
} else {
|
||||
val listState = rememberLazyListState()
|
||||
@@ -228,21 +236,14 @@ fun ScheduleScreen(
|
||||
LazyColumn(
|
||||
state = listState,
|
||||
modifier = Modifier.fillMaxSize(),
|
||||
verticalArrangement =
|
||||
Arrangement.spacedBy(12.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
contentPadding = PaddingValues(
|
||||
top = 16.dp,
|
||||
bottom = 24.dp
|
||||
)
|
||||
) {
|
||||
items(
|
||||
items = day.intervals.withIndex()
|
||||
.filter { (_, slot) ->
|
||||
slot.lessons.any { lesson ->
|
||||
!lesson.subject.isNullOrBlank() ||
|
||||
lesson.raw.isNotBlank()
|
||||
}
|
||||
},
|
||||
items = visibleIntervals,
|
||||
key = { it.index }
|
||||
) { (slotIndex, slot) ->
|
||||
LessonSlot(
|
||||
|
||||
@@ -24,7 +24,7 @@ internal fun ScheduleEmptyDay() {
|
||||
) {
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp)
|
||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||
) {
|
||||
Icon(
|
||||
painter = painterResource(R.drawable.event_busy_24dp),
|
||||
@@ -32,7 +32,10 @@ internal fun ScheduleEmptyDay() {
|
||||
modifier = Modifier.size(48.dp),
|
||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||
)
|
||||
|
||||
Column(
|
||||
horizontalAlignment = Alignment.CenterHorizontally,
|
||||
verticalArrangement = Arrangement.spacedBy(2.dp))
|
||||
{
|
||||
Text(
|
||||
text = "Занятий нет",
|
||||
style = MaterialTheme.typography.titleMedium
|
||||
@@ -45,6 +48,7 @@ internal fun ScheduleEmptyDay() {
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
|
||||
Reference in New Issue
Block a user