Skip to main content

Arrival feedback customization

You can customize the arrival feedback view by providing your own UI written in Jetpack Compose.

Customizing Arrival Feedback Content

The setArrivalFeedback function in DashNavigationFragment allows you to define custom content for the arrival feedback card. It takes an ArrivalFeedbackUiComposer, which is a composable function with two parameters: modifier and state. The modifier is an instance of Modifier, enabling layout configuration. The state is an instance of ArrivalFeedbackUiState, which contains all necessary information for rendering the feedback UI.

ArrivalFeedbackUiState

The ArrivalFeedbackUiState class provides the state needed for the arrival feedback card. It includes:

  • destination: The destination, represented as a DashSearchResult.
  • onClickGoodTripButton: A callback triggered when the "Good Trip" button is clicked.
  • onClickBadTripButton: A callback triggered when the "Bad Trip" button is clicked.

Example Usage

To set a custom arrival feedback implementation:

fragment.setArrivalFeedback { state, modifier ->
CustomArrivalFeedbackView(state, modifier)
}

The CustomArrivalFeedbackView composable customizes the feedback UI using the provided ArrivalFeedbackUiState.

To switch back to the default implementation at runtime:

fragment.setArrivalFeedback { state, modifier ->
DefaultArrivalFeedbackView(state, modifier)
}

For practical examples, explore our Dash Android Examples repository.

Was this page helpful?