The project contains several switch and button widgets built using BLoC technology, allowed to minimize the scene rendering when updating the GUI.
Three pairs of switches and pair of buttons have been created, based on the processing of callbacks of GestureDetector. They differ in functionality:
- first pair: FlatSwitch and FlatRoundedSwitch react to clicks and process onTap callback,
- second: FlatAdvancedSwitch and FlatAdvancedRoundedSwitch handle callbacks onTapDown and onTapUp,
- third: FlatButton and FlatRoundedButton handle callbacks onTapDown and onTapUp
As the names suggest, one of the widgets of the pair is geometrically a rectangle, the second is a rectangle with borders and rounded corners: there are users who like this. Accordingly, the functionality changes a little: you can adjust the width, color and radius of borders. All other parameters: background color, image and icon color are standard. Each widget has an additional attribute: an external method that causes some action when the switch is clicked. In Demo, these functions are reduced to influencing other switches: either pseudo-pressing them, or switching them to enable/disable states. The logic of widgets is subject to the logic of state machines built into the corresponding BLoC. Their diagrams are given below:
switch_recording.mp4
Enjoy (naturally if you enjoy the process of programming), and change the code as you wish.