修正展示用户搜索结果时的布局错误
This commit is contained in:
@@ -44,6 +44,7 @@ fun ActionButton(
|
|||||||
loadingBackgroundColor: Color = Color(0xFFD95757),
|
loadingBackgroundColor: Color = Color(0xFFD95757),
|
||||||
disabledBackgroundColor: Color = Color(0xFFD0D0D0),
|
disabledBackgroundColor: Color = Color(0xFFD0D0D0),
|
||||||
enabled: Boolean = true,
|
enabled: Boolean = true,
|
||||||
|
fullWidth:Boolean = false,
|
||||||
click: () -> Unit = {}
|
click: () -> Unit = {}
|
||||||
) {
|
) {
|
||||||
val animatedBackgroundColor by animateColorAsState(
|
val animatedBackgroundColor by animateColorAsState(
|
||||||
@@ -76,7 +77,13 @@ fun ActionButton(
|
|||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.align(Alignment.Center)
|
.align(Alignment.Center)
|
||||||
.fillMaxWidth(),
|
.let {
|
||||||
|
if(fullWidth){
|
||||||
|
it.fillMaxWidth()
|
||||||
|
}else{
|
||||||
|
it
|
||||||
|
}
|
||||||
|
},
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
Box(modifier = Modifier.align(Alignment.CenterStart)){
|
Box(modifier = Modifier.align(Alignment.CenterStart)){
|
||||||
@@ -93,7 +100,13 @@ fun ActionButton(
|
|||||||
}else{
|
}else{
|
||||||
Box(
|
Box(
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.let {
|
||||||
|
if(fullWidth){
|
||||||
|
it.fillMaxWidth()
|
||||||
|
}else{
|
||||||
|
it
|
||||||
|
}
|
||||||
|
}
|
||||||
.padding(horizontal = 16.dp),
|
.padding(horizontal = 16.dp),
|
||||||
contentAlignment = Alignment.Center
|
contentAlignment = Alignment.Center
|
||||||
) {
|
) {
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import androidx.compose.foundation.layout.navigationBars
|
|||||||
import androidx.compose.foundation.layout.padding
|
import androidx.compose.foundation.layout.padding
|
||||||
import androidx.compose.foundation.layout.size
|
import androidx.compose.foundation.layout.size
|
||||||
import androidx.compose.foundation.layout.systemBars
|
import androidx.compose.foundation.layout.systemBars
|
||||||
|
import androidx.compose.foundation.layout.width
|
||||||
import androidx.compose.foundation.lazy.LazyColumn
|
import androidx.compose.foundation.lazy.LazyColumn
|
||||||
import androidx.compose.foundation.pager.HorizontalPager
|
import androidx.compose.foundation.pager.HorizontalPager
|
||||||
import androidx.compose.foundation.pager.PagerState
|
import androidx.compose.foundation.pager.PagerState
|
||||||
@@ -322,7 +323,7 @@ fun UserItem(
|
|||||||
modifier = Modifier.weight(1f)
|
modifier = Modifier.weight(1f)
|
||||||
) {
|
) {
|
||||||
Text(text = accountProfile.nickName, fontSize = 16.sp, fontWeight = FontWeight.Bold)
|
Text(text = accountProfile.nickName, fontSize = 16.sp, fontWeight = FontWeight.Bold)
|
||||||
Spacer(modifier = Modifier.padding(2.dp))
|
Spacer(modifier = Modifier.width(2.dp))
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(
|
text = stringResource(
|
||||||
R.string.search_user_item_follower_count,
|
R.string.search_user_item_follower_count,
|
||||||
@@ -330,32 +331,34 @@ fun UserItem(
|
|||||||
), fontSize = 14.sp, color = Color(0xFF9E9E9E)
|
), fontSize = 14.sp, color = Color(0xFF9E9E9E)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Spacer(modifier = Modifier.padding(8.dp))
|
Spacer(modifier = Modifier.width(16.dp))
|
||||||
if (accountProfile.id != AppState.UserId) {
|
Box(
|
||||||
if (accountProfile.isFollowing) {
|
modifier = Modifier
|
||||||
ActionButton(
|
) {
|
||||||
text = stringResource(R.string.following_upper),
|
if (accountProfile.id != AppState.UserId) {
|
||||||
backgroundColor = Color(0xFF9E9E9E),
|
if (accountProfile.isFollowing) {
|
||||||
contentPadding = PaddingValues(vertical = 4.dp, horizontal = 8.dp),
|
ActionButton(
|
||||||
color = Color.White
|
text = stringResource(R.string.following_upper),
|
||||||
) {
|
backgroundColor = Color(0xFF9E9E9E),
|
||||||
onFollow(accountProfile)
|
contentPadding = PaddingValues(vertical = 4.dp, horizontal = 8.dp),
|
||||||
}
|
color = Color.White,
|
||||||
} else {
|
fullWidth = false
|
||||||
ActionButton(
|
) {
|
||||||
text = stringResource(R.string.follow_upper),
|
onFollow(accountProfile)
|
||||||
backgroundColor = Color(0xffda3832),
|
}
|
||||||
contentPadding = PaddingValues(vertical = 4.dp, horizontal = 8.dp),
|
} else {
|
||||||
color = Color.White
|
ActionButton(
|
||||||
) {
|
text = stringResource(R.string.follow_upper),
|
||||||
onFollow(accountProfile)
|
backgroundColor = Color(0xffda3832),
|
||||||
|
contentPadding = PaddingValues(vertical = 4.dp, horizontal = 8.dp),
|
||||||
|
color = Color.White,
|
||||||
|
fullWidth = false
|
||||||
|
) {
|
||||||
|
onFollow(accountProfile)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user