RPTaskNavigation
The navigation of an RPUITask, handed to an RPBottomNavigationBuilder. It exposes what the default bottom bar does — advance, go back, cancel — together with the state those actions depend on, so that a custom bar can be built without reaching into the task's internals.
Constructors
RPTaskNavigation
- required VoidCallback? onNext,
- required VoidCallback? onBack,
- required VoidCallback onCancel,
- required bool canProceed,
- required RPStep? currentStep,
- required int stepIndex,
- required int stepCount,
Properties
canProceed
Whether the current step is ready to be left, i.e. whether onNext is non-null.
currentStep
The step currently on screen. The default bar draws nothing on an RPCompletionStep, RPVisualConsentStep or RPConsentReviewStep, since those steps carry their own buttons. A custom bar is built on every step instead, and can use this to make the same choice.
onBack
Returns to the previous step, or null on the first step of the task, where there is nothing to go back to. Note that the default bar is stricter than this: it only offers BACK in an RPNavigableOrderedTask. A custom bar may offer it in a linear task too.
onCancel
Cancels the task, after asking the participant to confirm in a dialog. This is what the close button of the default carousel bar does. To end the task without confirmation, call RPUITask.onCancel directly and pop the route.
onNext
Advances to the next step, or null while the current step is not ready to be left — an unanswered question, typically. Passing it straight to a button's onPressed therefore disables the button until the step is answered.
stepCount
The number of steps in the task — for an RPNavigableOrderedTask not every step is necessarily shown, so it is an upper bound rather than an exact total.
stepIndex
The zero-based index of currentStep.