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 Greeting(name: String?) { | |
AnimatedVisibility( | |
visible = name != null | |
) { | |
val rememberedName = remember(this) { name!! } | |
Text(text = rememberedName) | |
} | |
} |
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 Greeting(name: String?) { | |
AnimatedVisibility( | |
visible = name != null, | |
exit = fadeOut(animationSpec = tween(durationMillis = 3_000)) | |
) { | |
Text(text = "Hello $name") | |
} | |
} |
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 Greeting(name: String?) { | |
AnimatedVisibility( | |
visible = name != null, | |
) { | |
if (name != null) Text(text = name) | |
} | |
} |
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 Greeting(name: String?) { | |
AnimatedVisibility( | |
visible = name != null, | |
) { | |
Text(text = name!!) | |
} | |
} |
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 { | |
ComposePlaygroundTheme { | |
Surface(modifier = Modifier.fillMaxSize(), color = MaterialTheme.colorScheme.background) { | |
var name by remember { mutableStateOf<String?>("Hello World") } | |
Column( | |
modifier = Modifier.fillMaxSize(), |
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 UserFragment { | |
private var userView: UserView? | |
override fun onCreateView( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
savedInstanceState: Bundle? | |
): View { | |
userView = UserView.inflate(inflater, container) |
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 UserView private constructor( | |
private val binding: UserViewBinding, | |
) { | |
companion object { | |
fun inflate( | |
inflater: LayoutInflater, | |
container: ViewGroup?, | |
) = UserView( |
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
data class Event(val username: String) | |
class UserViewModel : ViewModel() { | |
val events = MutableSharedFlow<Event> | |
} | |
class UserFragment : Fragment() { | |
private val viewModel by viewModels<UserViewModel>() |
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
data class Event(val username: String) | |
class UserViewModel : ViewModel() { | |
val events = MutableSharedFlow<Event> | |
} | |
class UserFragment : Fragment() { | |
private val viewModel by viewModels<UserViewModel>() |
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
version: "3.9" | |
secrets: | |
POSTGRES_PASSWORD: | |
external: true | |
services: | |
api_service: | |
image: yourServerImage:latest | |
deploy: |
NewerOlder