Open chinalwb opened 2 years ago
The design / screenshot in chapter 9 was:
But with the code in the final directory, it is:
/** * Represents app drawer header with the icon and the app name */ @Composable private fun AppDrawerHeader() { Column( modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { Image( imageVector = Icons.Filled.AccountCircle, colorFilter = ColorFilter.tint(Color.LightGray), modifier = Modifier .padding(16.dp) .size(50.dp), contentScale = ContentScale.Fit, alignment = Alignment.Center, contentDescription = stringResource(id = R.string.account) ) Text( text = stringResource(R.string.default_username), color = MaterialTheme.colors.primaryVariant ) ProfileInfo() } Divider( // Here color = MaterialTheme.colors.onSurface.copy(alpha = .2f), modifier = Modifier.padding( start = 16.dp, end = 16.dp, top = 16.dp ) ) }
Look at the Divider.
Divider
The code snippet in the book is:
@Composable private fun AppDrawerHeader() { Column( modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally ) { Image( ... ) Text( ... ) ProfileInfo() // Add this } Divider( // Here ... ) }
Look at the Divider again, with the sample code the divider would be above the Column rather than below it.
This is something you guys could do better, it confused me when reading this, sample codes before chapter 8 never runs into such issues.
The design / screenshot in chapter 9 was:
But with the code in the final directory, it is:
Look at the
Divider
.The code snippet in the book is:
Look at the Divider again, with the sample code the divider would be above the Column rather than below it.
This is something you guys could do better, it confused me when reading this, sample codes before chapter 8 never runs into such issues.