更新搜索页面UI
- 搜索按钮更新为可点击 - 搜索框样式更新 - 新增取消按钮 - 发现页面背景颜色更新
This commit is contained in:
@@ -48,6 +48,7 @@ import com.aiosman.riderpro.LocalNavController
|
|||||||
import com.aiosman.riderpro.R
|
import com.aiosman.riderpro.R
|
||||||
import com.aiosman.riderpro.ui.NavigationRoute
|
import com.aiosman.riderpro.ui.NavigationRoute
|
||||||
import com.aiosman.riderpro.ui.composables.CustomAsyncImage
|
import com.aiosman.riderpro.ui.composables.CustomAsyncImage
|
||||||
|
import com.aiosman.riderpro.ui.composables.StatusBarSpacer
|
||||||
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
import com.aiosman.riderpro.ui.modifiers.noRippleClickable
|
||||||
import com.aiosman.riderpro.ui.post.PostViewModel
|
import com.aiosman.riderpro.ui.post.PostViewModel
|
||||||
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
import com.google.accompanist.systemuicontroller.rememberSystemUiController
|
||||||
@@ -74,15 +75,14 @@ fun DiscoverScreen() {
|
|||||||
Column(
|
Column(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxSize()
|
.fillMaxSize()
|
||||||
.background(Color(0xFFF0F2F5))
|
.background(Color(0xFFF4F5F6))
|
||||||
.pullRefresh(state)
|
.pullRefresh(state)
|
||||||
.padding(bottom = navigationBarPaddings)
|
.padding(bottom = navigationBarPaddings)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth()
|
modifier = Modifier.fillMaxWidth().background(Color.White).padding(bottom = 10.dp)
|
||||||
) {
|
) {
|
||||||
Spacer(modifier = Modifier.height(statusBarPaddingValues.calculateTopPadding()))
|
StatusBarSpacer()
|
||||||
|
|
||||||
SearchButton(
|
SearchButton(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
@@ -95,7 +95,6 @@ fun DiscoverScreen() {
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = 16.dp)
|
|
||||||
.weight(1f)
|
.weight(1f)
|
||||||
) {
|
) {
|
||||||
DiscoverView()
|
DiscoverView()
|
||||||
@@ -114,7 +113,7 @@ fun SearchButton(
|
|||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clip(shape = RoundedCornerShape(8.dp))
|
.clip(shape = RoundedCornerShape(8.dp))
|
||||||
.background(Color(0xFFEEEEEE))
|
.background(Color(0xFFEEEEEE))
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||||
.noRippleClickable {
|
.noRippleClickable {
|
||||||
clickAction()
|
clickAction()
|
||||||
}
|
}
|
||||||
@@ -124,7 +123,8 @@ fun SearchButton(
|
|||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Search,
|
Icons.Default.Search,
|
||||||
contentDescription = null
|
contentDescription = null,
|
||||||
|
tint = Color(0xFF9E9E9E)
|
||||||
)
|
)
|
||||||
Box {
|
Box {
|
||||||
Text(
|
Text(
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import androidx.compose.ui.focus.focusRequester
|
|||||||
import androidx.compose.ui.graphics.Color
|
import androidx.compose.ui.graphics.Color
|
||||||
import androidx.compose.ui.platform.LocalContext
|
import androidx.compose.ui.platform.LocalContext
|
||||||
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
import androidx.compose.ui.platform.LocalSoftwareKeyboardController
|
||||||
|
import androidx.compose.ui.res.stringResource
|
||||||
import androidx.compose.ui.text.TextStyle
|
import androidx.compose.ui.text.TextStyle
|
||||||
import androidx.compose.ui.text.font.FontWeight
|
import androidx.compose.ui.text.font.FontWeight
|
||||||
import androidx.compose.ui.text.input.ImeAction
|
import androidx.compose.ui.text.input.ImeAction
|
||||||
@@ -76,7 +77,7 @@ fun SearchScreen() {
|
|||||||
val navigationBarPaddings =
|
val navigationBarPaddings =
|
||||||
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
|
WindowInsets.navigationBars.asPaddingValues().calculateBottomPadding()
|
||||||
val focusRequester = remember { FocusRequester() }
|
val focusRequester = remember { FocusRequester() }
|
||||||
|
val navController = LocalNavController.current
|
||||||
LaunchedEffect(Unit) {
|
LaunchedEffect(Unit) {
|
||||||
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = true)
|
systemUiController.setStatusBarColor(Color.Transparent, darkIcons = true)
|
||||||
}
|
}
|
||||||
@@ -91,13 +92,19 @@ fun SearchScreen() {
|
|||||||
.padding(bottom = navigationBarPaddings)
|
.padding(bottom = navigationBarPaddings)
|
||||||
) {
|
) {
|
||||||
Column(
|
Column(
|
||||||
modifier = Modifier.fillMaxWidth().background(Color.White).padding(bottom = 10.dp)
|
|
||||||
) {
|
|
||||||
Spacer(modifier = Modifier.height(statusBarPaddingValues.calculateTopPadding()))
|
|
||||||
SearchInput(
|
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
.padding(top = 16.dp, start = 24.dp, end = 24.dp),
|
.background(Color.White)
|
||||||
|
.padding(bottom = 10.dp)
|
||||||
|
) {
|
||||||
|
Spacer(modifier = Modifier.height(statusBarPaddingValues.calculateTopPadding()))
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(top = 16.dp, start = 24.dp, end = 24.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
SearchInput(
|
||||||
|
modifier = Modifier
|
||||||
|
.weight(1f),
|
||||||
text = model.searchText,
|
text = model.searchText,
|
||||||
onTextChange = {
|
onTextChange = {
|
||||||
model.searchText = it
|
model.searchText = it
|
||||||
@@ -109,11 +116,19 @@ fun SearchScreen() {
|
|||||||
},
|
},
|
||||||
focusRequester = focusRequester
|
focusRequester = focusRequester
|
||||||
)
|
)
|
||||||
|
Spacer(modifier = Modifier.size(16.dp))
|
||||||
|
Text(
|
||||||
|
stringResource(R.string.cancel),
|
||||||
|
fontSize = 16.sp,
|
||||||
|
modifier = Modifier.noRippleClickable {
|
||||||
|
navController.popBackStack()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (model.showResult) {
|
if (model.showResult) {
|
||||||
Spacer(modifier = Modifier.padding(8.dp))
|
Spacer(modifier = Modifier.padding(8.dp))
|
||||||
|
|
||||||
TabRow(
|
TabRow(
|
||||||
selectedTabIndex = selectedTabIndex.value,
|
selectedTabIndex = selectedTabIndex.value,
|
||||||
backgroundColor = Color.White,
|
backgroundColor = Color.White,
|
||||||
@@ -130,7 +145,6 @@ fun SearchScreen() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SearchPager(
|
SearchPager(
|
||||||
pagerState = pagerState
|
pagerState = pagerState
|
||||||
)
|
)
|
||||||
@@ -149,17 +163,17 @@ fun SearchInput(
|
|||||||
val context = LocalContext.current
|
val context = LocalContext.current
|
||||||
Box(
|
Box(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.clip(shape = RoundedCornerShape(8.dp))
|
.clip(shape = RoundedCornerShape(16.dp))
|
||||||
|
.background(Color(0xFFF4F5F6))
|
||||||
.background(Color(0xFFEEEEEE))
|
.padding(horizontal = 16.dp, vertical = 12.dp)
|
||||||
.padding(horizontal = 16.dp, vertical = 8.dp)
|
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Icon(
|
Icon(
|
||||||
Icons.Default.Search,
|
Icons.Default.Search,
|
||||||
contentDescription = null
|
contentDescription = null,
|
||||||
|
tint = Color(0xFF9E9E9E)
|
||||||
)
|
)
|
||||||
Box {
|
Box {
|
||||||
if (text.isEmpty()) {
|
if (text.isEmpty()) {
|
||||||
|
|||||||
@@ -50,4 +50,5 @@
|
|||||||
<string name="edit_profile">编辑个人资料</string>
|
<string name="edit_profile">编辑个人资料</string>
|
||||||
<string name="logout">登出</string>
|
<string name="logout">登出</string>
|
||||||
<string name="change_password">变更密码</string>
|
<string name="change_password">变更密码</string>
|
||||||
|
<string name="cancel">取消</string>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -49,4 +49,5 @@
|
|||||||
<string name="edit_profile">Edit profile</string>
|
<string name="edit_profile">Edit profile</string>
|
||||||
<string name="logout">Logout</string>
|
<string name="logout">Logout</string>
|
||||||
<string name="change_password">Change password</string>
|
<string name="change_password">Change password</string>
|
||||||
|
<string name="cancel">Cancel</string>
|
||||||
</resources>
|
</resources>
|
||||||
Reference in New Issue
Block a user