feathers 0.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 43

Feathers #

A lightweight game engine, that only uses feathers.

Why Feathers? #

The idea of feathers is to give you full control over your app. By allowing you to create the components you want, for the feathers you design. All you need to know, is a feather!

Quick Start #


import 'package:feathers/feathers.dart';
import 'dart:ui'

void main() async {
  FeatherEngine engine = new FeatherEngine();
  engine.initialize(new MyGame());

class MyGame extends Feather {
  void init() {
    this.addFeather('usersprite', new User());

class User extends Feather {
  void init() {
    this.setQuill<SpriteQuill>(new SpriteQuill())
      ..setSize(50.0, 150.0)
      ..setPosition(25.0, 50.0)

The Feather Loop #

Each feather, and all associated components follow a main way of looping. Primarily through the input, update, and render methods.

init: Initializes the feather/component.

destroy: Disposes of the feather/component, and all internal properties.

load: Loads any data neccessary for the feather/component.

unload: Unloads any data, to make room for loading new data.

input: Handles input events as neccessary for the feather/component.

update: Updates our feather/component.

render: Draws our feather/component to the screen.

Custom Components & Quills

Creating custom components is simple. Create a new file to hold your components, perhaps storing them in a custom_components directory. Add your class extending the Component class, then implement the methods appropriatly (found above in the Feather Loops section. It is up to you to determine how you want your component to handle everything! See example below:

class CustomComponent extends Component {
  void init() {

  void destroy() {

  void load() {

  void input(Event event) {

  void update(Time time) {

  void render(Context context) {

Quills #

Create quills is similar to creating components, except you do not need to implement the core loop functionality, since this is already handled for you. The main focus of your custom quill is to add whichever components you wish to have combined into one component set. See example below:

class ColoredSquareQuill extends Quill {
  void initWithColor(Color color) {
    addComponent<PositionComponent>(new PositionComponent())
      ..setPosition(25.0, 50.0);

    addComponent<SizeComponent>(new SizeComponent())
      ..setSize(75.0, 75.0);

    addComponent<ColorComponent>(new ColorComponent())

NOTE: Quill overrides require calling the super method at the end

Creating Consistent Components and Quills #

  • Components should not contain constructors, to keep things simple. This will help keep your code maintainable. Future versions plan to remove adding access to constructors.
  • Quills should init with a unique method, such as initWithColor, rather than using the init override. Again, this helps keep code more maintainable.

Contributing #

I hope that one day there will be a community of components and quills to help new users streamline their app development.

More Coming soon...

[0.0.1] - TODO: Add release date.

  • TODO: Describe initial release.


import 'package:feathers/feathers.dart';

import 'dart:ui';
import 'dart:math';

void main() async {
  FeatherEngine engine = new FeatherEngine();
  engine.initialize(new MyGame());

class MyGame extends Feather {
  Timer timer;

  /// For most things, we can handle everything inside of the init function
  /// ...but if you need to do something very specific during any other cycle
  /// ...such as load/unload/input/update/render, you have access to override
  /// ...those as well

  void init() {
    /// Add our scenes as part of `MyGame`
    addFeather('splash_scene', new SplashScene());
    addFeather('my_scene', new MyScene());

    /// Add a `ManagerComponent` to `MyGame`
    addComponent<ManagerComponent>(new ManagerComponent())

    /// Setup a timer for showing the 'splash_scene', then change to
    /// the 'my_scene' scene after 3 seconds.
    timer = new Timer(3.0);

    /// Always call `super` at the end of any override

  void update(Time time) {
    if (timer != null && timer.completed(time)) {
      timer = null;


class SplashScene extends Feather {
  void init() {
    /// This demonstrates using a feather without a preset `Quill`
    /// alternatively we could use the `SpriteQuill` to define our splash_image
    Feather splashImage = createFeather('splash_image');
    splashImage.addComponent<SizeComponent>(new SizeComponent())
      ..setSize(150.0, 150.0);
    splashImage.addComponent<PositionComponent>(new PositionComponent())
      ..setPosition(100.0, 225.0);
    splashImage.addComponent<TextureComponent>(new TextureComponent())
      ..setTexture(new Texture('splash.png'))
      ..setSource(Rect.fromLTWH(0.0, 0.0, 350.0, 351.0));


class MyScene extends Feather {
  int direction = 0;
  void init() {
    /// Give this scene a rectangle size from (0.0, 0.0) to (380.0, 700.0)
    addComponent<PositionComponent>(new PositionComponent())
      ..setPosition(0.0, 0.0);
    addComponent<SizeComponent>(new SizeComponent())
      ..setSize(Context.screen.width, Context.screen.height);

    InputComponent input =
        this.addComponent<InputComponent>(new InputComponent());
    input.addEvent(new Event(EventType.TOUCHDOWN), () {
      direction = Random().nextInt(3);

    this.createFeather('user').setQuill<SpriteQuill>(new SpriteQuill())
      ..setSize(50.0, 50.0)
      ..setPosition(25.0, 25.0)
      ..initWithColor(const Color(0xFFFFFFFF));


  void update(Time time) {
    PositionComponent position =
    double move = 20 * time.elapsedSeconds();
    switch (direction) {
      case 0:
        position.x += move;
      case 1:
        position.x -= move;
      case 2:
        position.y += move;
      case 3:
        position.y -= move;

    if (position.x > 380) {
      position.x = -50.0;
    } else if (position.x < -50) {
      position.x = 380.0;

    if (position.y > 700) {
      position.y = -50.0;
    } else if (position.y < -50) {
      position.y = 700.0;
        .setPosition(position.x, position.y);


Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  feathers: ^0.0.4

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:feathers/feathers.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 11, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.6.0
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.6


Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Fix lib/core/animation.dart. (-0.50 points)

Analysis of lib/core/animation.dart reported 1 hint:

line 37 col 11: The value of the local variable 'verticalFrames' isn't used.

Maintenance suggestions

Package is getting outdated. (-25.21 points)

The package was last published 65 weeks ago.

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies