Flux Motion

pub package license: BSD-3-Clause

Declarative, mobile-first motion for Flutter. Apply polished animation to any widget without spreading AnimationController, listeners, and lifecycle logic through your application.

Flux Motion catalog

Install

flutter pub add flutter_flux_motion
import 'package:flutter_flux_motion/flutter_flux_motion.dart';

Quick start

Every motion wraps an ordinary Flutter widget. Configure its behavior with an immutable spec and choose when it starts with MotionTrigger.

FluxSlide(
  trigger: MotionTrigger.onMount,
  spec: const SlideSpec(
    begin: Offset(0, 24),
    duration: Duration(milliseconds: 480),
    curve: Curves.easeOutCubic,
  ),
  child: const Card(
    child: Padding(
      padding: EdgeInsets.all(16),
      child: Text('Ready to move'),
    ),
  ),
)

Interaction and imperative playback

Motions can start on mount, tap, tap down, tap up, hover, scroll, or visibility.

FluxGlow(
  trigger: MotionTrigger.onTap,
  spec: const GlowSpec(
    color: Color(0xFF8B5CF6),
    radius: 24,
    spreadRadius: 3,
  ),
  child: const Icon(Icons.favorite, size: 44),
)

Use FluxMotionController when product state, validation, or an asynchronous result should control playback.

final motion = FluxMotionController();

FluxShake(
  controller: motion,
  child: const TextField(),
)

// For example, after invalid form submission:
motion.replay();

The controller exposes play(), stop(), reset(), and replay() and attaches to one motion widget at a time.

Orchestration

Use FluxSequence for ordered effects and FluxStagger for coordinated lists or groups. Both own their timeline and support the same interaction triggers and imperative controller.

FluxStagger(
  spec: const StaggerSpec(
    interval: Duration(milliseconds: 70),
    beginOffset: Offset(0, 18),
  ),
  children: const [
    ListTile(title: Text('Profile')),
    ListTile(title: Text('Notifications')),
    ListTile(title: Text('Security')),
  ],
)

Flux Motion integrates with Flutter's native navigator, dialogs, and Material bottom sheets.

final result = await Navigator.of(context).push<String>(
  FluxPageRoute(
    spec: const FluxPageRouteSpec.sharedAxis(),
    builder: (_) => const CheckoutPage(),
  ),
);

Use showFluxDialog and showFluxBottomSheet for typed results, native barriers and gestures, and consistent transition timing.

Available APIs

Category APIs
Essential motion FluxFade, FluxSlide, FluxScale, FluxRotate, FluxBlur
Feedback and emphasis FluxGlow, FluxShimmer, FluxShake, FluxPulse, FluxBounce
Orchestration FluxSequence, FluxStagger
Navigation FluxPageRoute, showFluxDialog, showFluxBottomSheet
Control MotionTrigger, FluxMotionController, FluxMotion

All widget and navigation motions honor Flutter's reduced-motion setting via MediaQuery.disableAnimations.

Interactive catalog

The Flux Motion catalog documents each public component with live examples, parameters, activation modes, mobile scenarios, composition guidance, and copy-ready Dart code.

To run the catalog locally:

cd example
flutter run -d chrome

Development

flutter pub get
flutter analyze
flutter test

Architecture and testing principles live in the docs/ directory. Contributions and real-world motion scenarios are welcome through the issue tracker.

License

Flux Motion is available under the BSD 3-Clause License.

Libraries

core/controllers/flux_motion_controller
core/drivers/explicit_driver
core/drivers/implicit_driver
core/drivers/motion_driver
core/effects/motion_effect
core/effects/motion_render
core/engine/default_motion_engine
core/engine/motion_engine
core/triggers/motion_trigger
core/widgets/flux_motion
core/widgets/flux_wrapper
flutter_flux_motion
Declarative, mobile-first motion widgets, orchestration, and navigation transitions for Flutter.
motions/blur/blur_effect
motions/blur/blur_render
motions/blur/blur_spec
motions/blur/flux_blur
motions/bounce/bounce_effect
motions/bounce/bounce_preset
motions/bounce/bounce_render
motions/bounce/bounce_spec
motions/bounce/flux_bounce
motions/fade/fade_effect
motions/fade/fade_render
motions/fade/fade_spec
motions/fade/flux_fade
motions/glow/flux_glow
motions/glow/glow_effect
motions/glow/glow_preset
motions/glow/glow_render
motions/glow/glow_spec
motions/pulse/flux_pulse
motions/pulse/pulse_effect
motions/pulse/pulse_preset
motions/pulse/pulse_render
motions/pulse/pulse_spec
motions/rotate/flux_rotate
motions/rotate/rotate_effect
motions/rotate/rotate_render
motions/rotate/rotate_spec
motions/scale/flux_scale
motions/scale/scale_effect
motions/scale/scale_render
motions/scale/scale_spec
motions/shake/flux_shake
motions/shake/shake_effect
motions/shake/shake_preset
motions/shake/shake_render
motions/shake/shake_spec
motions/shimmer/flux_shimmer
motions/shimmer/shimmer_effect
motions/shimmer/shimmer_preset
motions/shimmer/shimmer_render
motions/shimmer/shimmer_spec
motions/slide/flux_slide
motions/slide/slide_effect
motions/slide/slide_render
motions/slide/slide_spec
navigation/bottom_sheet/flux_bottom_sheet
navigation/bottom_sheet/flux_bottom_sheet_spec
navigation/dialog/flux_dialog
navigation/dialog/flux_dialog_spec
navigation/page/flux_page_route
navigation/page/flux_page_route_spec
orchestration/sequence/flux_sequence
orchestration/sequence/motion_sequence_step
orchestration/sequence/sequence_effect
orchestration/sequence/sequence_render
orchestration/sequence/sequence_spec
orchestration/stagger/flux_stagger
orchestration/stagger/stagger_spec