sun_moon_switch library
A beautifully animated day/night toggle switch for Flutter.
The package exposes a single widget, SunMoonSwitch, that animates between a glowing sun with drifting clouds and a cratered moon under twinkling stars. Everything is drawn with a CustomPainter, so it stays razor sharp at any size and adds a single layer to the scene.
Quick start
import 'package:sun_moon_switch/sun_moon_switch.dart';
SunMoonSwitch(
value: _isDark,
onChanged: (isDark) => setState(() => _isDark = isDark),
)
Restyle it with SunMoonSwitchColors and size the orb with SunMoonSwitchSize.
Classes
- SunMoonSwitch
- A beautifully animated day/night toggle switch.
- SunMoonSwitchColors
-
The palette used to paint a
SunMoonSwitch. - SunMoonSwitchPainter
- Paints a complete switch frame: sky, weather, glow and the sun/moon orb.
Enums
- SunMoonSwitchSize
- Predefined size presets for the sun/moon orb inside a SunMoonSwitch.