fluttershy 0.1.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 59

Fluttershy #

Low level game-engine-like interface for flutter games. All this does is exposing Game class which you can extend and override setup, update, event, render and destroy methods to do your own thing.

I am working on more complete engine in another repository. I wanted to leave this separate because it could be useful if you just want to do some interactive canvas widget which does not require whole engine library with sprite rendering, etc...

[0.1.4] #

  • Minor fixes

[0.1.3] #

  • Rendamed Backend class to Game class
  • Removed Event Type
  • Reexported core libraries and types

[0.1.2] #

  • Minor changes

[0.1.1] #

  • Basic pointer events

[0.1.0] #

  • Release this as a low level package with backend class which can be extended however you want

[0.0.2] #

  • API experimentation

[0.0.1] #

  • Initial release.

example/lib/main.dart

import 'dart:math';

import 'package:flutter/material.dart'
    hide State, Transform, Size, PointerMoveEvent;
import 'package:fluttershy/fluttershy.dart';
import 'package:fluttershy/game.dart';
import 'package:fluttershy/event.dart';
import 'package:fluttershy/events/pointer_event.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        resizeToAvoidBottomInset: false,
        body: Container(
          margin: EdgeInsets.all(200),
          child: Fluttershy(
            backgroundColor: Colors.pink,
            game: ExampleGame(),
          ),
        ),
      ),
    );
  }
}

class ExampleGame extends Game {
  final Paint paint = Paint()..color = Colors.amber;

  double time = 0;
  double positionX = 200;
  double positionY = 200;

  @override
  void update(double deltaTime) {
    time += deltaTime;
  }

  @override
  void event(Event event) {
    if (event.type == PointerMoveEvent) {
      positionX = (event as PointerMoveEvent).position.x;
      positionY = (event as PointerMoveEvent).position.y;
    }
  }

  @override
  void render(Canvas canvas) {
    canvas.drawOval(
        Rect.fromCenter(
            center: Offset(positionX, positionY + sin(time * 5) * 20),
            width: 200,
            height: 200),
        paint);
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  fluttershy: ^0.1.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:fluttershy/fluttershy.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
25
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
84
Overall:
Weighted score of the above. [more]
59
Learn more about scoring.

We analyzed this package on May 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health issues and suggestions

Document public APIs. (-0.49 points)

57 out of 58 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance suggestions

The package description is too short. (-16 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
flutter 0.0.0
vector_math ^2.0.8 2.0.8
Transitive dependencies
collection 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
Dev dependencies
flutter_test