|
@@ -1,84 +1,43 @@
|
|
|
package com.ys.bdtp.adm.mvvm.ui.screen.home
|
|
|
|
|
|
-import androidx.compose.foundation.Image
|
|
|
+import androidx.compose.foundation.ExperimentalFoundationApi
|
|
|
import androidx.compose.foundation.background
|
|
|
-import androidx.compose.foundation.layout.Arrangement
|
|
|
-import androidx.compose.foundation.layout.Box
|
|
|
-import androidx.compose.foundation.layout.Column
|
|
|
-import androidx.compose.foundation.layout.Row
|
|
|
-import androidx.compose.foundation.layout.Spacer
|
|
|
-import androidx.compose.foundation.layout.fillMaxSize
|
|
|
-import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
-import androidx.compose.foundation.layout.height
|
|
|
-import androidx.compose.foundation.layout.padding
|
|
|
-import androidx.compose.foundation.layout.width
|
|
|
-import androidx.compose.foundation.layout.wrapContentHeight
|
|
|
-import androidx.compose.material.Text
|
|
|
+import androidx.compose.foundation.layout.*
|
|
|
import androidx.compose.runtime.Composable
|
|
|
-import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.graphics.Color
|
|
|
-import androidx.compose.ui.res.painterResource
|
|
|
import androidx.compose.ui.tooling.preview.Preview
|
|
|
import androidx.compose.ui.unit.dp
|
|
|
-import androidx.compose.ui.unit.sp
|
|
|
-import com.google.accompanist.insets.LocalWindowInsets
|
|
|
-import com.google.accompanist.insets.rememberInsetsPaddingValues
|
|
|
-import com.ys.bdtp.adm.R
|
|
|
+import com.ys.bdtp.adm.mvvm.ui.compose.*
|
|
|
+import com.ys.bdtp.adm.mvvm.ui.screen.project.Project
|
|
|
|
|
|
+@OptIn(ExperimentalFoundationApi::class)
|
|
|
@Composable
|
|
|
fun HomeScreen() {
|
|
|
Column(modifier = Modifier.fillMaxSize()) {
|
|
|
- HomeTopBar("京东科技大厦")
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-@Composable
|
|
|
-fun HomeTopBar(projectName: String) {
|
|
|
- Box(
|
|
|
- modifier = Modifier.fillMaxWidth().wrapContentHeight().background(Color.White).padding(
|
|
|
- rememberInsetsPaddingValues(
|
|
|
- LocalWindowInsets.current.statusBars
|
|
|
- )
|
|
|
- ),
|
|
|
- ) {
|
|
|
- Row(
|
|
|
- modifier = Modifier.height(56.dp),
|
|
|
- horizontalArrangement = Arrangement.SpaceBetween,
|
|
|
- verticalAlignment = Alignment.CenterVertically
|
|
|
- ) {
|
|
|
- //Spacer(Modifier.statusBarsHeight())
|
|
|
- Row(
|
|
|
- verticalAlignment = Alignment.CenterVertically,
|
|
|
- horizontalArrangement = Arrangement.Start
|
|
|
-
|
|
|
- ) {
|
|
|
- Spacer(modifier = Modifier.width(32.dp))
|
|
|
- Image(
|
|
|
- painter = painterResource(R.drawable.logo),
|
|
|
- contentDescription = "",
|
|
|
- modifier = Modifier.height(36.dp),
|
|
|
- )
|
|
|
- Spacer(modifier = Modifier.width(16.dp))
|
|
|
- Spacer(modifier = Modifier.height(24.dp).width(1.dp).background(Color(0xFFD8D8D8)))
|
|
|
- Spacer(modifier = Modifier.width(16.dp))
|
|
|
- Text(text = projectName, fontSize = 16.sp, color = Color(0xFF1F2329))
|
|
|
- Spacer(modifier = Modifier.width(16.dp))
|
|
|
- Image(
|
|
|
- painter = painterResource(R.drawable.arrow_down),
|
|
|
- contentDescription = ""
|
|
|
+ Top(
|
|
|
+ left = { TopLeft() },
|
|
|
+ right = {
|
|
|
+ TopRight(
|
|
|
+ role = { "管家" },
|
|
|
+ click = { println("heiheihei") }
|
|
|
)
|
|
|
}
|
|
|
- }
|
|
|
+ )
|
|
|
+
|
|
|
Spacer(
|
|
|
modifier = Modifier.fillMaxWidth().height(1.dp).background(Color(0xFFEFF0F1))
|
|
|
- .align(Alignment.BottomCenter)
|
|
|
)
|
|
|
+
|
|
|
+ Content {
|
|
|
+ Project()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-@Preview
|
|
|
+
|
|
|
+@Preview(widthDp = 1280, heightDp = 800)
|
|
|
@Composable
|
|
|
fun PreviewHomeTopBar() {
|
|
|
- HomeTopBar("京东科技大厦")
|
|
|
+ HomeScreen()
|
|
|
}
|