个人中心

master
pan 4 years ago
parent edf9920f3e
commit e9f4ea9c7f
  1. 72
      app/src/main/java/com/gyf/csams/ui/MainActivity.kt
  2. 2
      app/src/main/java/com/gyf/csams/ui/model/ViewModel.kt
  3. 9
      app/src/main/res/drawable/ic_arrow_right.xml

@ -18,7 +18,6 @@ import androidx.compose.runtime.livedata.observeAsState
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.rotate
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalFocusManager
@ -78,32 +77,15 @@ fun Body() {
if(snackBarMsg!=""){
val scope= rememberCoroutineScope()
scope.launch {
val result=scaffoldState.snackbarHostState.showSnackbar(
scaffoldState.snackbarHostState.showSnackbar(
message = snackBarMsg
)
model.reset()
}
// scope.launch {
// delay(1000)
// scaffoldState.snackbarHostState.currentSnackbarData?.dismiss()
// }
}
}
composable(MainMenu.Center.name) {
Box(modifier = Modifier.fillMaxSize()) {
Column(Modifier.rotate(180F)) {
MainBottomAppBar(MainMenu.Center, navController, Modifier.rotate(180F))
Row(
modifier = Modifier
.fillMaxSize()
.rotate(180F),
horizontalArrangement = Arrangement.Center,
verticalAlignment = Alignment.CenterVertically
) {
AnimationText(text = "个人中心")
}
}
}
Center(navController = navController)
}
}
}
@ -111,6 +93,54 @@ fun Body() {
}
}
/**
* 个人中心
*
*/
@Composable
fun Center(navController: NavController){
MainFrame(background = { CenterBackground() }, mainMenu = MainMenu.Center, nav = navController) {
Column(modifier = Modifier
.weight(0.33F)
.fillMaxWidth(),verticalArrangement = Arrangement.Bottom) {
Card(backgroundColor = Color.White) {
Row(modifier = Modifier.fillMaxWidth(),verticalAlignment = Alignment.CenterVertically) {
Spacer(modifier = Modifier.weight(0.33F))
Row(modifier = Modifier.weight(0.33F),horizontalArrangement = Arrangement.Center) {
Text(text = "我的社团")
}
Row(modifier = Modifier.weight(0.33F),horizontalArrangement = Arrangement.End) {
Icon(
painter = painterResource(id = R.drawable.ic_arrow_right),
contentDescription = null,
modifier = Modifier.size(50.dp)
)
}
}
}
}
Spacer(modifier = Modifier
.weight(0.66F)
.fillMaxWidth())
}
}
/**
* 个人中心背景
*
*/
@Composable
fun CenterBackground(){
Image(
painter = painterResource(id = R.drawable.mb_bg_fb_28),
contentDescription = null,
contentScale = ContentScale.FillHeight,
alpha = 0.5F,
modifier = Modifier.fillMaxSize()
)
}
/**
* 主界面
*/
@ -479,7 +509,7 @@ fun DefaultPreview() {
CSAMSTheme {
// CommunitySearch(model = ListViewModel())
CommunityListBody(model = ListViewModel())
Text(text = "234234")
}
}

@ -102,7 +102,7 @@ class ListViewModel:ViewModel(){
}
fun search(){
Logger.i("使用社团名称:${_name.value}和社团简介${_desc.value}搜索社团")
Logger.i("使用社团名称:${_name.value},社团简介:${_desc.value} 搜索社团")
_snackBarMsg.value="搜索失败,请联系管理员"
}

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="200dp"
android:height="200dp"
android:viewportWidth="1024"
android:viewportHeight="1024">
<path
android:fillColor="#FF000000"
android:pathData="M593.45,512.13L360.06,278.61l45.29,-45.23 278.61,278.76L405.33,790.61l-45.23,-45.27z"/>
</vector>
Loading…
Cancel
Save