PR suggestions

This commit is contained in:
Erick Zanardo
2020-01-30 19:06:38 -03:00
parent 200c3da505
commit bcefcc7ff1
2 changed files with 9 additions and 6 deletions

View File

@ -90,6 +90,10 @@ This component wraps an instance of the [FlareAnimation](/doc/images.md#FlareAni
add(flareAnimation); add(flareAnimation);
``` ```
You can also change the current playing animation using the `updateAnimation` method.
For a working example, check this [source file](/doc/examples/flare/lib/main_component.dart).
## Composed component ## Composed component
A mixin that helps you to make a `Component` wraps other components. It is useful to group visual components through a hierarchy. When implemented, makes every item in its `components` collection field be updated and rendered with the same conditions. A mixin that helps you to make a `Component` wraps other components. It is useful to group visual components through a hierarchy. When implemented, makes every item in its `components` collection field be updated and rendered with the same conditions.
@ -199,4 +203,4 @@ The corners are drawn at the same size, the sides are streched on the side direc
Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders. Using this, you can get a box/rectangle that expands well to any sizes. This is useful for making panels, dialogs, borders.
Check the example app `nine_tile_box` details on how to use it. Check the example app `nine_tile_box` details on how to use it.

View File

@ -1,10 +1,10 @@
import 'dart:ui'; import 'dart:ui';
import 'package:flame/gestures.dart'; import 'package:flame/gestures.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart'; import 'package:flame/game.dart';
import 'package:flame/components/flare_component.dart'; import 'package:flame/components/flare_component.dart';
import 'package:flame/text_config.dart'; import 'package:flame/text_config.dart';
import 'package:flame/position.dart'; import 'package:flame/position.dart';
import 'package:flame/palette.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -16,11 +16,10 @@ void main() {
} }
class MyGame extends BaseGame with TapDetector, DoubleTapDetector { class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
final TextConfig fpsTextConfig = final TextConfig fpsTextConfig = TextConfig(color: BasicPalette.white.color);
const TextConfig(color: const Color(0xFFFFFFFF));
final paint = Paint()..color = const Color(0xFFE5E5E5E5); final paint = Paint()..color = const Color(0xFFE5E5E5E5);
final List<String> _animations = ["Stand", "Wave", "Jump", "Dance"]; final List<String> _animations = ['Stand', 'Wave', 'Jump', 'Dance'];
int _currentAnimation = 0; int _currentAnimation = 0;
FlareComponent flareComponent; FlareComponent flareComponent;
@ -57,7 +56,7 @@ class MyGame extends BaseGame with TapDetector, DoubleTapDetector {
} }
void _start() async { void _start() async {
flareComponent = FlareComponent("assets/Bob_Minion.flr", "Stand", 306, 228); flareComponent = FlareComponent('assets/Bob_Minion.flr', 'Stand', 306, 228);
flareComponent.x = 50; flareComponent.x = 50;
flareComponent.y = 240; flareComponent.y = 240;
add(flareComponent); add(flareComponent);