3 changed files with 5 additions and 79 deletions
@ -1,74 +0,0 @@ |
|||||
package com.whitefish.app.ui.components |
|
||||
|
|
||||
import androidx.compose.foundation.background |
|
||||
import androidx.compose.foundation.layout.* |
|
||||
import androidx.compose.material3.* |
|
||||
import androidx.compose.runtime.* |
|
||||
import androidx.compose.ui.Alignment |
|
||||
import androidx.compose.ui.Modifier |
|
||||
import androidx.compose.ui.graphics.Color |
|
||||
import androidx.compose.ui.text.font.FontWeight |
|
||||
import androidx.compose.ui.unit.dp |
|
||||
import androidx.compose.ui.unit.sp |
|
||||
import com.whitefish.app.getStatusBarHeight |
|
||||
import com.whitefish.app.getNavigationBarHeight |
|
||||
|
|
||||
/** |
|
||||
* 系统栏演示组件 |
|
||||
* 用于展示状态栏和导航栏高度的获取效果 |
|
||||
*/ |
|
||||
@Composable |
|
||||
fun SystemBarsDemo(modifier: Modifier = Modifier) { |
|
||||
val statusBarHeight = getStatusBarHeight() |
|
||||
val navigationBarHeight = getNavigationBarHeight() |
|
||||
|
|
||||
Column( |
|
||||
modifier = modifier |
|
||||
.fillMaxSize() |
|
||||
.background(Color(0xFF1A1A1A)) |
|
||||
.systemBarsPadding(), |
|
||||
horizontalAlignment = Alignment.CenterHorizontally, |
|
||||
verticalArrangement = Arrangement.Center |
|
||||
) { |
|
||||
Card( |
|
||||
modifier = Modifier.padding(16.dp), |
|
||||
colors = CardDefaults.cardColors(containerColor = Color(0xFF2A2A2A)) |
|
||||
) { |
|
||||
Column( |
|
||||
modifier = Modifier.padding(24.dp), |
|
||||
horizontalAlignment = Alignment.CenterHorizontally |
|
||||
) { |
|
||||
Text( |
|
||||
text = "系统栏高度信息", |
|
||||
fontSize = 20.sp, |
|
||||
fontWeight = FontWeight.Bold, |
|
||||
color = Color.White |
|
||||
) |
|
||||
|
|
||||
Spacer(modifier = Modifier.height(16.dp)) |
|
||||
|
|
||||
Text( |
|
||||
text = "状态栏高度: ${statusBarHeight}", |
|
||||
fontSize = 16.sp, |
|
||||
color = Color(0xFFE0E0E0) |
|
||||
) |
|
||||
|
|
||||
Spacer(modifier = Modifier.height(8.dp)) |
|
||||
|
|
||||
Text( |
|
||||
text = "导航栏高度: ${navigationBarHeight}", |
|
||||
fontSize = 16.sp, |
|
||||
color = Color(0xFFE0E0E0) |
|
||||
) |
|
||||
|
|
||||
Spacer(modifier = Modifier.height(16.dp)) |
|
||||
|
|
||||
Text( |
|
||||
text = "此内容区域已添加系统栏内边距", |
|
||||
fontSize = 14.sp, |
|
||||
color = Color(0xFFB0B0B0) |
|
||||
) |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
Loading…
Reference in new issue