From fe4f5b9ce1c656442b668fec0f9921493d9d2f8d Mon Sep 17 00:00:00 2001 From: shenzuqiang Date: Thu, 12 Mar 2026 14:14:58 +0800 Subject: [PATCH] =?UTF-8?q?Dev=EF=BC=9A=201=E3=80=81=E9=A6=96=E9=A1=B5?= =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=8C=E7=94=A8=E5=B7=A5=E7=A8=8B=E6=A8=A1?= =?UTF-8?q?=E5=BC=8F=EF=BC=8C=E5=87=8F=E5=B0=91=E4=BB=A3=E7=A0=81=E5=86=97?= =?UTF-8?q?=E4=BD=99=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/img/rabbit/bean/local/UIItemBean.kt | 5 +- .../java/com/img/rabbit/config/CommonData.kt | 4 +- .../com/img/rabbit/pages/screen/HomeScreen.kt | 917 ++++-------------- .../rabbit/pages/screen/make/ResizeScreen.kt | 2 +- 4 files changed, 206 insertions(+), 722 deletions(-) diff --git a/app/src/main/java/com/img/rabbit/bean/local/UIItemBean.kt b/app/src/main/java/com/img/rabbit/bean/local/UIItemBean.kt index e23174e..bbe1a21 100644 --- a/app/src/main/java/com/img/rabbit/bean/local/UIItemBean.kt +++ b/app/src/main/java/com/img/rabbit/bean/local/UIItemBean.kt @@ -4,5 +4,8 @@ data class UIItemBean( val id: Int, val name: String, val icon: Int, - val route: String + val route: String, + val resize: String = "", + val with: Float = 0f, + val height: Float = 0f ) diff --git a/app/src/main/java/com/img/rabbit/config/CommonData.kt b/app/src/main/java/com/img/rabbit/config/CommonData.kt index 4ff9b79..b675292 100644 --- a/app/src/main/java/com/img/rabbit/config/CommonData.kt +++ b/app/src/main/java/com/img/rabbit/config/CommonData.kt @@ -67,8 +67,8 @@ object CommonData { // 定义尺寸列表 val resizes = mutableListOf().apply { - add(ResizeBean(id = 0, size = "23x35mm", title = "标准一寸", width = 25f, height = 35f)) - add(ResizeBean(id = 1, size = "22x23mm", title = "小一寸", width = 22f, height = 32f)) + add(ResizeBean(id = 0, size = "25x35mm", title = "标准一寸", width = 25f, height = 35f)) + add(ResizeBean(id = 1, size = "22x32mm", title = "小一寸", width = 22f, height = 32f)) add(ResizeBean(id = 2, size = "35x53mm", title = "标准二寸", width = 35f, height = 53f)) add(ResizeBean(id = 3, size = "33x48mm", title = "小二寸", width = 33f, height = 48f)) add(ResizeBean(id = 4, size = "26x32mm", title = "身份证", width = 26f, height = 32f)) diff --git a/app/src/main/java/com/img/rabbit/pages/screen/HomeScreen.kt b/app/src/main/java/com/img/rabbit/pages/screen/HomeScreen.kt index 6e5656e..81c8d71 100644 --- a/app/src/main/java/com/img/rabbit/pages/screen/HomeScreen.kt +++ b/app/src/main/java/com/img/rabbit/pages/screen/HomeScreen.kt @@ -49,7 +49,6 @@ import androidx.compose.ui.tooling.preview.Preview import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.sp import androidx.lifecycle.viewmodel.compose.viewModel -import androidx.navigation.NavBackStackEntry import androidx.navigation.NavController import androidx.navigation.NavHostController import androidx.navigation.compose.currentBackStackEntryAsState @@ -73,6 +72,7 @@ import io.dcloud.feature.sdk.DCUniMPSDK import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import org.json.JSONObject +import kotlin.collections.chunked @SuppressLint("UnrememberedMutableState", "MutableCollectionMutableState") @Composable @@ -87,7 +87,33 @@ fun HomeScreen( val context = LocalContext.current val scope: CoroutineScope = rememberCoroutineScope() val progressPair = remember { mutableStateMapOf() } + //选尺寸制作 + val sizeItems = mutableListOf().apply { + add(UIItemBean(id = 1, name = "标准一寸", icon = R.mipmap.ic_home_size_bg, route = ScreenRoute.Cutout.route, resize = "25x35mm", with = 25f, height = 35f)) + add(UIItemBean(id = 2, name = "小一寸", icon = R.mipmap.ic_home_size_bg, route = ScreenRoute.Cutout.route, resize = "22x32mm", with = 22f, height = 32f)) + add(UIItemBean(id = 3, name = "标准二寸", icon = R.mipmap.ic_home_size_bg, route = ScreenRoute.Cutout.route, resize = "35x53mm", with = 35f, height = 53f)) + add(UIItemBean(id = 4, name = "小二寸", icon = R.mipmap.ic_home_size_bg, route = ScreenRoute.Cutout.route, resize = "33x48mm", with = 33f, height = 48f)) + } + //每排展示2个 + val sizeColumnsCount = 2 + val sizeRow = sizeItems.chunked(sizeColumnsCount) + //选证件制作 + val certificateItems = mutableListOf().apply { + add(UIItemBean(id = 1, name = "身份证", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "26x32mm", with = 26f, height = 32f)) + add(UIItemBean(id = 2, name = "护照", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "33x48mm", with = 33f, height = 48f)) + add(UIItemBean(id = 3, name = "驾驶证", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "22x32mm", with = 22f, height = 32f)) + add(UIItemBean(id = 4, name = "社保卡", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "26x32mm", with = 26f, height = 32f)) + add(UIItemBean(id = 5, name = "四六级", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "26x32mm", with = 26f, height = 32f)) + add(UIItemBean(id = 6, name = "司法考试", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "33x48mm", with = 33f, height = 48f)) + add(UIItemBean(id = 7, name = "结婚证", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "40x60mm", with = 40f, height = 60f)) + add(UIItemBean(id = 8, name = "中国签证", icon = R.mipmap.ic_home_certificate_bg, route = ScreenRoute.Cutout.route, resize = "35x45mm", with = 35f, height = 45f)) + } + //每排展示4个 + val certificateColumnsCount = 4 + val certificateRow = certificateItems.chunked(certificateColumnsCount) + + //其他 val otherItems = mutableListOf().apply { add(UIItemBean(id = 1, name = "拼长图", icon = R.mipmap.ic_home_other_1_puzzle, route = ScreenRoute.LongImage.route)) add(UIItemBean(id = 2, name = "格式转换", icon = R.mipmap.ic_home_other_2_format, route = ScreenRoute.Format.route)) @@ -422,7 +448,7 @@ fun HomeScreen( } } } - //选尺寸制作 + //选尺寸制作(标题) item { Column( modifier = Modifier @@ -438,263 +464,19 @@ fun HomeScreen( .wrapContentWidth() .padding(start = 16.dp, end = 16.dp, top = 12.dp) ) - Row( - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 12.dp) - ) { - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 25f) - currentBackStackEntry?.savedStateHandle?.set("height", 35f) - navigate(ScreenRoute.Cutout.route) - } - } - ){ - Image( - painter = painterResource(id = R.mipmap.ic_home_size_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(166 / 68f), - contentDescription = null, - ) - - Row( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Box( - modifier = Modifier - .fillMaxWidth() - .weight(0.25f) - ) - Column( - modifier = Modifier - .wrapContentSize() - .weight(0.75f) - ) { - Text( - text = "标准一寸", - fontSize = 14.sp, - fontWeight = FontWeight.Bold, - color = Color(0xFF1A1A1A), - modifier = Modifier.wrapContentSize() - ) - Text( - text = "25x35mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - color = Color(0xFF767676), - modifier = Modifier.wrapContentSize() - ) - } - } - } - Box( - modifier = Modifier - .width(10.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 22f) - currentBackStackEntry?.savedStateHandle?.set("height", 32f) - navigate(ScreenRoute.Cutout.route) - } - } - ){ - Image( - painter = painterResource(id = R.mipmap.ic_home_size_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(166 / 68f), - contentDescription = null, - ) - - Row( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Box( - modifier = Modifier - .fillMaxWidth() - .weight(0.25f) - ) - Column( - modifier = Modifier - .wrapContentSize() - .weight(0.75f) - ) { - Text( - text = "小一寸", - fontSize = 14.sp, - fontWeight = FontWeight.Bold, - color = Color(0xFF1A1A1A), - modifier = Modifier.wrapContentSize() - ) - Text( - text = "22x32mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - color = Color(0xFF767676), - modifier = Modifier.wrapContentSize() - ) - } - } - } - } - Row( - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 12.dp) - ) { - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 35f) - currentBackStackEntry?.savedStateHandle?.set("height", 53f) - navigate(ScreenRoute.Cutout.route) - } - } - ){ - Image( - painter = painterResource(id = R.mipmap.ic_home_size_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(166 / 68f), - contentDescription = null, - ) - - Row( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Box( - modifier = Modifier - .fillMaxWidth() - .weight(0.25f) - ) - Column( - modifier = Modifier - .wrapContentSize() - .weight(0.75f) - ) { - Text( - text = "标准二寸", - fontSize = 14.sp, - fontWeight = FontWeight.Bold, - color = Color(0xFF1A1A1A), - modifier = Modifier.wrapContentSize() - ) - Text( - text = "35x53mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - color = Color(0xFF767676), - modifier = Modifier.wrapContentSize() - ) - } - - } - } - Box( - modifier = Modifier - .width(10.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 33f) - currentBackStackEntry?.savedStateHandle?.set("height", 48f) - navigate(ScreenRoute.Cutout.route) - } - } - ){ - Image( - painter = painterResource(id = R.mipmap.ic_home_size_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(166 / 68f), - contentDescription = null, - ) - - Row( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Box( - modifier = Modifier - .fillMaxWidth() - .weight(0.25f) - ) - Column( - modifier = Modifier - .wrapContentSize() - .weight(0.75f) - ) { - Text( - text = "小二寸", - fontSize = 14.sp, - fontWeight = FontWeight.Bold, - color = Color(0xFF1A1A1A), - modifier = Modifier.wrapContentSize() - ) - Text( - text = "33x48mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - color = Color(0xFF767676), - modifier = Modifier.wrapContentSize() - ) - } - - } - } - } } } - //选证件制作 + //选尺寸制作(内容) + items (sizeRow){ + Column( + modifier = Modifier + .fillMaxWidth() + .offset(y = (-36).dp) + ) { + SizeItems(navController, generalViewModel, it) + } + } + //选证件制作(标题) item { //选证件制作 Column( @@ -710,467 +492,17 @@ fun HomeScreen( .wrapContentWidth() .padding(start = 16.dp, end = 16.dp, top = 18.dp) ) - Row( - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 12.dp) - ){ - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 26f) - currentBackStackEntry?.savedStateHandle?.set("height", 32f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "身份证", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - color = Color(0xFF1A1A1A), - lineHeight = 12.sp, - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "26x32mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 33f) - currentBackStackEntry?.savedStateHandle?.set("height", 48f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "护照", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "33x48mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 22f) - currentBackStackEntry?.savedStateHandle?.set("height", 32f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "驾驶证", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "22x32mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 26f) - currentBackStackEntry?.savedStateHandle?.set("height", 32f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "社保卡", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "26x32mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - - } - Row( - modifier = Modifier - .fillMaxWidth() - .padding(start = 16.dp, end = 16.dp, top = 12.dp) - ){ - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 26f) - currentBackStackEntry?.savedStateHandle?.set("height", 32f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "四六级", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "26x32mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 33f) - currentBackStackEntry?.savedStateHandle?.set("height", 48f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "司法考试", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "33x48mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 40f) - currentBackStackEntry?.savedStateHandle?.set("height", 60f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "结婚证", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "40x60mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - Box( - modifier = Modifier - .width(8.dp) - ) - Box( - modifier = Modifier - .wrapContentWidth() - .weight(1f) - .clickable( - indication = null, - interactionSource = remember { MutableInteractionSource() } - ) { - // 隐藏TabBar - generalViewModel.setNavigationBarVisible(false) - // 跳转抠图页面 - navController.apply { - currentBackStackEntry?.savedStateHandle?.set("width", 35f) - currentBackStackEntry?.savedStateHandle?.set("height", 45f) - navigate(ScreenRoute.Cutout.route) - } - } - ) { - Image( - painter = painterResource(id = R.mipmap.ic_home_certificate_bg), - modifier = Modifier - .fillMaxWidth() - .aspectRatio(80f / 50f), - contentDescription = null, - ) - - Column( - modifier = Modifier - .fillMaxWidth() - .align(Alignment.Center) - ) { - Text( - text = "中国签证", - fontSize = 12.sp, - fontWeight = FontWeight.Bold, - lineHeight = 12.sp, - color = Color(0xFF1A1A1A), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - Text( - text = "35x45mm", - fontSize = 10.sp, - fontWeight = FontWeight.Normal, - lineHeight = 10.sp, - color = Color(0xFFAAAAAA), - modifier = Modifier - .wrapContentSize() - .align(Alignment.CenterHorizontally) - ) - } - } - } + } + } + //选证件制作(内容) + items(certificateRow){ + //选证件制作 + Column( + modifier = Modifier + .fillMaxWidth() + .offset(y = (-36).dp) + ) { + CertificateItems(navController, generalViewModel, it) } } //其他 @@ -1182,6 +514,155 @@ fun HomeScreen( } } +@Composable +private fun SizeItems(navController: NavController, generalViewModel: GeneralViewModel, data: List){ + Row( + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp, top = 12.dp) + ) { + data.forEachIndexed { index, item -> + Box( + modifier = Modifier + .wrapContentWidth() + .weight(1f) + .clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { + // 隐藏TabBar + generalViewModel.setNavigationBarVisible(false) + // 跳转抠图页面 + navController.apply { + currentBackStackEntry?.savedStateHandle?.set("width", item.with) + currentBackStackEntry?.savedStateHandle?.set("height", item.height) + navigate(item.route) + } + } + ) { + Image( + painter = painterResource(id = item.icon), + modifier = Modifier + .fillMaxWidth() + .aspectRatio(166 / 68f), + contentDescription = null, + ) + + Row( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.Center) + ) { + Box( + modifier = Modifier + .fillMaxWidth() + .weight(0.25f) + ) + Column( + modifier = Modifier + .wrapContentSize() + .weight(0.75f) + ) { + Text( + text = item.name, + fontSize = 14.sp, + fontWeight = FontWeight.Bold, + color = Color(0xFF1A1A1A), + modifier = Modifier.wrapContentSize() + ) + Text( + text = item.resize, + fontSize = 10.sp, + fontWeight = FontWeight.Normal, + color = Color(0xFF767676), + modifier = Modifier.wrapContentSize() + ) + } + } + } + if(index != data.size - 1){ + Box( + modifier = Modifier + .width(10.dp) + ) + } + } + } +} + +@Composable +private fun CertificateItems(navController: NavController, generalViewModel: GeneralViewModel, data: List){ + Row( + modifier = Modifier + .fillMaxWidth() + .padding(start = 16.dp, end = 16.dp, top = 12.dp) + ) { + data.forEachIndexed { index, item -> + Box( + modifier = Modifier + .wrapContentWidth() + .weight(1f) + .clickable( + indication = null, + interactionSource = remember { MutableInteractionSource() } + ) { + // 隐藏TabBar + generalViewModel.setNavigationBarVisible(false) + // 跳转抠图页面 + navController.apply { + currentBackStackEntry?.savedStateHandle?.set("width", item.with) + currentBackStackEntry?.savedStateHandle?.set("height", item.height) + navigate(item.route) + } + } + ) { + Image( + painter = painterResource(id = item.icon),//R.mipmap.ic_home_certificate_bg + modifier = Modifier + .fillMaxWidth() + .aspectRatio(80f / 50f), + contentDescription = null, + ) + + Column( + modifier = Modifier + .fillMaxWidth() + .align(Alignment.Center) + ) { + Text( + text = item.name, + fontSize = 12.sp, + fontWeight = FontWeight.Bold, + color = Color(0xFF1A1A1A), + lineHeight = 12.sp, + modifier = Modifier + .wrapContentSize() + .align(Alignment.CenterHorizontally) + ) + Text( + text = item.resize, + fontSize = 10.sp, + fontWeight = FontWeight.Normal, + lineHeight = 10.sp, + color = Color(0xFFAAAAAA), + modifier = Modifier + .wrapContentSize() + .align(Alignment.CenterHorizontally) + ) + } + } + if(index != data.size - 1){ + Box( + modifier = Modifier + .width(8.dp) + ) + } + } + + } + +} + @Composable private fun OtherItems(navController: NavController, generalViewModel: GeneralViewModel, data: List){ Column( diff --git a/app/src/main/java/com/img/rabbit/pages/screen/make/ResizeScreen.kt b/app/src/main/java/com/img/rabbit/pages/screen/make/ResizeScreen.kt index 052776a..622873a 100644 --- a/app/src/main/java/com/img/rabbit/pages/screen/make/ResizeScreen.kt +++ b/app/src/main/java/com/img/rabbit/pages/screen/make/ResizeScreen.kt @@ -72,7 +72,7 @@ fun ResizeScreen(navController: NavController) { val graphicsLayer = rememberGraphicsLayer() val coroutineScope = rememberCoroutineScope() //加载图片参数 - val widthParam = navController.previousBackStackEntry?.savedStateHandle?.get("width") ?: 23f + val widthParam = navController.previousBackStackEntry?.savedStateHandle?.get("width") ?: 25f val heightParam = navController.previousBackStackEntry?.savedStateHandle?.get("height") ?: 35f