Smart Light Control

Loading preview

Starting the Flutter app

A Flutter smart light control with a brightness slider and a color picker.

Get the source

Add it to your project

Copies the Dart source into your app, so you own it. Flutter SDK only, no extra packages.

First time? Run dart pub global activate fluttertemplates_dev, or read the CLI guide.

How it works

Three fields hold the state: _on, _brightness and _colorIndex. The bulb is a circular Container whose fill and BoxShadow use glow with brightness as the alpha, so dragging the slider fades the halo. Switching off clears the shadow and disables the Slider by passing it a null onChanged. The state stays local, with no bulb on the other end.

Adapting it

  • Call your bulb API from the app bar Switch, the Slider and the swatch onTap.
  • Edit _colors to match the presets your hardware supports, or add a color wheel.
  • Set _brightness and _on from device state on load instead of the current defaults.