zero analyzer issues

This commit is contained in:
Renan Araujo
2019-03-23 15:02:17 -03:00
parent aacb3fcb65
commit 6696373bd7
18 changed files with 50 additions and 42 deletions

View File

@ -20,8 +20,8 @@ class AnimationComponent extends PositionComponent {
int amount, {
double textureX = 0.0,
double textureY = 0.0,
double textureWidth = null,
double textureHeight = null,
double textureWidth,
double textureHeight,
}) {
this.width = width;
this.height = height;

View File

@ -122,7 +122,7 @@ class SpriteComponent extends PositionComponent {
}
@override
render(Canvas canvas) {
void render(Canvas canvas) {
prepareCanvas(canvas);
sprite.render(canvas, width, height);
}

View File

@ -37,7 +37,7 @@ mixin ComposedComponent on Component {
OrderedSet(Comparing.on((c) => c.priority()));
@override
render(Canvas canvas) {
void render(Canvas canvas) {
canvas.save();
components.forEach((comp) => _renderComponent(canvas, comp));
canvas.restore();

View File

@ -1,7 +1,7 @@
import 'dart:async';
import 'dart:ui';
import 'package:flutter/src/painting/decoration_image.dart';
import 'package:flutter/painting.dart';
import '../flame.dart';
import 'component.dart';
@ -48,8 +48,8 @@ class ParallaxRenderer {
}
abstract class ParallaxComponent extends PositionComponent {
final BASE_SPEED = 30;
final LAYER_DELTA = 40;
final baseSpeed = 30;
final layerDelta = 40;
final List<ParallaxRenderer> _layers = [];
Size _size;
@ -108,7 +108,7 @@ abstract class ParallaxComponent extends PositionComponent {
}
for (int i = 0; i < _layers.length; i++) {
double scroll = _layers[i].scroll;
scroll += (BASE_SPEED + i * LAYER_DELTA) * delta / _size.width;
scroll += (baseSpeed + i * layerDelta) * delta / _size.width;
if (scroll > 1) {
scroll = scroll % 1;
}

View File

@ -9,7 +9,7 @@ class Resizable {
Size size;
/// Implementation provided by this mixin to the resize hook.
resize(Size size) {
void resize(Size size) {
this.size = size;
children().where((e) => e != null).forEach((e) => e.resize(size));
}

View File

@ -126,6 +126,7 @@ class TextBoxComponent extends PositionComponent with Resizable {
double get currentHeight => _withMargins((currentLine + 1) * _lineHeight);
@override
void render(Canvas c) {
if (_cache == null) {
return;
@ -168,6 +169,7 @@ class TextBoxComponent extends PositionComponent with Resizable {
_cache = await _redrawCache();
}
@override
void update(double dt) {
final int prevCurrentChar = currentChar;
_lifeTime += dt;

View File

@ -1,6 +1,6 @@
import 'dart:ui';
import 'package:flutter/src/painting/text_painter.dart';
import 'package:flutter/painting.dart';
import 'component.dart';
import '../position.dart';
@ -10,14 +10,14 @@ class TextComponent extends PositionComponent {
String _text;
TextConfig _config;
get text => _text;
String get text => _text;
set text(String text) {
_text = text;
_updateBox();
}
get config => _config;
TextConfig get config => _config;
set config(TextConfig config) {
_config = config;

View File

@ -10,7 +10,7 @@ class TiledComponent extends Component {
String filename;
TileMap map;
Image image;
Map<String, Image> images = Map<String, Image>();
Map<String, Image> images = <String, Image>{};
Future future;
bool _loaded = false;