Skip to main content

offline_games 1.0.0 copy "offline_games: ^1.0.0" to clipboard
offline_games: ^1.0.0 copied to clipboard

A plug-and-play mini arcade for Flutter apps when the device goes offline. Zero-config, dependency-free games, with author credits.

pub version License: MIT Flutter
CI Neo-Brutalist Size

Support me on Ko-fi

A plug-and-play mini-arcade for Flutter apps when the device goes offline. Zero configuration, zero heavy engines, and authentic 8-bit retro vibes in under 120 KB.

The Offline Dread #

Airplane mode, elevator rides, subway tunnels, or lost signals: users usually see a sad blank screen or frozen spinner 🥲. offline_games turns that downtime into instant retro entertainment with 1 line of code.

Happy News : ) #

  • 100% pure Dart & Flutter:
  • Zero Heavy Engines: No Flame, Unity, or Godot.
  • Zero Font Overhead: No .ttf or .otf assets.
  • Zero Asset Binaries: All sprites, scanlines, and glyphs render via Flutter Canvas.
  • Native Safe: 100% compatible with iOS SPM and Android AGP 8/9.

Features #

  • One Line Setup.
  • Honest Reachability: Real HTTP ping checks with debouncing (no false alarms).
  • Three Modes: Spin, Picker, or Single Game.
  • Built-in Games
  • Adaptive Theming.
  • AI-Agent Ready: Includes llms.txt for Cursor, Copilot, and Claude.

Table of Contents #

Installation #

Add to your pubspec.yaml:

dependencies:
  offline_games: ^1.0.0

Then run:

flutter pub get

Quick Start #

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

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

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'My App',
      builder: (context, child) => OfflineGames(
        child: child!,
      ),
      home: const MyHomePage(),
    );
  }
}

When connection drops, a retro offer card slides in: "You're offline. Play a quick game while you wait?". Tapping Play launches the arcade! When connection returns, a top banner offers to keep playing or return to where you left off.

Simulator Testing #

Simulate offline immediately without touching your Wi-Fi or airplane mode:

OfflineGames(
  debugForceOffline: true, // Instant offline test mode
  child: child!,
)

Modes #

Select how players discover games with mode:

1. Spin Mode (Default) #

Animated slot machine wheel with no-repeat selection:

OfflineGames(
  mode: const GamesMode.spin(),
  child: child!,
)

2. Picker Catalog Mode #

8-bit catalog grid with high scores:

OfflineGames(
  mode: const GamesMode.picker(),
  child: child!,
)

3. Single Game Mode #

Launches directly into one specific game:

OfflineGames(
  mode: const GamesMode.single(SnakeGame()),
  child: child!,
)

Theming #

Supports Dark, Light, and System brightness out of the box:

OfflineGames(
  themeMode: ThemeMode.system, // ThemeMode.dark, ThemeMode.light, or ThemeMode.system
  // Optional custom palette overrides:
  theme: OfflineGamesTheme.dark(
    primaryColor: const Color(0xFF00F0FF),
  ),
  child: child!,
)

Standalone APIs #

Launch or control the arcade anywhere in your app:

// 1. Imperative modal route
showOfflineGames(context);

// 2. Programmatic controller
final controller = OfflineGamesController();
OfflineGames(controller: controller, child: child!);

controller.open();       // Open arcade UI
controller.close();      // Close arcade UI
controller.suppress();   // Mute during checkout / payments
controller.allow();      // Re-enable automatic triggers

// 3. Standalone widgets
GameSpinner(games: GameCatalog.builtIn, onResult: (g) => print(g.meta.title));
GamePicker(games: GameCatalog.builtIn, onSelected: (g) => print(g.meta.title));
GamePlayer(game: const BreakoutGame(), onExit: () => Navigator.pop(context));

Built-in Games #

Game ID Genre Description
Breakout breakout Action Ball deflection physics, rainbow bricks, and tactile paddle steer.
Memory Match memory_match Puzzle 4x4 card flip challenge with authentic vector glyph sprites.
Snake snake Arcade Nokia-style classic serpent with directional swipes and D-pad.

Shared Retro Primitives #

Exported for use in your own custom views:

  • PixelText: 5x7 vector bitmask text with scaling and word-wrap. Zero font assets.
  • PixelGlyphWidget: 8-bit glyph icons (alien, apple, heart, star, sword, trophy, cloud).
  • RetroPixelCard: High-contrast cards with solid black borders and stepped drop shadows.
  • RetroPixelButton: Chunky 8-bit tactile pressable arcade buttons.
  • CrtScanlinesOverlay: CRT monitor overlay with scanlines and vignette.

API Reference #

OfflineGames #

Property Type Default Description
child Widget required Root or nested widget tree
mode GamesMode GamesMode.spin() Play mode (spin, picker, or single)
themeMode ThemeMode ThemeMode.system Brightness (system, dark, or light)
theme OfflineGamesTheme? null Custom theme colors and borders
debugForceOffline bool? null Forces immediate offline state for simulator testing
games List<OfflineGame>? GameCatalog.builtIn Registered games list
offlineDelay Duration 1 second Delay before showing offline prompt
connectivity ConnectivitySource? DefaultConnectivitySource Reachability checker provider
controller OfflineGamesController? null Programmatic open/close/suppress controller

OfflineGamesController #

Method / Property Description
isOpen Whether the offline arcade overlay is currently visible
isSuppressed Whether automatic offline prompts are currently muted
open() Programmatically opens the offline games interface
close() Programmatically closes the offline games interface
suppress() Temporarily silences prompts (e.g. during payment flows)
allow() Restores automatic offline prompts after suppression

Running the example #

cd example
flutter run

Contributing #

PRs and new games are welcome! See < 1 Hour Contribution Guide.

License #

Made with 💛 by aslamambiloly © 2026

7
likes
0
points
796
downloads

Publisher

verified publisheraslamambiloly.2bd.net

Weekly Downloads

A plug-and-play mini arcade for Flutter apps when the device goes offline. Zero-config, dependency-free games, with author credits.

Repository (GitHub)
View/report issues

Topics

#games #offline #arcade #connectivity #widget

License

unknown (license)

Dependencies

flutter, internet_connection_checker_plus

More

Packages that depend on offline_games