⚔️ Zeba Academy Learning Battle

A Flutter package for creating interactive learning battles, quiz competitions, player rankings, match history, and reward systems.

Build competitive learning experiences inside your Flutter applications with reusable models, services, and UI components.

Flutter Dart License


✨ Features

⚔️ 1v1 Learning Battles

Create competitive learning matches between two players.

Features:

  • Player vs Player battles
  • Battle creation
  • Question-based challenges
  • Score calculation
  • Winner detection

🧠 Quiz Competitions

Create quiz-based learning competitions.

Features:

  • Multiple choice questions
  • Question management
  • Answer validation
  • Quiz scoring system

🏆 Ranking System

Track learner progress with competitive rankings.

Features:

  • XP based leaderboard
  • Player ranking
  • Automatic sorting
  • Competitive learning experience

📜 Match History

Keep track of learning battles.

Features:

  • Battle records
  • Player history
  • Winner tracking
  • Match result storage

🎁 Rewards System

Motivate learners with rewards.

Features:

  • XP rewards
  • Achievement-ready structure
  • Reward tracking
  • Gamification support

📦 Installation

Add dependency:

dependencies:
  zeba_academy_learning_battle: ^1.0.0

Run:

flutter pub get

🚀 Usage

Import the package:

import 'package:zeba_academy_learning_battle/zeba_academy_learning_battle.dart';

👤 Create Players

final player1 = Player(
  id: "1",
  name: "Sufyan",
  points: 100,
);


final player2 = Player(
  id: "2",
  name: "Alex",
  points: 80,
);

🧠 Create Quiz Questions

final questions = [

Question(
  id: "q1",
  question: "Flutter uses which language?",
  options: [
    "Java",
    "Dart",
    "Python",
    "Swift",
  ],
  correctIndex: 1,
)

];

⚔️ Start Battle

final battle =
BattleService()
.createBattle(
  player1: player1,
  player2: player2,
  questions: questions,
);

🏆 Calculate Winner

final winner =
BattleService()
.calculateWinner(
  player1Score: 10,
  player2Score: 7,
);

print(winner);

Output:

player1

📊 Ranking Players

final rankedPlayers =
RankingService()
.rankPlayers(players);

Players will be sorted by XP points.


🎨 Widgets

Battle Card

BattleCard(
  battle: battle,
)

Ranking Tile

RankingTile(
  player: player,
  rank: 1,
)

🗂️ Package Structure

lib/

src/

 ├── models/
 │    ├── player.dart
 │    ├── question.dart
 │    ├── battle.dart
 │    └── reward.dart
 │
 ├── services/
 │    ├── battle_service.dart
 │    └── ranking_service.dart
 │
 └── widgets/
      ├── battle_card.dart
      └── ranking_tile.dart

🧪 Testing

Run tests:

flutter test

Analyze code:

flutter analyze

🛠️ Requirements

  • Flutter >= 3.10.0
  • Dart >= 3.0.0

🧑‍💻 About Me

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

Learn more about my work:

🌐 Website:
https://sufyanism.com/

💼 LinkedIn:
https://www.linkedin.com/in/sufyanism


🚀 Your all-in-one learning hub!

Explore courses and resources in coding, technology, and development.

Zeba Academy helps developers grow through practical learning, tutorials, projects, and hands-on experience.

Visit:

🌐 Main website:
https://zeba.academy

💻 Coding resources:
https://code.zeba.academy

▶️ YouTube tutorials:
https://www.youtube.com/@zeba.academy

📸 Instagram:
https://www.instagram.com/zeba.academy/


🤝 Contributing

Contributions are welcome.

Steps:

  1. Fork the repository

  2. Create a feature branch

git checkout -b feature/new-feature
  1. Commit changes
git commit -m "Add new feature"
  1. Push branch
git push origin feature/new-feature
  1. Create Pull Request

📄 License

This project is licensed under the GNU General Public License v3.0.

You are free to:

  • Use
  • Modify
  • Share
  • Distribute

under the terms of GPL-3.0.

See the LICENSE file for details.


⭐ Support

If this package helps your project:

⭐ Star the repository

🐛 Report issues

💡 Suggest improvements

Thank you for using Zeba Academy Learning Battle! 🚀