main #4

Closed
student-32996 wants to merge 9 commits from (deleted):main into main
6 changed files with 278 additions and 83 deletions
Showing only changes of commit 487d228a9b - Show all commits

View File

@@ -1,10 +1,15 @@
package ru.myitschool.work.ui package ru.myitschool.work.ui
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image import androidx.compose.foundation.Image
import androidx.compose.foundation.background import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.RowScope import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults import androidx.compose.material3.ButtonDefaults
@@ -12,15 +17,19 @@ import androidx.compose.material3.Text
import androidx.compose.material3.TextField import androidx.compose.material3.TextField
import androidx.compose.material3.TextFieldDefaults import androidx.compose.material3.TextFieldDefaults
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign 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.core.TestIds.Main
import ru.myitschool.work.ui.theme.Black import ru.myitschool.work.ui.theme.Black
import ru.myitschool.work.ui.theme.Blue
import ru.myitschool.work.ui.theme.Gray import ru.myitschool.work.ui.theme.Gray
import ru.myitschool.work.ui.theme.LightBlue import ru.myitschool.work.ui.theme.LightBlue
import ru.myitschool.work.ui.theme.LightGray import ru.myitschool.work.ui.theme.LightGray
@@ -194,3 +203,32 @@ fun BaseButton(
BaseText20(text = text) BaseText20(text = text)
} }
} }
@Composable
fun ErrorScreen() {
Column(
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.padding(horizontal = 20.dp, vertical = 40.dp)
) {
Spacer(modifier = Modifier.height(80.dp))
BaseText24(
text = "Ошибка загрузки данных",
textAlign = TextAlign.Center,
modifier = Modifier
.testTag(Main.ERROR)
.width(250.dp)
)
Spacer(modifier = Modifier.height(30.dp))
BaseButton(
modifier = Modifier.testTag(Main.REFRESH_BUTTON),
text = "Обновить",
btnColor = Blue,
btnContentColor = White,
onClick = {}
)
}
}

View File

@@ -3,4 +3,6 @@ package ru.myitschool.work.ui.nav
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
data object MainScreenDestination: ru.myitschool.work.ui.nav.AppDestination data object MainScreenDestination: AppDestination {
val userData = ""
}

View File

@@ -3,10 +3,12 @@ package ru.myitschool.work.ui.screen.auth
import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.width
import androidx.compose.material3.Button import androidx.compose.material3.Button
import androidx.compose.material3.CircularProgressIndicator import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@@ -48,8 +50,9 @@ fun AuthScreen(
) { ) {
Column( Column(
modifier = Modifier modifier = Modifier
.padding(20.dp) .fillMaxHeight()
.fillMaxSize(), .width(200.dp)
.padding(20.dp),
horizontalAlignment = Alignment.CenterHorizontally horizontalAlignment = Alignment.CenterHorizontally
) { ) {
Logo() Logo()

View File

@@ -1,11 +1,129 @@
package ru.myitschool.work.ui.screen.book package ru.myitschool.work.ui.screen.book
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.RowScope
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonColors
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
import androidx.navigation.NavController import androidx.navigation.NavController
import ru.myitschool.work.R
import ru.myitschool.work.core.TestIds.Main
import ru.myitschool.work.ui.BaseButton
import ru.myitschool.work.ui.BaseNoBackgroundButton
import ru.myitschool.work.ui.BaseText16
import ru.myitschool.work.ui.BaseText20
import ru.myitschool.work.ui.BaseText24
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.Gray
import ru.myitschool.work.ui.theme.LightGray
import ru.myitschool.work.ui.theme.MontserratFontFamily
import ru.myitschool.work.ui.theme.White
@Composable @Composable
fun BookScreen( fun BookScreen(
navController: NavController navController: NavController
) { ) {
Column(
) {
Row(
) {
BaseText24(
text = "Новая встреча"
)
BaseNoBackgroundButton(
text = "Назад",
onClick = {}
)
}
Column(
) {
BaseText16(
text = "Доступные даты"
)
BookDateList()
BaseText16(
text = "Выберите место встречи"
)
BookPlaceList()
BaseButton(
text = "Бронировать",
btnColor = Blue,
btnContentColor = White,
onClick = { navController.navigate(BookScreenDestination)},
modifier = Modifier
.testTag(Main.ADD_BUTTON)
.padding(horizontal = 10.dp, vertical = 15.dp)
.fillMaxWidth(),
icon = {Image(
painter = painterResource(R.drawable.add_icon),
contentDescription = "plus Icon"
)}
)
}
}
}
@Composable
fun BookPlaceList() {
BookPlaceListElement()
}
@Composable
fun BookPlaceListElement() {
} }
@Composable
fun BookDateList() {
BookDateListElement()
BookDateListElement()
BookDateListElement()
BookDateListElement()
BookDateListElement()
BookDateListElement()
BookDateListElement()
}
@Composable
fun BookDateListElement() {
Button(
border = BorderStroke(1.dp, Black),
onClick = {},
modifier = Modifier
.width(60.dp)
.padding(0.dp),
colors = ButtonColors(
contentColor = Black,
containerColor = Color.Transparent,
disabledContentColor = Black,
disabledContainerColor = Color.Transparent),
shape = RoundedCornerShape(16.dp)
) {
BaseText16(text = "16.06")
}
}

View File

@@ -31,6 +31,8 @@ import ru.myitschool.work.ui.BaseNoBackgroundButton
import ru.myitschool.work.ui.BaseText14 import ru.myitschool.work.ui.BaseText14
import ru.myitschool.work.ui.BaseText16 import ru.myitschool.work.ui.BaseText16
import ru.myitschool.work.ui.BaseText20 import ru.myitschool.work.ui.BaseText20
import ru.myitschool.work.ui.BaseText24
import ru.myitschool.work.ui.ErrorScreen
import ru.myitschool.work.ui.nav.BookScreenDestination import ru.myitschool.work.ui.nav.BookScreenDestination
import ru.myitschool.work.ui.theme.Black import ru.myitschool.work.ui.theme.Black
import ru.myitschool.work.ui.theme.Blue import ru.myitschool.work.ui.theme.Blue
@@ -43,10 +45,17 @@ fun MainScreen(
navController: NavController navController: NavController
) { ) {
Column ( Column (
horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier modifier = Modifier
.background(LightGray) .background(LightGray)
.fillMaxSize() .fillMaxSize()
.width(400.dp)
) { ) {
val dateError = false
if(!dateError) {
Column( Column(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier modifier = Modifier
@@ -124,29 +133,43 @@ fun MainScreen(
modifier = Modifier modifier = Modifier
.testTag(Main.ADD_BUTTON) .testTag(Main.ADD_BUTTON)
.padding(horizontal = 10.dp, vertical = 15.dp) .padding(horizontal = 10.dp, vertical = 15.dp)
.fillMaxWidth() .fillMaxWidth(),
icon = {Image(
painter = painterResource(R.drawable.add_icon),
contentDescription = "plus Icon"
)}
) )
} }
} }
else {
ErrorScreen()
}
}
} }
val bookListData = listOf(
"Конгресс Холл",
"Конгресс Холл",
"Конгресс Холл"
)
@Composable @Composable
fun BookList() { fun BookList() {
Column( Column(
modifier = Modifier.padding(horizontal = 20.dp) modifier = Modifier.padding(horizontal = 20.dp)
) { ) {
BookListElement() for ((index, book) in bookListData.withIndex()) {
BookListElement() BookListElement(index)
BookListElement() }
BookListElement()
} }
} }
@Composable @Composable
fun BookListElement() { fun BookListElement(index: Int) {
Row( Row(
modifier = Modifier modifier = Modifier
.testTag(Main.getIdItemByPosition(1)) .testTag(Main.getIdItemByPosition(index))
.fillMaxWidth() .fillMaxWidth()
.padding(vertical = 20.dp), .padding(vertical = 20.dp),
horizontalArrangement = Arrangement.SpaceBetween horizontalArrangement = Arrangement.SpaceBetween

View File

@@ -0,0 +1,11 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="17dp"
android:height="17dp"
android:viewportWidth="17"
android:viewportHeight="17">
<path
android:strokeWidth="1"
android:pathData="M8.296,0.5C8.503,0.5 8.656,0.565 8.786,0.695C8.916,0.826 8.981,0.977 8.98,1.183V7.61H15.405C15.615,7.61 15.767,7.676 15.896,7.805C16.026,7.934 16.09,8.086 16.09,8.294C16.089,8.503 16.024,8.657 15.894,8.788C15.767,8.917 15.616,8.981 15.407,8.98H8.98V15.405C8.98,15.615 8.914,15.767 8.785,15.896C8.656,16.026 8.504,16.09 8.296,16.09C8.087,16.089 7.934,16.024 7.805,15.894C7.676,15.766 7.61,15.615 7.61,15.405V8.98H1.185C0.975,8.98 0.823,8.915 0.695,8.786C0.566,8.656 0.5,8.503 0.5,8.294C0.5,8.086 0.565,7.935 0.694,7.806C0.825,7.675 0.978,7.61 1.185,7.61H7.61V1.185C7.61,0.975 7.676,0.824 7.805,0.695C7.934,0.566 8.087,0.501 8.296,0.5Z"
android:fillColor="#ffffff"
android:strokeColor="#ffffff"/>
</vector>