Skip to content

Commit

Permalink
Merge PR #34 from Gaurav-Kushwaha-1225 #23
Browse files Browse the repository at this point in the history
Add AppConstants Issue #23
  • Loading branch information
sapatevaibhav authored May 11, 2024
2 parents fec52af + 96cdb3b commit 9e2a4d1
Show file tree
Hide file tree
Showing 9 changed files with 674 additions and 641 deletions.
3 changes: 2 additions & 1 deletion lib/pages/about.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:learn/utils/constants.dart';
import 'package:url_launcher/url_launcher.dart';

class AboutPage extends StatelessWidget {
Expand Down Expand Up @@ -46,7 +47,7 @@ class AboutPage extends StatelessWidget {
),
const SizedBox(height: 8.0),
const Text(
'Interactive app to let your kids learn various things like\n\n - A - Z alphabets.\n - Animals and their sounds.\n - Birds and their sounds.\n - Various shapes.\n - Body parts.\n - Solar system.\n',
AppConstants.description,
style: TextStyle(fontSize: 18.0),
),
const SizedBox(height: 6.0),
Expand Down
138 changes: 9 additions & 129 deletions lib/pages/animals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,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';
import 'package:learn/utils/constants.dart';

class Animal {
final String name;
Expand All @@ -20,128 +21,7 @@ class Animal {
}

class AnimalsPage extends StatelessWidget {
final List<Animal> animals = [
Animal(
name: 'Cat',
svgAsset: 'assets/images/cat.svg',
soundAsset: 'assets/sounds/cat_sound.wav',
backgroundColor: const Color.fromARGB(193, 76, 175, 79),
),
Animal(
name: 'Deer',
svgAsset: 'assets/images/deer.svg',
soundAsset: 'assets/sounds/deer_sound.mp3',
backgroundColor: const Color.fromARGB(194, 157, 82, 222),
),
Animal(
name: 'Bear',
svgAsset: 'assets/images/bear.svg',
soundAsset: 'assets/sounds/bear_sound.mp3',
backgroundColor: const Color.fromARGB(193, 76, 207, 222),
),
Animal(
name: 'Cow',
svgAsset: 'assets/images/cow.svg',
soundAsset: 'assets/sounds/cow_sound.mp3',
backgroundColor: const Color.fromARGB(157, 251, 0, 0),
),
Animal(
name: 'Fox',
svgAsset: 'assets/images/fox.svg',
soundAsset: 'assets/sounds/fox_sound.mp3',
backgroundColor: const Color.fromARGB(193, 21, 234, 28),
),
Animal(
name: 'Giraffe',
svgAsset: 'assets/images/giraffe.svg',
soundAsset: 'assets/sounds/giraffe_sound.mp3',
backgroundColor: const Color.fromARGB(193, 226, 221, 70),
),
Animal(
name: 'Goat',
svgAsset: 'assets/images/goat.svg',
soundAsset: 'assets/sounds/goat_sound.mp3',
backgroundColor: const Color.fromARGB(138, 48, 59, 48),
),
Animal(
name: 'Kangaroo',
svgAsset: 'assets/images/kangaroo.svg',
soundAsset: 'assets/sounds/kangaroo_sound.mp3',
backgroundColor: const Color.fromARGB(154, 221, 214, 209),
),
Animal(
name: 'Monkey',
svgAsset: 'assets/images/monkey.svg',
soundAsset: 'assets/sounds/monkey_sound.mp3',
backgroundColor: const Color.fromARGB(193, 76, 175, 79),
),
Animal(
name: 'Pig',
svgAsset: 'assets/images/pig.svg',
soundAsset: 'assets/sounds/pig_sound.mp3',
backgroundColor: const Color.fromARGB(151, 40, 137, 248),
),
Animal(
name: 'Sheep',
svgAsset: 'assets/images/sheep.svg',
soundAsset: 'assets/sounds/sheep_sound.mp3',
backgroundColor: const Color.fromARGB(193, 240, 241, 170),
),
Animal(
name: 'Snake',
svgAsset: 'assets/images/snake.svg',
soundAsset: 'assets/sounds/snake_sound.mp3',
backgroundColor: const Color.fromARGB(193, 125, 176, 127),
),
Animal(
name: 'Squirrel',
svgAsset: 'assets/images/squirrel.svg',
soundAsset: 'assets/sounds/squirrel_sound.mp3',
backgroundColor: const Color.fromARGB(139, 175, 140, 76),
),
Animal(
name: 'Tiger',
svgAsset: 'assets/images/tiger.svg',
soundAsset: 'assets/sounds/tiger_sound.mp3',
backgroundColor: const Color.fromARGB(157, 251, 151, 0),
),
Animal(
name: 'Zebra',
svgAsset: 'assets/images/zebra.svg',
soundAsset: 'assets/sounds/zebra_sound.mp3',
backgroundColor: const Color.fromARGB(193, 187, 74, 178),
),
Animal(
name: 'Dog',
svgAsset: 'assets/images/dog.svg',
soundAsset: 'assets/sounds/dog_sound.mp3',
backgroundColor: const Color.fromARGB(193, 33, 149, 243),
),
Animal(
name: 'Elephant',
svgAsset: 'assets/images/elephant.svg',
soundAsset: 'assets/sounds/elephant_sound.mp3',
backgroundColor: const Color.fromARGB(193, 182, 221, 252),
),
Animal(
name: 'Horse',
svgAsset: 'assets/images/horse.svg',
soundAsset: 'assets/sounds/horse_sound.mp3',
backgroundColor: const Color.fromARGB(98, 243, 201, 33),
),
Animal(
name: 'Lion',
svgAsset: 'assets/images/lion.svg',
soundAsset: 'assets/sounds/lion_sound.mp3',
backgroundColor: const Color.fromARGB(193, 43, 197, 35),
),
Animal(
name: 'Rabbit',
svgAsset: 'assets/images/rabbit.svg',
soundAsset: 'assets/sounds/rabbit_sound.mp3',
backgroundColor: const Color.fromARGB(156, 243, 33, 236),
),
];


final FlutterTts flutterTts = FlutterTts();
final AudioPlayer audioPlayer = AudioPlayer();
Expand All @@ -153,35 +33,35 @@ class AnimalsPage extends StatelessWidget {
return Scaffold(
appBar: AppBar(
title: const Text(
'Animals',
AppConstants.animal,
style: TextStyle(fontWeight: FontWeight.bold),
),
),
body: ListView.builder(
itemCount: animals.length,
itemCount: AppConstants.animals.length,
itemBuilder: (context, index) {
return GestureDetector(
onTap: () {
_showAnimalPopup(context, animals[index],index);
_showAnimalPopup(context, AppConstants.animals[index],index);
},
child: Container(
margin: const EdgeInsets.all(5.0),
padding: const EdgeInsets.all(8.0),
decoration: BoxDecoration(
border: Border.all(color: Colors.black, width: 1.0),
borderRadius: BorderRadius.circular(8.0),
color: animals[index].backgroundColor,
color: AppConstants.animals[index].backgroundColor,
),
child: Row(
children: [
SizedBox(
width: 50,
height: 50,
child: SvgPicture.asset(animals[index].svgAsset),
child: SvgPicture.asset(AppConstants.animals[index].svgAsset),
),
const SizedBox(width: 28.0),
Text(
animals[index].name,
AppConstants.animals[index].name,
style: const TextStyle(
fontWeight: FontWeight.bold,
fontSize: 30.0,
Expand Down Expand Up @@ -210,7 +90,7 @@ class AnimalsPage extends StatelessWidget {
animal: animal,
flutterTts: flutterTts,
audioPlayer: audioPlayer,
animals: animals,
animals: AppConstants.animals,
currentIndex: currentIndex,
);
},
Expand Down
Loading

0 comments on commit 9e2a4d1

Please sign in to comment.