-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
59b65d3
commit bd38494
Showing
7 changed files
with
371 additions
and
0 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
app/src/main/java/com/streamliners/data/IndianStatesList.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package com.streamliners.data | ||
|
||
val indianStatesAndUTs = listOf( | ||
// States | ||
"Andhra Pradesh", | ||
"Arunachal Pradesh", | ||
"Assam", | ||
"Bihar", | ||
"Chhattisgarh", | ||
"Goa", | ||
"Gujarat", | ||
"Haryana", | ||
"Himachal Pradesh", | ||
"Jharkhand", | ||
"Karnataka", | ||
"Kerala", | ||
"Madhya Pradesh", | ||
"Maharashtra", | ||
"Manipur", | ||
"Meghalaya", | ||
"Mizoram", | ||
"Nagaland", | ||
"Odisha", | ||
"Punjab", | ||
"Rajasthan", | ||
"Sikkim", | ||
"Tamil Nadu", | ||
"Telangana", | ||
"Tripura", | ||
"Uttar Pradesh", | ||
"Uttarakhand", | ||
"West Bengal", | ||
|
||
// Union Territories | ||
"Andaman and Nicobar Islands", | ||
"Chandigarh", | ||
"Dadra and Nagar Haveli and Daman and Diu", | ||
"Delhi", | ||
"Jammu and Kashmir", | ||
"Ladakh", | ||
"Lakshadweep", | ||
"Puducherry" | ||
) |
82 changes: 82 additions & 0 deletions
82
app/src/main/java/com/streamliners/feature/dialogs_sample/DialogsSampleScreen.kt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package com.streamliners.feature.dialogs_sample | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Column | ||
import androidx.compose.foundation.layout.fillMaxSize | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.material3.Button | ||
import androidx.compose.material3.SnackbarHostState | ||
import androidx.compose.material3.Text | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.runtime.rememberCoroutineScope | ||
import androidx.compose.ui.Alignment | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.unit.dp | ||
import androidx.navigation.NavController | ||
import com.streamliners.compose.android.comp.appBar.TitleBarScaffold | ||
import com.streamliners.compose.android.comp.selectDialog.SelectDialog | ||
import com.streamliners.compose.android.comp.selectDialog.rememberSelectDialogState | ||
import com.streamliners.compose.android.comp.selectDialog.showForMultipleSelection | ||
import com.streamliners.compose.android.comp.selectDialog.showForSingleSelection | ||
import com.streamliners.compose.comp.Center | ||
import com.streamliners.data.indianStatesAndUTs | ||
import kotlinx.coroutines.launch | ||
|
||
@Composable | ||
fun DialogsSampleScreen( | ||
navController: NavController | ||
) { | ||
|
||
val scope = rememberCoroutineScope() | ||
val snackbarHostState = remember { SnackbarHostState() } | ||
val selectDialogState = rememberSelectDialogState<String>() | ||
|
||
TitleBarScaffold( | ||
title = "Dialogs Samples", | ||
navigateUp = { navController.navigateUp() }, | ||
snackbarHostState = snackbarHostState | ||
) { paddingValues -> | ||
|
||
Column( | ||
modifier = Modifier | ||
.fillMaxSize() | ||
.padding(paddingValues) | ||
.padding(16.dp), | ||
horizontalAlignment = Alignment.CenterHorizontally, | ||
verticalArrangement = Arrangement.Center | ||
) { | ||
Button( | ||
onClick = { | ||
selectDialogState.showForSingleSelection( | ||
"Select your Gender", | ||
listOf("Male", "Female", "Other") | ||
) { selection -> | ||
scope.launch { | ||
snackbarHostState.showSnackbar("You selected : $selection") | ||
} | ||
} | ||
} | ||
) { | ||
Text(text = "Show Single Select Dialog") | ||
} | ||
|
||
Button( | ||
onClick = { | ||
selectDialogState.showForMultipleSelection( | ||
"Select your Favourite states", | ||
indianStatesAndUTs | ||
) { selection -> | ||
scope.launch { | ||
snackbarHostState.showSnackbar("You selected : $selection") | ||
} | ||
} | ||
} | ||
) { | ||
Text(text = "Show Multi Select Dialog") | ||
} | ||
} | ||
} | ||
|
||
SelectDialog(mState = selectDialogState) | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.