ПВАЗХЩПХЗВАЩЗПХВАХЗПЩВ, ЭТО САМЫЙ ЖОСКИЙ КОСТЫЛЬ, НО ОНО РАБОТАЕТ
This commit is contained in:
parent
61b1507973
commit
4df3eff3b1
@ -11,6 +11,7 @@ import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.navigation.NavHostController
|
||||
import com.example.labwork.database.DAO.BicycleDao
|
||||
import com.example.labwork.models.Bicycle
|
||||
import com.example.labwork.pages.ListInfo
|
||||
@ -31,7 +32,7 @@ fun ScreenProfile() {
|
||||
|
||||
|
||||
@Composable
|
||||
fun ScreenListProduct(bicycleDao: BicycleDao) {
|
||||
fun ScreenListProduct(bicycleDao: BicycleDao, navHostController: NavHostController) {
|
||||
val bicycles = remember { mutableStateListOf<Bicycle>() }
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
@ -45,7 +46,7 @@ fun ScreenListProduct(bicycleDao: BicycleDao) {
|
||||
modifier = Modifier.fillMaxHeight().padding(bottom = 65.dp)
|
||||
) {
|
||||
items(bicycles) { item ->
|
||||
ListProduct(item = item, bicycleDao = bicycleDao)
|
||||
ListProduct(item = item, bicycleDao = bicycleDao, navHostController = navHostController)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ fun SlideGraph(
|
||||
ScreenInfo()
|
||||
}
|
||||
composable("ListProduct"){
|
||||
ScreenListProduct(bicycleDao)
|
||||
ScreenListProduct(bicycleDao, navHostController = navHostController)
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,6 +35,7 @@ import androidx.compose.ui.text.font.FontWeight
|
||||
import androidx.compose.ui.text.style.TextAlign
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.compose.ui.unit.sp
|
||||
import androidx.navigation.NavHostController
|
||||
import com.example.labwork.R
|
||||
import com.example.labwork.database.DAO.BicycleDao
|
||||
import com.example.labwork.database.DAO.UserDao
|
||||
@ -45,7 +46,7 @@ import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
@Composable
|
||||
fun ListProduct(item: Bicycle, bicycleDao: BicycleDao) {
|
||||
fun ListProduct(item: Bicycle, bicycleDao: BicycleDao, navHostController: NavHostController) {
|
||||
var isFullAbout by remember { mutableStateOf(false) }
|
||||
val scale by animateFloatAsState(if (isFullAbout) 1f else 0f)
|
||||
val textSize by animateDpAsState(if (isFullAbout) 18.dp else 24.dp)
|
||||
@ -116,10 +117,11 @@ fun ListProduct(item: Bicycle, bicycleDao: BicycleDao) {
|
||||
.padding(start = 9.dp, bottom = 9.dp)
|
||||
.size(height = 32.dp, width = 40.dp),
|
||||
onClick = {
|
||||
// Удаление выбранного велосипеда по нажатию на кнопку
|
||||
// СУПЕР ЖОСКИЙ КОСТЫЛЬ ЭТО ВООБЩЕ ТРЕШ
|
||||
GlobalScope.launch {
|
||||
bicycleDao.deleteBicycle(item)
|
||||
}
|
||||
navHostController.navigate("ListProduct")
|
||||
},
|
||||
shape = RoundedCornerShape(15.dp)
|
||||
) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user