mirror of
				https://github.com/flame-engine/flame.git
				synced 2025-11-01 01:18:38 +08:00 
			
		
		
		
	Linting
This commit is contained in:
		| @ -87,24 +87,23 @@ void main() async { | ||||
|     rows: 1, | ||||
|   ); | ||||
|   final _animation = _animationSpriteSheet.createAnimation( | ||||
|       0, | ||||
|       stepTime: 0.2, | ||||
|       to: 3, | ||||
|       loop: true, | ||||
|     0, | ||||
|     stepTime: 0.2, | ||||
|     to: 3, | ||||
|     loop: true, | ||||
|   ); | ||||
|   dashbook.storiesOf('FlameAnimationWidget').decorator(CenterDecorator()) | ||||
|       .add( | ||||
|           'default', | ||||
|           (ctx) => Container( | ||||
|               width: ctx.numberProperty('container width', 400), | ||||
|               height: ctx.numberProperty('container height', 200), | ||||
|               padding: const EdgeInsets.all(20), | ||||
|               child: FlameAnimationWidget( | ||||
|                   animation: _animation, | ||||
|                   play: ctx.boolProperty('playing', true), | ||||
|                   center: ctx.boolProperty('center', true), | ||||
|               ), | ||||
|   dashbook.storiesOf('FlameAnimationWidget').decorator(CenterDecorator()).add( | ||||
|         'default', | ||||
|         (ctx) => Container( | ||||
|           width: ctx.numberProperty('container width', 400), | ||||
|           height: ctx.numberProperty('container height', 200), | ||||
|           padding: const EdgeInsets.all(20), | ||||
|           child: FlameAnimationWidget( | ||||
|             animation: _animation, | ||||
|             play: ctx.boolProperty('playing', true), | ||||
|             center: ctx.boolProperty('center', true), | ||||
|           ), | ||||
|         ), | ||||
|       ); | ||||
|  | ||||
|   runApp(dashbook); | ||||
|  | ||||
| @ -14,14 +14,14 @@ class FlameAnimationWidget extends StatefulWidget { | ||||
|     this.animation, | ||||
|     this.play = true, | ||||
|     this.center = false, | ||||
|   }): assert(animation.loaded(), 'Animation must be loaded'); | ||||
|   }) : assert(animation.loaded(), 'Animation must be loaded'); | ||||
|  | ||||
|   @override | ||||
|   State createState() => _FlameAnimationWidget(); | ||||
| } | ||||
|  | ||||
| class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTickerProviderStateMixin { | ||||
|  | ||||
| class _FlameAnimationWidget extends State<FlameAnimationWidget> | ||||
|     with SingleTickerProviderStateMixin { | ||||
|   AnimationController _controller; | ||||
|   int _lastUpdated; | ||||
|  | ||||
| @ -39,19 +39,17 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke | ||||
|   void initState() { | ||||
|     super.initState(); | ||||
|  | ||||
|     _controller = AnimationController( | ||||
|         vsync: this | ||||
|     ) | ||||
|     ..addListener(() { | ||||
|       final now = DateTime.now().millisecond; | ||||
|     _controller = AnimationController(vsync: this) | ||||
|       ..addListener(() { | ||||
|         final now = DateTime.now().millisecond; | ||||
|  | ||||
|       final dt = max(0, (now - _lastUpdated) / 1000); | ||||
|       widget.animation.update(dt); | ||||
|         final dt = max(0, (now - _lastUpdated) / 1000); | ||||
|         widget.animation.update(dt); | ||||
|  | ||||
|       setState(() { | ||||
|         _lastUpdated = now; | ||||
|         setState(() { | ||||
|           _lastUpdated = now; | ||||
|         }); | ||||
|       }); | ||||
|     }); | ||||
|  | ||||
|     widget.animation.onCompleteAnimation = _pauseAnimation; | ||||
|  | ||||
| @ -66,8 +64,7 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke | ||||
|       _lastUpdated = DateTime.now().millisecond; | ||||
|       _controller.repeat( | ||||
|           // -/+ 60 fps | ||||
|           period: Duration(milliseconds: 16) | ||||
|       ); | ||||
|           period: Duration(milliseconds: 16)); | ||||
|     }); | ||||
|   } | ||||
|  | ||||
| @ -85,6 +82,7 @@ class _FlameAnimationWidget extends State<FlameAnimationWidget> with SingleTicke | ||||
|  | ||||
|   @override | ||||
|   Widget build(ctx) { | ||||
|     return FlameSpriteWidget(sprite: widget.animation.getSprite(), center: widget.center); | ||||
|     return FlameSpriteWidget( | ||||
|         sprite: widget.animation.getSprite(), center: widget.center); | ||||
|   } | ||||
| } | ||||
|  | ||||
| @ -28,7 +28,8 @@ class _FlameSpritePainer extends CustomPainter { | ||||
|   _FlameSpritePainer(this._sprite, this._center); | ||||
|  | ||||
|   @override | ||||
|   bool shouldRepaint(_FlameSpritePainer old) => old._sprite != _sprite || old._center != _center; | ||||
|   bool shouldRepaint(_FlameSpritePainer old) => | ||||
|       old._sprite != _sprite || old._center != _center; | ||||
|  | ||||
|   @override | ||||
|   void paint(Canvas canvas, Size size) { | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Erick Zanardo
					Erick Zanardo