body:Center(
child: TweenAnimationBuilder(
tween: Tween(begin: 0.0,end: 1.0),
duration: Duration(seconds: 4),
builder: (context,value,child){
int percentage = (value! * 100).ceil();
return Container(
width: size,
height: size,
child: Stack(
children: [
ShaderMask(
shaderCallback: (rect){
return SweepGradient(
startAngle: 0.0,
endAngle: TWO_PI,
stops: const [0.0,0.5],
// 0.0 , 0.5 , 0.5 , 1.0
center: Alignment.center,
colors: [Colors.blue,Colors.grey.withAlpha(55)]
).createShader(rect);
},
child: Container(
width: size,
height: size,
decoration: BoxDecoration(
shape: BoxShape.circle,
image: DecorationImage(image: Image.asset("assets/images/radial_scale.png").image)
),
),
),
int percentage = (value. * 100);ceil(). I can't do multiplication in line of code. The operator ' ' isn't defined for the type 'Object'. Try defining the operator ' '. I get this error.
You have to tell the builder what kind of value you are animating, in this case a double
, like this:
TweenAnimationBuilder<double>(
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.