Skip to main content

marquee_transition 1.3.0 copy "marquee_transition: ^1.3.0" to clipboard
marquee_transition: ^1.3.0 copied to clipboard

A smooth, configurable marquee text and widget scrolling transition for Flutter.

Marquee Transition

A high-performance, silky-smooth marquee text and widget scrolling transition for Flutter.

Pub Version Pub Points GitHub Repo License: MIT


Features #

  • πŸ”„ Continuous Endless Wrap-Around: Seamless 60/120fps wrap-around scrolling without pauses, visual jumps, or viewport gaps.
  • ⏱️ Item-by-Item Snap with Delay: Step from child to child, pausing at each item (snap: true, snapDelay: Duration(seconds: 3)) with smooth cubic easing.
  • πŸͺž Ping-Pong Mirror Mode: Smooth back-and-forth bounce mode with configurable reverse curve, reverse duration, and reverse delays.
  • ⚑ Constant Velocity (px/sec): Maintains uniform scrolling speed across dynamic or localized content lengths with the velocity parameter.
  • ⏸️ Pause on Hover & Touch: Automatically pauses scrolling when mouse hovers (pauseOnHover) or pointer presses down on touchscreens (pauseOnTouch).
  • 🎨 Fading Edge Gradients: Built-in edge gradient masking with configurable fade ratio (fadingEdgeRatio) for elegant visual fades.
  • 🌟 Custom Dividers & Gap: Injects spacing via declarative gap or custom decorative divider widgets between items and sequences.
  • β™Ώ Accessibility Ready: Built-in support for OS Reduce Motion (respectReduceMotion) and ExcludeSemantics for duplicate sequences.
  • πŸŽ›οΈ Imperative State Control: Control playback programmatically via pause(), resume(), and restart().
  • πŸ“ Convenience Constructor: Instant single-string ticker via MarqueeTransition.text(...).
  • 🧭 Multi-directional: Supports horizontal (right, left) and vertical (down, up) scrolling.

Getting Started #

Add marquee_transition to your pubspec.yaml:

dependencies:
  marquee_transition: ^1.0.0

Then import the package in your Dart code:

import 'package:marquee_transition/marquee_transition.dart';

Usage #

1. Seamless Continuous Ticker #

Scroll multiple widgets continuously with a fixed speed and custom divider:

MarqueeTransition(
  velocity: 70.0, // 70 logical pixels per second
  divider: Padding(
    padding: EdgeInsets.symmetric(horizontal: 16),
    child: Icon(Icons.circle, size: 8, color: Colors.blue),
  ),
  children: const [
    Text('πŸš€ Flutter 3.29 is out!'),
    Text('πŸ“¦ MarqueeTransition v1.0.0 released!'),
    Text('⚑ 60/120fps smooth wrap-around!'),
  ],
)

2. Convenience Text Marquee with Fading Edges & Hover-Pause #

MarqueeTransition.text(
  'Breaking news: Widgetarian Showroom is now officially released! Hover over this text to pause scrolling.',
  style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
  velocity: 60,
  fadingEdge: true,
  fadingEdgeRatio: 0.12,
  pauseOnHover: true,
)

3. Ping-Pong Mirror Mode #

Scrolls forward to the end of content, pauses briefly, and scrolls back in reverse:

MarqueeTransition(
  mirror: true,
  velocity: 50.0,
  delay: const Duration(seconds: 1),
  reverseDelay: const Duration(seconds: 1),
  curve: Curves.easeInOutCubic,
  reverseCurve: Curves.easeInOutCubic,
  children: [
    for (int i = 0; i < 5; i++)
      Container(
        width: 140,
        margin: const EdgeInsets.symmetric(horizontal: 8),
        color: Colors.amber,
        child: Center(child: Text('Card #$i')),
      ),
  ],
)

4. Imperative State Controls #

final marqueeKey = GlobalKey<MarqueeTransitionState>();

// Render widget
MarqueeTransition(
  key: marqueeKey,
  velocity: 60,
  children: const [Text('Controlled Ticker')],
);

// Control playback
marqueeKey.currentState?.pause();
marqueeKey.currentState?.resume();
marqueeKey.currentState?.restart();

5. Single-Child Headline Banner (fillViewport: true) #

Show exactly one headline at a time with clean, full-viewport paging and zero text truncation:

MarqueeTransition(
  snap: true,
  fillViewport: true,
  snapDelay: const Duration(seconds: 3),
  snapDuration: const Duration(milliseconds: 600),
  snapCurve: Curves.easeInOutCubic,
  onSnap: (index) => print('Active item: $index'),
  children: const [
    Text('πŸ“’ Announcement 1: Flutter 3.29 is out!'),
    Text('⚑ Announcement 2: Performance boosted by 2x!'),
    Text('πŸ›‘οΈ Announcement 3: Zero vulnerabilities detected!'),
  ],
)

6. Vertical News Alert Flipper #

Flip news or alerts vertically one-by-one:

Container(
  height: 48,
  padding: const EdgeInsets.symmetric(horizontal: 16),
  decoration: BoxDecoration(
    color: Colors.amber.shade100,
    borderRadius: BorderRadius.circular(8),
  ),
  child: const MarqueeTransition(
    direction: AxisDirection.down,
    snap: true,
    fillViewport: true,
    snapDelay: Duration(seconds: 2),
    children: [
      Text('⚠️ Server Notice: Maintenance scheduled at 02:00 UTC.'),
      Text('πŸ”” Version 1.3.0 is now live on pub.dev!'),
      Text('πŸ›‘οΈ Security: Automated compliance passed.'),
    ],
  ),
)

Parameters #

Parameter Type Default Description
children List<Widget> required The widgets displayed inside the marquee.
repeat int -1 Number of cycles to repeat (-1 for infinite loop).
pause bool false Whether the marquee animation is paused.
mirror bool false Whether to play forward and backward in ping-pong mode.
snap bool false Step and snap item-by-item with pause delays.
snapDelay Duration 3s Duration to pause at each child when snap is true.
snapDuration Duration? 600ms Transition duration when moving between snapped items.
snapCurve Curve easeInOutCubic Easing curve for snap transitions.
fillViewport bool false Expand each child to 100% viewport extent for single-item banners.
itemExtent double? null Fixed dimension per child item along the scroll axis.
onSnap ValueChanged<int>? null Callback fired when landing on a snapped child index.
velocity double? null Speed in logical pixels per second. Overrides duration.
duration Duration? 5s Duration of one animation cycle (used when velocity is null).
direction AxisDirection right Direction of scrolling (right, left, down, up).
curve Curve linear Easing curve for forward scrolling.
delay Duration Duration.zero Delay before forward animation begins.
reverseDuration Duration? null Duration for reverse movement in mirror mode.
reverseCurve Curve? null Easing curve for reverse movement in mirror mode.
reverseDelay Duration? null Delay before reverse movement in mirror mode.
divider Widget? null Widget inserted between items and between loop cycles.
gap double 16.0 Spacing between items and cycles when divider is null.
pauseOnHover bool false Automatically pause scrolling when mouse hovers over marquee.
pauseOnTouch bool false Automatically pause scrolling when pointer touches marquee.
respectReduceMotion bool true Pause scrolling when OS Reduce Motion is enabled.
fadingEdge bool false Apply soft transparent fading mask to the marquee edges.
fadingEdgeRatio double 0.1 Fraction of marquee width/height to fade (0.0 to 0.5).
onCycleComplete ValueChanged<int>? null Callback triggered after each cycle finishes.
onComplete VoidCallback? null Callback triggered when all repeats have finished playing.

Contributing #

Contributions and bug reports are welcome! Please submit issues and pull requests to the GitHub Repository.

0
likes
150
points
796
downloads

Documentation

API reference

Publisher

verified publisherwidgetarian.com

Weekly Downloads

A smooth, configurable marquee text and widget scrolling transition for Flutter.

Homepage
Repository (GitHub)
View/report issues

Topics

#marquee #scroll #animation #transition #widgetarian

Funding

Consider supporting this project:

buymeacoffee.com
ko-fi.com

License

BSD-3-Clause (license)

Dependencies

flutter

More

Packages that depend on marquee_transition