Skip to content

Conversation

@nxzef
Copy link

@nxzef nxzef commented May 21, 2024

This pull request refactors the navigationIcon logic to improve code readability and efficiency.

Changes Made

  • Simplified the conditional logic for setting the navigationIcon.
  • Combined nested blocks to reduce redundancy.

Before

navigationIcon = if (isShowingDetailPage) {
    {
        IconButton(onClick = onBackButtonClick) {
            Icon(
                imageVector = Icons.Filled.ArrowBack,
                contentDescription = stringResource(R.string.back_button)
            )
        }
    }
} else {
    { Box {} }
}

After

navigationIcon = {
    if (isShowingDetailPage) {
        IconButton(onClick = onBackButtonClick) {
            Icon(
                imageVector = Icons.Filled.ArrowBack,
                contentDescription = stringResource(R.string.back_button)
            )
        }
    }
}

Benefits

  • Readability: The new code is easier to read and understand.
  • Efficiency: Reduces unnecessary nested blocks and simplifies the conditional check.

I have tested the changes to ensure the navigation icon behaves as expected. Please let me know if there are any further adjustments needed.

@nxzef
Copy link
Author

nxzef commented May 21, 2024

@android-dev-lxl, @OwenScott-GDS, @osuleymanova Could you please review the changes and provide any feedback or suggestions? Your input would be greatly appreciated.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant