Impl base app theme, change statusbar color
This commit is contained in:
@@ -3,7 +3,21 @@ package ru.fincode.tsudesk.feature.schedule.presentation.screen
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.horizontalScroll
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.WindowInsets
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.layout.statusBars
|
||||
import androidx.compose.foundation.layout.width
|
||||
import androidx.compose.foundation.layout.windowInsetsPadding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.rememberScrollState
|
||||
@@ -14,9 +28,23 @@ import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Close
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowDown
|
||||
import androidx.compose.material.icons.filled.KeyboardArrowUp
|
||||
import androidx.compose.material3.*
|
||||
import androidx.compose.material3.AssistChip
|
||||
import androidx.compose.material3.AssistChipDefaults
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.DropdownMenu
|
||||
import androidx.compose.material3.DropdownMenuItem
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.LinearProgressIndicator
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.OutlinedTextField
|
||||
import androidx.compose.material3.OutlinedTextFieldDefaults
|
||||
import androidx.compose.material3.Surface
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TextButton
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.draw.clip
|
||||
@@ -28,7 +56,7 @@ import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import ru.fincode.tsudesk.core.common.model.DataResult
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.*
|
||||
import ru.fincode.tsudesk.core.ui.theme.TSUDeskThemeExt
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.util.dowRuShort
|
||||
import ru.fincode.tsudesk.feature.schedule.presentation.util.todayString
|
||||
|
||||
@@ -60,62 +88,67 @@ private fun ScheduleHeader(
|
||||
onIntent: (ScheduleIntent) -> Unit
|
||||
) {
|
||||
val shape = RoundedCornerShape(bottomStart = 20.dp, bottomEnd = 20.dp)
|
||||
val brand = TSUDeskThemeExt.colors
|
||||
|
||||
val headerBrush = Brush.linearGradient(
|
||||
listOf(
|
||||
MaterialTheme.colorScheme.error,
|
||||
MaterialTheme.colorScheme.error.copy(alpha = 0.75f)
|
||||
brand.brand,
|
||||
brand.brand.copy(alpha = 0.75f)
|
||||
)
|
||||
)
|
||||
|
||||
Column(
|
||||
Box(
|
||||
Modifier
|
||||
.fillMaxWidth()
|
||||
.clip(shape)
|
||||
.background(headerBrush)
|
||||
.padding(top = 20.dp, start = 16.dp, end = 16.dp, bottom = 14.dp)
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = "Расписание",
|
||||
color = MaterialTheme.colorScheme.onError,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "ТулГУ • Осенний семестр",
|
||||
color = MaterialTheme.colorScheme.onError.copy(alpha = 0.8f),
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
Column(
|
||||
Modifier
|
||||
// inset только для содержимого, фон остаётся до верха
|
||||
.windowInsetsPadding(WindowInsets.statusBars)
|
||||
.padding(start = 16.dp, end = 16.dp, bottom = 14.dp)
|
||||
) {
|
||||
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||
Column(Modifier.weight(1f)) {
|
||||
Text(
|
||||
text = "Расписание",
|
||||
color = brand.onBrand,
|
||||
fontSize = 20.sp,
|
||||
fontWeight = FontWeight.Bold
|
||||
)
|
||||
Text(
|
||||
text = "ТулГУ • Осенний семестр",
|
||||
color = brand.onBrand.copy(alpha = 0.8f),
|
||||
fontSize = 11.sp,
|
||||
fontWeight = FontWeight.Medium
|
||||
)
|
||||
}
|
||||
|
||||
ModeToggle(
|
||||
mode = state.viewMode,
|
||||
onMode = { onIntent(ScheduleIntent.SetViewMode(it)) }
|
||||
)
|
||||
}
|
||||
|
||||
ModeToggle(
|
||||
mode = state.viewMode,
|
||||
onMode = { onIntent(ScheduleIntent.SetViewMode(it)) }
|
||||
Spacer(Modifier.height(12.dp))
|
||||
|
||||
GroupSelector(
|
||||
groupInput = state.groupInput,
|
||||
recentGroups = state.recentGroups,
|
||||
expanded = state.isGroupMenuExpanded,
|
||||
isLoading = state.isLoading,
|
||||
onExpanded = { onIntent(ScheduleIntent.SetGroupMenuExpanded(it)) },
|
||||
onValueChange = { onIntent(ScheduleIntent.ChangeGroupInput(it)) },
|
||||
onSelectRecent = { group ->
|
||||
onIntent(ScheduleIntent.SelectRecentGroup(group))
|
||||
onIntent(ScheduleIntent.ApplyGroup)
|
||||
},
|
||||
onRemoveRecent = { onIntent(ScheduleIntent.RemoveRecentGroup(it)) },
|
||||
onApply = { onIntent(ScheduleIntent.ApplyGroup) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.height(12.dp))
|
||||
|
||||
GroupSelector(
|
||||
groupInput = state.groupInput,
|
||||
recentGroups = state.recentGroups,
|
||||
expanded = state.isGroupMenuExpanded,
|
||||
isLoading = state.isLoading,
|
||||
onExpanded = { onIntent(ScheduleIntent.SetGroupMenuExpanded(it)) },
|
||||
onValueChange = { onIntent(ScheduleIntent.ChangeGroupInput(it)) },
|
||||
|
||||
// выбор из списка -> сразу загрузка
|
||||
onSelectRecent = { group ->
|
||||
onIntent(ScheduleIntent.SelectRecentGroup(group))
|
||||
onIntent(ScheduleIntent.ApplyGroup)
|
||||
},
|
||||
|
||||
onRemoveRecent = { onIntent(ScheduleIntent.RemoveRecentGroup(it)) },
|
||||
onApply = { onIntent(ScheduleIntent.ApplyGroup) },
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -566,9 +599,10 @@ private fun LessonCard(lesson: UiLesson) {
|
||||
|
||||
@Composable
|
||||
private fun LessonBadge(text: String, kind: BadgeKind) {
|
||||
val brand = TSUDeskThemeExt.colors
|
||||
val (bg, fg) = when (kind) {
|
||||
BadgeKind.INFO -> MaterialTheme.colorScheme.primary.copy(alpha = 0.12f) to MaterialTheme.colorScheme.primary
|
||||
BadgeKind.PRIMARY -> MaterialTheme.colorScheme.error.copy(alpha = 0.12f) to MaterialTheme.colorScheme.error
|
||||
BadgeKind.PRIMARY -> brand.brandSoft to brand.brand
|
||||
BadgeKind.LAB -> MaterialTheme.colorScheme.tertiary.copy(alpha = 0.12f) to MaterialTheme.colorScheme.tertiary
|
||||
BadgeKind.MUTED -> MaterialTheme.colorScheme.surfaceVariant to MaterialTheme.colorScheme.onSurfaceVariant
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user