LoadingLinear

fun LoadingLinear(modifier: Modifier = Modifier, text: String? = null, progress: Float = 0.0f, labelPosition: LabelPosition.Horizontal = LabelPosition.Horizontal.Center, labelTransition: Boolean = false, width: Dp = IndicatorWidth)

Loading Linear is used when there is a determinate loading time, when it is possible to know the completion time. Meant to be used when the process takes more than 10 seconds. Preferable when time remaining can be displayed.

Loading components indicates determinate or indeterminate loading time when retrieving data or performing slow computations.

Parameters

modifier

Modifier to be applied to the LoadingLinear

text

The text do be displayed below loading indicator

progress

The progress of this progress indicator, where 0.0 represents no progress and 1.0 represents full progress. Values outside of this range are coerced into the range.

labelPosition

indicates whether the label will be displayed. The default value is LabelPosition.Horizontal.Center.

labelTransition

controls whether the text switching transition is animated or not.

width

controls whether the text switching transition is animated or not.

See also

Samples

import androidx.annotation.IntRange
import androidx.compose.animation.AnimatedContent
import androidx.compose.animation.SizeTransform
import androidx.compose.animation.core.FiniteAnimationSpec
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.keyframes
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.animation.togetherWith
import androidx.compose.foundation.Canvas
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.progressSemantics
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.material3.Text
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalDensity
import androidx.compose.ui.semantics.clearAndSetSemantics
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.dp
import kotlinx.coroutines.delay
import net.ikea.skapa.foundation.*
import net.ikea.skapa.ui.LabelPosition
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.BallNormalSize
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.BallSqueezedSize
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.BallStretchedSize
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.DurationInMilliseconds
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.FloorDistance
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.HalfDistance
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.InitialDistance
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.TotalDistance
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.TravelDistanceFactor
import net.ikea.skapa.ui.components.LoadingProps.BallAnimation.atDuration
import net.ikea.skapa.ui.components.LoadingProps.LinearProgress.IndicatorHeight
import net.ikea.skapa.ui.components.LoadingProps.LinearProgress.IndicatorWidth

fun main() { 
   //sampleStart 
   SkapaTheme {
    Column(horizontalAlignment = Alignment.CenterHorizontally) {
        LoadingBall(
            variant = LoadingBallVariant.Emphasised,
            size = LoadingBallSize.Large
        )
    }
} 
   //sampleEnd
}