KotlinLeaner
11/24/2022, 1:32 PMColumn
inside my ColumnScope.ScanDeviceList
If I removed inside Column
form ColumnScope.ScanDeviceList
my views are misaligned. Is this because of AnimatedVisibility
? If yes, what is the solution for this? I am using AnimatedVisibility
because I want to give basic animation’s to my view and it also checking the condition. Many thanksKotlinLeaner
11/24/2022, 1:32 PM@Composable
fun PairContent(
viewModel: airViewModel,
scanDeviceList: List<ScanResult>,
) {
AnimatedVisibility(visible = true) {
AppBarScaffold() {
Column(
modifier = Modifier
.padding(10.dp)
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
) {
if (viewModel.isBluetoothEnabled) {
ScanDeviceList(scanDeviceList, modifier = Modifier.align(Alignment.Start))
} else {
// more condition
}
}
}
}
}
ScanDeviceList
@Composable
fun ColumnScope.ScanDeviceList(
scanDeviceList: List<ScanResult>,
modifier: Modifier = Modifier,
) {
Spacer(modifier = Modifier.height(10.dp))
AnimatedVisibility(
scanDeviceList.isNotEmpty(),
modifier = modifier
) {
Column {
Text(text ="xyz")
Spacer(
modifier = Modifier.height(10.dp)
)
scanDeviceList.forEachIndexed { index, scanResult ->
Surface {
ScanItem(index, scanResult, scanDeviceList)
}
}
}
}
}
Stylianos Gakis
11/24/2022, 2:56 PMKotlinLeaner
11/24/2022, 2:58 PMStylianos Gakis
11/24/2022, 2:59 PMKotlinLeaner
11/24/2022, 3:01 PMKotlinLeaner
11/24/2022, 3:02 PMKotlinLeaner
11/24/2022, 3:03 PMKotlinLeaner
11/24/2022, 3:03 PMDoris Liu
11/29/2022, 12:29 AMAnimatedVisibility { Column { children() } }
.