NumberTicker.builder constructor
const
NumberTicker.builder({})
Creates a NumberTicker with custom builder for complete display control.
This constructor provides maximum flexibility by allowing you to define exactly how the animated number should be presented. The builder receives the current interpolated numeric value and can construct any widget tree.
Parameters:
initialNumber(num?, optional): Starting value for first animation.number(num, required): Target value to animate to and display.builder(NumberTickerBuilder, required): Custom display builder function.child(Widget?, optional): Optional child passed to builder for optimization.duration(Duration?, optional): Override animation duration.curve(Curve?, optional): Override animation curve.
Example:
NumberTicker.builder(
number: _score,
duration: Duration(milliseconds: 400),
builder: (context, value, child) {
return Container(
padding: EdgeInsets.all(8),
decoration: BoxDecoration(
color: Colors.green,
borderRadius: BorderRadius.circular(8),
),
child: Text(
'${value.toInt()} points',
style: TextStyle(color: Colors.white, fontSize: 18),
),
);
},
);
Implementation
const NumberTicker.builder({
super.key,
this.initialNumber,
required this.number,
required this.builder,
this.child,
this.duration,
this.curve,
}) : formatter = null,
style = null;