Skip to content

Commit

Permalink
Merge pull request #112 from Maheen-Ilyas/models
Browse files Browse the repository at this point in the history
Models folder created in lib folder
  • Loading branch information
sapatevaibhav authored May 22, 2024
2 parents bc2c3ff + f35b380 commit d5be0d7
Show file tree
Hide file tree
Showing 17 changed files with 181 additions and 125 deletions.
15 changes: 15 additions & 0 deletions lib/models/animal_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
15 changes: 15 additions & 0 deletions lib/models/bird_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
15 changes: 15 additions & 0 deletions lib/models/colours_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
13 changes: 13 additions & 0 deletions lib/models/flower_model.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'package:flutter/material.dart';

class Flower {
final String name;
final String resource;
final Color background;

Flower({
required this.name,
required this.resource,
required this.background,
});
}
15 changes: 15 additions & 0 deletions lib/models/itemdata_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
15 changes: 15 additions & 0 deletions lib/models/occupation_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
15 changes: 15 additions & 0 deletions lib/models/planet_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
15 changes: 15 additions & 0 deletions lib/models/season_model.dart
Original file line number Diff line number Diff line change
@@ -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,
});
}
16 changes: 1 addition & 15 deletions lib/pages/modules/animals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,8 @@ 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 {


Expand Down
21 changes: 6 additions & 15 deletions lib/pages/modules/atoz.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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';
import 'package:learn/utils/constants.dart';

class ItemTile extends StatelessWidget {
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -301,4 +288,8 @@ class _AtoZState extends State<AtoZ> {
),
);
}
}
}

void main() {
runApp(const AtoZ());
}
16 changes: 1 addition & 15 deletions lib/pages/modules/birds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,11 @@ 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 {


final FlutterTts flutterTts = FlutterTts();
final AudioPlayer audioPlayer = AudioPlayer();

Expand Down
15 changes: 1 addition & 14 deletions lib/pages/modules/colours.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:learn/utils/assets_path.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,
});
}
import 'package:learn/models/colours_model.dart';

class ColoursPage extends StatefulWidget {
const ColoursPage({Key? key}) : super(key: key);
Expand Down
69 changes: 45 additions & 24 deletions lib/pages/modules/flowers.dart
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:learn/models/flower_model.dart';
import 'package:learn/utils/assets_path.dart';


class Flower{
final String name;
final String resource;
final Color background;

Flower({required this.name,required this.resource,required this.background});
}


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

Expand All @@ -21,26 +12,56 @@ class FlowerPage extends StatefulWidget {
}

class _FlowerPageState extends State<FlowerPage> {

final List<Flower> flowers = [
Flower(name: "Rose", resource: AssetsPath.getFlowerImage(Flowers.rose), background: Colors.redAccent),
Flower(name: "Sunflower", resource: AssetsPath.getFlowerImage(Flowers.sunflower), background: Colors.yellowAccent),
Flower(name: "Lily", resource: AssetsPath.getFlowerImage(Flowers.lily), background: Colors.greenAccent),
Flower(name: "Marigold", resource: AssetsPath.getFlowerImage(Flowers.marigold), background: Colors.yellow),
Flower(name: "Carnation", resource: AssetsPath.getFlowerImage(Flowers.carnation), background: Colors.redAccent),
Flower(name: "Daffodil", resource: AssetsPath.getFlowerImage(Flowers.daffodil), background: Colors.purpleAccent),
Flower(name: "Daisy", resource: AssetsPath.getFlowerImage(Flowers.daisy), background: Colors.green),
Flower(name: "Poppy", resource: AssetsPath.getFlowerImage(Flowers.poppy), background: Colors.redAccent),
Flower(name: "Tulip", resource: AssetsPath.getFlowerImage(Flowers.tulip), background: Colors.pink),
Flower(name: "Lavender", resource: AssetsPath.getFlowerImage(Flowers.lavender), background: Colors.purple),
Flower(name: "Hibiscus", resource: AssetsPath.getFlowerImage(Flowers.hibiscus), background: Colors.red),

Flower(
name: "Rose",
resource: AssetsPath.getFlowerImage(Flowers.rose),
background: Colors.redAccent),
Flower(
name: "Sunflower",
resource: AssetsPath.getFlowerImage(Flowers.sunflower),
background: Colors.yellowAccent),
Flower(
name: "Lily",
resource: AssetsPath.getFlowerImage(Flowers.lily),
background: Colors.greenAccent),
Flower(
name: "Marigold",
resource: AssetsPath.getFlowerImage(Flowers.marigold),
background: Colors.yellow),
Flower(
name: "Carnation",
resource: AssetsPath.getFlowerImage(Flowers.carnation),
background: Colors.redAccent),
Flower(
name: "Daffodil",
resource: AssetsPath.getFlowerImage(Flowers.daffodil),
background: Colors.purpleAccent),
Flower(
name: "Daisy",
resource: AssetsPath.getFlowerImage(Flowers.daisy),
background: Colors.green),
Flower(
name: "Poppy",
resource: AssetsPath.getFlowerImage(Flowers.poppy),
background: Colors.redAccent),
Flower(
name: "Tulip",
resource: AssetsPath.getFlowerImage(Flowers.tulip),
background: Colors.pink),
Flower(
name: "Lavender",
resource: AssetsPath.getFlowerImage(Flowers.lavender),
background: Colors.purple),
Flower(
name: "Hibiscus",
resource: AssetsPath.getFlowerImage(Flowers.hibiscus),
background: Colors.red),
];

final FlutterTts flutterTts = FlutterTts();
int currentIndex = 0;


void _navigateToNextFlower() {
setState(() {
currentIndex = (currentIndex + 1) % flowers.length;
Expand Down
15 changes: 1 addition & 14 deletions lib/pages/modules/occupation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
15 changes: 1 addition & 14 deletions lib/pages/modules/planets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_tts/flutter_tts.dart';
import 'package:just_audio/just_audio.dart';
import 'package:learn/utils/assets_path.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<Planet> planets = [
Expand Down
15 changes: 1 addition & 14 deletions lib/pages/modules/seasons.dart
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
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);

Expand Down
Loading

0 comments on commit d5be0d7

Please sign in to comment.