animated_theme_switcher_plus 1.0.0
animated_theme_switcher_plus: ^1.0.0 copied to clipboard
Animated theme switching for Flutter, with feathered circle and box reveals that expand from any tap position. Supports forward and reverse playback.
1.0.0 #
Initial release. Requires Flutter 3.10 or newer (Dart 3).
Features #
- Premium reveals —
PremiumThemeSwitchingArearenders featheredShaderMasktransitions with soft gradient edges, a depth-bloom scale on the incoming theme, and a receding fade on the outgoing one. Available as a radial reveal (ThemeSwitcherCirclePlusClipper) and a rectangular reveal (ThemeSwitcherBoxPlusClipper). - Classic reveals —
ThemeSwitchingAreaanimates a hard-edgedClipPaththat grows from the reveal origin, with circle and box clippers included. - Tap-anchored origins — pass an
offsetfromTapDownDetailsso the reveal starts exactly where the user touched, rather than at the widget centre. - Forward and reverse playback —
isReversedinverts the layer order so the outgoing theme peels away instead of the incoming theme growing over it. Supported by both rendering modes. - Mixed rendering —
PremiumThemeSwitchingAreafalls back to classic path clipping for any non-Plus clipper, so both styles can coexist on one screen without swapping the area widget. - Custom clippers — implement
ThemeSwitcherClipperto define arbitrary reveal shapes. - Duration management —
PremiumThemeSwitchingArea.changeThemeapplies the longer premium duration for the reveal and restores the provider's original duration on completion. - No dependencies beyond the Flutter SDK.
Implementation notes #
ThemeProviderdisposes both itsAnimationControllerand itsThemeModel, preventing the memory leak and the debug-mode "AnimationController was not disposed" assertion.- Premium reveals compress all visible motion into the first half of the controller timeline and then snap the controller to its endpoint, so the tap gate reopens as soon as the animation is perceptually finished instead of waiting out imperceptible tail motion.
- Concurrent theme switches are dropped rather than queued — a tap during an in-flight reveal is a no-op.
- The screenshot layer is removed from the widget tree once the animation completes.