marquee_transition 1.1.0
marquee_transition: ^1.1.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.
Features #
- π Continuous Endless Wrap-Around: Seamless 60/120fps wrap-around scrolling without pauses, visual jumps, or viewport gaps.
- πͺ 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
velocityparameter. - βΈοΈ 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
gapor custom decorativedividerwidgets between items and sequences. - βΏ Accessibility Ready: Built-in support for OS Reduce Motion (
respectReduceMotion) andExcludeSemanticsfor duplicate sequences. - ποΈ Imperative State Control: Control playback programmatically via
pause(),resume(), andrestart(). - π 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();
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. |
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.