quiz_package 0.1.5 copy "quiz_package: ^0.1.5" to clipboard
quiz_package: ^0.1.5 copied to clipboard

A package providing quiz-related widgets and utilities.

🧠 quiz_package #

quiz_package est un package Flutter permettant d'intégrer facilement une mécanique de quiz dans votre application, avec ou sans clé de participation. Il fournit un widget principal QuizEngine hautement configurable et extensible.

🚀 Installation #

Ajoutez ceci à votre pubspec.yaml :

dependencies:
  quiz_package:
    quiz-package: {{pubdev_version}}
    #path: /srv/owlnext/quiz-package
    #git:
      #url: https://github.com/owlnext-fr/quiz-package

📦 Import

import 'package:quiz_package/quiz_package.dart';

🧪 Exemple d'utilisation

@override
Widget build(BuildContext context) {
  if (isPartcipationKeyReachable) {
    return QuizEngine(
      useParticipationKey: true,
      services: QuizEngineServices(
        getParticipationDetails: () async {
          return await ParticipationService().getParticipationDetails();
        },
        putParticipationResponses: ({required data}) async {
          return await ParticipationService().putParticipationResponses(data: data);
        },
      ),
      errors: QuizEngineErrorLogger(
        captureException: (throwable, {scope, stackTrace}) async {
          Sentry.captureException(throwable, stackTrace: stackTrace, withScope: (scopeContext) {
            scopeContext.setTag(
              'QuizEngine -> scope: ${scope ?? "Not provided"}',
              'error: $throwable, trace: $stackTrace',
            );
          });
        },
      ),
    );
  }

  // Fallback sans clé de participation
  return QuizEngine(
    useParticipationKey: false,
    quizTemplate: fallbackQuiz, //Passer directement le template de formulaire
    services: QuizEngineServices(),
    errors: QuizEngineErrorLogger(
      captureException: (throwable, {scope, stackTrace}) async {
        Sentry.captureException(throwable, stackTrace: stackTrace, withScope: (scopeContext) {
          scopeContext.setTag(
            'QuizEngine -> scope: ${scope ?? "Not provided"}',
            'error: $throwable, trace: $stackTrace',
          );
        });
      },
    ),
  );
}

0
likes
120
points
59
downloads

Publisher

unverified uploader

Weekly Downloads

A package providing quiz-related widgets and utilities.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

cached_network_image, flutter, flutter_markdown, intl, url_launcher

More

Packages that depend on quiz_package