Skip to content

The repository contains a collection of four types of event driven BLoC's switch widgets and demo sample app.

Notifications You must be signed in to change notification settings

mk590901/Event-driven-BLoC-s-switch-widgets

Repository files navigation

Event driven BLoC's switch and button widgets

The project contains several switch and button widgets built using BLoC technology, allowed to minimize the scene rendering when updating the GUI.

Introduction

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

Widgets brief description

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:

State machine I (FlatSwitch and FlatRoundedSwitch classes)

switch_2_state_a

State machine II (FlatAdvancedSwitch and FlatAdvancedRoundedSwitch classes)

switch_6_states_a

State machine III (FlatButton and FlatRoundedButton classes)

button_3_state

Movie

switch_recording.mp4

Resume

Enjoy (naturally if you enjoy the process of programming), and change the code as you wish.

About

The repository contains a collection of four types of event driven BLoC's switch widgets and demo sample app.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published