mercredi 26 mai 2021

Reusing screen but deciding what widgets to show based on a limited number of states

I have a screen that has a certain amount of functionality that will be reused for different workflows. Each of these workflows will reuse most of the functionality of the screen, and most of the UI elements. Each workflow is predetermined, and therefore the page does not need to be dynamic in terms of logic. The things that will change on the screen will be small things, such as the title, and whether or not to show the number of the step of the current workflow.

I know of multiple ways to do this, but am wondering about best practice. I am currently using BLoC as the state management.

My current idea is to create an enum that will be passed into the widget, then use ternary expressions to determine what UI elements to show based on the state enum passed in.

Aucun commentaire:

Enregistrer un commentaire