quiz_bank 0.0.2 icon indicating copy to clipboard operation
quiz_bank: ^0.0.2 copied to clipboard

A new Flutter Package that gives access to general true false questions , and is super-easy to use.

Quiz Bank #

A package containing the general quiz questions based on True False. Quiz Bank is super easy to use TRUE FALSE based question bank for Flutter. You may add your own quiz questions in addition to the existing one.

Version

Features #

  • Single line question generator
  • Super customizable
    • Randomize the questions
    • Add your own questions

Getting started #

You must add the library as a dependency to your project.

dependencies:
 quiz_bank: ^0.0.1

You can also reference the git repo directly if you want:

dependencies:
 quiz_bank:
   git: git://github.com/droidbg/quiz_bank.git

You should then run flutter packages get

Usage #

import 'package:quiz_bank/quiz_bank.dart'
main(){
QuizBrain quiz_brain=QuizBrain(); //Create Object
//Random Question Generate
quiz_brain.RandomQuestion();
//Generate Next Question: return type Void
quiz_brain.nextQuestion();

//Print Question and Correct Options
print(quiz_brain.getQuestionText());
print(quiz_brain.getCorrectAnswer());


}

Example Code


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

void main() => runApp(DemoQuiz());

class DemoQuiz extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: QuestionPage(),
    );
  }
}

class QuestionPage extends StatefulWidget {
  @override
  _QuestionPageState createState() => _QuestionPageState();
}

class _QuestionPageState extends State<QuestionPage> {
  QuizBrain quiz_brain = QuizBrain();

  RandomText() {
    setState(() {
      quiz_brain.RandomQuestion();
    });
  }

  changeText() {
    setState(() {
      quiz_brain.nextQuestion();
    });
  }

  @override
  Widget build(BuildContext context) {
    String QuestionText = quiz_brain.getQuestionText(); //Question Goes Here
    bool AnswerText = quiz_brain.getCorrectAnswer(); //Answer Goes Here
    return Scaffold(
        appBar: AppBar(title: Text('Quiz Demo')),
        body: Center(
            child: Column(children: [
          SizedBox(
            height: 70.0,
          ),
          Text(
            '$QuestionText',
          ),
          Text(
            '$AnswerText',
          ),
          SizedBox(
            height: 20.0,
          ),
          ElevatedButton(
              child: Text('Next Question'),
              onPressed: () {
                changeText();
              }),
          SizedBox(
            height: 20.0,
          ),
          ElevatedButton(
              child: Text('Random Question'),
              onPressed: () {
                RandomText();
              })
        ])));
  }
}



Output

Output

Contributions #

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request.

Version compatability #

See CHANGELOG for all breaking (and non-breaking) changes.


Made with ❤ by Binni G.

4
likes
100
pub points
33%
popularity

Publisher

unverified uploader

A new Flutter Package that gives access to general true false questions , and is super-easy to use.

Documentation

API reference

License

Icon for licenses.MIT (LICENSE)

Dependencies

flutter

More

Packages that depend on quiz_bank