Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question models moved to different files #203

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions lib/models/fruit_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import 'package:flutter/material.dart';

class Fruit {
final String name;
final String svgAsset;
final bool isfruit;
final Color backgroundColor;

Fruit({
required this.name,
required this.isfruit,
required this.svgAsset,
required this.backgroundColor,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/animal_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class AnimalQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

AnimalQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/bird_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class BirdQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

BirdQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/flower_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class FlowerQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

FlowerQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/occupation_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class OccupationQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

OccupationQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/part_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class PartQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

PartQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
11 changes: 11 additions & 0 deletions lib/models/questions/planet_question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class PlanetQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

PlanetQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
13 changes: 13 additions & 0 deletions lib/models/questions/question.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
class Questions {
String question;
List<String> options;
String? image;
int answer;

Questions({
required this.question,
required this.options,
required this.answer,
this.image,
});
}
15 changes: 0 additions & 15 deletions lib/pages/explore/quiz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,6 @@ class Quiz extends StatefulWidget {
@override
State<Quiz> createState() => _QuizState();
}

class Questions {
String question;
List<String> options;
String? image;
int answer;

Questions({
required this.question,
required this.options,
required this.answer,
this.image,
});
}

class _QuizState extends State<Quiz> {
int _score = 0;
int SelectedIndex = -1;
Expand Down
14 changes: 0 additions & 14 deletions lib/pages/fruits.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@ import 'package:learn/utils/functions.dart';

import '../utils/const_dimensions.dart';

class Fruit {
final String name;
final String svgAsset;
final bool isfruit;
final Color backgroundColor;

Fruit({
required this.name,
required this.isfruit,
required this.svgAsset,
required this.backgroundColor,
});
}

class FruitsPage extends StatefulWidget {
FruitsPage({Key? key}) : super(key: key);

Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/animals_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class AnimalQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

AnimalQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/animal_question.dart';

class AnimalsTestPage extends StatefulWidget {
const AnimalsTestPage({Key? key}) : super(key: key);
Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/birds_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class BirdQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

BirdQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/bird_question.dart';

class BirdsTestPage extends StatefulWidget {
const BirdsTestPage({Key? key}) : super(key: key);
Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/flowers_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class FlowerQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

FlowerQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/flower_question.dart';

class FlowersTestPage extends StatefulWidget {
const FlowersTestPage({Key? key}) : super(key: key);
Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/occupations_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class OccupationQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

OccupationQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/occupation_question.dart';

class OccupationsTestPage extends StatefulWidget {
const OccupationsTestPage({Key? key}) : super(key: key);
Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/parts_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class PartQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

PartQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/part_question.dart';

class PartsTestPage extends StatefulWidget {
const PartsTestPage({Key? key}) : super(key: key);
Expand Down
13 changes: 1 addition & 12 deletions lib/pages/modules/planets_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,7 @@

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

class PlanetQuestion {
final String imageAsset;
final List<String> options;
final String correctAnswer;

PlanetQuestion({
required this.imageAsset,
required this.options,
required this.correctAnswer,
});
}
import 'package:learn/models/questions/planet_question.dart';

class PlanetsTestPage extends StatefulWidget {
const PlanetsTestPage({Key? key}) : super(key: key);
Expand Down
2 changes: 2 additions & 0 deletions lib/utils/constants.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

import 'package:learn/models/animal_model.dart';
import 'package:learn/models/bird_model.dart';
import 'package:learn/models/fruit_model.dart';
import 'package:learn/models/itemdata_model.dart';
import 'package:learn/models/occupation_model.dart';
import 'package:learn/models/questions/question.dart';
import 'package:learn/models/season_model.dart';
// ignore: unused_import
import 'package:learn/models/number_model.dart';
Expand Down