Skip to content

Instantly share code, notes, and snippets.

fun MenuView(
modifier: Modifier = Modifier,
menuSections: List<MenuSections> = FakeData.menuData
) {
val scope = rememberCoroutineScope()
val sectionsListState = rememberLazyListState()
val itemsListState = rememberLazyListState()
var selectedSectionIndex by remember { mutableStateOf(0) }
fun MenuView(
modifier: Modifier = Modifier,
menuSections: List<MenuSections> = FakeData.menuData
) {
val scope = rememberCoroutineScope()
...
...
MenuSectionsView(
selectedIndex = selectedSectionIndex,
menuSections = menuSections,
@Composable
fun MenuView(
modifier: Modifier = Modifier,
menuSections: List<MenuSections> = FakeData.menuData
) {
val scope = rememberCoroutineScope()
...
...
MenuItemsView(
menuSections = menuSections,
@Composable
fun MenuSectionsView(
selectedIndex: Int,
menuSections: List<MenuSections>,
sectionsListState: LazyListState,
onClick: (sectionIndex: Int) -> Unit
) {
LazyRow(
modifier = Modifier.padding(),
state = sectionsListState
@Composable
fun MenuItemView(section: MenuSections) {
Column {
section.menuItems.forEach { menuItem ->
Column(Modifier.padding(10.dp)) {
Row(
verticalAlignment = Alignment.CenterVertically
) {
Column(
modifier = Modifier.weight(1f),
@Composable
fun MenuItemsView(
menuSections: List<MenuSections>,
itemsListState: LazyListState,
onPostScroll: () -> Unit
) {
LazyColumn(
state = itemsListState,
modifier = Modifier
.padding()
@Composable
fun SectionTextView(
modifier: Modifier = Modifier,
text: String,
isSelected: Boolean
) {
Column(modifier) {
var textWidth by remember { mutableStateOf(0.dp) }
val density = LocalDensity.current
//User name text field
Column{
val focusManager = LocalFocusManager.current
AppTextField(
text = viewModel.firstName,
placeholder = "First Name",
onChange = {
viewModel.firstName = it
},
class FormViewModel : ViewModel() {
var firstName by mutableStateOf("")
var lastName by mutableStateOf("")
var password by mutableStateOf("")
var mobileNumber by mutableStateOf("")
var mobileCountryCode by mutableStateOf("")
var dateOfBirth by mutableStateOf("")
//...
fun AppTextField(
modifier: Modifier = Modifier,
text: String,
placeholder: String,
leadingIcon: @Composable (() -> Unit)? = null,
onChange: (String) -> Unit = {},
imeAction: ImeAction = ImeAction.Next,
keyboardType: KeyboardType = KeyboardType.Text,
keyBoardActions: KeyboardActions = KeyboardActions(),
isEnabled: Boolean = true