flame_shells 0.0.1

  • Readme
  • Changelog
  • Example
  • Installing
  • 46

Flame Shells #

Beautiful and easy to use widgets that emulates console shells for your Flame game.

Right now this package bundles only a single shell, emulating classic portable consoles from early 90s, featuring a direction pad and two action buttons.

How to use #

import 'package:flame_shells/flame_shells.dart';

void main() async {
  final game = MyGame();
  final shell = FlameShell(game: game);
  runApp(shell);
}

class MyGame extends Game with HasShellControls {
  @override
  void onShellButtonTapDown(button) {
    // handle tap down
  }

  @override
  void onShellButtonTapUp(button) {
    // handle tap up
  }
}

[0.0.1] - TODO: Add release date. #

  • TODO: Describe initial release.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flame/game.dart';
import 'package:flame/flame.dart';

import 'package:flame_shells/flame_shells.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Flame.util.fullScreen();
  final game = MyGame();
  final shell = FlameShell(game: game);
  runApp(shell);
}

class MyGame extends Game with HasShellControls {
  Rect _rect = Rect.fromLTWH(10, 10, 50, 50);
  Paint _paint = Paint()..color = Color(0xFFFFFFFF);

  double _xVelocity = 0.0;
  double _yVelocity = 0.0;

  @override
  void update(double dt) {
    _rect = _rect.translate(_xVelocity * 100 * dt, _yVelocity * 100 * dt);
  }

  @override
  void render(Canvas canvas) {
    canvas.drawRect(_rect, _paint);
  }

  @override
  void onShellButtonTapDown(button) {
    if (button == FlameShellButton.DPAD_UP) {
      _yVelocity = -1;
    } else if (button == FlameShellButton.DPAD_DOWN) {
      _yVelocity = 1;
    }

    if (button == FlameShellButton.DPAD_LEFT) {
      _xVelocity = -1;
    } else if (button == FlameShellButton.DPAD_RIGHT) {
      _xVelocity = 1;
    }

    if (button == FlameShellButton.ACTION_B) {
      _paint = Paint()..color = Color(0xFF00FF00);
    }

    if (button == FlameShellButton.ACTION_A) {
      _paint = Paint()..color = Color(0xFF0000FF);
    }
  }

  @override
  void onShellButtonTapUp(button) {
    if (button == FlameShellButton.DPAD_UP ||
        button == FlameShellButton.DPAD_DOWN) {
      _yVelocity = 0;
    }

    if (button == FlameShellButton.DPAD_LEFT ||
        button == FlameShellButton.DPAD_RIGHT) {
      _xVelocity = 0;
    }

    if (button == FlameShellButton.ACTION_B ||
        button == FlameShellButton.ACTION_A) {
      _paint = Paint()..color = Color(0xFFFFFFFF);
    }
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flame_shells: ^0.0.1

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

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

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/flame_audio.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform ios

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/flame_audio.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform linux

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/bgm.dart, package:audioplayers/audioplayers.dart] that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/flame_audio.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart, package:path_provider_linux/path_provider_linux.dart] that declares support for platforms: linux

Package does not support Flutter platform web

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/flame_audio.dart, package:audioplayers/audio_cache.dart, package:path_provider/path_provider.dart] that declares support for platforms: android, ios, linux, macos

Package does not support Flutter platform windows

Because of import path [package:flame_shells/flame_shells.dart, package:flame_shells/widgets/flame_shell.dart, package:flame_shells/has_shell_controls.dart, package:flame/game.dart, package:flame/game/game.dart, package:flame/components/component.dart, package:flame/sprite.dart, package:flame/flame.dart, package:flame/bgm.dart, package:audioplayers/audioplayers.dart] that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

because of import path [flame_shells] that is in a package requiring null.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flame).

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.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flame ^0.18.1 0.18.3 0.24.0
flutter 0.0.0
meta ^1.1.8 1.1.8 1.2.2
Transitive dependencies
archive 2.0.13
args 1.6.0
audioplayers 0.15.1
box2d_flame 0.4.6
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
file 5.2.1
flare_dart 2.3.4
flare_flutter 2.0.5
flutter_svg 0.17.4 0.18.0
flutter_web_plugins 0.0.0
intl 0.16.1
ordered_set 1.1.5 2.0.0
path 1.7.0
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
petitparser 3.0.4
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
synchronized 2.2.0+1
tiled 0.2.1 0.6.0
typed_data 1.1.6 1.2.0
uuid 2.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
xml 3.7.0 4.2.0
Dev dependencies
flutter_test