mirror of
https://github.com/flame-engine/flame.git
synced 2025-10-31 00:48:47 +08:00
Update usages of Dart UI Color to not use deprecated fields and methods. On latest main of Flutter these will cause lint errors, [as can be seen here](https://github.com/flame-engine/flame/actions/runs/10814047130/job/29999530293?pr=3282). Note: I will update the `flame_3d`-specific violations on a followup.
26 lines
678 B
Dart
Executable File
26 lines
678 B
Dart
Executable File
import 'package:flame/components.dart';
|
|
import 'package:flame/palette.dart';
|
|
import 'package:flame_isolate_example/terrain/terrain.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Grass extends PositionComponent with Terrain {
|
|
static final _color = Paint()..color = const Color(0xff567d46);
|
|
static final _debugColor = BasicPalette.black.withOpacity(0.5).paint();
|
|
|
|
late final _rect = size.toRect();
|
|
late final _rect2 = Rect.fromCenter(
|
|
center: _rect.center,
|
|
height: 10,
|
|
width: 10,
|
|
);
|
|
|
|
@override
|
|
void render(Canvas canvas) {
|
|
canvas.drawRect(_rect, _color);
|
|
canvas.drawRect(_rect2, _debugColor);
|
|
}
|
|
|
|
@override
|
|
double difficulty = 1.0;
|
|
}
|