feat: 优化食物相机界面,调整导航和取景框样式
This commit is contained in:
@@ -144,34 +144,35 @@ export default function FoodCameraScreen() {
|
|||||||
<View style={styles.container}>
|
<View style={styles.container}>
|
||||||
<StatusBar barStyle="light-content" backgroundColor="transparent" translucent />
|
<StatusBar barStyle="light-content" backgroundColor="transparent" translucent />
|
||||||
|
|
||||||
{/* 相机视图 */}
|
{/* 头部导航 */}
|
||||||
<CameraView
|
<HeaderBar
|
||||||
ref={cameraRef}
|
title=""
|
||||||
style={styles.camera}
|
onBack={() => router.back()}
|
||||||
facing={facing}
|
transparent={true}
|
||||||
ratio="16:9"
|
backColor={'#333'}
|
||||||
>
|
/>
|
||||||
{/* 头部导航 */}
|
|
||||||
<HeaderBar
|
|
||||||
title=""
|
|
||||||
onBack={() => router.back()}
|
|
||||||
transparent={true}
|
|
||||||
backColor={'#fff'}
|
|
||||||
/>
|
|
||||||
|
|
||||||
{/* 取景框和提示文本 */}
|
{/* 主要内容区域 */}
|
||||||
<View style={styles.overlayContainer}>
|
<View style={styles.contentContainer}>
|
||||||
<Text style={styles.hintText}>确保食物在辅助框内</Text>
|
{/* 取景框容器 */}
|
||||||
|
<View style={styles.cameraFrameContainer}>
|
||||||
|
<Text style={styles.hintText}>确保食物在取景框内</Text>
|
||||||
|
|
||||||
{/* 取景框 */}
|
{/* 相机取景框 */}
|
||||||
<View style={styles.viewfinderContainer}>
|
<View style={styles.cameraFrame}>
|
||||||
<View style={styles.viewfinder}>
|
<CameraView
|
||||||
{/* 四个角的装饰 */}
|
ref={cameraRef}
|
||||||
<View style={[styles.corner, styles.topLeft]} />
|
style={styles.cameraView}
|
||||||
<View style={[styles.corner, styles.topRight]} />
|
facing={facing}
|
||||||
<View style={[styles.corner, styles.bottomLeft]} />
|
>
|
||||||
<View style={[styles.corner, styles.bottomRight]} />
|
{/* 取景框装饰 */}
|
||||||
</View>
|
<View style={styles.viewfinderOverlay}>
|
||||||
|
<View style={[styles.corner, styles.topLeft]} />
|
||||||
|
<View style={[styles.corner, styles.topRight]} />
|
||||||
|
<View style={[styles.corner, styles.bottomLeft]} />
|
||||||
|
<View style={[styles.corner, styles.bottomRight]} />
|
||||||
|
</View>
|
||||||
|
</CameraView>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
@@ -198,31 +199,15 @@ export default function FoodCameraScreen() {
|
|||||||
</View>
|
</View>
|
||||||
|
|
||||||
{/* 底部控制栏 */}
|
{/* 底部控制栏 */}
|
||||||
<SafeAreaView style={styles.bottomContainer}>
|
<View style={styles.bottomContainer}>
|
||||||
<View style={styles.controlsContainer}>
|
<View style={styles.controlsContainer}>
|
||||||
{/* 相册按钮 */}
|
|
||||||
{/* <TouchableOpacity style={styles.controlButton} onPress={pickImageFromGallery}>
|
|
||||||
<View style={styles.albumButton}>
|
|
||||||
<Ionicons name="images-outline" size={24} color="#FFF" />
|
|
||||||
</View>
|
|
||||||
<Text style={styles.controlButtonText}>相册</Text>
|
|
||||||
</TouchableOpacity> */}
|
|
||||||
|
|
||||||
{/* 拍照按钮 */}
|
{/* 拍照按钮 */}
|
||||||
<TouchableOpacity style={styles.captureButton} onPress={takePicture}>
|
<TouchableOpacity style={styles.captureButton} onPress={takePicture}>
|
||||||
<View style={styles.captureButtonInner} />
|
<View style={styles.captureButtonInner} />
|
||||||
</TouchableOpacity>
|
</TouchableOpacity>
|
||||||
|
|
||||||
{/* AR按钮 */}
|
|
||||||
{/* <TouchableOpacity style={styles.controlButton} onPress={handleARPress}>
|
|
||||||
<View style={styles.arButton}>
|
|
||||||
<Text style={styles.arButtonText}>AR</Text>
|
|
||||||
</View>
|
|
||||||
<Text style={styles.controlButtonText}>AR</Text>
|
|
||||||
</TouchableOpacity> */}
|
|
||||||
</View>
|
</View>
|
||||||
</SafeAreaView>
|
</View>
|
||||||
</CameraView>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -232,6 +217,32 @@ const styles = StyleSheet.create({
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
backgroundColor: '#000',
|
backgroundColor: '#000',
|
||||||
},
|
},
|
||||||
|
contentContainer: {
|
||||||
|
flex: 1,
|
||||||
|
paddingTop: 100,
|
||||||
|
},
|
||||||
|
cameraFrameContainer: {
|
||||||
|
flex: 1,
|
||||||
|
justifyContent: 'center',
|
||||||
|
alignItems: 'center',
|
||||||
|
paddingHorizontal: 20,
|
||||||
|
},
|
||||||
|
cameraFrame: {
|
||||||
|
width: 300,
|
||||||
|
height: 300,
|
||||||
|
borderRadius: 20,
|
||||||
|
overflow: 'hidden',
|
||||||
|
borderWidth: 3,
|
||||||
|
borderColor: '#FFF',
|
||||||
|
backgroundColor: '#000',
|
||||||
|
},
|
||||||
|
cameraView: {
|
||||||
|
flex: 1,
|
||||||
|
},
|
||||||
|
viewfinderOverlay: {
|
||||||
|
flex: 1,
|
||||||
|
position: 'relative',
|
||||||
|
},
|
||||||
camera: {
|
camera: {
|
||||||
flex: 1,
|
flex: 1,
|
||||||
},
|
},
|
||||||
@@ -284,31 +295,12 @@ const styles = StyleSheet.create({
|
|||||||
right: 0,
|
right: 0,
|
||||||
zIndex: 10,
|
zIndex: 10,
|
||||||
},
|
},
|
||||||
overlayContainer: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
paddingTop: 100,
|
|
||||||
},
|
|
||||||
hintText: {
|
hintText: {
|
||||||
color: '#FFF',
|
color: '#FFF',
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: '500',
|
fontWeight: '500',
|
||||||
marginBottom: 30,
|
marginBottom: 20,
|
||||||
textAlign: 'center',
|
textAlign: 'center',
|
||||||
textShadowColor: 'rgba(0, 0, 0, 0.75)',
|
|
||||||
textShadowOffset: { width: 0, height: 1 },
|
|
||||||
textShadowRadius: 3,
|
|
||||||
},
|
|
||||||
viewfinderContainer: {
|
|
||||||
flex: 1,
|
|
||||||
justifyContent: 'center',
|
|
||||||
alignItems: 'center',
|
|
||||||
},
|
|
||||||
viewfinder: {
|
|
||||||
width: 280,
|
|
||||||
height: 280,
|
|
||||||
position: 'relative',
|
|
||||||
},
|
},
|
||||||
corner: {
|
corner: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@@ -345,7 +337,7 @@ const styles = StyleSheet.create({
|
|||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'center',
|
justifyContent: 'center',
|
||||||
paddingHorizontal: 20,
|
paddingHorizontal: 20,
|
||||||
marginBottom: 20,
|
marginVertical: 20,
|
||||||
},
|
},
|
||||||
mealTypeButton: {
|
mealTypeButton: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -372,11 +364,11 @@ const styles = StyleSheet.create({
|
|||||||
color: '#333',
|
color: '#333',
|
||||||
},
|
},
|
||||||
bottomContainer: {
|
bottomContainer: {
|
||||||
backgroundColor: 'rgba(0, 0, 0, 0.3)',
|
paddingBottom: 40,
|
||||||
},
|
},
|
||||||
controlsContainer: {
|
controlsContainer: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-around',
|
justifyContent: 'center',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
paddingVertical: 20,
|
paddingVertical: 20,
|
||||||
paddingHorizontal: 40,
|
paddingHorizontal: 40,
|
||||||
|
|||||||
Reference in New Issue
Block a user