|
|
|
@ -32,8 +32,8 @@ import androidx.navigation.compose.NavHost |
|
|
|
|
import androidx.navigation.compose.composable |
|
|
|
|
import androidx.navigation.compose.rememberNavController |
|
|
|
|
import com.gyf.csams.R |
|
|
|
|
import com.gyf.csams.ui.model.AssociationDto |
|
|
|
|
import com.gyf.csams.ui.model.CarouselViewModel |
|
|
|
|
import com.gyf.csams.ui.model.CommunityDto |
|
|
|
|
import com.gyf.csams.ui.model.ListViewModel |
|
|
|
|
import com.gyf.csams.ui.model.MarqueeViewModel |
|
|
|
|
import com.gyf.csams.ui.theme.CSAMSTheme |
|
|
|
@ -69,7 +69,7 @@ fun Body() { |
|
|
|
|
Main(navController = navController) |
|
|
|
|
} |
|
|
|
|
composable(MainMenu.List.name) { |
|
|
|
|
CommunityList(navController = navController) |
|
|
|
|
AssociationList(navController = navController) |
|
|
|
|
|
|
|
|
|
val model:ListViewModel= viewModel() |
|
|
|
|
val snackBarMsg:String by model.snackBarMsg.observeAsState("") |
|
|
|
@ -180,17 +180,17 @@ fun MainBackground() { |
|
|
|
|
* @param navController |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun CommunityList(navController: NavController) { |
|
|
|
|
fun AssociationList(navController: NavController) { |
|
|
|
|
MainFrame( |
|
|
|
|
background = { |
|
|
|
|
CommunityListBackground() |
|
|
|
|
AssociationListBackground() |
|
|
|
|
}, |
|
|
|
|
mainMenu = MainMenu.List, |
|
|
|
|
nav = navController |
|
|
|
|
) { |
|
|
|
|
RegisterCommunity() |
|
|
|
|
CommunitySearch() |
|
|
|
|
CommunityListBody() |
|
|
|
|
RegisterAssociation() |
|
|
|
|
AssociationSearch() |
|
|
|
|
AssociationListBody() |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -199,7 +199,7 @@ fun CommunityList(navController: NavController) { |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun RegisterCommunity() { |
|
|
|
|
fun RegisterAssociation() { |
|
|
|
|
Row( |
|
|
|
|
horizontalArrangement = Arrangement.End, |
|
|
|
|
modifier = Modifier |
|
|
|
@ -219,7 +219,7 @@ fun RegisterCommunity() { |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun CommunityListBackground() { |
|
|
|
|
fun AssociationListBackground() { |
|
|
|
|
Image( |
|
|
|
|
painter = painterResource(id = R.drawable.mb_bg_fb_07), |
|
|
|
|
contentDescription = null, |
|
|
|
@ -233,24 +233,22 @@ fun CommunityListBackground() { |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun CommunityListBody(model: ListViewModel = viewModel()) { |
|
|
|
|
val communityList: MutableList<CommunityDto>? by model.communityDto.observeAsState() |
|
|
|
|
fun AssociationListBody(model: ListViewModel = viewModel()) { |
|
|
|
|
val associationList: MutableList<AssociationDto>? by model.associationDto.observeAsState() |
|
|
|
|
val listState = rememberLazyListState() |
|
|
|
|
|
|
|
|
|
// Text(text ="communityList.size=${communityList?.size}") |
|
|
|
|
|
|
|
|
|
LazyColumn(state = listState) { |
|
|
|
|
communityList?.chunked(2)?.forEach { |
|
|
|
|
associationList?.chunked(2)?.forEach { |
|
|
|
|
item{ |
|
|
|
|
Row { |
|
|
|
|
Spacer(modifier = Modifier.weight(0.1F)) |
|
|
|
|
Box(modifier = Modifier.weight(0.35F)) { |
|
|
|
|
Community(communityDto = it[0]) |
|
|
|
|
Association(associationDto = it[0]) |
|
|
|
|
} |
|
|
|
|
Spacer(modifier = Modifier.weight(0.05F)) |
|
|
|
|
if(it.size==2) { |
|
|
|
|
Box(modifier = Modifier.weight(0.35F)) { |
|
|
|
|
Community(communityDto = it[1]) |
|
|
|
|
Association(associationDto = it[1]) |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
Box(modifier = Modifier |
|
|
|
@ -278,15 +276,15 @@ fun CommunityListBody(model: ListViewModel = viewModel()) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Composable |
|
|
|
|
fun Community(communityDto: CommunityDto) { |
|
|
|
|
fun Association(associationDto: AssociationDto) { |
|
|
|
|
Card { |
|
|
|
|
Image( |
|
|
|
|
painter = painterResource(id = R.drawable.community_list_border), |
|
|
|
|
painter = painterResource(id = R.drawable.association_list_border), |
|
|
|
|
contentDescription = null |
|
|
|
|
) |
|
|
|
|
Row(modifier = Modifier.fillMaxWidth(), |
|
|
|
|
horizontalArrangement = Arrangement.Center) { |
|
|
|
|
Text(text = communityDto.name) |
|
|
|
|
Text(text = associationDto.name) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
@ -298,7 +296,7 @@ fun Community(communityDto: CommunityDto) { |
|
|
|
|
* |
|
|
|
|
*/ |
|
|
|
|
@Composable |
|
|
|
|
fun CommunitySearch(model: ListViewModel = viewModel()) { |
|
|
|
|
fun AssociationSearch(model: ListViewModel = viewModel()) { |
|
|
|
|
val name: String by model.name.observeAsState("") |
|
|
|
|
Card(modifier = Modifier.padding(horizontal = 50.dp, vertical = 10.dp)) { |
|
|
|
|
Column { |
|
|
|
@ -507,9 +505,7 @@ fun ClubActivitiesImage(model: CarouselViewModel = viewModel()) { |
|
|
|
|
@Composable |
|
|
|
|
fun DefaultPreview() { |
|
|
|
|
CSAMSTheme { |
|
|
|
|
// CommunitySearch(model = ListViewModel()) |
|
|
|
|
|
|
|
|
|
Text(text = "234234") |
|
|
|
|
Text(text = "666") |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|