Skip to main content
AI Assist is now on Stack Overflow. Start a chat to get instant answers from across the network. Sign up to save and share your chats.
added 466 characters in body
Source Link
Gabriele Mariotti
  • 370.1k
  • 114
  • 1k
  • 935

To apply the align modifier you can scope your composable with the required scope.
You can use:

@Composable fun ColumnScope.Devices( isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = Modifier.fillMaxWidth().align(Alignment.Start) ) { Text("xxx") } } 

Otherwise you can use:

@Composable fun Devices( modifier: Modifier, isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = modifier ) { Text("xxx") } } 

and then

item(){ Column() { Devices( modifier = Modifier.fillMaxWidth().align(Alignment.Start), isEmpty = true) } } 

To apply the align modifier you can scope your composable with the required scope.
You can use:

@Composable fun ColumnScope.Devices( isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = Modifier.fillMaxWidth().align(Alignment.Start) ) { Text("xxx") } } 

To apply the align modifier you can scope your composable with the required scope.
You can use:

@Composable fun ColumnScope.Devices( isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = Modifier.fillMaxWidth().align(Alignment.Start) ) { Text("xxx") } } 

Otherwise you can use:

@Composable fun Devices( modifier: Modifier, isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = modifier ) { Text("xxx") } } 

and then

item(){ Column() { Devices( modifier = Modifier.fillMaxWidth().align(Alignment.Start), isEmpty = true) } } 
Post Undeleted by Gabriele Mariotti
deleted 536 characters in body
Source Link
Gabriele Mariotti
  • 370.1k
  • 114
  • 1k
  • 935

You can use different layouts inTo apply the itemalign blockmodifier you can scope your composable with the required scope.
Something likeYou can use:

 LazyColumn(@Composable  verticalArrangement =fun ArrangementColumnScope.Top,Devices(   horizontalAlignment =isEmpty: Alignment.CenterHorizontallyBoolean,  ){  item(){   RowAnimatedVisibility(   Modifier.fillMaxWidth()isEmpty,   horizontalArrangementmodifier = Arrangement.Start ){  Text("Start") } } item(){ Row( Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Centeralign(Alignment.Start)   ) {   Text("Center""xxx")   }  } } 

enter image description here

You can use different layouts in the item block.
Something like:

 LazyColumn(  verticalArrangement = Arrangement.Top,   horizontalAlignment = Alignment.CenterHorizontally  ){  item(){   Row(   Modifier.fillMaxWidth(),   horizontalArrangement = Arrangement.Start ){  Text("Start") } } item(){ Row( Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center   ){   Text("Center")   }  } } 

enter image description here

To apply the align modifier you can scope your composable with the required scope.
You can use:

@Composable fun ColumnScope.Devices( isEmpty: Boolean, ) { AnimatedVisibility( isEmpty, modifier = Modifier.fillMaxWidth().align(Alignment.Start) ) { Text("xxx") } } 
Post Deleted by Gabriele Mariotti
Source Link
Gabriele Mariotti
  • 370.1k
  • 114
  • 1k
  • 935

You can use different layouts in the item block.
Something like:

 LazyColumn( verticalArrangement = Arrangement.Top, horizontalAlignment = Alignment.CenterHorizontally ){ item(){ Row( Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Start ){ Text("Start") } } item(){ Row( Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.Center ){ Text("Center") } } } 

enter image description here