From e9f4ea9c7f49401a56b5fa822dfe17784eabc299 Mon Sep 17 00:00:00 2001 From: pan <1029559041@qq.com> Date: Tue, 11 May 2021 12:23:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=AD=E5=BF=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/gyf/csams/ui/MainActivity.kt | 72 +++++++++++++------ .../java/com/gyf/csams/ui/model/ViewModel.kt | 2 +- app/src/main/res/drawable/ic_arrow_right.xml | 9 +++ 3 files changed, 61 insertions(+), 22 deletions(-) create mode 100644 app/src/main/res/drawable/ic_arrow_right.xml diff --git a/app/src/main/java/com/gyf/csams/ui/MainActivity.kt b/app/src/main/java/com/gyf/csams/ui/MainActivity.kt index 6a18c38..9f87c24 100644 --- a/app/src/main/java/com/gyf/csams/ui/MainActivity.kt +++ b/app/src/main/java/com/gyf/csams/ui/MainActivity.kt @@ -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") } } diff --git a/app/src/main/java/com/gyf/csams/ui/model/ViewModel.kt b/app/src/main/java/com/gyf/csams/ui/model/ViewModel.kt index 846ed67..1d162b0 100644 --- a/app/src/main/java/com/gyf/csams/ui/model/ViewModel.kt +++ b/app/src/main/java/com/gyf/csams/ui/model/ViewModel.kt @@ -102,7 +102,7 @@ class ListViewModel:ViewModel(){ } fun search(){ - Logger.i("使用社团名称:${_name.value}和社团简介${_desc.value}搜索社团") + Logger.i("使用社团名称:${_name.value},社团简介:${_desc.value} 搜索社团") _snackBarMsg.value="搜索失败,请联系管理员" } diff --git a/app/src/main/res/drawable/ic_arrow_right.xml b/app/src/main/res/drawable/ic_arrow_right.xml new file mode 100644 index 0000000..0e6fd19 --- /dev/null +++ b/app/src/main/res/drawable/ic_arrow_right.xml @@ -0,0 +1,9 @@ + + +