|
@@ -42,9 +42,12 @@ import androidx.compose.foundation.lazy.items
|
|
|
import androidx.compose.material.icons.Icons
|
|
|
import androidx.compose.material.icons.filled.Menu
|
|
|
import androidx.compose.material.icons.filled.Person
|
|
|
+import androidx.compose.material3.DrawerValue
|
|
|
import androidx.compose.material3.ExperimentalMaterial3Api
|
|
|
+import androidx.compose.material3.ModalNavigationDrawer
|
|
|
import androidx.compose.material3.Scaffold
|
|
|
import androidx.compose.material3.TopAppBar
|
|
|
+import androidx.compose.material3.rememberDrawerState
|
|
|
import androidx.compose.runtime.*
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
@@ -61,7 +64,6 @@ import com.example.iplace.model.Place
|
|
|
@Composable
|
|
|
fun MenuV(navController: NavHostController){
|
|
|
val viewModel = MainViewModel()
|
|
|
- var showDrawer by remember { mutableStateOf(false) }
|
|
|
|
|
|
var placeList by remember { mutableStateOf<List<Place>>(emptyList()) }
|
|
|
// LaunchedEffect(key1 = true) {
|
|
@@ -84,179 +86,110 @@ fun MenuV(navController: NavHostController){
|
|
|
contentScale = ContentScale.FillHeight,
|
|
|
modifier = Modifier.fillMaxSize()
|
|
|
)
|
|
|
- // Шторка (Drawer)
|
|
|
- AnimatedVisibility(
|
|
|
- visible = showDrawer,
|
|
|
- enter = slideInHorizontally { it },
|
|
|
- exit = slideOutHorizontally { -it }
|
|
|
+
|
|
|
+ var showDrawer by remember { mutableStateOf(false) }
|
|
|
+ //с 7:44
|
|
|
+ ModalNavigationDrawer(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth(0.8f)
|
|
|
+ ,
|
|
|
+
|
|
|
+ drawerContent = {
|
|
|
+ DrawerContent(navController)
|
|
|
+ }
|
|
|
) {
|
|
|
- Box(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .background(Color.White.copy(alpha = 0.8f)) // Полупрозрачный фон
|
|
|
- .clickable { showDrawer = false } // Закрытие при клике вне шторки
|
|
|
- ) {
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .background(Color.White)
|
|
|
- .padding(16.dp)
|
|
|
- ) {
|
|
|
-// IconButton(onClick = { showDrawer = false }) {
|
|
|
-// Icon(Icons.Filled.Menu, contentDescription = "Закрыть")
|
|
|
-// }
|
|
|
- Button(
|
|
|
- onClick = { navController.navigate("profile") },
|
|
|
- modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(
|
|
|
- text = "Профиль",
|
|
|
- fontSize = 24.sp,
|
|
|
- fontFamily = basicNunitosans
|
|
|
- )
|
|
|
- }
|
|
|
- Button(
|
|
|
- onClick = { navController.navigate("favouritesV") },
|
|
|
- modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(
|
|
|
- text = "Избранное",
|
|
|
- fontSize = 24.sp,
|
|
|
- fontFamily = basicNunitosans
|
|
|
- )
|
|
|
- }
|
|
|
- Button(
|
|
|
- onClick = { navController.navigate("addPlace") },
|
|
|
- modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(
|
|
|
- text = "Добавить место",
|
|
|
- fontSize = 24.sp,
|
|
|
- fontFamily = basicNunitosans
|
|
|
- )
|
|
|
- }
|
|
|
- Button(
|
|
|
- onClick = { navController.navigate("menuV") },
|
|
|
- modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(
|
|
|
- text = "Меню",
|
|
|
- fontSize = 24.sp,
|
|
|
- fontFamily = basicNunitosans
|
|
|
- )
|
|
|
- }
|
|
|
- Button(
|
|
|
- onClick = { },
|
|
|
- modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(
|
|
|
- text = "Ещё",
|
|
|
- fontSize = 24.sp,
|
|
|
- fontFamily = basicNunitosans
|
|
|
- )
|
|
|
- }
|
|
|
+ Scaffold(
|
|
|
+ topBar = {
|
|
|
+ TopAppBar(
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ title = {
|
|
|
+ Row(
|
|
|
+ modifier = Modifier.fillMaxWidth(),
|
|
|
+ horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
+ verticalAlignment = Alignment.CenterVertically
|
|
|
+ ) {
|
|
|
+ IconButton(onClick = { showDrawer = true }) {
|
|
|
+ Icon(Icons.Filled.Menu, contentDescription = "Меню")
|
|
|
+ }
|
|
|
+
|
|
|
+ OutlinedTextField(
|
|
|
+ value = "",
|
|
|
+ onValueChange = {},
|
|
|
+ label = { Text("Поиск") },
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .padding(horizontal = 16.dp)
|
|
|
+ .weight(1f)
|
|
|
+ .clip(RoundedCornerShape(20.dp))
|
|
|
+ )
|
|
|
+
|
|
|
+ IconButton(onClick = { navController.navigate("profile") }) {
|
|
|
+ Icon(Icons.Filled.Person, contentDescription = "Профиль")
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ ) { innerPadding ->
|
|
|
+ Column(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxSize()
|
|
|
+ .padding(innerPadding)
|
|
|
+ ) {
|
|
|
+ // Кнопка "Фильтр" с выпадающим списком (заглушка)
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .padding(16.dp),
|
|
|
+ verticalAlignment = Alignment.CenterVertically
|
|
|
+ ) {
|
|
|
+ Button(onClick = { /* Обработка нажатия на фильтр */ }) {
|
|
|
+ Text("Фильтр")
|
|
|
+ }
|
|
|
+ // Выпадающий список (заглушка)
|
|
|
+ Spacer(modifier = Modifier.width(8.dp))
|
|
|
+ // ...
|
|
|
+ Button(
|
|
|
+ onClick = { navController.navigate("addPlace") },
|
|
|
+ modifier = Modifier
|
|
|
+ .width(40.dp)
|
|
|
+ .height(40.dp),
|
|
|
+ colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
+ ) {
|
|
|
+ Text(text = "добавить место")
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ Text(
|
|
|
+ text = "Лучшие места",
|
|
|
+ fontWeight = FontWeight.Bold,
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth(),
|
|
|
+ textAlign = TextAlign.Center
|
|
|
+ )
|
|
|
+ LazyColumn(
|
|
|
+ contentPadding = PaddingValues(
|
|
|
+ horizontal = 16.dp,
|
|
|
+ vertical = 10.dp),
|
|
|
+ verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
|
+ ){
|
|
|
+ items(placeList) {
|
|
|
+ place ->
|
|
|
+ PlaceCard(place = place, navController
|
|
|
+
|
|
|
+ )
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
|
|
|
- Scaffold(
|
|
|
- topBar = {
|
|
|
- TopAppBar(
|
|
|
- title = {
|
|
|
- // Кнопка меню
|
|
|
- Row(
|
|
|
- modifier = Modifier.fillMaxWidth(),
|
|
|
- horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
- verticalAlignment = Alignment.CenterVertically
|
|
|
- ) {
|
|
|
- IconButton(onClick = { showDrawer = true} ) {
|
|
|
- Icon(Icons.Filled.Menu, contentDescription = "Меню")
|
|
|
- }
|
|
|
- OutlinedTextField(
|
|
|
- value = "",
|
|
|
- onValueChange = {},
|
|
|
- label = { Text("Поиск") },
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxWidth()
|
|
|
- .padding(horizontal = 16.dp)
|
|
|
- .weight(1f)
|
|
|
- .clip(RoundedCornerShape(20.dp))
|
|
|
- )// Заглушка для поиска
|
|
|
-// Text(text = "Поиск", modifier = Modifier.weight(1f))
|
|
|
- IconButton(onClick = { navController.navigate("profile") }) {
|
|
|
- Icon(Icons.Filled.Person, contentDescription = "Профиль")
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-// ,backgroundColor = Color.White,
|
|
|
-// elevation = 0.dp
|
|
|
- )
|
|
|
- }
|
|
|
-// ,
|
|
|
-// drawerContent = {
|
|
|
-// DrawerContent(showDrawer, navController)
|
|
|
-// },
|
|
|
-// drawerGesturesEnabled = showDrawer
|
|
|
- ) { innerPadding ->
|
|
|
- Column(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
- .padding(innerPadding)
|
|
|
- ) {
|
|
|
- // Кнопка "Фильтр" с выпадающим списком (заглушка)
|
|
|
- Row(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxWidth()
|
|
|
- .padding(16.dp),
|
|
|
- verticalAlignment = Alignment.CenterVertically
|
|
|
- ) {
|
|
|
- Button(onClick = { /* Обработка нажатия на фильтр */ }) {
|
|
|
- Text("Фильтр")
|
|
|
- }
|
|
|
- // Выпадающий список (заглушка)
|
|
|
- Spacer(modifier = Modifier.width(8.dp))
|
|
|
- // ...
|
|
|
- Button(
|
|
|
- onClick = { navController.navigate("addPlace") },
|
|
|
- modifier = Modifier
|
|
|
- .width(40.dp)
|
|
|
- .height(40.dp),
|
|
|
- colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
- ) {
|
|
|
- Text(text = "добавить место")
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- Text(
|
|
|
- text = "Лучшие места",
|
|
|
- fontWeight = FontWeight.Bold,
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxWidth(),
|
|
|
- textAlign = TextAlign.Center
|
|
|
- )
|
|
|
- LazyColumn(
|
|
|
- contentPadding = PaddingValues(
|
|
|
- horizontal = 16.dp,
|
|
|
- vertical = 10.dp),
|
|
|
- verticalArrangement = Arrangement.spacedBy(10.dp)
|
|
|
- ){
|
|
|
- items(placeList) {
|
|
|
- place ->
|
|
|
- PlaceCard(place = place, navController
|
|
|
-
|
|
|
- )
|
|
|
- }
|
|
|
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
}
|
|
|
|
|
|
@Composable
|
|
@@ -286,7 +219,8 @@ fun PlaceCard(place: Place, navController: NavHostController){
|
|
|
|
|
|
modifier = Modifier
|
|
|
.matchParentSize()
|
|
|
- .background(color = Color.LightGray.copy(alpha = 0.6f))
|
|
|
+ .background(color = Color.LightGray.copy(alpha = 0.2f))
|
|
|
+ .padding(16.dp)
|
|
|
){
|
|
|
Column(
|
|
|
modifier = Modifier
|
|
@@ -295,13 +229,13 @@ fun PlaceCard(place: Place, navController: NavHostController){
|
|
|
Text(
|
|
|
text = place.title,
|
|
|
fontSize = 18.sp,
|
|
|
- color = Color.Black,
|
|
|
+ color = Color.White,
|
|
|
|
|
|
)
|
|
|
Text(
|
|
|
text = place.id_categoryFK.toString(),
|
|
|
fontSize = 18.sp,
|
|
|
- color = Color.Black,
|
|
|
+ color = Color.White,
|
|
|
|
|
|
)
|
|
|
}
|
|
@@ -326,7 +260,7 @@ fun PlaceCard(place: Place, navController: NavHostController){
|
|
|
|
|
|
|
|
|
@Composable
|
|
|
-fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
+fun DrawerContent(navController: NavHostController) {
|
|
|
val headlinesOswald = FontFamily( //выбор шрифта
|
|
|
Font(resId = R.font.headlines_oswald)
|
|
|
)
|
|
@@ -335,15 +269,15 @@ fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
)
|
|
|
Column(
|
|
|
modifier = Modifier
|
|
|
- .fillMaxSize()
|
|
|
+ .fillMaxWidth()
|
|
|
+ .height(170.dp)
|
|
|
.background(Color.White)
|
|
|
- .padding(16.dp)
|
|
|
+ ,
|
|
|
+ horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
+ verticalArrangement = Arrangement.Center
|
|
|
) {
|
|
|
-// IconButton(onClick = { showDrawer = false }) {
|
|
|
-// Icon(Icons.Filled.Menu, contentDescription = "Закрыть")
|
|
|
-// }
|
|
|
Button(
|
|
|
- onClick = { navController.navigate("policyConditionality") },
|
|
|
+ onClick = { navController.navigate("profile") },
|
|
|
modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
) {
|
|
@@ -354,7 +288,7 @@ fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
)
|
|
|
}
|
|
|
Button(
|
|
|
- onClick = { navController.navigate("policyConditionality") },
|
|
|
+ onClick = { navController.navigate("favouritesV") },
|
|
|
modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
) {
|
|
@@ -365,7 +299,7 @@ fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
)
|
|
|
}
|
|
|
Button(
|
|
|
- onClick = { navController.navigate("policyConditionality") },
|
|
|
+ onClick = { navController.navigate("addPlace") },
|
|
|
modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
) {
|
|
@@ -376,7 +310,7 @@ fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
)
|
|
|
}
|
|
|
Button(
|
|
|
- onClick = { navController.navigate("policyConditionality") },
|
|
|
+ onClick = { navController.navigate("menuV") },
|
|
|
modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
) {
|
|
@@ -387,7 +321,7 @@ fun DrawerContent(showDrawer: Boolean, navController: NavHostController) {
|
|
|
)
|
|
|
}
|
|
|
Button(
|
|
|
- onClick = { navController.navigate("policyConditionality") },
|
|
|
+ onClick = { },
|
|
|
modifier = Modifier.width(290.dp).height(50.dp),
|
|
|
colors = ButtonDefaults.buttonColors(brown_contrast)
|
|
|
) {
|