您的位置:首页 > 健康 > 美食 > 质量最好的购物平台_邯郸思勤网络科技有限公司_dw网页制作详细步骤_seo什么意思

质量最好的购物平台_邯郸思勤网络科技有限公司_dw网页制作详细步骤_seo什么意思

2025/7/2 2:31:54 来源:https://blog.csdn.net/github_35581409/article/details/143363703  浏览:    关键词:质量最好的购物平台_邯郸思勤网络科技有限公司_dw网页制作详细步骤_seo什么意思
质量最好的购物平台_邯郸思勤网络科技有限公司_dw网页制作详细步骤_seo什么意思

引入

implementation(compose.material3)

添加触发

@OptIn(ExperimentalMaterial3Api::class)@Composableprivate fun BasicDateUnit(label: String, selectedDateStr: MutableState<String>) {var showDatePicker by remember { mutableStateOf(false) }var selectedDate = rememberDatePickerState()EditorRow() {LabelText(label)MyTextField(value = selectedDateStr.value,textStyle = LocalTextStyle.current.copy(color = textColorLight, fontSize = 20.sp),trailingIcon = {Icon(imageVector = Icons.Default.ArrowDropDown,contentDescription = "Dropdown Arrow",tint = Color.Black)},singleLine = true,readOnly = true,enabled = false,onValueChange = {},modifier = Modifier.size(313.dp, 48.dp).background(Color.White, RoundedCornerShape(8.dp)).padding(vertical = 10.dp, horizontal = 16.dp).clickable( //添加点击事件,取消点击效果interactionSource = remember { MutableInteractionSource() },indication = null) {showDatePicker = !showDatePicker},colors = TextFieldDefaults.textFieldColors(backgroundColor = Color.Transparent,focusedIndicatorColor = Color.Transparent,unfocusedIndicatorColor = Color.Transparent,disabledIndicatorColor = Color.Transparent,errorIndicatorColor = Color.Transparent,cursorColor = Color(0XFF46A6FA),))}if (showDatePicker) {DatePickerDialog(onDismissRequest = { showDatePicker = false },confirmButton = {TextButton(onClick = {selectedDateStr.value = TimeUtils.millis2String(selectedDate.selectedDateMillis ?: System.currentTimeMillis(),ConstantUtil.DATE_FORMAT)showDatePicker = false // 处理确认逻辑}) {Text("确认", color = textColorSecondary)}},modifier = Modifier.fillMaxWidth(),dismissButton = {TextButton(onClick = { showDatePicker = false }) {Text("取消", color = labelBgColor)}},shape = MaterialTheme.shapes.medium,tonalElevation = 8.dp,colors = DatePickerDefaults.colors(), // 使用默认颜色properties = DialogProperties(),content = {DatePicker(state = selectedDate)})}}

效果

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com