добавила букинг
по хорошему нужно доделать дезигн всего
This commit is contained in:
parent
3b192d27cb
commit
9b61677603
@ -10,8 +10,8 @@ class MainActivity : ComponentActivity() {
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContent {
|
||||
///Navigate()
|
||||
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"))
|
||||
Navigate()
|
||||
//HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,12 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import com.example.androidlabs.Hotel
|
||||
import com.example.androidlabs.R
|
||||
import com.example.androidlabs.booking.BookingScreen
|
||||
import com.example.androidlabs.homeScreen.CardItem.HotelCard
|
||||
import com.example.androidlabs.homeScreen.HomeScreen
|
||||
import com.example.androidlabs.hotelScreen.HotelInfo
|
||||
import com.example.androidlabs.profileScreen.profile.ProfileScreen
|
||||
import com.example.androidlabs.profileScreen.signIn.LoginScreen
|
||||
|
||||
@ -15,17 +20,20 @@ fun NavController(navController: NavHostController){
|
||||
navController = navController,
|
||||
startDestination = NavItem.Home.route
|
||||
){
|
||||
composable(NavItem.Home.route){
|
||||
HomeScreen()
|
||||
composable(NavItem.HotelInfo.route){
|
||||
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"), navController)
|
||||
}
|
||||
composable(NavItem.Home.route){
|
||||
HomeScreen(navController)
|
||||
}
|
||||
// composable(NavItem.Like.route){
|
||||
// LikeScreen()
|
||||
// }
|
||||
composable(NavItem.Profile.route) {
|
||||
ProfileScreen(navController)
|
||||
}
|
||||
composable(NavItem.SignIn.route){
|
||||
LoginScreen(navController)
|
||||
}
|
||||
composable(NavItem.Booking.route){
|
||||
BookingScreen()
|
||||
}
|
||||
}
|
||||
}
|
@ -8,8 +8,9 @@ import androidx.compose.ui.graphics.vector.ImageVector
|
||||
|
||||
sealed class NavItem(val route: String, val icon: ImageVector?){
|
||||
object Home : NavItem("home", Icons.Default.Home)
|
||||
object Like : NavItem("like", Icons.Default.Favorite)
|
||||
//object Order : NavItem("order", Icons.Default.ShoppingCart)
|
||||
object Profile : NavItem("profile", Icons.Default.Person)
|
||||
object SignIn : NavItem("login", null)
|
||||
object HotelInfo : NavItem("HotelInfo", null)
|
||||
object Booking : NavItem("booking", null)
|
||||
|
||||
}
|
@ -23,7 +23,6 @@ fun Navigate(){
|
||||
val navController = rememberNavController()
|
||||
val listItem = listOf(
|
||||
NavItem.Home,
|
||||
NavItem.Like,
|
||||
NavItem.Profile,
|
||||
)
|
||||
|
||||
|
@ -0,0 +1,111 @@
|
||||
package com.example.androidlabs.booking
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
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.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
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.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.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
|
||||
@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)
|
||||
,
|
||||
verticalArrangement = Arrangement.Center,
|
||||
horizontalAlignment = Alignment.CenterHorizontally
|
||||
) {
|
||||
Text(text = "Booking", fontSize = 24.sp, fontWeight = FontWeight.Bold)
|
||||
|
||||
Spacer(modifier = Modifier.height(16.dp))
|
||||
|
||||
BasicTextField(
|
||||
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),
|
||||
singleLine = true,
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Text,
|
||||
imeAction = ImeAction.Next
|
||||
),
|
||||
keyboardActions = KeyboardActions(
|
||||
onNext = {
|
||||
|
||||
}
|
||||
),
|
||||
)
|
||||
|
||||
BasicTextField(
|
||||
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),
|
||||
singleLine = true,
|
||||
visualTransformation = PasswordVisualTransformation(),
|
||||
keyboardOptions = KeyboardOptions(
|
||||
keyboardType = KeyboardType.Text,
|
||||
imeAction = ImeAction.Next
|
||||
),
|
||||
|
||||
keyboardActions = KeyboardActions(
|
||||
onNext = {
|
||||
|
||||
}
|
||||
),
|
||||
){
|
||||
|
||||
}
|
||||
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
|
||||
contentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
//TODO
|
||||
},
|
||||
modifier = Modifier.fillMaxWidth()
|
||||
) {
|
||||
Text("Payment")
|
||||
}
|
||||
}
|
||||
}
|
@ -25,17 +25,18 @@ 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 com.example.androidlabs.Hotel
|
||||
import com.example.androidlabs.R
|
||||
|
||||
@Composable
|
||||
fun HotelCard (hotel: Hotel){
|
||||
fun HotelCard (hotel: Hotel, navController: NavHostController){
|
||||
androidx.compose.material.Card(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp)
|
||||
.clickable {
|
||||
Log.d("My log", "Clicked")
|
||||
navController.navigate("HotelInfo")
|
||||
},
|
||||
shape = RoundedCornerShape(15.dp),
|
||||
elevation = 5.dp
|
||||
@ -101,6 +102,6 @@ fun HotelCard (hotel: Hotel){
|
||||
@Composable
|
||||
fun CardPreview() {
|
||||
|
||||
HotelCard(Hotel("hotel", R.drawable.img, 4, "location"))
|
||||
//HotelCard(Hotel("hotel", R.drawable.img, 4, "location"))
|
||||
|
||||
}
|
@ -17,13 +17,14 @@ 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 com.example.androidlabs.R
|
||||
import com.example.androidlabs.homeScreen.CardItem.HotelCard
|
||||
import com.example.androidlabs.Hotel
|
||||
import com.example.androidlabs.homeScreen.SearchField.SearchField
|
||||
|
||||
@Composable
|
||||
fun HomeScreen() {
|
||||
fun HomeScreen(navController: NavHostController) {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
@ -44,7 +45,8 @@ fun HomeScreen() {
|
||||
Text(text="Find a Source you want to spent times", color = Color.White)
|
||||
SearchField(
|
||||
modifier = Modifier
|
||||
.padding(horizontal = 10.dp, vertical = 20.dp)
|
||||
.padding(horizontal = 10.dp, vertical = 20.dp),
|
||||
|
||||
) { searchText ->
|
||||
// Обработка введенного текста поиска
|
||||
}
|
||||
@ -55,7 +57,7 @@ fun HomeScreen() {
|
||||
//.verticalScroll(rememberScrollState())
|
||||
){
|
||||
items(count = 100 ){
|
||||
HotelCard(Hotel("hotel", R.drawable.img, it % 6, "location"))
|
||||
HotelCard(Hotel("hotel", R.drawable.img, it % 6, "location"), navController)
|
||||
}
|
||||
|
||||
}
|
||||
@ -64,5 +66,5 @@ fun HomeScreen() {
|
||||
@Preview(showBackground = true)
|
||||
@Composable
|
||||
fun HotelPreview() {
|
||||
HomeScreen()
|
||||
//HomeScreen()
|
||||
}
|
@ -29,12 +29,13 @@ import androidx.compose.ui.layout.ContentScale
|
||||
import androidx.compose.ui.res.painterResource
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavHostController
|
||||
import com.example.androidlabs.Hotel
|
||||
import com.example.androidlabs.R
|
||||
import com.example.androidlabs.homeScreen.CardItem.HotelCard
|
||||
|
||||
@Composable
|
||||
fun HotelInfo(hotel: Hotel) {
|
||||
fun HotelInfo(hotel: Hotel, navController: NavHostController) {
|
||||
Column (
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@ -130,7 +131,8 @@ fun HotelInfo(hotel: Hotel) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
//.fillMaxHeight()
|
||||
.padding(horizontal = 60.dp),
|
||||
.padding(horizontal = 60.dp)
|
||||
.padding(bottom = 60.dp),
|
||||
verticalAlignment = Alignment.Bottom
|
||||
){
|
||||
Button(
|
||||
@ -139,8 +141,7 @@ fun HotelInfo(hotel: Hotel) {
|
||||
contentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
//TODO
|
||||
//navController.navigate("booking")
|
||||
navController.navigate("booking")
|
||||
},
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
@ -156,6 +157,6 @@ fun HotelInfo(hotel: Hotel) {
|
||||
@Composable
|
||||
fun HotelInfoPreview() {
|
||||
|
||||
HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"))
|
||||
//HotelInfo(Hotel("hotel", R.drawable.img_1, 4, "location"))
|
||||
|
||||
}
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.requiredSize
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.material.Text
|
||||
import androidx.compose.runtime.Composable;
|
||||
import androidx.compose.ui.Alignment
|
||||
@ -31,6 +32,10 @@ fun ProfileScreen(navController: NavHostController) {
|
||||
modifier = Modifier.padding(vertical = 16.dp)
|
||||
){
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
|
||||
contentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
navController.navigate("login")
|
||||
},
|
||||
@ -42,6 +47,10 @@ fun ProfileScreen(navController: NavHostController) {
|
||||
}
|
||||
Row{
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
|
||||
contentColor = Color.White
|
||||
),
|
||||
onClick = { /*TODO*/ },
|
||||
modifier = Modifier
|
||||
.requiredSize(100.dp, 40.dp)
|
||||
|
@ -8,6 +8,7 @@ import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.foundation.text.KeyboardActions
|
||||
import androidx.compose.foundation.text.KeyboardOptions
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.ButtonDefaults
|
||||
import androidx.compose.runtime.*
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
@ -89,6 +90,10 @@ fun LoginScreen(navController : NavHostController) {
|
||||
}
|
||||
|
||||
Button(
|
||||
colors = ButtonDefaults.buttonColors(
|
||||
backgroundColor = (Color(red = 0x2A, green = 0x7D, blue = 0xB9, alpha = 0xFF)),
|
||||
contentColor = Color.White
|
||||
),
|
||||
onClick = {
|
||||
navController.navigate("login")
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user