refactor: Use Skeleton item as a loader component of Confirmation dialogs

This commit is contained in:
Artem Chepurnoy 2023-12-30 11:44:38 +02:00
parent de6985d8d6
commit bca0d1d965
No known key found for this signature in database
GPG Key ID: FAC37D0CF674043E
1 changed files with 7 additions and 8 deletions

View File

@ -6,13 +6,13 @@ import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.ExperimentalLayoutApi import androidx.compose.foundation.layout.ExperimentalLayoutApi
import androidx.compose.foundation.layout.FlowRow import androidx.compose.foundation.layout.FlowRow
import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.icons.Icons import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.outlined.Info import androidx.compose.material.icons.outlined.Info
import androidx.compose.material3.Checkbox import androidx.compose.material3.Checkbox
import androidx.compose.material3.CircularProgressIndicator
import androidx.compose.material3.Icon import androidx.compose.material3.Icon
import androidx.compose.material3.LocalContentColor import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.LocalTextStyle
@ -24,7 +24,6 @@ import androidx.compose.runtime.getValue
import androidx.compose.runtime.key import androidx.compose.runtime.key
import androidx.compose.runtime.remember import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberUpdatedState import androidx.compose.runtime.rememberUpdatedState
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.text.TextStyle import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.input.KeyboardType import androidx.compose.ui.text.input.KeyboardType
@ -48,6 +47,7 @@ import com.artemchep.keyguard.ui.FlatItemLayout
import com.artemchep.keyguard.ui.FlatTextField import com.artemchep.keyguard.ui.FlatTextField
import com.artemchep.keyguard.ui.MediumEmphasisAlpha import com.artemchep.keyguard.ui.MediumEmphasisAlpha
import com.artemchep.keyguard.ui.PasswordStrengthBadge import com.artemchep.keyguard.ui.PasswordStrengthBadge
import com.artemchep.keyguard.ui.skeleton.SkeletonItem
import com.artemchep.keyguard.ui.theme.Dimens import com.artemchep.keyguard.ui.theme.Dimens
import com.artemchep.keyguard.ui.theme.combineAlpha import com.artemchep.keyguard.ui.theme.combineAlpha
import com.artemchep.keyguard.ui.theme.monoFontFamily import com.artemchep.keyguard.ui.theme.monoFontFamily
@ -86,7 +86,10 @@ fun ConfirmationScreen(
content = if (showContent) { content = if (showContent) {
// composable // composable
{ {
Column { Column(
modifier = Modifier
.fillMaxWidth(),
) {
val items = state.items.getOrNull().orEmpty() val items = state.items.getOrNull().orEmpty()
if (args.message != null) { if (args.message != null) {
Text( Text(
@ -112,11 +115,7 @@ fun ConfirmationScreen(
} }
if (state.items is Loadable.Loading) { if (state.items is Loadable.Loading) {
CircularProgressIndicator( SkeletonItem()
modifier = Modifier
.align(Alignment.CenterHorizontally)
.padding(16.dp),
)
} }
} }
} }