Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding flutter mini sprite #40

Merged
merged 6 commits into from Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/flutter_mini_sprite.yaml
@@ -0,0 +1,46 @@
name: flutter_mini_sprite

on:
push:
branches:
- main
paths:
- .github/workflows/flutter_mini_sprite.yaml
- packages/flutter_mini_sprite/**

pull_request:
branches:
- main
paths:
- .github/workflows/flutter_mini_sprite.yaml
- packages/flutter_mini_sprite/**

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2.3.4
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
cache: true
- uses: bluefireteam/melos-action@main

- name: Install Dependencies
run: melos bootstrap

- name: Format
run: melos exec --scope flutter_mini_sprite flutter format --set-exit-if-changed lib

- name: Analyze
run: melos exec --scope flutter_mini_sprite flutter analyze --fatal-infos --fatal-warnings .

- name: Run Tests
run: melos exec --scope flutter_mini_sprite flutter test --coverage

- name: Check Code Coverage
uses: VeryGoodOpenSource/very_good_coverage@v1
with:
path: packages/flutter_mini_sprite/coverage/lcov.info
min_coverage: 70
2 changes: 2 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 41 additions & 0 deletions packages/flutter_mini_sprite/.gitignore
@@ -0,0 +1,41 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# VSCode related
.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Web related
lib/generated_plugin_registrant.dart

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

coverage
29 changes: 29 additions & 0 deletions packages/flutter_mini_sprite/README.md
@@ -0,0 +1,29 @@
# flutter_mini_sprite

[![style: very good analysis][very_good_analysis_badge]][very_good_analysis_link]
[![License: MIT][license_badge]][license_link]

Provides Widgets to render mini sprites into Flutter

[license_badge]: https://img.shields.io/badge/license-MIT-blue.svg
[license_link]: https://opensource.org/licenses/MIT
[very_good_analysis_badge]: https://img.shields.io/badge/style-very_good_analysis-B22C89.svg
[very_good_analysis_link]: https://pub.dev/packages/very_good_analysis

# How to use it

Add flutter mini sprite to the project pubspec:
erickzanardo marked this conversation as resolved.
Show resolved Hide resolved

```
dart pub add flutter_mini_sprite
```

Use the Widget

```dart
MiniSpriteWidget(
pixelSize: 10,
sprite: MiniSprite.fromDataString('...'),
palette: [ const Color(0xFFFFFF00), const Color(0xFFFF0000) ],
),
```
1 change: 1 addition & 0 deletions packages/flutter_mini_sprite/analysis_options.yaml
@@ -0,0 +1 @@
include: package:very_good_analysis/analysis_options.3.0.1.yaml
44 changes: 44 additions & 0 deletions packages/flutter_mini_sprite/example/.gitignore
@@ -0,0 +1,44 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
45 changes: 45 additions & 0 deletions packages/flutter_mini_sprite/example/.metadata
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: android
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: ios
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: linux
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: macos
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: web
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
- platform: windows
create_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543
base_revision: ffccd96b62ee8cec7740dab303538c5fc26ac543

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions packages/flutter_mini_sprite/example/README.md
@@ -0,0 +1,16 @@
# example

A new Flutter project.
erickzanardo marked this conversation as resolved.
Show resolved Hide resolved

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
29 changes: 29 additions & 0 deletions packages/flutter_mini_sprite/example/analysis_options.yaml
@@ -0,0 +1,29 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
24 changes: 24 additions & 0 deletions packages/flutter_mini_sprite/example/lib/main.dart
@@ -0,0 +1,24 @@
import 'package:dashbook/dashbook.dart';
import 'package:flutter/material.dart';
import 'package:flutter_mini_sprite/flutter_mini_sprite.dart';
import 'package:mini_sprite/mini_sprite.dart';

void main() {
final dashbook = Dashbook();

dashbook.storiesOf('Flutter Mini Sprite').add('default', (context) {
return Center(
child: MiniSpriteWidget(
pixelSize: context.numberProperty('pixelSize', 10),
sprite: MiniSprite.fromDataString(
'8,8;1,-1;3,1;4,-1;1,1;3,0;1,1;3,-1;1,1;4,0;2,1;1,-1;1,1;6,0;2,1;6,0;2,1;4,0;2,1;1,-1;1,1;3,0;1,1;4,-1;3,1;4,-1'),
palette: [
context.colorProperty('color 1', const Color(0xFFFFFFFF)),
context.colorProperty('color 2', const Color(0xFF000000)),
],
),
);
});

runApp(dashbook);
}