Creating terminal-based UIs and games in Dart should be accessible and fun!

Overview

griddle

Griddle simplifies the concept of creating 2D games or UI applications within a 2D-matrix, or grid, which in turn makes it a suitable cross-platform graphics framework for lower fidelity games or apps.

On pub.dev Code coverage Github action status Dartdocs Style guide

It is inspired by:

Purpose

Creating simple 2D programs that run inside a terminal (or terminal emulator) is complicated. The goal of griddle is to abstract a terminal-like screen into a 2D grid of character cells.

Like termpixels, this project makes the terminal more accessible and more fun, but in Dart!

To learn more about griddle, read our design philosophy.

Usage

Example app running

import 'dart:io' show stdout;
import 'dart:math' as math;

import 'package:griddle/griddle.dart';

void main() {
  final screen = Screen.display(Display.fromAnsiTerminal(
    stdout,
    width: () => stdout.terminalColumns,
    height: () => stdout.terminalLines,
  ));

  const string = 'Hello World, from Griddle for Dart!';

  Stream<void>.periodic.listen((_) {
    screen.clear();

    for (var i = 0; i < string.length; i++) {
      final t = DateTime.now().millisecondsSinceEpoch / 1000;
      final f = i / string.length;
      final c = Color.fromHSL(f * 300 + t, 1, 0.5);
      final x = screen.width ~/ 2 - string.length ~/ 2;
      final o = math.sin(t * 3 + f * 5) * 2;
      final y = (screen.height / 2 + o).round();

      screen.print(string[i], x + i, y, foreground: c);
    }

    screen.update();
  });
}

(For the full example, see example/example.dart)

Contributing

This package welcomes new issues and pull requests.

Changes or requests that do not match the following criteria will be rejected:

  1. Common decency as described by the Contributor Covenant.
  2. Making this library brittle.
  3. Adding platform-specific functionality.
  4. A somewhat arbitrary bar of "complexity", everything should be easy to use.
You might also like...

Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun hand-drawn look.

Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun hand-drawn look.

wired_elements Wired Elements is a series of basic UI Elements that have a hand drawn look. These can be used for wireframes, mockups, or just the fun

Jun 30, 2022

Make localizing hard-coded strings fun!

Make localizing hard-coded strings fun!

Flutter Localizer IntelliJ Plugin IntelliJ Plugin to ease the process of localizing hard coded strings in Flutter projects Installation The plugin is

Feb 25, 2022

Flutter UI Challenges for fun

Flutter UI Challenges for fun

flutter_fun Just small ui challenges for Fun. Glitch effect experiment IoT Humidity App Slider Design: https://dribbble.com/shots/6315218-IoT-Humidity

Sep 10, 2022

A Random Anime Quotes app I made for fun.

Random Anime Quotes An random anime quote app I made for fun. Powered by Airi Preview ranimequotes.mp4 Features ✅ Like and save locally your favorite

Aug 24, 2022

A fun Snowfall/Rainfall Project with Interactions

snowfall Snowfall Project Getting Started This project is a starting point for a Flutter application. A few resources to get you started if this is yo

Jan 21, 2022

Dart library for creating static trees of execution.

Processing tree Dart library for building and executing static trees of execution created in runtime. When to use it The main idea behind usage of thi

Dec 20, 2021

Simple Dart package for creating mailto links in your Flutter apps or web pages

Simple Dart package for creating mailto links in your Flutter apps or web pages

mailto Simple Dart package for creating mailto links in your Flutter and Dart apps The mailto package helps you build mailto links and provides you wi

Jul 8, 2022

Creating complete social media app like instagram, facebook using flutter dart.

instoo The social media application that allows user to check out new feed, like, comment and even check other user’s profile. It has search, follow,

Sep 13, 2022

Hangman and yet another gaming App(i love games and making it XD)

Hangman and yet another gaming App(i love games and making it XD)

and yet another gaming App(i love games and making it XD) , i completed the ui and almost all the functionality , i will add some storing data using firebase later, anyways please give a try and enjoy it , i will try in the future to use flame engine to make a 3d cool app or even 2d, any feedback will be apperciated since im still halfway to be a proffesional

Aug 7, 2022
Comments
  • Cells drawn at Y = 0 don't appear on the terminal

    Cells drawn at Y = 0 don't appear on the terminal

    // Doesn't show up without scrolling back:
    screen.print('${DateTime.now().millisecondsSinceEpoch}', 0, 0);
    
    // Does:
    screen.print('${DateTime.now().millisecondsSinceEpoch}', 0, 1);
    
    bug 
    opened by matanlurey 1
  • Optimize <_Screen.update> to minimize ANSI escape code usage

    Optimize <_Screen.update> to minimize ANSI escape code usage

    screen.print('GREEN', 0, 2, foreground: green, background: blue);
    screen.update();
    

    ... leaves output such as:

    \x1B[2J\n
    \x1B[0m \x1B[0m \x1B[0m \x1B[0m \x1B[0m\n
    \x1B[0mH\x1B[0mE\x1B[0mL\x1B[0mL\x1B[0mO\n
          \x1B[38;2;0;255;0m\x1B[48;2;0;0;255mG\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mR\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mE\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mE\x1B[38;2;0;255;0m\x1B[48;2;0;0;255mN\n
    

    This is technically correct (the best kind of correct), but it should be possible to do this in only a tiny handful of escapes.

    enhancement 
    opened by matanlurey 0
Owner
Matan Lurey
Staff Software Engineer / TLM. I only contribute to fun/personal projects on GitHub and not anything related to my work 😎
Matan Lurey
Socket library for creating real-time multiplayer games. Based on TCP, with the ability to send messages over UDP (planned).

Game socket The library was published in early access and is not stable, as it is being developed in parallel with other solutions. English is not a n

Stanislav 10 Aug 10, 2022
Terminal styling done right - now for Dart!

vscode debug console windows terminal Console/Terminal text coloring and styling library for Dart 'Terminal string styling done right' I created this

Tim Maffett 2 Sep 14, 2022
Speed Share is a highly available file sharing terminal on LAN(local area network) developed by flutter framework.

速享 Language: 中文简体 | English 这是一款完全基于局域网的文件互传终端,速享不使用任何服务器,不使用您的移动流量,不收集任何用户数据,完全的点对点传输。 可以快速共享文本消息,图片或其他文件,文件夹。 适用于局域网中的文件互传,解决 QQ,微信等上传文件会经过服务器的问题,或者

null 275 Sep 27, 2022
Beautiful and accessible math in all browsers

MathJax Beautiful math in all browsers MathJax is an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all

MathJax 9k Sep 27, 2022
My flutter (android, ios) UI design examples 🎈 - user profile UIs, food order ui, splashscreen, mask widget usage, settings page ui

Flutter UI Design Examples ?? This repository contains the flutter ui designs I designed while learning. Doctor Appointment App UI Packages in use: fl

Aleyna Eser 22 Sep 26, 2022
We created Flappy Bird, a straightforward game based on flutter animation, from scratch using only Dart & Flutter and no third-party games or animation components.

Flappy-Bird Description A ridiculous game created by Flutter, all you have to do is touch the screen to make the bird leap as long as you avoid the ba

hab 7 Sep 26, 2022
Deepak Sharma 145 Sep 26, 2022
💙🔥 FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

???? FlutterFire commons repository, makes FlutterFire app development faster, easier, and more fun!

Kosuke Saigusa 15 Jul 8, 2022
The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students.

The Health==Wealth app aims to make leading a healthy lifestyle simple, fun and rewarding for students. Students can also track and see their progress through the app.

null 2 Jun 25, 2022
Wordle It's fun, simple and, like a crossword.

Wordle It's fun, simple and, like a crossword. Getting Started Wordle gives players six chances to guess a randomly selected five-letter word. As show

Amogh Nagar 4 Sep 9, 2022