Feature: design for like screen and some refactoring
This commit is contained in:
parent
368f530be1
commit
e9285732a7
@ -0,0 +1,5 @@
|
||||
package com.example.android_programming.HomeScreen.BrandScrollBar
|
||||
|
||||
data class ItemFilterByBrand(
|
||||
val imageId: Int,
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package com.example.android_programming.HomeScreen
|
||||
package com.example.android_programming.HomeScreen.BrandScrollBar
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
@ -2,36 +2,26 @@ package com.example.android_programming.HomeScreen
|
||||
|
||||
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.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.LazyRow
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.foundation.lazy.rememberLazyListState
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.foundation.text.BasicTextField
|
||||
import androidx.compose.foundation.verticalScroll
|
||||
import androidx.compose.material.Icon
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.filled.Search
|
||||
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.draw.clip
|
||||
import androidx.compose.ui.graphics.Color
|
||||
import androidx.compose.ui.graphics.vector.ImageVector
|
||||
import androidx.compose.ui.text.TextStyle
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.example.android_programming.HomeScreen.BrandScrollBar.ItemFilterByBrand
|
||||
import com.example.android_programming.HomeScreen.BrandScrollBar.ItemRow
|
||||
import com.example.android_programming.HomeScreen.SearchField.SearchField
|
||||
import com.example.android_programming.HomeScreen.SneakerRecyclerView.CardSneaker
|
||||
import com.example.android_programming.SneakerItem
|
||||
import com.example.android_programming.R
|
||||
|
||||
@Composable
|
||||
|
@ -1,5 +0,0 @@
|
||||
package com.example.android_programming.HomeScreen
|
||||
|
||||
data class ItemFilterByBrand(
|
||||
val imageId: Int,
|
||||
)
|
@ -1,4 +1,4 @@
|
||||
package com.example.android_programming.HomeScreen;
|
||||
package com.example.android_programming.HomeScreen.SearchField;
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
@ -1,12 +1,10 @@
|
||||
package com.example.android_programming.HomeScreen
|
||||
package com.example.android_programming.HomeScreen.SneakerRecyclerView
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
@ -23,6 +21,7 @@ import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import com.example.android_programming.R
|
||||
import com.example.android_programming.SneakerItem
|
||||
|
||||
@Composable
|
||||
fun CardSneaker(item: SneakerItem) {
|
@ -0,0 +1,75 @@
|
||||
package com.example.android_programming.LikeScreen
|
||||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.Row
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.layout.size
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.Button
|
||||
import androidx.compose.material.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.graphics.Color
|
||||
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.compose.ui.unit.sp
|
||||
import com.example.android_programming.R
|
||||
import com.example.android_programming.SneakerItem
|
||||
|
||||
@Composable
|
||||
fun CardSneakerLike(item: SneakerItem) {
|
||||
Row(
|
||||
modifier = Modifier
|
||||
.fillMaxWidth()
|
||||
.padding(10.dp)
|
||||
.clip(RoundedCornerShape(10.dp))
|
||||
.background(Color.LightGray),
|
||||
verticalAlignment = Alignment.CenterVertically,
|
||||
horizontalArrangement = Arrangement.SpaceBetween
|
||||
) {
|
||||
Image(
|
||||
painter = painterResource(id = item.imageId),
|
||||
contentDescription = "image",
|
||||
contentScale = ContentScale.Crop,
|
||||
modifier = Modifier
|
||||
.size(70.dp)
|
||||
.padding(10.dp)
|
||||
.clip(RoundedCornerShape(10.dp))
|
||||
)
|
||||
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.weight(1f)
|
||||
.padding(start = 16.dp)
|
||||
) {
|
||||
Text(text = item.name, fontSize = 20.sp)
|
||||
Text(text = "${item.price} USD", color = Color.Red, fontSize = 16.sp)
|
||||
}
|
||||
|
||||
// Кнопка для удаления
|
||||
Button(
|
||||
onClick = { },
|
||||
modifier = Modifier
|
||||
.size(40.dp)
|
||||
.padding(10.dp)
|
||||
) {
|
||||
Text(text = "X", fontSize = 16.sp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun CardSneakerLikePreview(){
|
||||
CardSneakerLike(SneakerItem(R.drawable.sneaker, "Jordan", 159.99))
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.example.android_programming.LikeScreen;
|
||||
|
||||
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.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.itemsIndexed
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
import androidx.compose.ui.unit.dp
|
||||
import com.example.android_programming.R
|
||||
import com.example.android_programming.SneakerItem
|
||||
|
||||
@Composable
|
||||
fun LikeScreen() {
|
||||
Column(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.White)
|
||||
){
|
||||
Text(
|
||||
text = "Favorites",
|
||||
style = MaterialTheme.typography.h5,
|
||||
fontWeight = FontWeight.Bold,
|
||||
modifier = Modifier
|
||||
.padding(10.dp, 10.dp)
|
||||
)
|
||||
Row {
|
||||
LazyColumn(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
) {
|
||||
itemsIndexed(
|
||||
listOf(
|
||||
SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
|
||||
SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
|
||||
SneakerItem(R.drawable.sneaker, "Jordan", 159.99),
|
||||
)
|
||||
){_, item->
|
||||
CardSneakerLike(item = item)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun LikeScreenPreview(){
|
||||
LikeScreen()
|
||||
}
|
@ -5,7 +5,7 @@ import androidx.navigation.NavHostController
|
||||
import androidx.navigation.compose.NavHost
|
||||
import androidx.navigation.compose.composable
|
||||
import com.example.android_programming.HomeScreen.HomeScreen
|
||||
import com.example.android_programming.Screens.LikeScreen
|
||||
import com.example.android_programming.LikeScreen.LikeScreen
|
||||
import com.example.android_programming.Screens.OrderScreen
|
||||
import com.example.android_programming.Screens.ProfileScreen
|
||||
|
||||
|
@ -1,36 +0,0 @@
|
||||
package com.example.android_programming.Screens;
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.material.MaterialTheme
|
||||
import androidx.compose.material.Text
|
||||
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.text.font.FontWeight
|
||||
import androidx.compose.ui.tooling.preview.Preview
|
||||
|
||||
@Composable
|
||||
fun LikeScreen() {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fillMaxSize()
|
||||
.background(Color.White),
|
||||
contentAlignment = Alignment.Center
|
||||
) {
|
||||
Text(
|
||||
text = "Like",
|
||||
fontSize = MaterialTheme.typography.h3.fontSize,
|
||||
fontWeight = FontWeight.Bold,
|
||||
color = Color.Black
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
@Preview
|
||||
fun LikeScreenPreview(){
|
||||
LikeScreen()
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package com.example.android_programming.HomeScreen
|
||||
package com.example.android_programming
|
||||
|
||||
data class SneakerItem(
|
||||
val imageId: Int,
|
Loading…
Reference in New Issue
Block a user