basket_ball_game

A customizable basketball shooting game widget built with the Flame engine. Drop a full 3-minute basketball arcade game anywhere in your Flutter app with a single widget.

Features

  • Swipe to aim and shoot with a trajectory preview
  • Animated power bar — hold longer for more speed
  • Animated player character with arm follow and throw animation
  • 3-minute countdown timer with Game Over screen
  • Score counter with popup feedback on each basket
  • Fully self-contained — no setup beyond adding the dependency

Installation

Add to your pubspec.yaml:

dependencies:
  basket_ball_game: ^1.0.0

Usage

import 'package:basket_ball_game/basket_ball_game.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]);
  runApp(const MaterialApp(
    home: SafeArea(child: BasketballGameWidget()),
  ));
}

The widget fills all available space. Wrap it in a SizedBox or Expanded to constrain it.

How to play

  1. Swipe up from the bottom half of the screen to start aiming.
  2. Drag left/right to steer the shot direction.
  3. Release to shoot — the longer you hold, the more power.
  4. Score as many baskets as you can before the 3-minute timer runs out.

License

MIT — see LICENSE.