Сделан шилдик в расписании

This commit is contained in:
2023-04-05 00:28:41 +03:00
parent b5a69d470d
commit 5fd497f70e
3 changed files with 84 additions and 4 deletions
@@ -289,4 +289,16 @@ fun HomeWorkCardPrev() {
isDone = !it isDone = !it
} }
) )
}
@Preview
@Composable
fun ScheduleShieldPrev() {
BaseScheduleShield(
subjectName = "Физика",
teacherName = "Иванов Иван Иванович",
classNumber = "3.13",
nextLessonName = "Обществознание"
)
} }
@@ -1,10 +1,21 @@
package ru.megboyzz.dnevnik.screens.ui package ru.megboyzz.dnevnik.screens.ui
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.*
import androidx.compose.material.Icon
import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import ru.megboyzz.dnevnik.AsPainter
import ru.megboyzz.dnevnik.AsString
import ru.megboyzz.dnevnik.R
import ru.megboyzz.dnevnik.ui.theme.H2
import ru.megboyzz.dnevnik.ui.theme.MainText
import ru.megboyzz.dnevnik.ui.theme.dark
import ru.megboyzz.dnevnik.ui.theme.mainBlue
@Composable @Composable
fun BaseScheduleShield( fun BaseScheduleShield(
@@ -15,9 +26,39 @@ fun BaseScheduleShield(
) { ) {
BaseCard { BaseCard {
Column( Column(
modifier = Modifier
.defaultMinSize(300.dp)
.padding(top = 20.dp, bottom = 40.dp),
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(15.dp)
) { ) {
Column(
verticalArrangement = Arrangement.spacedBy(8.dp),
horizontalAlignment = Alignment.CenterHorizontally
) {
Icon(
painter = R.drawable.ic_cap.AsPainter(),
contentDescription = ""
)
TextHeader(
title = R.string.title_now_lesson.AsString(),
value = subjectName
)
}
TextHeader(
title = R.string.title_lesson_teacher.AsString(),
value = teacherName
)
TextHeader(
title = R.string.title_classroom.AsString(),
value = classNumber
)
TextHeader(
title = R.string.title_next_lesson.AsString(),
value = nextLessonName,
valueIsBlue = false
)
} }
} }
} }
@@ -29,8 +70,22 @@ fun TextHeader(
valueIsBlue: Boolean = true valueIsBlue: Boolean = true
) { ) {
Column( Column(
verticalArrangement = Arrangement.spacedBy(10.dp) verticalArrangement = Arrangement.spacedBy(2.dp),
modifier = Modifier.width(200.dp)
) { ) {
Text(
text = title,
style = MainText,
color = dark,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()
)
Text(
text = value,
style = H2,
color = if(valueIsBlue) mainBlue else dark,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxWidth()
)
} }
} }
+13
View File
@@ -0,0 +1,13 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="40dp"
android:height="40dp"
android:viewportWidth="40"
android:viewportHeight="40">
<group>
<clip-path
android:pathData="M0,0h40v40h-40z"/>
<path
android:pathData="M36.761,8.716L24.471,2.861C21.766,1.245 18.399,1.217 15.666,2.786L3.238,8.716C3.191,8.74 3.143,8.765 3.098,8.791C0.149,10.478 -0.875,14.236 0.811,17.185C1.383,18.185 2.224,19.004 3.238,19.55L6.666,21.183V29.35C6.668,33.001 9.045,36.228 12.531,37.313C14.958,38.015 17.474,38.359 20,38.333C22.525,38.361 25.041,38.021 27.468,37.321C30.955,36.236 33.331,33.01 33.333,29.358V21.18L36.667,19.586V33.333C36.667,34.253 37.413,35 38.333,35C39.254,35 40,34.253 40,33.333V13.333C40.011,11.376 38.465,9.568 36.761,8.716ZM30,29.358C30,31.542 28.583,33.474 26.5,34.13C24.387,34.733 22.197,35.027 20,35C17.802,35.027 15.613,34.733 13.5,34.13C11.416,33.474 9.999,31.542 10,29.358V22.771L15.528,25.405C16.892,26.215 18.45,26.64 20.036,26.636C21.546,26.647 23.031,26.247 24.331,25.48L30,22.771V29.358ZM35.333,16.541L22.763,22.541C21.01,23.562 18.838,23.533 17.113,22.466L4.815,16.616C3.444,15.877 2.932,14.167 3.671,12.796C3.921,12.332 4.296,11.948 4.753,11.686L17.245,5.72C18.998,4.701 21.169,4.73 22.895,5.795L35.185,11.65C36.089,12.151 36.654,13.099 36.666,14.133C36.668,15.112 36.164,16.023 35.333,16.541Z"
android:fillColor="#272727"/>
</group>
</vector>