I am making a messaging application with Jetpack compose, when textfield enable, topbar is hidden upwards
Scaffold(
topBar = {
CenterAlignedTopAppBar(modifier = Modifier
.height(50.dp)
.clip(RoundedCornerShape(10.dp)),
title = {
Row {
Box(modifier = Modifier
.size(40.dp)
.align(Alignment.CenterVertically)){
Image(modifier = Modifier
.fillMaxSize()
.clip(CircleShape),bitmap = ImageBitmap.imageResource(R.drawable.numan) , contentDescription = null, contentScale = ContentScale.Crop )
}
Spacer(modifier = Modifier.padding(horizontal = 2.dp))
Text(modifier = Modifier
.padding(top = 12.dp)
.fillMaxHeight(),
text = username.toString(), fontFamily = googleSans, color = MaterialTheme.colorScheme.secondary
)
}
},
navigationIcon = {
Icon(modifier = Modifier
.fillMaxHeight()
.width(30.dp)
.clickable {
navController.navigateUp()
},imageVector = Icons.Filled.ArrowBack, contentDescription = "back", tint = MaterialTheme.colorScheme.secondary)
}
,colors = TopAppBarDefaults.centerAlignedTopAppBarColors(
contentColorFor(backgroundColor = MaterialTheme.colorScheme.primary),
))
}
, containerColor = MaterialTheme.colorScheme.primary)
When I set windowSoftInputMode:adjustResize, the messaging screen works as I want, but other screens with textfields (for example login screen) were distorted.Although I tried all the ways such as AdjustPan, it did not give the result I wanted, I did it directly in the surface before scaffold, I changed it this way, but the problem was not solved again, how to solve this problem, thank you to everyone who helps me in advance.
OutlinedTextField(modifier = Modifier
.fillMaxWidth(),
value = myMessage.value,
onValueChange ={
myMessage.value = it
}, trailingIcon ={
Icon(imageVector = Icons.Filled.Send,
contentDescription = null,
tint = MaterialTheme.colorScheme.onPrimary)
},
placeholder = {
Text(text = "Mesaj Yaz...")
},
colors = OutlinedTextFieldDefaults.colors(
focusedBorderColor = MaterialTheme.colorScheme.onPrimary,
unfocusedBorderColor = MaterialTheme.colorScheme.onPrimary,
cursorColor = MaterialTheme.colorScheme.onPrimary,
focusedTextColor = MaterialTheme.colorScheme.onPrimary,
unfocusedTextColor = MaterialTheme.colorScheme.onPrimary,
focusedPlaceholderColor = MaterialTheme.colorScheme.onPrimary,
unfocusedPlaceholderColor = MaterialTheme.colorScheme.onPrimary,
selectionColors = TextSelectionColors(handleColor = MaterialTheme.colorScheme.onPrimary,
backgroundColor = MaterialTheme.colorScheme.primary)
),
keyboardOptions = KeyboardOptions(capitalization = KeyboardCapitalization.Sentences)
)
}
}
}```