🚀🧨📝 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.

Overview

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.

• Button
• IconButton
• FloatingActionButton
• Chip

2-3 TextField


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.

• LazyColumn(Vertical RecyclerView)
• LazyRow(Horizontal RecyclerView
• LazyVerticalGrid(GridLayout)
• StickyHeaders

2-6 TopAppbar & Tab


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.

• BottomSheetScaffold
• BottomSheetState
• ModalBottomSheetLayout

2-10-4 BottomDrawer


BottomDrawer with BottomAppBar.

• BottomDrawer
• BottomAppBar
• Scaffold

2-10-5 BackdropScaffold


BackdropScaffold provides an API to put together several material components to construct your screen.

2-11 Snackbar, Progress, Selection


Create Snackbars with various layouts and styling, Checkboxes with selectable text, tri state checkbox, grouped radio buttons and sliders.

• SnackBar
• ProgressIndicator
• Checkbox
• TriStateCheckbox
• Switch
• RadioButton
• Slider
• RangeSlider

2-12 Dialog, AlertDialog


Create Dialog, and AlertDialog with standard and custom layouts. Implement on dismiss logic and get result when dialog is closed.

• AlertDialog
• Dialog
• DialogProperties

Layout

Tutorial Preview

3-1-1 Custom Modifier


Create custom layout using using layout, Measurable, Constraint, Placeable.

• Custom Modifier
• Measurable
• Constraint
• Placeable

3-1-3 graphicsLayer


Use Modifier.offset{} and Modifier.graphicsLayer{} to scale, translate or change other properties of a Composable.

• Modifier
• graphicsLayer

3-2-1 Custom Layout


Create custom layout using using MeasurePolicy and use intrinsic dimensions.

• Custom Layout
• Measurable
• Constraint
• Placeable

3-3-1 Scope&ParentDataModifier


Add custom modifiers to Composable inside a custom layout using its scope like align modifier only available in specific Composable like a custom Column.

• Custom Layout
• Scope
• ParentDataModifier
• Measurable
• Constraint
• Placeable

3-4 BoxWithConstraints


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.

• SubcomposeLayout
• Constraint
• Measurable
• Constraint
• Placeable

3-6-1 Custom Chat Layouts1


Custom layout like whatsapp chat layout that moves time and message read status layout right or bottom based on message width.

• Custom Layout
• Measurable
• Constraint
• Placeable

3-6-2 Custom Chat SubcomposeLayout


Custom layout like whatsapp chat. Added quote and name tag resized to longest sibling using SubcomposeColumn from previous examples to have whole layout.

• Custom Layout
• SubcomposeLayout
• Measurable
• Constraint
• Placeable

State

Tutorial Preview

4-1 Remember&MutableState


Remember and mutableState effect recomposition and states.

• remember
• State
• Recomposition

4-2-3 Scoped Recomposition


How hierarchy of Composables effects Smart Composition.

• remember
• Recomposition
• State

4-4 Custom Remember


Create a custom remember and custom component to have badge that changes its shape based on properties set by custom rememberable.

• remember
• State
• Recomposition
• Custom Layout

4-5-1 SideEffect1


Use remember functions like rememberCoroutineScope, and rememberUpdatedState and side-effect functions such as LaunchedEffect and DisposableEffect.

• remember
• rememberCoroutineScope
• rememberUpdatedState
• LaunchedEffect
• DisposableEffect

4-5-2 SideEffect2


Use SideEffect, derivedStateOf, produceState and snapshotFlow.

• remember
• SideEffect
• derivedStateOf
• produceStateOf
• snapshotFlow

4-7-3 Compose Phases3


How deferring a state read changes which phases of frame(Composition, Layout, Draw) are called.

• Modifier
• Recomposition
• Composition
• Layout
• Draw

Gesture

Tutorial Preview

5-1-1 Clickable


Use clickable modifier, Indication. Indication to clip ripples, or create custom ripple effects.

• clickable
• Indication
• rememberRipple
• pointerInput
• pointerInteropFilter

5-1-2 InteractionSource1


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.

• pointerInput
• pointerInteropFilter
• detectTapGestures
• detectDragGestures
• onPress
• onDoubleTap

5-3 Transform 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.

• AwaitPointerEventScope
• PointerInputChange
• awaitFirstDown
• waitForUpOrCancellation
• awaitPointerEvent
• awaitTouchSlopOrCancellation
• awaitDragOrCancellation

5-4-3 Centroid, Zoom, Pan, Rotation


Use AwaitPointerEventScope to calculate centroid position and size, zoom, pan, and rotation.

• AwaitPointerEventScope
• centroid
• pan
• zoom

5-6-2 Gesture Propagation1


Consume different type of touch events in Composable in an hierarchy to display gesture propagation between parent and children with MOVE gestures.

• AwaitPointerEventScope
• pointerInput
• consume
• consumePositionChange
• anyChangeConsumed

5-6-4 Transform Propagation


Consume events to rotate, zoom, move or apply drag or move events on Composables.
• AwaitPointerEventScope
• detectTransformGestures
• consume
• consumePositionChange
• anyChangeConsumed
• pan
• zoom

5-9-4 Collapsing TopAppBar


Create a collapsing TopAppBar using Modifier.nestedScroll and NestedScrollConnection.
• nestedScroll
• NestedScrollConnection

5-10-1 Image Touch Detection


Detect touch position on image and get color at touch position.
• Image
• AwaitPointerEventScope

5-11 Zoomable LazyColumn


Zoom images inside a LazyColum.
• Image
• Zoom
• AwaitPointerEventScope

Graphics

Tutorial Preview

6-1-1 Canvas Basics 1


Use canvas draw basic shapes like line, circle, rectangle, and points with different attributes such as style, stroke cap, brush.

• Canvas
• DrawScope
• Path
• Path Effect

6-1-2 Canvas Basics 2


Use canvas to draw arc, with path effect, stroke cap, stroke join, miter and other attributes and draw images with src, dst attributes.

• Canvas
• DrawScope
• Path
• Path Effect

6-1-3 Canvas Paths


Use canvas to draw path using absolute and relative positions, adding arc to path, drawing custom paths, progress, polygons, quads, and cubic.

• Canvas
• DrawScope
• Path
• Path Effect

6-1-4 Canvas Path Ops


Use canvas to clip paths, or canvas using path, or rectangle with operations such as Difference, Intersect, Union, Xor, or ReverseDifference..

• Canvas
• DrawScope
• Path
• PathOperation
• ClipOperation

6-1-5 Canvas Path Segments


Use canvas to flatten Android Path to path segments and display PathSegment start and/or end points.

• Canvas
• DrawScope
• Path
• PathSegment

6-1-6 Canvas PathEffect


Use PathEffect such as dashedPathEffect, cornerPathEffect, chainPathEffect and stompedPathEffect to draw shapes add path effects around Composables

• Canvas
• DrawScope
• Path
• Path Effect

6-2 Blend(Porter-Duff) Modes


Use blend(Porter-Duff) modes to change drawing source/destination or clip based on blend mode ,and manipulate pixels.

• Canvas
• DrawScope
• Path
• Path Effect
• BlendMode

6-4-2 Drawing App


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.

• Canvas
• DrawScope
• Path
• AwaitPointerEventScope
• PointerInputChange
• BlendMode

6-5 Color Picker


Color Picker that calculates angle from center and gets a color using hue and returns a color as in HSL or RGB color model.

• Canvas
• DrawScope
• Path
• AwaitPointerEventScope
• PointerInputChange
• BlendMode

6-6 Scale/Translation Edit


Editable Composable that changes position and scale when touched and dragged from handles or changes position when touched inside.

• Canvas
• DrawScope
• Scale
• Translate
• AwaitPointerEventScope
• PointerInputChange

Resources and References

Codelab Jetpack Compose Basics
Codelab Jetpack Compose Layouts
Codelab Jetpack Compose States
Codelab Jetpack Compose Advanced State
Developer Android
Developer Android Material
Jetpack Compose Samples
Under the hood of Jetpack Compose — part 2 of 2- Leland Richardson
What is “donut-hole skipping” in Jetpack Compose?-Vinay Gaba
Android Graphics
Playing with Paths-Nick Butcher
Custom Shape with Jetpack Compose-Julien Salvi
Porter Duff Mode
Porter/Duff Compositing and Blend Modes
Practical Image PorterDuff Mode Usage in Android-Elye
Android Image Lighting Control and Color Filtering-Elye
Android Image Color Change With ColorMatrix-Elye
Manipulating images and Drawables with Android’s ColorFilter-Nick Rout

You might also like...
Send Whatsapp Message Without Saving Mobile Number

Send Whatsapp Message Without Saving Mobile Number In this project i created the

A simple calendar with events, customizable widgets and no ads.
A simple calendar with events, customizable widgets and no ads.

Simple Calendar A simple calendar with events and a customizable widget. A simple calendar with optional CalDAV synchronization. You can easily create

A sample Music Player project that help you learn about Compose in Android
A sample Music Player project that help you learn about Compose in Android

Music App Compose UI A sample Music Player project that help you learn about Compose in Android. Note that this app only contain UI and has no logic.

Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin Gradle DSL.

SampleCompose Modular Android architecture which showcase Kotlin, MVVM, Navigation, Hilt, Coroutines, Jetpack compose, Retrofit, Unit test and Kotlin

A toy port scanner to help me (and you!) learn Kotlin + Akka.

kotlin-akka-portscan A toy program to help me (and you!) learn Kotlin + Akka. butwhy.gif When I want to learn a new language, I've found it helpful to

Learn how to make an app designed for single-screen devices shine when running on foldable and dual-screen devices

dcberlin21-workshop Make your app shine om foldable devices with the samples we have here. Related links SDK open-source code SDK samples (Kotlin) App

A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.
A basic, incomplete, buggy, far from efficient UI toolkit for Kotlin/Android. An experiment for fun and to learn.

Apex Apex is just a simple proof of concept to demonstrate how easily you can build your own UI Toolkit from scratch. This code base is most likely fu

Owner
Smart Tool Factory
🚀 Building colorful and shiny things with Compose(Jetpack Compose Artist🎨)
Smart Tool Factory
Application to facilitate the allocation of over quotas of the subjects of a career in a practical

Application to facilitate the allocation of over quotas of the subjects of a career in a practical, intuitive and equitable way among students who were left without a quota at the time of enrollment.

Fede Sandoval 3 May 17, 2022
Android Kotlin Fundamentals codelab(Lesson 2: Layouts(Constraints Layout))

ColorsMyView Finished code for Android Kotlin Fundamentals codelab(Lesson 2: Layouts(Constraints Layout)) Introduction The ColorMyViews app is inspire

Animesh Roy 0 Nov 26, 2021
A clone of hn.premii.com implemented in KMP with Web (React), iOS (Swift UI), Android and Desktop (Compose) UIs

An clone of hn.premii.com implemented in Kotlin Multiplatform with shared Android/Desktop Compose UI, SwiftUI on iOS and React for Web This example su

Tarek Belkahia 7 Feb 5, 2022
Counterpart of onTouchEvent for Jetpack Compose and transform gesture with specific number of pointers

Counterpart of onTouchEvent for Jetpack Compose and transform gestures notify when last pointer is up number of pointer that are down or list of pointers that can be used to get details of events when gesture is on

Smart Tool Factory 19 Nov 19, 2022
Kotlin Tutorials for new learners.

Kotlin Programming Tutorial for Beginners Learn Kotlin Programming, its basics and Fundamentals from scratch. Topics to be covered Overview Course int

INTELLISOFT 8 Apr 21, 2022
A basic library that enables easy composition of gesture sequence recognition on a view

GestureSequence A basic library that enables easy composition of gesture sequence recognition on a view. Basic API looks like: // Perform action() whe

Paul Klauser 8 Nov 2, 2022
An application to follow popular movies and tv series and create watch list

MoviesAndTV MoviesAndTV is an application to follow popular movies and tv series and create watch list from your favorite tv series and movies. Also y

Elvan Erdem 3 May 25, 2022
Android app for streaming and downloading Movies, TV-Series and Anime.

The main app CloudStream-3 DOWNLOAD: https://github.com/LagradOst/CloudStream-3/releases Features: AdFree, No ads whatsoever No tracking/analytics Boo

ArjixWasTaken 4 Aug 5, 2022
A canvas you can draw on with different colors.

Simple Draw A canvas you can draw on with different colors. Want to draw something but you have no paper? This app will suit you perfectly. Just pick

Simple Mobile Tools 408 Dec 29, 2022
Kotlin-koans - Kotlin Koans are a series of exercises to get you familiar with the Kotlin Syntax

kotlin-koans-edu Kotlin Koans are a series of exercises to get you familiar with

null 1 Jan 11, 2022