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 LocalBackPressedDispatcher = | |
| staticCompositionLocalOf<OnBackPressedDispatcher> { error("No Back Dispatcher provided") } | |
| @Composable | |
| fun MyBackPressed(onBackPressed: () -> Unit) { | |
| val backPressDispatcher = LocalBackPressedDispatcher.current | |
| val backCallBack = remember { | |
| object : OnBackPressedCallback(true) { | |
| override fun handleOnBackPressed() { |
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
| @Composable | |
| fun SideEffectTest() { | |
| val alphabets = arrayListOf("A", "B", "C", "D", "E", "F") | |
| var clickCount by remember { | |
| mutableStateOf(0) | |
| } | |
| /** | |
| * todo | |
| * composable ilk açılışta başarılı şekilde recompose olursa sideEffect çalışacaktır. |
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
| @Composable | |
| fun ImageDownloader() { | |
| val imageUrl = "http://my-image.profile.jpg" | |
| val imageRepository = ImageRepository(imageUrl) | |
| val imageLoadState by produceState(initialValue = "Start request", key1 = imageRepository) { | |
| val imageResult = imageRepository.loadImage() | |
| value = imageResult | |
| } | |
| Text(text = imageLoadState) |
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
| LaunchedEffect(key1 = userClickCount) { | |
| if (userClickCount > INITIAL_USER_CLICK_COUNT) | |
| scaffoldState.snackbarHostState.showSnackbar(currentCounterText) | |
| launchEffectControl(userClickCount) | |
| } | |
| fun CoroutineScope.launchEffectControl(userClickCount: Int) { | |
| launch { | |
| // 4 saniye öncesindeki tıklamaları yok sayar ! |
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
| var name: String by remember { | |
| mutableStateOf("") | |
| } | |
| var name: MutableState<String> = remember { | |
| mutableStateOf("") | |
| } | |
| var name: String by rememberSaveable { | |
| mutableStateOf("") |
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
| @Composable | |
| fun LoginScreen() { | |
| var name: String by remember { | |
| mutableStateOf("") | |
| } | |
| var password: String by remember { | |
| mutableStateOf("") | |
| } |
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
| @Composable | |
| fun StateLess(text: String, modifier: Modifier) { | |
| Text(text = text, modifier = modifier) | |
| } |
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
| @Composable | |
| fun StateFullText(text: String) { | |
| Text( | |
| text = text, | |
| modifier = Modifier | |
| .background(Color.Black) | |
| .blur(8.dp) | |
| .alpha(0.3F) | |
| .padding(16.dp), | |
| fontSize = 24.sp, |
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
| @ExperimentalComposeUiApi | |
| @Composable | |
| fun PasswordTextField() { | |
| val keyboardController = LocalSoftwareKeyboardController.current | |
| var passwordText by remember { | |
| mutableStateOf("") | |
| } | |
| var passwordVisibility by remember { |
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{ | |
| contacts().entries.forEach { | |
| stickyHeader { | |
| Text(text = "${it.key}") | |
| } | |
| items(it.value) { name -> | |
| Text(text = name) |
NewerOlder