Skip to content

Commit

Permalink
#3 - Remember in Composition
Browse files Browse the repository at this point in the history
  • Loading branch information
jhg3410 committed Jan 30, 2023
1 parent 346fb61 commit a791948
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,11 @@ import androidx.compose.ui.unit.dp
fun WaterCounter(modifier: Modifier = Modifier) {
Column(modifier = modifier.padding(16.dp)) {
var count by remember { mutableStateOf(0) }

if (count > 0) {
var showTask by remember { mutableStateOf(true) }
if (showTask) {
WellnessTaskItem(
taskName = "Have you taken your 15 minute walk today?",
onClose = { showTask = false }
)
}
Text(text = "You've had $count glasses")
Text("You've had $count glasses.")
}

Row(modifier = Modifier.padding(top = 8.dp)) {
Button(
onClick = { count++ },
enabled = count < 10
) {
Text(text = "Add one")
}

Button(
onClick = { count = 0 },
modifier = Modifier.padding(start = 8.dp)
) {
Text(text = "Clear water count")
}
Button(onClick = { count++ }, Modifier.padding(top = 8.dp), enabled = count < 10) {
Text("Add one")
}
}
}

This file was deleted.

0 comments on commit a791948

Please sign in to comment.