main #4

Closed
student-32996 wants to merge 9 commits from (deleted):main into main
7 changed files with 241 additions and 25 deletions
Showing only changes of commit 7dc115052d - Show all commits

View File

@@ -23,26 +23,46 @@ import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp import androidx.compose.ui.unit.sp
import ru.myitschool.work.R import ru.myitschool.work.R
import ru.myitschool.work.ui.theme.Black
import ru.myitschool.work.ui.theme.Gray import ru.myitschool.work.ui.theme.Gray
import ru.myitschool.work.ui.theme.Typography import ru.myitschool.work.ui.theme.Typography
import ru.myitschool.work.ui.theme.White
@Composable @Composable
fun BaseText24( fun BaseText24(
text: String, text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
color: Color = Color.Unspecified, color: Color = Black,
textAlign: TextAlign = TextAlign.Left textAlign: TextAlign = TextAlign.Left
) { ) {
Text( Text(
text = text, text = text,
fontSize = 24.sp, fontSize = 24.sp,
style = _root_ide_package_.ru.myitschool.work.ui.theme.Typography.bodyLarge, style = Typography.bodyLarge,
modifier = modifier, modifier = modifier,
color = color, color = color,
textAlign = textAlign textAlign = textAlign
) )
} }
@Composable
fun BaseNoBackgroundButton(
text: String,
onClick: () -> Unit
) {
Button(
onClick = onClick,
colors = ButtonDefaults.buttonColors(
containerColor = Color.Transparent,
contentColor = White,
disabledContainerColor = Color.Transparent,
disabledContentColor = White
)
) {
BaseText16(text = text, color = White)
}
}
@Composable @Composable
fun Logo() { fun Logo() {
Image( Image(
@@ -56,11 +76,11 @@ fun Logo() {
fun BaseText16( fun BaseText16(
text: String, text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
color: Color = Color.Unspecified color: Color = Black,
) { ) {
Text( Text(
text = text, text = text,
style = _root_ide_package_.ru.myitschool.work.ui.theme.Typography.bodySmall, style = Typography.bodySmall,
fontSize = 16.sp, fontSize = 16.sp,
color = color, color = color,
modifier = modifier modifier = modifier
@@ -71,17 +91,32 @@ fun BaseText16(
fun BaseText12( fun BaseText12(
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
text: String, text: String,
color: Color = Color.Unspecified, color: Color = Black,
) { ) {
Text( Text(
text = text, text = text,
style = _root_ide_package_.ru.myitschool.work.ui.theme.Typography.bodySmall, style = Typography.bodySmall,
fontSize = 12.sp, fontSize = 12.sp,
color = color, color = color,
modifier = modifier, modifier = modifier,
) )
} }
@Composable
fun BaseText14(
modifier: Modifier = Modifier,
text: String,
color: Color = Black,
) {
Text(
text = text,
style = Typography.bodySmall,
fontSize = 14.sp,
color = color,
modifier = modifier,
)
}
@Composable @Composable
fun BaseInputText( fun BaseInputText(
placeholder: String= "", placeholder: String= "",
@@ -97,12 +132,12 @@ fun BaseInputText(
}, },
shape = RoundedCornerShape(16.dp), shape = RoundedCornerShape(16.dp),
placeholder = { placeholder = {
_root_ide_package_.ru.myitschool.work.ui.BaseText16( BaseText16(
text = placeholder, text = placeholder,
color = _root_ide_package_.ru.myitschool.work.ui.theme.Gray color = Gray
) )
}, },
textStyle = _root_ide_package_.ru.myitschool.work.ui.theme.Typography.bodySmall.copy(fontSize = 16.sp), textStyle = Typography.bodySmall.copy(fontSize = 16.sp),
colors = TextFieldDefaults.colors( colors = TextFieldDefaults.colors(
focusedIndicatorColor = Color.Transparent, focusedIndicatorColor = Color.Transparent,
unfocusedIndicatorColor = Color.Transparent, unfocusedIndicatorColor = Color.Transparent,
@@ -118,14 +153,17 @@ fun BaseInputText(
fun BaseText20( fun BaseText20(
text: String, text: String,
color: Color = Color.Unspecified, color: Color = Color.Unspecified,
style: TextStyle = _root_ide_package_.ru.myitschool.work.ui.theme.Typography.bodySmall, style: TextStyle = Typography.bodySmall,
modifier: Modifier = Modifier.padding(7.dp),
textAlign: TextAlign = TextAlign.Unspecified
) { ) {
Text( Text(
text = text, text = text,
style = style, style = style,
fontSize = 20.sp, fontSize = 20.sp,
modifier = Modifier.padding(7.dp), modifier = modifier,
color = color color = color,
textAlign = textAlign
) )
} }
@@ -150,6 +188,6 @@ fun BaseButton(
shape = RoundedCornerShape(16.dp), shape = RoundedCornerShape(16.dp),
) { ) {
icon() icon()
_root_ide_package_.ru.myitschool.work.ui.BaseText20(text = text) BaseText20(text = text)
} }
} }

View File

@@ -15,6 +15,8 @@ import ru.myitschool.work.ui.nav.AuthScreenDestination
import ru.myitschool.work.ui.nav.BookScreenDestination import ru.myitschool.work.ui.nav.BookScreenDestination
import ru.myitschool.work.ui.nav.MainScreenDestination import ru.myitschool.work.ui.nav.MainScreenDestination
import ru.myitschool.work.ui.screen.auth.AuthScreen import ru.myitschool.work.ui.screen.auth.AuthScreen
import ru.myitschool.work.ui.screen.book.BookScreen
import ru.myitschool.work.ui.screen.main.MainScreen
@Composable @Composable
fun AppNavHost( fun AppNavHost(
@@ -33,18 +35,14 @@ fun AppNavHost(
navController = navController) navController = navController)
} }
composable<MainScreenDestination> { composable<MainScreenDestination> {
Box( MainScreen(
contentAlignment = Alignment.Center navController = navController
) { )
Text(text = "Hello")
}
} }
composable<BookScreenDestination> { composable<BookScreenDestination> {
Box( BookScreen(
contentAlignment = Alignment.Center navController = navController
) { )
Text(text = "Hello")
}
} }
} }
} }

View File

@@ -82,7 +82,7 @@ fun AuthScreen(
BaseButton( BaseButton(
text = stringResource(R.string.auth_sign_in), text = stringResource(R.string.auth_sign_in),
onClick = {}, onClick = { navController.navigate(MainScreenDestination)},
btnColor = Blue, btnColor = Blue,
btnContentColor = White btnContentColor = White
) )

View File

@@ -0,0 +1,11 @@
package ru.myitschool.work.ui.screen.book
import androidx.compose.runtime.Composable
import androidx.navigation.NavController
@Composable
fun BookScreen(
navController: NavController
) {
}

View File

@@ -0,0 +1,151 @@
package ru.myitschool.work.ui.screen.main
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
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.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import ru.myitschool.work.R
import ru.myitschool.work.ui.BaseButton
import ru.myitschool.work.ui.BaseNoBackgroundButton
import ru.myitschool.work.ui.BaseText14
import ru.myitschool.work.ui.BaseText16
import ru.myitschool.work.ui.BaseText20
import ru.myitschool.work.ui.nav.BookScreenDestination
import ru.myitschool.work.ui.theme.Black
import ru.myitschool.work.ui.theme.Blue
import ru.myitschool.work.ui.theme.LightGray
import ru.myitschool.work.ui.theme.Typography
import ru.myitschool.work.ui.theme.White
@Composable
fun MainScreen(
navController: NavController
) {
Column (
modifier = Modifier
.background(LightGray)
.fillMaxSize()
) {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier
.clip(RoundedCornerShape(bottomStart = 16.dp, bottomEnd = 16.dp))
.background(Blue)
.fillMaxWidth()
.padding(10.dp)
) {
Row(
horizontalArrangement = Arrangement.SpaceBetween,
modifier = Modifier.fillMaxWidth()
) {
BaseNoBackgroundButton(
text = "Обновить",
onClick = { }
)
BaseNoBackgroundButton(
text = "Выйти",
onClick = { }
)
}
Image(
painter = painterResource(R.drawable.avatar),
contentDescription = "User avatar",
modifier = Modifier.padding(20.dp)
)
BaseText20(
text = "Артемий Артемиев Иванович",
color = White,
textAlign = TextAlign.Center,
modifier = Modifier.width(250.dp),
style = Typography.bodyLarge
)
Spacer(modifier = Modifier.height(20.dp))
}
Column(
verticalArrangement = Arrangement.SpaceBetween,
modifier = Modifier
.fillMaxSize()
.padding(20.dp)
.clip(RoundedCornerShape(16.dp))
.background(White)
) {
Column(
modifier = Modifier.fillMaxWidth()
) {
Text(
text = "Ваши забронированные места",
style = Typography.bodyMedium,
color = Black,
fontSize = 16.sp,
modifier = Modifier.padding(
horizontal = 10.dp,
vertical = 20.dp
)
)
BookList()
}
BaseButton(
text = "Бронировать",
btnColor = Blue,
btnContentColor = White,
onClick = { navController.navigate(BookScreenDestination)},
modifier = Modifier
.padding(horizontal = 10.dp, vertical = 15.dp)
.fillMaxWidth()
)
}
}
}
@Composable
fun BookList() {
Column(
modifier = Modifier.padding(horizontal = 20.dp)
) {
BookListElement()
BookListElement()
BookListElement()
BookListElement()
}
}
@Composable
fun BookListElement() {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 20.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
BaseText14(
text = "Конгресс Холл"
)
BaseText14(
text = "16.02.3026"
)
}
}

View File

@@ -16,4 +16,8 @@ val Gray = Color(0xFF777777)
val White = Color(0xFFFFFFFF) val White = Color(0xFFFFFFFF)
val Red = Color(0xFFFF4D4D) val Red = Color(0xFFFF4D4D)
val LightGray = Color(0xFFF2F1F7)
val Black = Color(0xFF000000)

View File

@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="100dp"
android:height="100dp"
android:viewportWidth="100"
android:viewportHeight="100">
<path
android:pathData="M50,50m-48.5,0a48.5,48.5 0,1 1,97 0a48.5,48.5 0,1 1,-97 0"
android:strokeWidth="3"
android:fillColor="#AEC3FF"
android:strokeColor="#ffffff"/>
<path
android:pathData="M61.99,54.17C64.58,54.17 66.67,56.26 66.67,58.85V60.05C66.67,61.91 66.01,63.71 64.8,65.13C61.53,68.95 56.55,70.83 50,70.83C43.45,70.83 38.48,68.95 35.21,65.13C34,63.71 33.34,61.91 33.34,60.05V58.85C33.34,56.26 35.44,54.17 38.03,54.17H61.99ZM61.99,57.29H38.03C37.16,57.29 36.47,57.99 36.47,58.85V60.05C36.47,61.17 36.86,62.25 37.59,63.1C40.2,66.16 44.3,67.71 50,67.71C55.71,67.71 59.8,66.16 62.42,63.1C63.15,62.25 63.55,61.17 63.55,60.05V58.85C63.55,57.99 62.85,57.29 61.99,57.29ZM50,29.18C55.75,29.18 60.42,33.84 60.42,39.59C60.42,45.35 55.75,50.01 50,50.01C44.25,50.01 39.58,45.35 39.58,39.59C39.58,33.84 44.25,29.18 50,29.18ZM50,32.3C45.97,32.3 42.71,35.57 42.71,39.59C42.71,43.62 45.97,46.88 50,46.88C54.03,46.88 57.29,43.62 57.29,39.59C57.29,35.57 54.03,32.3 50,32.3Z"
android:fillColor="#ffffff"/>
</vector>