mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-02 20:13:50 +08:00
zero analyzer issues
This commit is contained in:
@ -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;
|
||||
|
||||
@ -122,7 +122,7 @@ class SpriteComponent extends PositionComponent {
|
||||
}
|
||||
|
||||
@override
|
||||
render(Canvas canvas) {
|
||||
void render(Canvas canvas) {
|
||||
prepareCanvas(canvas);
|
||||
sprite.render(canvas, width, height);
|
||||
}
|
||||
|
||||
@ -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();
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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));
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user