优化
This commit is contained in:
@@ -385,6 +385,11 @@ abstract class GoodsListActivity : ComponentActivity() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
try {
|
||||||
|
DialogManager.dismissAll()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
//cameraController?.unbind()
|
//cameraController?.unbind()
|
||||||
//isCameraReady = false
|
//isCameraReady = false
|
||||||
|
|||||||
@@ -199,23 +199,23 @@ class AddGoodsDialog(
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
val netRate = (netRateText.toFloatOrNull() ?: 0f) / 100f
|
val netRate = (netRateText.toFloatOrNull() ?: 0f) / 100f
|
||||||
val goodsType = binding.tvGoodsType.tag.toString()
|
val goodsType = binding.tvGoodsType.tag
|
||||||
if (goodsType.isBlank()) {
|
if (goodsType == null || goodsType.toString().isBlank()) {
|
||||||
context.toast("请录入物品类型")
|
context.toast("请录入物品类型")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val storageType = binding.tvStorageType.tag.toString()
|
val storageType = binding.tvStorageType.tag
|
||||||
if (storageType.isBlank()) {
|
if (storageType == null || storageType.toString().isBlank()) {
|
||||||
context.toast("请录入存储方式")
|
context.toast("请录入存储方式")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val warehouseUnit = binding.tvWarehouseUnit.tag.toString()
|
val warehouseUnit = binding.tvWarehouseUnit.tag
|
||||||
if (warehouseUnit.isBlank()) {
|
if (warehouseUnit == null || warehouseUnit.toString().isBlank()) {
|
||||||
context.toast("请录入库存单位")
|
context.toast("请录入库存单位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val purchaseUnit = binding.tvProcurementUnit.tag.toString()
|
val purchaseUnit = binding.tvProcurementUnit.tag
|
||||||
if (purchaseUnit.isBlank()) {
|
if (purchaseUnit == null || purchaseUnit.toString().isBlank()) {
|
||||||
context.toast("请录采购单位")
|
context.toast("请录采购单位")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@@ -237,11 +237,11 @@ class AddGoodsDialog(
|
|||||||
val param = GoodsAddParam(
|
val param = GoodsAddParam(
|
||||||
goodName = goodsName,
|
goodName = goodsName,
|
||||||
netRate = netRate,
|
netRate = netRate,
|
||||||
goodType = goodsType,
|
goodType = goodsType.toString(),
|
||||||
storageType = storageType,
|
storageType = storageType.toString(),
|
||||||
unitId = warehouseUnit,
|
unitId = warehouseUnit.toString(),
|
||||||
consumeValue = costValue,
|
consumeValue = costValue,
|
||||||
purchaseUnit = purchaseUnit,
|
purchaseUnit = purchaseUnit.toString(),
|
||||||
purchaseValue = goodsCount.toSafeFloat(),
|
purchaseValue = goodsCount.toSafeFloat(),
|
||||||
purchasePrice = goodsPrice.toSafeBigDecimal(),
|
purchasePrice = goodsPrice.toSafeBigDecimal(),
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -212,7 +212,7 @@ class GoodsStoreDialog(
|
|||||||
return@readWeightInfo
|
return@readWeightInfo
|
||||||
}
|
}
|
||||||
val unitTag = binding.tvProcurementUnit.tag
|
val unitTag = binding.tvProcurementUnit.tag
|
||||||
if (unitTag == null) {
|
if (unitTag == null || unitTag.toString().isBlank()) {
|
||||||
return@readWeightInfo
|
return@readWeightInfo
|
||||||
}
|
}
|
||||||
val id = unitTag.toString()
|
val id = unitTag.toString()
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import androidx.compose.animation.core.tween
|
|||||||
import androidx.compose.animation.fadeIn
|
import androidx.compose.animation.fadeIn
|
||||||
import androidx.compose.animation.fadeOut
|
import androidx.compose.animation.fadeOut
|
||||||
import androidx.compose.foundation.Image
|
import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.background
|
|
||||||
import androidx.compose.foundation.layout.Box
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.PaddingValues
|
import androidx.compose.foundation.layout.PaddingValues
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
import androidx.compose.foundation.layout.fillMaxSize
|
||||||
@@ -16,25 +15,18 @@ import androidx.compose.runtime.mutableStateOf
|
|||||||
import androidx.compose.runtime.remember
|
import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.paint
|
|
||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.layout.ContentScale
|
import androidx.compose.ui.layout.ContentScale
|
||||||
import androidx.compose.ui.res.painterResource
|
import androidx.compose.ui.res.painterResource
|
||||||
import androidx.navigation.NavHostController
|
import androidx.navigation.NavHostController
|
||||||
import androidx.navigation.NavType
|
|
||||||
import androidx.navigation.compose.NavHost
|
import androidx.navigation.compose.NavHost
|
||||||
import androidx.navigation.compose.composable
|
import androidx.navigation.compose.composable
|
||||||
import androidx.navigation.compose.currentBackStackEntryAsState
|
import androidx.navigation.compose.currentBackStackEntryAsState
|
||||||
import androidx.navigation.compose.rememberNavController
|
import androidx.navigation.compose.rememberNavController
|
||||||
import androidx.navigation.navArgument
|
|
||||||
import com.sw.inbound.GlobalKey
|
import com.sw.inbound.GlobalKey
|
||||||
import com.sw.inbound.R
|
import com.sw.inbound.R
|
||||||
import com.sw.inbound.ui.page.HomeScreen
|
import com.sw.inbound.ui.page.HomeScreen
|
||||||
import com.sw.inbound.ui.page.LoginScreen
|
|
||||||
import com.sw.inbound.ui.page.PurchaseOrderScreen
|
import com.sw.inbound.ui.page.PurchaseOrderScreen
|
||||||
//import com.sw.inbound.ui.page.ReceiptProductScreen
|
|
||||||
//import com.sw.inbound.ui.page.SelfProcurementScreen
|
|
||||||
//import com.sw.inbound.ui.page.TestScreen
|
|
||||||
import com.sw.inbound.ui.weight.GlobalLoading
|
import com.sw.inbound.ui.weight.GlobalLoading
|
||||||
import com.sw.inbound.utils.SPUtil
|
import com.sw.inbound.utils.SPUtil
|
||||||
import com.sw.inbound.utils.ToastUtils
|
import com.sw.inbound.utils.ToastUtils
|
||||||
@@ -125,9 +117,9 @@ private fun NavHost(
|
|||||||
HomeScreen(modifier = Modifier, navController, onBackRequest = onBackRequest)
|
HomeScreen(modifier = Modifier, navController, onBackRequest = onBackRequest)
|
||||||
}
|
}
|
||||||
// 登录
|
// 登录
|
||||||
composable(Screen.Login.route) {
|
// composable(Screen.Login.route) {
|
||||||
LoginScreen(modifier = Modifier, navController)
|
// LoginScreen(modifier = Modifier, navController)
|
||||||
}
|
// }
|
||||||
// 采购单入库
|
// 采购单入库
|
||||||
composable(
|
composable(
|
||||||
Screen.PurchaseOrder.route,
|
Screen.PurchaseOrder.route,
|
||||||
@@ -163,7 +155,7 @@ private fun NavHost(
|
|||||||
|
|
||||||
sealed class Screen(val route: String) {
|
sealed class Screen(val route: String) {
|
||||||
data object Home : Screen("home")
|
data object Home : Screen("home")
|
||||||
data object Login : Screen("login")
|
// data object Login : Screen("login")
|
||||||
|
|
||||||
// 采购单入库
|
// 采购单入库
|
||||||
data object PurchaseOrder : Screen("purchase_order")
|
data object PurchaseOrder : Screen("purchase_order")
|
||||||
|
|||||||
@@ -57,12 +57,12 @@ fun HomeScreen(
|
|||||||
|
|
||||||
Column(modifier = Modifier.fillMaxSize()) {
|
Column(modifier = Modifier.fillMaxSize()) {
|
||||||
TopTitleBar(user = user, onLogoutClick = {
|
TopTitleBar(user = user, onLogoutClick = {
|
||||||
viewModel.logout()
|
// viewModel.logout()
|
||||||
navController.navigate(Screen.Login.route) {
|
// navController.navigate(Screen.Login.route) {
|
||||||
popUpTo(Screen.Home.route) {
|
// popUpTo(Screen.Home.route) {
|
||||||
inclusive = true
|
// inclusive = true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
})
|
})
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically,
|
verticalAlignment = Alignment.CenterVertically,
|
||||||
|
|||||||
@@ -1,202 +1,202 @@
|
|||||||
package com.sw.inbound.ui.page
|
//package com.sw.inbound.ui.page
|
||||||
|
//
|
||||||
import androidx.compose.foundation.Image
|
//import androidx.compose.foundation.Image
|
||||||
import androidx.compose.foundation.border
|
//import androidx.compose.foundation.border
|
||||||
import androidx.compose.foundation.layout.Arrangement
|
//import androidx.compose.foundation.layout.Arrangement
|
||||||
import androidx.compose.foundation.layout.Box
|
//import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.Column
|
//import androidx.compose.foundation.layout.Column
|
||||||
import androidx.compose.foundation.layout.Spacer
|
//import androidx.compose.foundation.layout.Spacer
|
||||||
import androidx.compose.foundation.layout.fillMaxSize
|
//import androidx.compose.foundation.layout.fillMaxSize
|
||||||
import androidx.compose.foundation.layout.fillMaxWidth
|
//import androidx.compose.foundation.layout.fillMaxWidth
|
||||||
import androidx.compose.foundation.layout.height
|
//import androidx.compose.foundation.layout.height
|
||||||
import androidx.compose.foundation.layout.padding
|
//import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
//import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.width
|
//import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
//import androidx.compose.foundation.shape.RoundedCornerShape
|
||||||
import androidx.compose.foundation.text.KeyboardOptions
|
//import androidx.compose.foundation.text.KeyboardOptions
|
||||||
import androidx.compose.material3.Text
|
//import androidx.compose.material3.Text
|
||||||
import androidx.compose.material3.TextField
|
//import androidx.compose.material3.TextField
|
||||||
import androidx.compose.material3.TextFieldDefaults
|
//import androidx.compose.material3.TextFieldDefaults
|
||||||
import androidx.compose.runtime.Composable
|
//import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.LaunchedEffect
|
//import androidx.compose.runtime.LaunchedEffect
|
||||||
import androidx.compose.runtime.getValue
|
//import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
//import androidx.compose.runtime.mutableStateOf
|
||||||
import androidx.compose.runtime.remember
|
//import androidx.compose.runtime.remember
|
||||||
import androidx.compose.runtime.setValue
|
//import androidx.compose.runtime.setValue
|
||||||
import androidx.compose.ui.Alignment
|
//import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
//import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.graphics.Color
|
//import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.graphics.asImageBitmap
|
//import androidx.compose.ui.graphics.asImageBitmap
|
||||||
import androidx.compose.ui.res.colorResource
|
//import androidx.compose.ui.res.colorResource
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
//import androidx.compose.ui.text.input.ImeAction
|
||||||
import androidx.compose.ui.text.input.KeyboardType
|
//import androidx.compose.ui.text.input.KeyboardType
|
||||||
import androidx.compose.ui.text.input.PasswordVisualTransformation
|
//import androidx.compose.ui.text.input.PasswordVisualTransformation
|
||||||
import androidx.compose.ui.text.input.VisualTransformation
|
//import androidx.compose.ui.text.input.VisualTransformation
|
||||||
import androidx.compose.ui.text.style.TextAlign
|
//import androidx.compose.ui.text.style.TextAlign
|
||||||
import androidx.compose.ui.unit.dp
|
//import androidx.compose.ui.unit.dp
|
||||||
import androidx.compose.ui.unit.sp
|
//import androidx.compose.ui.unit.sp
|
||||||
import androidx.hilt.navigation.compose.hiltViewModel
|
//import androidx.hilt.navigation.compose.hiltViewModel
|
||||||
import androidx.navigation.NavController
|
//import androidx.navigation.NavController
|
||||||
import androidx.navigation.compose.rememberNavController
|
//import androidx.navigation.compose.rememberNavController
|
||||||
import com.sw.inbound.GlobalData
|
//import com.sw.inbound.GlobalData
|
||||||
import com.sw.inbound.GlobalKey
|
//import com.sw.inbound.GlobalKey
|
||||||
import com.sw.inbound.R
|
//import com.sw.inbound.R
|
||||||
import com.sw.inbound.ext.bold
|
//import com.sw.inbound.ext.bold
|
||||||
import com.sw.inbound.ext.textAlign
|
//import com.sw.inbound.ext.textAlign
|
||||||
import com.sw.inbound.ext.withSize
|
//import com.sw.inbound.ext.withSize
|
||||||
import com.sw.inbound.ui.Screen
|
//import com.sw.inbound.ui.Screen
|
||||||
import com.sw.inbound.ui.theme.AppTypography
|
//import com.sw.inbound.ui.theme.AppTypography
|
||||||
import com.sw.inbound.ui.weight.CustomButton
|
//import com.sw.inbound.ui.weight.CustomButton
|
||||||
import com.sw.inbound.utils.QRCodeUtil
|
//import com.sw.inbound.utils.QRCodeUtil
|
||||||
import com.sw.inbound.utils.SPUtil
|
//import com.sw.inbound.utils.SPUtil
|
||||||
import com.sw.inbound.viewmodel.UserViewModel
|
//import com.sw.inbound.viewmodel.UserViewModel
|
||||||
import timber.log.Timber
|
//import timber.log.Timber
|
||||||
|
//
|
||||||
/**
|
///**
|
||||||
* 登录界面
|
// * 登录界面
|
||||||
*/
|
// */
|
||||||
@Composable
|
//@Composable
|
||||||
fun LoginScreen(
|
//fun LoginScreen(
|
||||||
modifier: Modifier = Modifier,
|
// modifier: Modifier = Modifier,
|
||||||
controller: NavController = rememberNavController(),
|
// controller: NavController = rememberNavController(),
|
||||||
viewModel: UserViewModel = hiltViewModel<UserViewModel>()
|
// viewModel: UserViewModel = hiltViewModel<UserViewModel>()
|
||||||
) {
|
//) {
|
||||||
var username by remember { mutableStateOf<String>("") }
|
// var username by remember { mutableStateOf<String>("") }
|
||||||
var password by remember { mutableStateOf<String>("") }
|
// var password by remember { mutableStateOf<String>("") }
|
||||||
|
//
|
||||||
// val user by viewModel.user.collectAsState()
|
//// val user by viewModel.user.collectAsState()
|
||||||
|
//
|
||||||
LaunchedEffect(Unit) {
|
// LaunchedEffect(Unit) {
|
||||||
Timber.d(" user =")
|
// Timber.d(" user =")
|
||||||
username = SPUtil.getInstance().get(GlobalKey.KEY_USER_NAME, "").toString()
|
// username = SPUtil.getInstance().get(GlobalKey.KEY_USER_NAME, "").toString()
|
||||||
viewModel.user.collect {
|
// viewModel.user.collect {
|
||||||
Timber.d(" user collect = ${it}")
|
// Timber.d(" user collect = ${it}")
|
||||||
if (it != null) {
|
// if (it != null) {
|
||||||
GlobalData.user = it
|
// GlobalData.user = it
|
||||||
controller.navigate(Screen.Home.route) {
|
|
||||||
Timber.d("登录成功,跳转到主界面")
|
|
||||||
controller.popBackStack()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// if (user != null){
|
|
||||||
// controller.navigate(Screen.Home.route) {
|
// controller.navigate(Screen.Home.route) {
|
||||||
|
// Timber.d("登录成功,跳转到主界面")
|
||||||
// controller.popBackStack()
|
// controller.popBackStack()
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
|
|
||||||
val qrCodeBmp by lazy {
|
|
||||||
QRCodeUtil.generateQRCode(
|
|
||||||
content = GlobalData.deviceId,
|
|
||||||
size = 150
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Box(contentAlignment = Alignment.BottomStart) {
|
|
||||||
Column(
|
|
||||||
modifier = Modifier.fillMaxSize(),
|
|
||||||
verticalArrangement = Arrangement.Center,
|
|
||||||
horizontalAlignment = Alignment.CenterHorizontally
|
|
||||||
) {
|
|
||||||
Text(text = "出入库管理", style = AppTypography.black141428TextStyle.withSize(60.sp).bold())
|
|
||||||
Spacer(modifier = Modifier.height(91.dp))
|
|
||||||
|
|
||||||
UserInputView(value = username, placeholderValue = "请输入用户名", onValueChange = {
|
|
||||||
username = it
|
|
||||||
})
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(30.dp))
|
|
||||||
|
|
||||||
UserInputView(value = password, placeholderValue = "请输入密码", onValueChange = {
|
|
||||||
password = it
|
|
||||||
}, isPassword = true)
|
|
||||||
|
|
||||||
Spacer(modifier = Modifier.height(90.dp))
|
|
||||||
CustomButton(
|
|
||||||
modifier = modifier
|
|
||||||
.width(885.dp)
|
|
||||||
.height(120.dp),
|
|
||||||
text = "登录",
|
|
||||||
onClick = {
|
|
||||||
//if (username.isEmpty() || password.isEmpty()) {
|
|
||||||
// ToastUtils.showToast("用户名或密码不能为空")
|
|
||||||
// return@CustomButton
|
|
||||||
//}
|
|
||||||
viewModel.login(username, password)
|
|
||||||
// TODO: 测试功能,临时打开新页面
|
|
||||||
controller.navigate(Screen.Home.route)
|
|
||||||
// controller.context.startActivity<ReceiptActivity> {
|
|
||||||
// putExtra(GoodsListActivity.ID, "123123")
|
|
||||||
// putExtra(GoodsListActivity.SUPPLIER_ID, "123123123123")
|
|
||||||
// }
|
// }
|
||||||
},
|
//// if (user != null){
|
||||||
borderColor = colorResource(R.color.blue),
|
//// controller.navigate(Screen.Home.route) {
|
||||||
textColor = colorResource(R.color.white),
|
//// controller.popBackStack()
|
||||||
fontSize = 36.sp
|
//// }
|
||||||
)
|
//// }
|
||||||
}
|
// }
|
||||||
Image(
|
//
|
||||||
bitmap = qrCodeBmp!!.asImageBitmap(),
|
// val qrCodeBmp by lazy {
|
||||||
contentDescription = "",
|
// QRCodeUtil.generateQRCode(
|
||||||
modifier = Modifier
|
// content = GlobalData.deviceId,
|
||||||
.padding(start = 10.dp, bottom = 10.dp)
|
// size = 150
|
||||||
.size(80.dp, 80.dp)
|
// )
|
||||||
)
|
// }
|
||||||
}
|
//
|
||||||
}
|
// Box(contentAlignment = Alignment.BottomStart) {
|
||||||
|
// Column(
|
||||||
|
// modifier = Modifier.fillMaxSize(),
|
||||||
@Composable
|
// verticalArrangement = Arrangement.Center,
|
||||||
private fun UserInputView(
|
// horizontalAlignment = Alignment.CenterHorizontally
|
||||||
value: String,
|
// ) {
|
||||||
placeholderValue: String,
|
// Text(text = "出入库管理", style = AppTypography.black141428TextStyle.withSize(60.sp).bold())
|
||||||
onValueChange: (String) -> Unit,
|
// Spacer(modifier = Modifier.height(91.dp))
|
||||||
isPassword: Boolean = false,
|
//
|
||||||
isShowPassword: Boolean = false
|
// UserInputView(value = username, placeholderValue = "请输入用户名", onValueChange = {
|
||||||
) {
|
// username = it
|
||||||
val backgroundColor = Color.White.copy(alpha = 0.37f)
|
// })
|
||||||
|
//
|
||||||
TextField(
|
// Spacer(modifier = Modifier.height(30.dp))
|
||||||
value = value,
|
//
|
||||||
onValueChange = onValueChange,
|
// UserInputView(value = password, placeholderValue = "请输入密码", onValueChange = {
|
||||||
modifier = Modifier
|
// password = it
|
||||||
.height(120.dp)
|
// }, isPassword = true)
|
||||||
.width(885.dp)
|
//
|
||||||
.border(
|
// Spacer(modifier = Modifier.height(90.dp))
|
||||||
width = 2.dp,
|
// CustomButton(
|
||||||
color = backgroundColor,
|
// modifier = modifier
|
||||||
shape = RoundedCornerShape(10.dp)
|
// .width(885.dp)
|
||||||
),
|
// .height(120.dp),
|
||||||
colors = TextFieldDefaults.colors(
|
// text = "登录",
|
||||||
focusedContainerColor = backgroundColor,
|
// onClick = {
|
||||||
unfocusedContainerColor = backgroundColor,
|
// //if (username.isEmpty() || password.isEmpty()) {
|
||||||
disabledContainerColor = backgroundColor,
|
// // ToastUtils.showToast("用户名或密码不能为空")
|
||||||
focusedIndicatorColor = Color.Transparent,
|
// // return@CustomButton
|
||||||
unfocusedIndicatorColor = Color.Transparent,
|
// //}
|
||||||
disabledIndicatorColor = Color.Transparent
|
// viewModel.login(username, password)
|
||||||
),
|
// // TODO: 测试功能,临时打开新页面
|
||||||
// 密码输入相关设置
|
// controller.navigate(Screen.Home.route)
|
||||||
visualTransformation = if (isPassword && !isShowPassword) {
|
//// controller.context.startActivity<ReceiptActivity> {
|
||||||
PasswordVisualTransformation()
|
//// putExtra(GoodsListActivity.ID, "123123")
|
||||||
} else {
|
//// putExtra(GoodsListActivity.SUPPLIER_ID, "123123123123")
|
||||||
VisualTransformation.None
|
//// }
|
||||||
},
|
// },
|
||||||
keyboardOptions = KeyboardOptions(
|
// borderColor = colorResource(R.color.blue),
|
||||||
keyboardType = if (isPassword) KeyboardType.Password else KeyboardType.Text,
|
// textColor = colorResource(R.color.white),
|
||||||
imeAction = if (isPassword) ImeAction.Done else ImeAction.Next
|
// fontSize = 36.sp
|
||||||
),
|
// )
|
||||||
shape = RoundedCornerShape(10.dp),
|
// }
|
||||||
textStyle = AppTypography.gray96a0aaTextStyle.withSize(30.sp).textAlign(TextAlign.Center),
|
// Image(
|
||||||
placeholder = {
|
// bitmap = qrCodeBmp!!.asImageBitmap(),
|
||||||
Text(
|
// contentDescription = "",
|
||||||
text = placeholderValue,
|
// modifier = Modifier
|
||||||
modifier = Modifier.fillMaxWidth(),
|
// .padding(start = 10.dp, bottom = 10.dp)
|
||||||
textAlign = TextAlign.Center, // 占位符水平居中
|
// .size(80.dp, 80.dp)
|
||||||
style = AppTypography.gray96a0aaTextStyle.textAlign(TextAlign.Center)
|
// )
|
||||||
)
|
// }
|
||||||
},
|
//}
|
||||||
singleLine = true // 确保单行输入(避免换行导致高度变化)
|
//
|
||||||
)
|
//
|
||||||
|
//@Composable
|
||||||
}
|
//private fun UserInputView(
|
||||||
|
// value: String,
|
||||||
|
// placeholderValue: String,
|
||||||
|
// onValueChange: (String) -> Unit,
|
||||||
|
// isPassword: Boolean = false,
|
||||||
|
// isShowPassword: Boolean = false
|
||||||
|
//) {
|
||||||
|
// val backgroundColor = Color.White.copy(alpha = 0.37f)
|
||||||
|
//
|
||||||
|
// TextField(
|
||||||
|
// value = value,
|
||||||
|
// onValueChange = onValueChange,
|
||||||
|
// modifier = Modifier
|
||||||
|
// .height(120.dp)
|
||||||
|
// .width(885.dp)
|
||||||
|
// .border(
|
||||||
|
// width = 2.dp,
|
||||||
|
// color = backgroundColor,
|
||||||
|
// shape = RoundedCornerShape(10.dp)
|
||||||
|
// ),
|
||||||
|
// colors = TextFieldDefaults.colors(
|
||||||
|
// focusedContainerColor = backgroundColor,
|
||||||
|
// unfocusedContainerColor = backgroundColor,
|
||||||
|
// disabledContainerColor = backgroundColor,
|
||||||
|
// focusedIndicatorColor = Color.Transparent,
|
||||||
|
// unfocusedIndicatorColor = Color.Transparent,
|
||||||
|
// disabledIndicatorColor = Color.Transparent
|
||||||
|
// ),
|
||||||
|
// // 密码输入相关设置
|
||||||
|
// visualTransformation = if (isPassword && !isShowPassword) {
|
||||||
|
// PasswordVisualTransformation()
|
||||||
|
// } else {
|
||||||
|
// VisualTransformation.None
|
||||||
|
// },
|
||||||
|
// keyboardOptions = KeyboardOptions(
|
||||||
|
// keyboardType = if (isPassword) KeyboardType.Password else KeyboardType.Text,
|
||||||
|
// imeAction = if (isPassword) ImeAction.Done else ImeAction.Next
|
||||||
|
// ),
|
||||||
|
// shape = RoundedCornerShape(10.dp),
|
||||||
|
// textStyle = AppTypography.gray96a0aaTextStyle.withSize(30.sp).textAlign(TextAlign.Center),
|
||||||
|
// placeholder = {
|
||||||
|
// Text(
|
||||||
|
// text = placeholderValue,
|
||||||
|
// modifier = Modifier.fillMaxWidth(),
|
||||||
|
// textAlign = TextAlign.Center, // 占位符水平居中
|
||||||
|
// style = AppTypography.gray96a0aaTextStyle.textAlign(TextAlign.Center)
|
||||||
|
// )
|
||||||
|
// },
|
||||||
|
// singleLine = true // 确保单行输入(避免换行导致高度变化)
|
||||||
|
// )
|
||||||
|
//
|
||||||
|
//}
|
||||||
Reference in New Issue
Block a user