pref: Pad 加载动画宽度

This commit is contained in:
HuanCheng65 2023-10-05 01:48:28 +08:00
parent 7701fceff0
commit 735ded6a5b
No known key found for this signature in database
GPG Key ID: 5EC9DD60A32C7360
2 changed files with 15 additions and 8 deletions

View File

@ -6,6 +6,7 @@ import androidx.compose.foundation.layout.ColumnScope
import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidthIn
import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll import androidx.compose.foundation.verticalScroll
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
@ -59,7 +60,9 @@ fun TipScreen(
horizontalAlignment = Alignment.CenterHorizontally, horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.spacedBy(8.dp, alignment = Alignment.CenterVertically) verticalArrangement = Arrangement.spacedBy(8.dp, alignment = Alignment.CenterVertically)
) { ) {
image() Column(modifier = Modifier.requiredWidthIn(max = 400.dp)) {
image()
}
ProvideTextStyle( ProvideTextStyle(
value = MaterialTheme.typography.h6.copy( value = MaterialTheme.typography.h6.copy(
color = ExtendedTheme.colors.text, color = ExtendedTheme.colors.text,

View File

@ -5,6 +5,7 @@ import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.requiredWidthIn
import androidx.compose.material.MaterialTheme import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text import androidx.compose.material.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
@ -13,6 +14,7 @@ import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import com.airbnb.lottie.compose.LottieAnimation import com.airbnb.lottie.compose.LottieAnimation
import com.airbnb.lottie.compose.LottieCompositionSpec import com.airbnb.lottie.compose.LottieCompositionSpec
import com.airbnb.lottie.compose.LottieConstants import com.airbnb.lottie.compose.LottieConstants
@ -24,13 +26,15 @@ import com.huanchengfly.tieba.post.ui.widgets.compose.TipScreen
val DefaultLoadingScreen: @Composable StateScreenScope.() -> Unit = { val DefaultLoadingScreen: @Composable StateScreenScope.() -> Unit = {
val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.lottie_loading_paperplane)) val composition by rememberLottieComposition(LottieCompositionSpec.RawRes(R.raw.lottie_loading_paperplane))
LottieAnimation( Box(modifier = Modifier.requiredWidthIn(max = 500.dp)) {
composition = composition, LottieAnimation(
iterations = LottieConstants.IterateForever, composition = composition,
modifier = Modifier iterations = LottieConstants.IterateForever,
.fillMaxWidth() modifier = Modifier
.aspectRatio(2f) .fillMaxWidth()
) .aspectRatio(2f)
)
}
// CircularProgressIndicator(modifier = Modifier.size(48.dp), color = MaterialTheme.colors.primary) // CircularProgressIndicator(modifier = Modifier.size(48.dp), color = MaterialTheme.colors.primary)
} }