дезигн поправлен

потом можно исправить админ панель
This commit is contained in:
VictoriaPresnyakova 2023-10-17 21:59:23 +04:00
parent 35d89b440e
commit 83d91169cc
15 changed files with 189 additions and 79 deletions

View File

@ -5,5 +5,7 @@ data class Hotel(
val name: String,
val img: Int,
val stars: Int,
val location: String
val location: String,
val info: String,
val price: Int,
)

View File

@ -25,7 +25,7 @@ fun NavController(navController: NavHostController) {
startDestination = NavItem.Home.route
) {
composable(NavItem.HotelInfo.route) {
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"), navController)
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location", "info", 4000), navController)
}
composable(NavItem.Home.route) {
HomeScreen(navController)

View File

@ -51,7 +51,6 @@ fun AddPanel(){
.fillMaxWidth()
.padding(16.dp)
.clip(RoundedCornerShape(16.dp))
.background((Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)))
.verticalScroll(rememberScrollState())
) {
Column(
@ -70,7 +69,7 @@ fun AddPanel(){
)
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF),
backgroundColor = colorResource(id = R.color.figma_blue),
contentColor = Color.White
),
onClick = {
@ -79,6 +78,7 @@ fun AddPanel(){
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 16.dp)
.height(50.dp)
) {
Text("Add image")
}
@ -103,16 +103,15 @@ fun AddPanel(){
),
placeholder = {
Text(
text = "Brand",
text = "Stars",
style = TextStyle(fontSize = 12.sp)
)
}
)
Spacer(modifier = Modifier.height(16.dp))
TextField(
value = " ",
value = "",
onValueChange = { },
modifier = Modifier
.fillMaxWidth()
@ -131,7 +130,7 @@ fun AddPanel(){
),
placeholder = {
Text(
text = "Model",
text = "Location",
style = TextStyle(fontSize = 12.sp)
)
}
@ -140,13 +139,14 @@ fun AddPanel(){
Spacer(modifier = Modifier.height(16.dp))
TextField(
value = " ",
value = "",
onValueChange = { },
modifier = Modifier
.fillMaxWidth()
.height(150.dp)
.height(50.dp)
.padding(16.dp, 0.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp)),
singleLine = true,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
imeAction = ImeAction.Next
@ -158,12 +158,11 @@ fun AddPanel(){
),
placeholder = {
Text(
text = "Description",
text = "Info",
style = TextStyle(fontSize = 12.sp)
)
}
)
Spacer(modifier = Modifier.height(16.dp))
TextField(
@ -191,10 +190,37 @@ fun AddPanel(){
)
}
)
Spacer(modifier = Modifier.height(16.dp))
TextField(
value = "",
onValueChange = { },
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
.padding(16.dp, 0.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp)),
singleLine = true,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
imeAction = ImeAction.Next
),
keyboardActions = KeyboardActions(
onNext = {
}
),
placeholder = {
Text(
text = "Info",
style = TextStyle(fontSize = 12.sp)
)
}
)
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor =(Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor =colorResource(id = R.color.figma_blue),
contentColor = Color.White
),
onClick = {
@ -203,8 +229,9 @@ fun AddPanel(){
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.height(50.dp)
) {
Text("Add sneaker")
Text("Add hotel")
}
}
}

View File

@ -12,13 +12,16 @@ import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.profileScreen.signIn.LoginScreen
@Composable
fun AdminPanel(navHostController: NavHostController) {
var isAddPanelVisible by remember { mutableStateOf(false) }
var isChangePanelVisible by remember { mutableStateOf(false) }
var isChangePanelVisible by remember { mutableStateOf(true) }
Column(
modifier = Modifier
@ -45,4 +48,11 @@ fun AdminPanel(navHostController: NavHostController) {
ChangePanel(navHostController)
}
}
}
@Composable
@Preview(showBackground = true)
fun SignInScreenPreview(){
val navController = rememberNavController()
AdminPanel(navController)
}

View File

@ -56,7 +56,7 @@ fun CardHotelForChange(item: Hotel, navController: NavHostController) {
.padding(start = 16.dp)
) {
item.name?.let { Text(text = it, fontSize = 20.sp) }
Text(text = "${item.location} USD", color = Color.Red, fontSize = 16.sp)
Text(text = "${item.location}", color = Color.Red, fontSize = 16.sp)
}
Image(
@ -66,8 +66,8 @@ fun CardHotelForChange(item: Hotel, navController: NavHostController) {
.size(40.dp)
.padding(10.dp)
.clickable {
val sneakerItemString = Gson().toJson(item)
navController.navigate("changeSneaker/${sneakerItemString}")
val hotelItemString = Gson().toJson(item)
navController.navigate("changeHotel/${hotelItemString}")
}
)
@ -89,7 +89,7 @@ fun CardHotelForChange(item: Hotel, navController: NavHostController) {
@Composable
@Preview
fun CardSneakerLikePreview(){
fun CardHotelLikePreview(){
val navController = rememberNavController()
CardHotelForChange(Hotel("Hotel", R.drawable.img, 5, "location"), navController)
CardHotelForChange(Hotel("Hotel", R.drawable.img, 5, "location", "info", 4000), navController)
}

View File

@ -34,9 +34,9 @@ fun ChangePanel(navHostController: NavHostController){
) {
itemsIndexed(
listOf(
Hotel("Hotel", R.drawable.img, 5, "location"),
Hotel("Hotel", R.drawable.img, 5, "location"),
Hotel("Hotel", R.drawable.img, 5, "location")
Hotel("Hotel", R.drawable.img, 5, "location", "info", 4000),
Hotel("Hotel", R.drawable.img, 5, "location", "info", 4000),
Hotel("Hotel", R.drawable.img, 5, "location", "info", 4000)
)
){_, item->
CardHotelForChange(item = item, navHostController)

View File

@ -16,6 +16,7 @@ import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.Button
import androidx.compose.material.ButtonDefaults
import androidx.compose.material.Text
import androidx.compose.material.TextField
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@ -24,40 +25,49 @@ import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.input.ImeAction
import androidx.compose.ui.text.input.KeyboardType
import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.R
import com.example.androidlabs.profileScreen.signIn.LoginScreen
@Composable
fun BookingScreen() {
var room by remember { mutableStateOf("") }
var date by remember { mutableStateOf("") }
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
.padding(15.dp, 0.dp)
.padding(16.dp)
,
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Text(text = "Booking", fontSize = 24.sp, fontWeight = FontWeight.Bold)
var room by remember { mutableStateOf("") }
var date by remember { mutableStateOf("") }
Spacer(modifier = Modifier.height(16.dp))
Text(
text = "Booking",
fontSize = 24.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
)
BasicTextField(
TextField(
value = room,
onValueChange = { room = it },
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
.padding(8.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
.padding(8.dp),
.padding(16.dp, 0.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp)),
singleLine = true,
keyboardOptions = KeyboardOptions(
keyboardType = KeyboardType.Text,
@ -68,17 +78,24 @@ fun BookingScreen() {
}
),
placeholder = {
Text(
text = "Room",
style = TextStyle(fontSize = 12.sp)
)
}
)
BasicTextField(
Spacer(modifier = Modifier.height(16.dp))
TextField(
value = date,
onValueChange = { date = it },
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
.padding(8.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp))
.padding(8.dp),
.padding(16.dp, 0.dp)
.border(1.dp, Color.Gray, RoundedCornerShape(4.dp)),
singleLine = true,
visualTransformation = PasswordVisualTransformation(),
keyboardOptions = KeyboardOptions(
@ -91,21 +108,35 @@ fun BookingScreen() {
}
),
){
}
placeholder = {
Text(
text = "Date",
style = TextStyle(fontSize = 12.sp)
)
}
)
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
//TODO
},
modifier = Modifier.fillMaxWidth()
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 16.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text("Payment")
}
}
}
}
@Composable
@Preview(showBackground = true)
fun BookingScreenPreview(){
val navController = rememberNavController()
BookingScreen()
}

View File

@ -13,11 +13,13 @@ import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.R
import com.example.androidlabs.homeScreen.CardItem.HotelCard
import com.example.androidlabs.Hotel
@ -31,7 +33,7 @@ fun HomeScreen(navController: NavHostController) {
.background(Color.White)
) {
Box(modifier = Modifier
.background(Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF))
.background(colorResource(id = R.color.figma_blue))
.fillMaxHeight(0.18f)
){
Column(
@ -57,7 +59,7 @@ fun HomeScreen(navController: NavHostController) {
//.verticalScroll(rememberScrollState())
){
items(count = 100 ){
HotelCard(Hotel("hotel", R.drawable.img, it % 6, "location"), navController)
HotelCard(Hotel("hotel", R.drawable.img, it % 6, "location", "info", 4000), navController)
}
}
@ -66,5 +68,6 @@ fun HomeScreen(navController: NavHostController) {
@Preview(showBackground = true)
@Composable
fun HotelPreview() {
//HomeScreen()
var nc = rememberNavController()
HomeScreen(nc)
}

View File

@ -35,7 +35,7 @@ fun SearchField(
modifier = modifier
.clip(RoundedCornerShape(30.dp))
.fillMaxWidth()
.background(Color.LightGray)
.background(Color.White)
,
) {
Row(

View File

@ -2,6 +2,7 @@ package com.example.androidlabs.hotelScreen
import androidx.compose.animation.shrinkVertically
import androidx.compose.foundation.Image
import androidx.compose.foundation.ScrollState
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
@ -9,6 +10,7 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.fillMaxHeight
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.rememberScrollState
@ -26,10 +28,12 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.Hotel
import com.example.androidlabs.R
import com.example.androidlabs.homeScreen.CardItem.HotelCard
@ -59,6 +63,7 @@ fun HotelInfo(hotel: Hotel, navController: NavHostController) {
Row (
modifier = Modifier
.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
){
Text(text = hotel.name)
@ -127,17 +132,14 @@ fun HotelInfo(hotel: Hotel, navController: NavHostController) {
Text(text = "inf")
}
}
//Divider(color = Color.Black, thickness = 1.dp)
Row(
modifier = Modifier
//.fillMaxHeight()
.padding(horizontal = 60.dp)
modifier = Modifier
.padding(bottom = 60.dp),
verticalAlignment = Alignment.Bottom
){
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
@ -145,6 +147,8 @@ fun HotelInfo(hotel: Hotel, navController: NavHostController) {
},
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 16.dp, 16.dp, 5.dp)
.height(50.dp)
) {
Text("Select Room")
}
@ -156,7 +160,7 @@ fun HotelInfo(hotel: Hotel, navController: NavHostController) {
@Preview(showBackground = true)
@Composable
fun HotelInfoPreview() {
//HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"))
val navController = rememberNavController()
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location", "info", 4000), navController)
}

View File

@ -18,71 +18,76 @@ import androidx.compose.ui.unit.dp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.ui.draw.clip
import androidx.compose.ui.res.colorResource
import com.example.androidlabs.R
@Composable
fun ProfileScreen(navController: NavHostController) {
Column(
modifier = Modifier
.fillMaxSize()
.background(Color.White),
.fillMaxWidth()
.fillMaxHeight()
.padding(16.dp),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
){
Row(
modifier = Modifier
.clip(RoundedCornerShape(20.dp))
){
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
navController.navigate("person")
},
modifier = Modifier
.requiredSize(300.dp, 40.dp)
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text(text = "Profile")
}
}
Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier
.clip(RoundedCornerShape(20.dp))
){
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
navController.navigate("login")
},
modifier = Modifier
.requiredSize(300.dp, 40.dp)
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text(text = "Sign In")
}
}
Spacer(modifier = Modifier.height(16.dp))
Row(
modifier = Modifier
.clip(RoundedCornerShape(20.dp))
){
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
navController.navigate("signup")
},
modifier = Modifier
.requiredSize(300.dp, 40.dp)
.fillMaxWidth()
.padding(16.dp, 0.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text(text = "Sign Up")
}
@ -91,7 +96,7 @@ fun ProfileScreen(navController: NavHostController) {
}
@Composable
@Preview
@Preview(showBackground = true)
fun ProfileScreenPreview(){
val navController = rememberNavController()
ProfileScreen(navController = navController)

View File

@ -38,6 +38,8 @@ import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.R
@Composable
fun SignInCard(navController: NavHostController) {
@ -46,7 +48,7 @@ fun SignInCard(navController: NavHostController) {
.fillMaxWidth()
.padding(16.dp)
.clip(RoundedCornerShape(16.dp))
.background((Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)))
){
Column(
modifier = Modifier.fillMaxWidth(),
@ -122,8 +124,8 @@ fun SignInCard(navController: NavHostController) {
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = Color.White,
contentColor = Color.Black
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
@ -131,6 +133,7 @@ fun SignInCard(navController: NavHostController) {
modifier = Modifier
.fillMaxWidth()
.padding(16.dp, 16.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text("Sign In")
}
@ -144,4 +147,11 @@ fun SignInCard(navController: NavHostController) {
)
}
}
}
@Composable
@Preview(showBackground = true)
fun SignInScreenPreview(){
val navController = rememberNavController()
LoginScreen(navController = navController)
}

View File

@ -23,6 +23,7 @@ import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import androidx.navigation.NavHostController
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.profileScreen.profile.ProfileScreen
import androidx.compose.material.Text as Text1
@Composable
@ -34,4 +35,11 @@ fun LoginScreen(navController: NavHostController) {
) {
SignInCard(navController)
}
}
@Composable
@Preview
fun LoginScreenPreview(){
val navController = rememberNavController()
LoginScreen(navController = navController)
}

View File

@ -34,6 +34,9 @@ import androidx.compose.ui.text.input.PasswordVisualTransformation
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.compose.rememberNavController
import com.example.androidlabs.R
import com.example.androidlabs.profileScreen.signIn.LoginScreen
@Composable
@Preview
@ -48,7 +51,6 @@ fun SignUpCard() {
.fillMaxWidth()
.padding(16.dp)
.clip(RoundedCornerShape(16.dp))
.background((Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)))
){
Column(
modifier = Modifier.fillMaxWidth(),
@ -207,18 +209,25 @@ fun SignUpCard() {
Button(
colors = ButtonDefaults.buttonColors(
backgroundColor = Color.White,
contentColor = Color.Black
backgroundColor = (colorResource(id = R.color.figma_blue)),
contentColor = Color.White
),
onClick = {
},
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
.padding(16.dp, 16.dp, 16.dp, 0.dp)
.height(50.dp)
) {
Text("Sign Up")
}
}
}
}
@Composable
@Preview(showBackground = true)
fun SignUpScreenPreview(){
SignUpScreen()
}

View File

@ -8,5 +8,6 @@
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="figma">#F4F4F4</color>
<color name="figma_blue">#3660F6</color>
<color name="figma_blue">#802A7DB9</color>
</resources>