There are no reviews yet. Be the first to send feedback to the community and the maintainers!
Repository Details
๐๐งจ๐ Series of Tutorials to learn about Jetpack Compose with subjects Material Widgets, Layout, SubcomposeLayout, custom layouts, State, custom rememberable, recomposition, LaunchedEffect, side-effects, Gesture, Animation, Navigation, Canvas, UIs like whatsapp and others.
Jetpack Compose Tutorials and Playground
๐ค Overview
Series of Tutorials to learn about Jetpack Compose, Material Widgets, State, Animation, and
Navigation. Easy to search in code and in app. Each chapter module contains its own content in code.
SearchBar can be used to search with a tag or description available for each tutorial.
Recommended section is under constructions for now, when finished it will get recommended tags using
previous searches using a database, domain with ViewModel.
Tutorial
Preview
1-1 Column, Row, Box, Modifiers
Create Row that adds elements in horizontal order, and Column that adds elements in vertical order.
โข Column โข Row โข Box โข Modifier
1-2 Surface, Shape, Clickable
Create and modify Surface to draw background for Composables, add click action to any composable. Set weight or offset modifiers.
โข Surface โข Shape โข Clickable
Material Widgets
Tutorial
Preview
2-1 Text
Create Text component with different properties such as color, background, font weight, family, style, spacing and others
โข Text โข Row โข FontStyle โข Annotated String Hyperlink
2-2 Button, IconButton, FAB, Chip
Create button with text and/or with image, Floating Action Button or Chips. Modify properties of buttons including color, text, and click actions.
Create TextField component with regular style or outlined. Set error, colors, state, icons, and IME actions.
โข TextField โข OutlinedTextField โข IME โข Phone format VisualTransformation โข Regex
2-4 Image
Create Image with image, vector resource or with Painter, set image and Content scales to fit, expand or shrink image. Change shape of Image or apply ColorFilter and PorterDuff modes.
โข Image โข Canvas โข Drawable โข Bitmap
2-5 LazyColumn/Row/VerticalGrid
Vertical, horizontal grid lists with LazyColumn, LazyRow and LazyVerticalGrid. Use contentPadding set paddings for lists, verticalArrangement or horizontalArrangement for padding between items, rememberLazyListState to manually scroll.
TopAppbar with actions, overflow menus. Tabs with text only, image only and image+text with different background, divider, and indicators.
โข TopAppBar โข Overflow menu โข TabRow and Tab โข Tab Indicator, Divider
2-7 BottomNavigation
Bottom navigation bars allow movement between primary destinations in an app. BottomNavigation should contain multiple BottomNavigationItems, each representing a singular destination.
โข BottomNavigation โข BottomNavigationItem
2-8 BottomAppBar
A bottom app bar displays navigation and key actions at the bottom of screens.
โข BottomAppBar โข Scaffold
2-9-1 Side Navigation
A backdrop appears behind all other surfaces in an app, displaying contextual and actionable content.
โข Scaffold โข Side Navigation โข DrawerState
2-9-2 ModalDrawer
Modal navigation drawers block interaction with the rest of an appโs content with a scrim. They are elevated above most of the appโs UI and donโt affect the screenโs layout grid.
โข ModalDrawer โข DrawerState โข Scaffold
2-10-1 BottomSheet
Create bottom sheet using BottomSheetScaffold and rememberBottomSheetScaffoldState, create modal bottom sheets.
Add custom modifiers to Composable inside a custom layout using its scope like align modifier only available in specific Composable like a custom Column.
BoxWithConstraints is a composable that defines its own content according to the available space, based on the incoming constraints or the current LayoutDirection.
โข BoxWithConstraints โข Constraint
3-5 SubcomposeLayout
Subcompose layout which allows to subcompose the actual content during the measuring stage for example to use the values calculated during the measurement as params for the composition of the children.
Custom layout like whatsapp chat. Added quote and name tag resized to longest sibling using SubcomposeColumn from previous examples to have whole layout.
Use Interaction source to collect interactions or change scale of Composables based on interaction state.
โข clickable โข InteractionSource
5-1-3 InteractionSource2
Use InteractionSource to update touch state of multiple Composable or another Composable based on current interaction.
โข clickable โข InteractionSource
5-2 Tap&Drag Gesture
Use PointerInput to listen press, tap, long press, drag gestures. detectTapGestures is used for listening for tap, longPress, doubleTap, and press gestures.
Use PointerInput to listen for detectTransformGesture to get centroid, pan, zoom and rotate params.
โข pointerInput โข detectTransformGestures โข centroid โข pan โข zoom
5-4-1 AwaitPointerEventScope1
Use AwaitPointerEventScope to get awaitFirstDown for down events, waitForUpOrCancellation for up events, and awaitPointerEvent for move events with pointers.
Draw to canvas using touch down, move and up events using array of paths to have erase, undo, redo actions and set properties for each path separately.
Use blend(Porter-Duff) modes with androidx.compose.ui.graphics.Canvas to erase and compare pixels with erased Bitmap to find ou percentage of erased area.