zeba_academy_badges

License: GPL v3 Flutter Dart

A production-ready Flutter package for building gamified learning experiences with:

  • ⭐ XP System
  • šŸŽÆ Levels
  • šŸ† Achievement Badges
  • šŸ“ˆ Leaderboards
  • šŸŽ Rewards

Perfect for:

  • Learning Apps
  • LMS Platforms
  • Course Platforms
  • Gamification Systems
  • Education Dashboards
  • Student Progress Tracking

Features

āœ… XP Progress Tracking āœ… Automatic Level Calculation āœ… Achievement Badge Unlocking āœ… Reward Claim System āœ… Leaderboards āœ… Lightweight Architecture āœ… Fully Customizable Widgets āœ… Package Ready for pub.dev


Installation

Add dependency:

dependencies:
  zeba_academy_badges: ^1.0.0

Install:

flutter pub get

Import

import 'package:zeba_academy_badges/zeba_academy_badges.dart';

Quick Start

final controller =
    BadgesController();

await controller.addXP(
  250,
);

Display:

XPCard(
  xp: controller.xp,
  level: controller.level,
)

Package Structure

lib/
│
ā”œā”€ā”€ src/
│   ā”œā”€ā”€ badge.dart
│   ā”œā”€ā”€ level.dart
│   ā”œā”€ā”€ reward.dart
│   ā”œā”€ā”€ leaderboard_user.dart
│   ā”œā”€ā”€ xp_record.dart
│   │
│   ā”œā”€ā”€ xp_service.dart
│   ā”œā”€ā”€ badge_service.dart
│   ā”œā”€ā”€ reward_service.dart
│   ā”œā”€ā”€ leaderboard_service.dart
│   │
│   ā”œā”€ā”€ badges_controller.dart
│   │
│   ā”œā”€ā”€ xp_card.dart
│   ā”œā”€ā”€ badge_grid.dart
│   ā”œā”€ā”€ reward_card.dart
│   └── leaderboard_widget.dart
│
└── zeba_academy_badges.dart

XP System

Add experience points:

controller.addXP(
  120,
);

Read values:

controller.xp
controller.level

Levels

Example:

Level 1 → 0 XP
Level 2 → 500 XP
Level 3 → 1000 XP
Level 4 → 1500 XP

Achievement Badges

Create badges:

final badges = [

  Badge(
    id: '1',
    title: 'Starter',
    icon: '⭐',
    requiredXP: 100,
  ),

  Badge(
    id: '2',
    title: 'Champion',
    icon: 'šŸ†',
    requiredXP: 1000,
  ),
];

Render:

BadgeGrid(
  badges: badges,
)

Leaderboards

LeaderboardWidget(
  users: users,
)

Example:

final users = [

 LeaderboardUser(
   name: 'Alex',
   xp: 2500,
 ),

 LeaderboardUser(
   name: 'Sarah',
   xp: 1700,
 ),
];

Rewards

Reward(
 title: 'Premium Course',
 cost: 500,
)

Redeem:

RewardService()
  .redeem(
      reward,
      xp,
);

Example

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

void main() {
 runApp(
   const MyApp(),
 );
}

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

 @override
 Widget build(
   BuildContext context,
 ) {
   final controller =
       BadgesController();

   controller.addXP(
     800,
   );

   return MaterialApp(
     home: Scaffold(
       body: XPCard(
         xp: controller.xp,
         level: controller.level,
       ),
     ),
   );
 }
}

Testing

Run tests:

flutter test

Analyze:

flutter analyze

Publish check:

flutter pub publish --dry-run

Roadmap

v1.0

  • XP
  • Levels
  • Badges

v1.1

  • Rewards

v1.2

  • Cloud Leaderboards

v2.0

  • Firebase Sync
  • Analytics

License

This project is licensed under the GNU General Public License v3.0 (GPL-3.0).

See the LICENSE file for details.


About Me

✨ I’m Sufyan bin Uzayr, an open-source developer passionate about building and sharing meaningful projects.

You can learn more about me and my work at:

🌐 https://sufyanism.com šŸ’¼ https://www.linkedin.com/in/sufyanism


Your all-in-one learning hub!

šŸš€ Explore courses and resources in coding, tech, and development at zeba.academy and code.zeba.academy.

Empower yourself with practical skills through curated tutorials, real-world projects, and hands-on experience.

Level up your tech game today! šŸ’»āœØ

Zeba Academy is a learning platform dedicated to:

  • Coding
  • Technology
  • Development

āž” Main Site: https://zeba.academy āž” Courses: https://code.zeba.academy āž” YouTube: https://www.youtube.com/@zeba.academy āž” Instagram: https://www.instagram.com/zeba.academy/


Thank you for visiting ā¤ļø