|
|
@@ -18,6 +18,7 @@ import androidx.compose.foundation.layout.offset
|
|
|
import androidx.compose.foundation.layout.padding
|
|
|
import androidx.compose.foundation.layout.size
|
|
|
import androidx.compose.foundation.shape.RoundedCornerShape
|
|
|
+import androidx.compose.material3.HorizontalDivider
|
|
|
import androidx.compose.material3.Icon
|
|
|
import androidx.compose.material3.Scaffold
|
|
|
import androidx.compose.material3.Text
|
|
|
@@ -88,53 +89,56 @@ class PageHome : PageBase() {
|
|
|
@Composable
|
|
|
fun CreateNavigationBar(pv: PaddingValues, bgColor: Color, vm: VMHome) {
|
|
|
val state by vm.state.collectAsState()
|
|
|
- Row(
|
|
|
- modifier = Modifier
|
|
|
- .fillMaxWidth()
|
|
|
- .background(bgColor)
|
|
|
- .padding(PaddingValues(bottom = pv.calculateBottomPadding()))
|
|
|
- ) {
|
|
|
- state.navs.forEach { nav ->
|
|
|
- Box(
|
|
|
- modifier = Modifier
|
|
|
- .weight(1.0f)
|
|
|
- .height(66.dp)
|
|
|
- .clickable(
|
|
|
- interactionSource = remember { MutableInteractionSource() },
|
|
|
- indication = null,
|
|
|
- onClick = { vm.updateNavIndex(nav.id) }),
|
|
|
- ) {
|
|
|
- Column(
|
|
|
- verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
- modifier = Modifier.align(Alignment.Center)
|
|
|
+ Column(modifier = Modifier.fillMaxWidth()) {
|
|
|
+ HorizontalDivider(thickness = 1.dp, color = Color(0xFFEEEEEE))
|
|
|
+ Row(
|
|
|
+ modifier = Modifier
|
|
|
+ .fillMaxWidth()
|
|
|
+ .background(bgColor)
|
|
|
+ .padding(PaddingValues(bottom = pv.calculateBottomPadding()))
|
|
|
+ ) {
|
|
|
+ state.navs.forEach { nav ->
|
|
|
+ Box(
|
|
|
+ modifier = Modifier
|
|
|
+ .weight(1.0f)
|
|
|
+ .height(66.dp)
|
|
|
+ .clickable(
|
|
|
+ interactionSource = remember { MutableInteractionSource() },
|
|
|
+ indication = null,
|
|
|
+ onClick = { vm.updateNavIndex(nav.id) }),
|
|
|
) {
|
|
|
- Icon(
|
|
|
- painter = painterResource(nav.icon),
|
|
|
- contentDescription = null,
|
|
|
- modifier = Modifier.size(18.dp),
|
|
|
- tint = if (state.navIndex == nav.id) nav.selectedColor else nav.unselectedColor
|
|
|
- )
|
|
|
- Text(
|
|
|
- nav.title,
|
|
|
- Modifier.padding(top = 5.dp),
|
|
|
- fontSize = 12.sp,
|
|
|
- lineHeight = 12.sp,
|
|
|
- color = if (state.navIndex == nav.id) nav.selectedColor else nav.unselectedColor
|
|
|
+ Column(
|
|
|
+ verticalArrangement = Arrangement.Center, horizontalAlignment = Alignment.CenterHorizontally,
|
|
|
+ modifier = Modifier.align(Alignment.Center)
|
|
|
+ ) {
|
|
|
+ Icon(
|
|
|
+ painter = painterResource(nav.icon),
|
|
|
+ contentDescription = null,
|
|
|
+ modifier = Modifier.size(18.dp),
|
|
|
+ tint = if (state.navIndex == nav.id) nav.selectedColor else nav.unselectedColor
|
|
|
+ )
|
|
|
+ Text(
|
|
|
+ nav.title,
|
|
|
+ Modifier.padding(top = 5.dp),
|
|
|
+ fontSize = 12.sp,
|
|
|
+ lineHeight = 12.sp,
|
|
|
+ color = if (state.navIndex == nav.id) nav.selectedColor else nav.unselectedColor
|
|
|
+ )
|
|
|
+ }
|
|
|
+ if (nav.count > 0) Text(
|
|
|
+ "${nav.count}", color = Color.White, modifier = Modifier
|
|
|
+ .offset(x = 16.dp, y = 5.dp)
|
|
|
+ .defaultMinSize(14.dp, 14.dp)
|
|
|
+ .clip(RoundedCornerShape(14.dp))
|
|
|
+ .background(Color.Red)
|
|
|
+ .align(Alignment.TopCenter)
|
|
|
+ .padding(top = 1.dp)
|
|
|
+ .padding(horizontal = 2.dp),
|
|
|
+ textAlign = TextAlign.Center,
|
|
|
+ fontSize = 10.sp,
|
|
|
+ lineHeight = 10.sp
|
|
|
)
|
|
|
}
|
|
|
- if (nav.count > 0) Text(
|
|
|
- "${nav.count}", color = Color.White, modifier = Modifier
|
|
|
- .offset(x = 16.dp, y = 5.dp)
|
|
|
- .defaultMinSize(14.dp, 14.dp)
|
|
|
- .clip(RoundedCornerShape(14.dp))
|
|
|
- .background(Color.Red)
|
|
|
- .align(Alignment.TopCenter)
|
|
|
- .padding(top = 1.dp)
|
|
|
- .padding(horizontal = 2.dp),
|
|
|
- textAlign = TextAlign.Center,
|
|
|
- fontSize = 10.sp,
|
|
|
- lineHeight = 10.sp
|
|
|
- )
|
|
|
}
|
|
|
}
|
|
|
}
|