flutter_tile_grid 0.1.1

Flutter Tile Grid #

A board of tiles organized in a grid which the user can pan and zoom.

Quick Start #

TileGrid(
  builder: (context, tile, x, y, size) {
    return Center(child: Text(tile, style: TextStyle(fontSize: size - 10)));
  },
  grid: [
    ['A', 'B', 'C'],
    ['D', 'E', 'F'],
    ['G', 'H', 'I'],
  ],
  originX: 1,
  originY: 1,
),

This will display a grid of characters which you can pan and zoom in.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_tile_grid/flutter_tile_grid.dart';

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

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Tile Grid Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: Scaffold(
        appBar: AppBar(
          title: Text('Tile Grid Demo'),
        ),
        body: TileGrid(
          backgroundColor: Colors.blue.shade200,
          board: Container(
            decoration: BoxDecoration(
              border: Border(
                top: BorderSide(width: 0),
                left: BorderSide(width: 0),
                right: BorderSide(width: 0),
                bottom: BorderSide(width: 0),
              ),
            ),
          ),
          builder: (context, tile, x, y, size) {
            return Container(
              decoration: BoxDecoration(
                color: tile.shade500,
              ),
            );
          },
          grid: [
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
            [Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue],
            [Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green],
            [Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red, Colors.blue, Colors.green, Colors.red],
          ],
          originX: 9,
          originY: 9,
        ),
      ),
    );
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_tile_grid: ^0.1.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:flutter_tile_grid/flutter_tile_grid.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]
60
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

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

  • Dart: 2.5.1
  • pana: 0.12.21
  • Flutter: 1.9.1+hotfix.4

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health suggestions

Format lib/flutter_tile_grid.dart.

Run flutter format to format lib/flutter_tile_grid.dart.

Maintenance issues and suggestions

Provide a file named CHANGELOG.md. (-20 points)

Changelog entries help developers follow the progress of your package. See the example generated by stagehand.

The package description is too short. (-20 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.0.0-dev.68.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8