View jc-sc-3.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
class SegmentedControlActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
JetpackComposeDemoTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colors.background | |
) { | |
SegmentedControlPage() |
View jc-sc-2.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
val genders = listOf("Male", "Female") | |
SegmentedControl( | |
items = genders, | |
defaultSelectedItemIndex = 0 | |
) { | |
Log.e("CustomToggle", "Selected item : ${genders[it]}") | |
} |
View jc-sc-1.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
/** | |
* items : list of items to be render | |
* defaultSelectedItemIndex : to highlight item by default (Optional) | |
* useFixedWidth : set true if you want to set fix width to item (Optional) | |
* itemWidth : Provide item width if useFixedWidth is set to true (Optional) | |
* cornerRadius : To make control as rounded (Optional) | |
* color : Set color to control (Optional) | |
* onItemSelection : Get selected item index | |
*/ | |
@Composable |
View MainActivityDialog.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
class MainActivity : ComponentActivity() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContent { | |
JetpackComposeDemoTheme { | |
Surface( | |
modifier = Modifier.fillMaxSize(), | |
color = MaterialTheme.colors.background | |
) { | |
HomePage() |
View CustomDialog.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
@Composable | |
fun CustomDialog(value: String, setShowDialog: (Boolean) -> Unit, setValue: (String) -> Unit) { | |
val txtFieldError = remember { mutableStateOf("") } | |
val txtField = remember { mutableStateOf(value) } | |
Dialog(onDismissRequest = { setShowDialog(false) }) { | |
Surface( | |
shape = RoundedCornerShape(16.dp), | |
color = Color.White |
View lazycolumn.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
private val personsList = mutableListOf<PersonModel>() | |
@Composable | |
fun Dashboard(navController: NavHostController) { | |
Box(modifier = Modifier.fillMaxSize()){ | |
DashboardPage(navController) | |
} | |
} | |
@Composable |
View outlinedspinner.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
val options = listOf("Food", "Bill Payment", "Recharges", "Outing", "Other") | |
var expanded by remember { mutableStateOf(false) } | |
var selectedOptionText by remember { mutableStateOf(options[0]) } | |
ExposedDropdownMenuBox( | |
expanded = expanded, | |
onExpandedChange = { | |
expanded = !expanded | |
} |
View jcp2-6.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
ClickableText( | |
text = AnnotatedString("Forgot password?"), | |
onClick = { navController.navigate(Routes.ForgotPassword.route) }, | |
style = TextStyle( | |
fontSize = 14.sp, | |
fontFamily = FontFamily.Default | |
) | |
) |
View jcp2-5.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
ClickableText( | |
text = AnnotatedString("Sign up here"), | |
modifier = Modifier | |
.align(Alignment.BottomCenter) | |
.padding(20.dp), | |
onClick = { navController.navigate(Routes.SignUp.route) }, | |
style = TextStyle( | |
fontSize = 14.sp, | |
fontFamily = FontFamily.Default, | |
textDecoration = TextDecoration.Underline, |
View jcp2-4.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
@Composable | |
fun ScreenMain(){ | |
val navController = rememberNavController() | |
NavHost(navController = navController, startDestination = Routes.Login.route) { | |
composable(Routes.Login.route) { | |
LoginPage(navController = navController) | |
} |
NewerOlder