This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LazyColumn( | |
modifier = Modifier.fillMaxSize(), | |
contentPadding = PaddingValues(horizontal = 10.dp) | |
) { | |
items(items = foodList) { food -> | |
FoodItemCard(foodItem = food) | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LazyRow( | |
modifier = Modifier | |
.fillMaxHeight(0.3f) | |
.fillMaxWidth() | |
.background(Color.LightGray, shape = RoundedCornerShape(topEnd = 10.dp, topStart = 10.dp)) | |
.padding(vertical = 10.dp) | |
.align(Alignment.BottomCenter), | |
verticalAlignment = Alignment.CenterVertically, | |
horizontalArrangement = Arrangement.Center | |
) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Modifier.pointerInput(Unit) { | |
detectDragGesturesAfterLongPress(onDragStart = { | |
currentState.dataToDrop = dataToDrop | |
currentState.isDragging = true | |
currentState.dragPosition = currentPosition + it | |
currentState.draggableComposable = content | |
}, onDrag = { change, dragAmount -> | |
change.consumeAllChanges() | |
currentState.dragOffset += Offset(dragAmount.x, dragAmount.y) | |
}, onDragEnd = { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Box(modifier = modifier.fillMaxSize()) | |
{ | |
content() | |
if (state.isDragging) { | |
var targetSize by remember { | |
mutableStateOf(IntSize.Zero) | |
} | |
Box(modifier = Modifier | |
.graphicsLayer { | |
val offset = (state.dragPosition + state.dragOffset) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LongPressDraggable(modifier = Modifier.fillMaxSize()) { | |
LazyColumn( | |
modifier = Modifier.fillMaxSize(), | |
contentPadding = PaddingValues(horizontal = 10.dp) | |
) { | |
items(items = foodList) { food -> | |
FoodItemCard(foodItem = food) | |
} | |
} | |
PersonListContainer() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val keyboardController = LocalSoftwareKeyboardController.current | |
//To hide keyboard | |
keyboardController?.hide() | |
//To show keyboard | |
keyboardController?.show() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val keyboardController = LocalSoftwareKeyboardController.current | |
var text by remember { | |
mutableStateOf("") | |
} | |
TextField( | |
value = text, | |
onValueChange = { text = it }, | |
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), | |
keyboardActions = KeyboardActions( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val focusManager = LocalFocusManager.current | |
var text by remember { | |
mutableStateOf("") | |
} | |
TextField( | |
value = text, | |
onValueChange = { text = it }, | |
keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done), | |
keyboardActions = KeyboardActions( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<activity | |
android:name=".MainActivity" | |
android:windowSoftInputMode="adjustResize" | |
.../> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val state = rememberLazyListState() | |
LazyColumn( | |
state = state, | |
modifier = Modifier.fillMaxSize(), | |
horizontalAlignment = Alignment.CenterHorizontally | |
){ | |
items(12) { item -> | |
YourTextField(item) | |
Spacer(modifier = Modifier.height(10.dp)) | |
} |