flutter_screen_controller library
A view-controller pattern implementation to separate UI from logic
Classes
-
DataListScreenController<
T> - This is same as DataScreenController, except that it is specialized for list T is the type of list item, so if T is String, then list will be type of List
- ScreenController
- Abstract base class for controller, all screen controller must inerhit this class A wrapper widget (ScreenControllerBuilder) is required for controller to work here is how to use:
-
ScreenControllerBuilder<
T extends ScreenController> - A wrapper widget for the controllable part of your screen This class will create a statefullWidget and passe state to the controller, so that the controller will have ability to update the UI This class is also responsible to call controller onInit, onReady and onDispose methods. The controller is unuseful without this class, here is how to use:
-
ScreenControllerBuilderState<
T extends ScreenController> - Normaly you do not need this, else you want to customize controller behavior
Mixins
-
DataScreenController<
T> - This mixin provide a capability to perform data load logic. By using this mixin, a controller will inherit "data", "isLoading" and "error" members and the controller must implement "fetchData" mehtod, then enjoy the logic This class has also refresh method with silence option (refresh data without trigger loader)