Skip to content

Instantly share code, notes, and snippets.

View fvilarino's full-sized avatar

Francesc Vilariño Güell fvilarino

View GitHub Profile
@fvilarino
fvilarino / action_menu_08.kt
Created November 7, 2022 06:47
App Bar Final
sealed interface ActionMenuItem {
val title: String
val onClick: () -> Unit
sealed interface IconMenuItem : ActionMenuItem {
val icon: ImageVector
val contentDescription: String?
data class AlwaysShown(
override val title: String,
@fvilarino
fvilarino / shared_app_bar_final.kt
Last active August 20, 2024 10:55
Shared App Bar - Final
val HomeRoute = "home"
val SettingsRoute = "settings"
val ManyOptionsRoute = "manyOptions"
val NoAppBarRoute = "noAppBar"
sealed interface Screen {
val route: String
val isAppBarVisible: Boolean
val navigationIcon: ImageVector?
val navigationIconContentDescription: String?
@fvilarino
fvilarino / circular_carousel_14.kt
Created August 5, 2022 05:20
Circular Carousel Final
@fvilarino
fvilarino / draggable_content_final.kt
Created June 22, 2023 18:56
Draggable Contente - Final
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
PlaygroundTheme {
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background,
) {
Box {
@fvilarino
fvilarino / animiated_drawer_final.kt
Created November 24, 2022 22:56
Animated Drawer - Final
@Stable
interface AnimatedDrawerState {
var density: Float
val drawerWidth: Dp
val drawerTranslationX: Float
val drawerElevation: Float
val backgroundTranslationX: Float
val backgroundAlpha: Float
@fvilarino
fvilarino / container_transform_animation.kt
Created April 26, 2024 02:56
Container Transform - Animation
@Composable
fun MorphingFab(modifier: Modifier = Modifier) {
val users = remember { mutableStateListOf<User>() }
// 1
var showDialog by remember { mutableStateOf(false) }
// 2
SharedTransitionLayout(
modifier = Modifier
.fillMaxSize(),
) {
@fvilarino
fvilarino / container_transform_baseline.kt
Last active April 26, 2024 02:53
Container Transform - Baseline
@Composable
fun MorphingFab(modifier: Modifier = Modifier) {
val users = remember { mutableStateListOf<User>() }
Box(modifier = modifier) {
UserList(
users = users,
modifier = Modifier.fillMaxSize(),
)
InputBox(
@fvilarino
fvilarino / container_transform_input_box.kt
Created April 26, 2024 02:47
Container Transform - Input Box
// 1
@Composable
fun InputBox(
onAddUser: (User) -> Unit,
onCancel: () -> Unit,
modifier: Modifier = Modifier,
) {
// 2
Card(
modifier = modifier,
@fvilarino
fvilarino / container_transform_final.kt
Created April 26, 2024 01:59
Container Transform - Final
data class User(
val name: String,
val email: String,
)
@OptIn(ExperimentalSharedTransitionApi::class)
@Composable
fun MorphingFab(modifier: Modifier = Modifier) {
val users = remember { mutableStateListOf<User>() }
var showDialog by remember { mutableStateOf(false) }
@fvilarino
fvilarino / container_transform_fab.kt
Created April 26, 2024 01:19
Container Transform - FAB
FloatingActionButton(
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(all = 16.dp),
onClick = {
// TODO
}
) {
Icon(
imageVector = Icons.Default.Add,