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

Professional exam and quiz UI kit for Flutter with question cards, result analytics, leaderboards, and reusable exam layouts for EdTech apps.

example/lib/main.dart

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

void main() {
  runApp(const ExamExampleApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: "Exam UI Kit Demo",
      theme: ThemeData(
        colorSchemeSeed: Colors.blue,
        useMaterial3: true,
        fontFamily: "Roboto",
      ),
      home: const ExamPage(),
    );
  }
}

class ExamPage extends StatefulWidget {
  const ExamPage({super.key});

  @override
  State<ExamPage> createState() => _ExamPageState();
}

class _ExamPageState extends State<ExamPage> {

  int currentQuestion = 0;
  int score = 0;
  int? selectedIndex;

  final List<QuestionModel> questions = [

    QuestionModel(
      question: "What is Flutter?",
      options: [
        "Framework",
        "Language",
        "Database",
        "IDE"
      ],
      correctIndex: 0,
    ),

    QuestionModel(
      question: "Flutter uses which language?",
      options: [
        "Java",
        "Dart",
        "Python",
        "Kotlin"
      ],
      correctIndex: 1,
    ),

    QuestionModel(
      question: "Who developed Flutter?",
      options: [
        "Microsoft",
        "Apple",
        "Google",
        "Meta"
      ],
      correctIndex: 2,
    ),
  ];

  void nextQuestion() {

    if (selectedIndex == questions[currentQuestion].correctIndex) {
      score++;
    }

    if (currentQuestion < questions.length - 1) {

      setState(() {
        currentQuestion++;
        selectedIndex = null;
      });

    } else {

      Navigator.push(
        context,
        MaterialPageRoute(
          builder: (_) => ResultScreen(
            score: score,
            total: questions.length,
          ),
        ),
      );
    }
  }

  @override
  Widget build(BuildContext context) {

    return Scaffold(

      appBar: AppBar(
        centerTitle: true,
        title: const Text(
          "Zeba Academy Exam UI Kit",
          style: TextStyle(fontWeight: FontWeight.bold),
        ),
      ),

      body: Container(

        decoration: const BoxDecoration(
          gradient: LinearGradient(
            colors: [
              Color(0xffeef2ff),
              Color(0xffffffff)
            ],
            begin: Alignment.topCenter,
            end: Alignment.bottomCenter,
          ),
        ),

        child: Padding(
          padding: const EdgeInsets.all(20),

          child: Column(
            children: [

              ExamProgressBar(
                current: currentQuestion + 1,
                total: questions.length,
              ),

              const SizedBox(height: 20),

              Expanded(
                child: Center(
                  child: QuestionCard(
                    question: questions[currentQuestion],
                    onOptionSelected: (index) {
                      selectedIndex = index;
                    },
                  ),
                ),
              ),

              SizedBox(
                width: double.infinity,
                height: 50,
                child: ElevatedButton(
                  onPressed: nextQuestion,
                  child: const Text(
                    "Next Question",
                    style: TextStyle(fontSize: 16),
                  ),
                ),
              ),

              const SizedBox(height: 10),

            ],
          ),
        ),
      ),
    );
  }
}
0
likes
130
points
97
downloads
screenshot

Documentation

API reference

Publisher

verified publisherzeba.academy

Weekly Downloads

Professional exam and quiz UI kit for Flutter with question cards, result analytics, leaderboards, and reusable exam layouts for EdTech apps.

Homepage

License

unknown (license)

Dependencies

flutter

More

Packages that depend on zeba_academy_exam_ui_kit