diff --git a/lib/models/animal_model.dart b/lib/models/animal_model.dart new file mode 100644 index 0000000..6c917ca --- /dev/null +++ b/lib/models/animal_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Animal { + final String name; + final String svgAsset; + final String soundAsset; + final Color backgroundColor; + + Animal({ + required this.name, + required this.svgAsset, + required this.soundAsset, + required this.backgroundColor, + }); +} diff --git a/lib/models/bird_model.dart b/lib/models/bird_model.dart new file mode 100644 index 0000000..f7aa028 --- /dev/null +++ b/lib/models/bird_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Bird { + final String name; + final String svgAsset; + final String soundAsset; + final Color backgroundColor; + + Bird({ + required this.name, + required this.svgAsset, + required this.soundAsset, + required this.backgroundColor, + }); +} diff --git a/lib/models/colours_model.dart b/lib/models/colours_model.dart new file mode 100644 index 0000000..5293a08 --- /dev/null +++ b/lib/models/colours_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Colours { + final String name; + final String jpgAsset; + final Color bgColor; + final Color fontColor; + + Colours({ + required this.name, + required this.jpgAsset, + required this.bgColor, + required this.fontColor, + }); +} diff --git a/lib/models/itemdata_model.dart b/lib/models/itemdata_model.dart new file mode 100644 index 0000000..c0ad7ca --- /dev/null +++ b/lib/models/itemdata_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class ItemData { + final String iconAsset; + final String title; + final String description; + final Color backgroundColor; + + ItemData({ + required this.iconAsset, + required this.title, + required this.description, + required this.backgroundColor, + }); +} diff --git a/lib/models/occupation_model.dart b/lib/models/occupation_model.dart new file mode 100644 index 0000000..0cbf7f6 --- /dev/null +++ b/lib/models/occupation_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Occupation { + final String name; + final String description; + final String svgAsset; + final Color backgroundColor; + + Occupation({ + required this.name, + required this.description, + required this.svgAsset, + required this.backgroundColor, + }); +} diff --git a/lib/models/planet_model.dart b/lib/models/planet_model.dart new file mode 100644 index 0000000..40c8432 --- /dev/null +++ b/lib/models/planet_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Planet { + final String name; + final String svgAsset; + final String description; + final Color backgroundColor; + + Planet({ + required this.name, + required this.svgAsset, + required this.description, + required this.backgroundColor, + }); +} diff --git a/lib/models/season_model.dart b/lib/models/season_model.dart new file mode 100644 index 0000000..9d57a74 --- /dev/null +++ b/lib/models/season_model.dart @@ -0,0 +1,15 @@ +import 'package:flutter/material.dart'; + +class Season { + final String name; + final String description; + final String imageAsset; + final Color backgroundColor; + + Season({ + required this.name, + required this.description, + required this.imageAsset, + required this.backgroundColor, + }); +} diff --git a/lib/pages/modules/animals.dart b/lib/pages/modules/animals.dart index 099aaa2..5149073 100644 --- a/lib/pages/modules/animals.dart +++ b/lib/pages/modules/animals.dart @@ -4,22 +4,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:just_audio/just_audio.dart'; +import 'package:learn/models/animal_model.dart'; import 'package:learn/utils/constants.dart'; -class Animal { - final String name; - final String svgAsset; - final String soundAsset; - final Color backgroundColor; - - Animal({ - required this.name, - required this.svgAsset, - required this.soundAsset, - required this.backgroundColor, - }); -} - class AnimalsPage extends StatelessWidget { diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index d5604e2..113c958 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -3,6 +3,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'dart:async'; import 'package:flutter_tts/flutter_tts.dart'; +import 'package:learn/models/itemdata_model.dart'; class ItemTile extends StatelessWidget { final int index; @@ -222,20 +223,6 @@ class _PopupDialogState extends State<_PopupDialog> { } } -class ItemData { - final String iconAsset; - final String title; - final String description; - final Color backgroundColor; - - ItemData({ - required this.iconAsset, - required this.title, - required this.description, - required this.backgroundColor, - }); -} - class AtoZ extends StatefulWidget { const AtoZ({Key? key}) : super(key: key); diff --git a/lib/pages/modules/birds.dart b/lib/pages/modules/birds.dart index e8a138b..563c7a5 100644 --- a/lib/pages/modules/birds.dart +++ b/lib/pages/modules/birds.dart @@ -4,22 +4,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:just_audio/just_audio.dart'; +import 'package:learn/models/bird_model.dart'; import 'package:learn/utils/constants.dart'; -class Bird { - final String name; - final String svgAsset; - final String soundAsset; - final Color backgroundColor; - - Bird({ - required this.name, - required this.svgAsset, - required this.soundAsset, - required this.backgroundColor, - }); -} - class BirdsPage extends StatelessWidget { diff --git a/lib/pages/modules/colours.dart b/lib/pages/modules/colours.dart index cdfcf09..1d01193 100644 --- a/lib/pages/modules/colours.dart +++ b/lib/pages/modules/colours.dart @@ -1,20 +1,8 @@ import 'package:flutter/material.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:learn/models/colours_model.dart'; -class Colours { - final String name; - final String jpgAsset; - final Color bgColor; - final Color fontColor; - - Colours({ - required this.name, - required this.jpgAsset, - required this.bgColor, - required this.fontColor, - }); -} class ColoursPage extends StatefulWidget { const ColoursPage({Key? key}) : super(key: key); diff --git a/lib/pages/modules/occupation.dart b/lib/pages/modules/occupation.dart index ee160c6..220964b 100644 --- a/lib/pages/modules/occupation.dart +++ b/lib/pages/modules/occupation.dart @@ -2,22 +2,9 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:just_audio/just_audio.dart'; +import 'package:learn/models/occupation_model.dart'; import 'package:learn/utils/constants.dart'; -class Occupation { - final String name; - final String description; - final String svgAsset; - final Color backgroundColor; - - Occupation({ - required this.name, - required this.description, - required this.svgAsset, - required this.backgroundColor, - }); -} - class OccupationPage extends StatelessWidget { final FlutterTts flutterTts = FlutterTts(); final AudioPlayer audioPlayer = AudioPlayer(); diff --git a/lib/pages/modules/seasons.dart b/lib/pages/modules/seasons.dart index 1de3e79..5643f3e 100644 --- a/lib/pages/modules/seasons.dart +++ b/lib/pages/modules/seasons.dart @@ -1,23 +1,10 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:learn/models/season_model.dart'; import 'package:learn/utils/constants.dart'; -class Season { - final String name; - final String description; - final String imageAsset; - final Color backgroundColor; - - Season({ - required this.name, - required this.description, - required this.imageAsset, - required this.backgroundColor, - }); -} - class SeasonsPage extends StatelessWidget { - SeasonsPage({Key? key}) : super(key: key); + const SeasonsPage({Key? key}) : super(key: key); @override Widget build(BuildContext context) { @@ -86,7 +73,7 @@ class SeasonPopup extends StatefulWidget { final int currentIndex; final List seasons; - SeasonPopup({ + const SeasonPopup({ required this.currentIndex, required this.seasons, }); diff --git a/lib/pages/modules/solar.dart b/lib/pages/modules/solar.dart index 4780968..3bc9b56 100644 --- a/lib/pages/modules/solar.dart +++ b/lib/pages/modules/solar.dart @@ -2,20 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:flutter_tts/flutter_tts.dart'; import 'package:just_audio/just_audio.dart'; - -class Planet { - final String name; - final String svgAsset; - final String description; - final Color backgroundColor; - - Planet({ - required this.name, - required this.svgAsset, - required this.description, - required this.backgroundColor, - }); -} +import 'package:learn/models/planet_model.dart'; class PlanetsPage extends StatelessWidget { final List planets = [ diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index fa33360..6c3cbd0 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -1,12 +1,14 @@ import 'dart:ui'; +import 'package:learn/models/animal_model.dart'; +import 'package:learn/models/bird_model.dart'; +import 'package:learn/models/itemdata_model.dart'; +import 'package:learn/models/occupation_model.dart'; +import 'package:learn/models/season_model.dart'; + import '../explore/quiz.dart'; import 'package:flutter/material.dart'; -import '../pages/modules/animals.dart'; -import '../pages/modules/atoz.dart'; -import '../pages/modules/birds.dart'; -import '../pages/modules/seasons.dart'; -import '../pages/modules/occupation.dart'; + class AppConstants { static const List candidates = [