修复闪光灯模式切换不生效问题

This commit is contained in:
Developer
2026-04-19 19:55:48 +08:00
parent 871f6637ac
commit ccafe90442

View File

@@ -360,6 +360,23 @@ private fun CameraContent(
}
}
// 闪光灯模式变化时更新 ImageCapture
LaunchedEffect(flashMode, imageCapture) {
imageCapture?.let {
try {
it.flashMode = flashMode
Log.d("CameraScreen", "Flash mode updated to: $flashMode")
} catch (e: Exception) {
Log.e("CameraScreen", "Failed to update flash mode", e)
}
}
}
// 强制重组:当 flashMode 变化时触发
LaunchedEffect(flashMode) {
// 闪光灯变化时确保相机已绑定
}
Box(modifier = Modifier.fillMaxSize()) {
// 相机预览
AndroidView(