Your Second Kotlin Android App

Aug 29 2023 · Kotlin 1.8.21, Android 13, Android Studio Flamingo | 2022.2.1

Part 4: Use Jetpack Navigation

29. Complete the TaskDetailsScreen Composable

Episode complete

Play next episode

Next
About this episode

Leave a rating/review

See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 28. Challenge: Set Up TaskDetailsScreenContent Next episode: 30. Navigate to a Compose Destination

Get immediate access to this and 4,000+ other videos and books.

Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and 4,000+ professional videos in a single subscription, it's simply the best investment you can make in your development career.

Learn more Already a subscriber? Sign in.

Transcript: 29. Complete the TaskDetailsScreen Composable

You have the TaskDetailScreenContent ready. In this episode, you’ll create the TaskDetailScreen composable that will be used to display the TaskDetailScreenContent composable.

Still insde the TaskDetailScreen.kt file, create a new composable named TaskDetailScreen.

@Composable
fun TaskDetailScreen() {
    
}

Inside the TaskDetailScreen composable, add the following code:

Scaffold(
    topBar = {
        ListMakerTopAppBar(
            title = "",
            showBackButton = true,
            onBackPressed = {}
        )
    },
    content = {
        TaskDetailsScreenContent(modifier = Modifier.padding(it), emptyList())
    },
    floatingActionButton = {
        ListMakerFloatingActionButton(
            title = stringResource(id = R.string.task_to_add),
            inputHint = stringResource(id = R.string.task_hint),
            onFabClick = { todoName ->

            }
        )
    }
)

Using same process as before, create the string resource named task_to_add with the value What is the task you want to add? Here’s a breakdown of what you’ve done:

  • You’re using the Scaffold composable to display the ListMakerTopAppBar and ListMakerFloatingActionButton composable. This is similar to what you did in the TaskListScreen composable. Notice that for the ListMakerTopAppBar composable, you’re passing an empty lambda to the onBackPressed parameter. You’ll implement the functionality later on in the course.
  • You’re displaying the TaskDetailsScreenContent composable. You’re passing an empty list to the taskTodos parameter. You’ll implement the functionality later on in the course.
  • You’re using the ListMakerFloatingActionButton composable to display the floating action button. You’re passing an empty lambda to the onFabClick parameter. You’ll implement the functionality later on in the course.