Toggle

A toggle will let users activate or deactivate a control, like an on/off switch.

Flutter

Is new design vision part implemented using new tokens?

Up to date

Resources

Example

Forms/Toggle


                                                        
                                                        
                                                            OptimusToggle(
                                                              offIcon: OptimusIcons.lock,
                                                              onIcon: OptimusIcons.unlock,
                                                              isChecked: _isChecked,
                                                              onChanged:
                                                                  (value) => setState(() => _isChecked = value),
                                                            )
                                                        
                                                            

OptimusToggle Example

API

Name

Description

Type

Default

onIcon

Icon for the on state

IconData?

 

offIcon

Icon for the off state

IconData?

 

onChange

Callback on the state change. If not provided, the switch will be disabled.

ValueChanged<bool>?

 

isChecked

The state of the switch

bool

false