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