diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index ba6fea6..4505007 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -259,7 +259,7 @@ class _AtoZState extends State { mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ const Text( - 'A-Z', + AppConstants.a_z, style: TextStyle(fontWeight: FontWeight.bold), ), Expanded( diff --git a/lib/pages/modules/colours.dart b/lib/pages/modules/colours.dart index a0f068d..b82c475 100644 --- a/lib/pages/modules/colours.dart +++ b/lib/pages/modules/colours.dart @@ -7,6 +7,8 @@ import 'package:learn/utils/assets_path.dart'; // import '../../utils/const_dimensions.dart'; import 'package:learn/models/colours_model.dart'; +import '../../utils/constants.dart'; + class ColoursPage extends StatefulWidget { const ColoursPage({Key? key}) : super(key: key); @@ -15,81 +17,20 @@ class ColoursPage extends StatefulWidget { } class _ColoursPageState extends State { - final List colours = [ - Colours( - name: 'Blue', - jpgAsset: AssetsPath.getColoursImage(ColorImages.blue), - bgColor: Colors.lightBlueAccent, - fontColor: Colors.lightBlueAccent, - ), - Colours( - name: 'Yellow', - jpgAsset: AssetsPath.getColoursImage(ColorImages.yellow), - bgColor: Colors.yellow.shade600, - fontColor: Colors.yellow.shade600, - ), - Colours( - name: 'Black', - jpgAsset: AssetsPath.getColoursImage(ColorImages.black), - bgColor: Colors.black, - fontColor: Colors.black, - ), - Colours( - name: 'Green', - jpgAsset: AssetsPath.getColoursImage(ColorImages.green), - bgColor: Colors.green, - fontColor: Colors.green, - ), - Colours( - name: 'Pink', - jpgAsset: AssetsPath.getColoursImage(ColorImages.pink), - bgColor: Colors.pink.shade300, - fontColor: Colors.pink.shade300, - ), - Colours( - name: 'White', - jpgAsset: AssetsPath.getColoursImage(ColorImages.white), - bgColor: Colors.grey.shade400, - fontColor: Colors.grey.shade400, - ), - Colours( - name: 'Red', - jpgAsset: AssetsPath.getColoursImage(ColorImages.red), - bgColor: Colors.red, - fontColor: Colors.red, - ), - Colours( - name: 'Violet', - jpgAsset: AssetsPath.getColoursImage(ColorImages.violet), - bgColor: Colors.deepPurple, - fontColor: Colors.deepPurple, - ), - Colours( - name: 'Brown', - jpgAsset: AssetsPath.getColoursImage(ColorImages.brown), - bgColor: const Color(0xFF964B00), - fontColor: const Color(0xFF964B00), - ), - Colours( - name: 'Orange', - jpgAsset: AssetsPath.getColoursImage(ColorImages.orange), - bgColor: Colors.orange, - fontColor: Colors.orange, - ), - ]; + final FlutterTts flutterTts = FlutterTts(); int currentIndex = 0; void _navigateToNextColour() { setState(() { - currentIndex = (currentIndex + 1) % colours.length; + currentIndex = (currentIndex + 1) % AppConstants.colours.length; }); } void _navigateToPreviousColour() { setState(() { - currentIndex = (currentIndex - 1 + colours.length) % colours.length; + currentIndex = (currentIndex - 1 + AppConstants.colours.length) % AppConstants.colours.length; }); } @@ -100,11 +41,11 @@ class _ColoursPageState extends State { @override Widget build(BuildContext context) { - Colours colour = colours[currentIndex]; + Colours colour = AppConstants.colours[currentIndex]; return Scaffold( appBar: AppBar( title: Text( - 'Colours', + AppConstants.color, style: TextStyle( fontWeight: FontWeight.bold, fontSize: 30, diff --git a/lib/pages/modules/flowers.dart b/lib/pages/modules/flowers.dart index db1ae9a..8b09405 100644 --- a/lib/pages/modules/flowers.dart +++ b/lib/pages/modules/flowers.dart @@ -1,183 +1,138 @@ -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'; - -// import '../../utils/const_dimensions.dart'; - -class FlowerPage extends StatefulWidget { - const FlowerPage({super.key}); - - @override - State createState() => _FlowerPageState(); -} - -class _FlowerPageState extends State { - final List flowers = [ - Flower( - name: "Rose", - resource: AssetsPath.getFlowerImage(Flowers.rose), - background: Colors.red.shade600), - Flower( - name: "Sunflower", - resource: AssetsPath.getFlowerImage(Flowers.sunflower), - background: Colors.yellow.shade700), - Flower( - name: "Lily", - resource: AssetsPath.getFlowerImage(Flowers.lily), - background: Colors.green.shade300), - Flower( - name: "Marigold", - resource: AssetsPath.getFlowerImage(Flowers.marigold), - background: Colors.orange.shade600), - Flower( - name: "Dandelion", - resource: AssetsPath.getFlowerImage(Flowers.dandelion), - background: Colors.green.shade600), - Flower( - name: "Lotus", - resource: AssetsPath.getFlowerImage(Flowers.lotus), - background: Colors.pink.shade300), - Flower( - name: "Daisy", - resource: AssetsPath.getFlowerImage(Flowers.daisy), - background: Colors.brown.shade400), - Flower( - name: "Jasmine", - resource: AssetsPath.getFlowerImage(Flowers.jasmine), - background: Colors.green.shade600), - Flower( - name: "Tulip", - resource: AssetsPath.getFlowerImage(Flowers.tulip), - background: Colors.pink.shade400), - Flower( - name: "Lavender", - resource: AssetsPath.getFlowerImage(Flowers.lavender), - background: Colors.purple.shade600), - Flower( - name: "Hibiscus", - resource: AssetsPath.getFlowerImage(Flowers.hibiscus), - background: Colors.pink.shade400), - ]; - - final FlutterTts flutterTts = FlutterTts(); - int currentIndex = 0; - - void _navigateToNextFlower() { - setState(() { - currentIndex = (currentIndex + 1) % flowers.length; - }); - } - - void _navigateToPreviousFlower() { - setState(() { - currentIndex = (currentIndex - 1 + flowers.length) % flowers.length; - }); - } - - Future readName(String name) async { - await flutterTts.setVolume(1.0); - await flutterTts.setLanguage("EN-IN"); - await flutterTts.setPitch(1.0); - await flutterTts.speak(name); - } - - @override - Widget build(BuildContext context) { - Flower flower = flowers[currentIndex]; - return Scaffold( - appBar: AppBar( - title: const Text( - 'Flowers', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 30, - ), - ), - ), - backgroundColor: flower.background, - - body: Center( - child: SingleChildScrollView( - child: Center( - child: Container( - padding: const EdgeInsets.all(20), - constraints: const BoxConstraints(maxWidth: 400, maxHeight: 700), - decoration: BoxDecoration( - color: Colors.white.withOpacity(0.7), - borderRadius: BorderRadius.circular(7.0), - boxShadow: [ - BoxShadow( - color: Colors.white.withOpacity(0.2), - spreadRadius: 2, - blurRadius: 5, - offset: const Offset(0, 3), - ), - ], - ), - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - GestureDetector( - onTap: _navigateToNextFlower, - child: Container( - width: double.infinity, - height: 300, - child: SvgPicture.asset( - flower.resource, - fit: BoxFit.contain, - ), - ), - ), - const SizedBox(height: 20), - Text( - flower.name, - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 60, - fontFamily: 'Comic', - color: flower.background, - ), - ), - const SizedBox(height: 20), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - IconButton( - onPressed: _navigateToPreviousFlower, - icon: const Icon( - Icons.arrow_back, - size: 30, - ), - ), - const SizedBox(width: 20), - IconButton.outlined( - highlightColor: Colors.amber, - onPressed: () { - readName(flower.name); - }, - icon: const Icon( - Icons.volume_up_outlined, - size: 40, - ), - ), - const SizedBox(width: 20), - IconButton( - onPressed: _navigateToNextFlower, - icon: const Icon( - Icons.arrow_forward, - size: 30, - ), - ) - ], - ), - ], - ), - ), - ), - ), - ), - ); - } -} +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'; +import 'package:learn/utils/constants.dart'; + +import '../../utils/const_dimensions.dart'; + +class FlowerPage extends StatefulWidget { + const FlowerPage({super.key}); + + @override + State createState() => _FlowerPageState(); +} + +class _FlowerPageState extends State { + + final FlutterTts flutterTts = FlutterTts(); + int currentIndex = 0; + + void _navigateToNextFlower() { + setState(() { + currentIndex = (currentIndex + 1) % AppConstants.flowers.length; + }); + } + + void _navigateToPreviousFlower() { + setState(() { + currentIndex = (currentIndex - 1 + AppConstants.flowers.length) % AppConstants.flowers.length; + }); + } + + Future readName(String name) async { + await flutterTts.setVolume(1.0); + await flutterTts.setLanguage("EN-IN"); + await flutterTts.setPitch(1.0); + await flutterTts.speak(name); + } + + @override + Widget build(BuildContext context) { + Flower flower = AppConstants.flowers[currentIndex]; + return Scaffold( + appBar: AppBar( + title: const Text( + AppConstants.flower, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30, + ), + ), + ), + backgroundColor: flower.background, + + body: Center( + child: SingleChildScrollView( + child: Center( + child: Container( + padding: const EdgeInsets.all(20), + constraints: const BoxConstraints(maxWidth: 400, maxHeight: 700), + decoration: BoxDecoration( + color: Colors.white.withOpacity(0.7), + borderRadius: BorderRadius.circular(7.0), + boxShadow: [ + BoxShadow( + color: Colors.white.withOpacity(0.2), + spreadRadius: 2, + blurRadius: 5, + offset: const Offset(0, 3), + ), + ], + ), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + GestureDetector( + onTap: _navigateToNextFlower, + child: Container( + width: double.infinity, + height: 300, + child: SvgPicture.asset( + flower.resource, + fit: BoxFit.contain, + ), + ), + ), + const SizedBox(height: 20), + Text( + flower.name, + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 60, + fontFamily: 'Comic', + color: flower.background, + ), + ), + const SizedBox(height: 20), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + IconButton( + onPressed: _navigateToPreviousFlower, + icon: const Icon( + Icons.arrow_back, + size: 30, + ), + ), + const SizedBox(width: 20), + IconButton.outlined( + highlightColor: Colors.amber, + onPressed: () { + readName(flower.name); + }, + icon: const Icon( + Icons.volume_up_outlined, + size: 40, + ), + ), + const SizedBox(width: 20), + IconButton( + onPressed: _navigateToNextFlower, + icon: const Icon( + Icons.arrow_forward, + size: 30, + ), + ) + ], + ), + ], + ), + ), + ), + ), + ), + ); + } +} \ No newline at end of file diff --git a/lib/pages/modules/occupation.dart b/lib/pages/modules/occupation.dart index 4225e71..7e7b5ee 100644 --- a/lib/pages/modules/occupation.dart +++ b/lib/pages/modules/occupation.dart @@ -17,7 +17,7 @@ class OccupationPage extends StatelessWidget { return Scaffold( appBar: AppBar( title: const Text( - 'Occupations', + AppConstants.occupation, style: TextStyle(fontWeight: FontWeight.bold), ), leading: IconButton( diff --git a/lib/pages/modules/planets.dart b/lib/pages/modules/planets.dart index 2ee6b88..25abc4f 100644 --- a/lib/pages/modules/planets.dart +++ b/lib/pages/modules/planets.dart @@ -5,66 +5,11 @@ 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'; +import 'package:learn/utils/constants.dart'; import '../../utils/const_dimensions.dart'; import 'package:learn/models/planet_model.dart'; class PlanetsPage extends StatelessWidget { - final List planets = [ - Planet( - name: 'Sun', - svgAsset: AssetsPath.getSolarImage(SolarSystem.sun), - description: 'Sun is the biggest star in the solar system.', - backgroundColor: const Color.fromARGB(255, 208, 211, 23), - ), - Planet( - name: 'Mercury', - svgAsset: AssetsPath.getSolarImage(SolarSystem.mercury), - description: 'Mercury is the closest planet to the Sun.', - backgroundColor: const Color.fromARGB(255, 221, 221, 221), - ), - Planet( - name: 'Venus', - svgAsset: AssetsPath.getSolarImage(SolarSystem.venus), - description: 'Venus is known for its thick atmosphere.', - backgroundColor: const Color.fromARGB(255, 240, 193, 95), - ), - Planet( - name: 'Earth', - svgAsset: AssetsPath.getSolarImage(SolarSystem.earth), - description: 'Earth is the third planet from the Sun.', - backgroundColor: const Color.fromARGB(255, 81, 149, 192), - ), - Planet( - name: 'Mars', - svgAsset: AssetsPath.getSolarImage(SolarSystem.mars), - description: 'Mars is often called the Red Planet.', - backgroundColor: const Color.fromARGB(255, 238, 118, 96), - ), - Planet( - name: 'Jupiter', - svgAsset: AssetsPath.getSolarImage(SolarSystem.jupiter), - description: 'Jupiter is the largest planet in our solar system.', - backgroundColor: const Color.fromARGB(255, 204, 164, 122), - ), - Planet( - name: 'Saturn', - svgAsset: AssetsPath.getSolarImage(SolarSystem.saturn), - description: 'Saturn is known for its beautiful rings.', - backgroundColor: const Color.fromARGB(255, 229, 215, 194), - ), - Planet( - name: 'Uranus', - svgAsset: AssetsPath.getSolarImage(SolarSystem.uranus), - description: 'Uranus is an ice giant with a unique rotation axis.', - backgroundColor: const Color.fromARGB(255, 169, 222, 246), - ), - Planet( - name: 'Neptune', - svgAsset: AssetsPath.getSolarImage(SolarSystem.neptune), - description: 'Neptune is the farthest planet from the Sun.', - backgroundColor: const Color.fromARGB(255, 64, 90, 200), - ), - ]; final FlutterTts flutterTts = FlutterTts(); final AudioPlayer audioPlayer = AudioPlayer(); @@ -76,7 +21,7 @@ class PlanetsPage extends StatelessWidget { return Scaffold( appBar: AppBar( title: const Text( - 'Solar System', + AppConstants.solar, style: TextStyle(fontWeight: FontWeight.bold), ), leading: IconButton( @@ -89,7 +34,7 @@ class PlanetsPage extends StatelessWidget { body: SingleChildScrollView( child: Center( child: PlanetWidget( - planets: planets, + planets: AppConstants.planets, flutterTts: flutterTts, audioPlayer: audioPlayer, ), diff --git a/lib/pages/modules/seasons.dart b/lib/pages/modules/seasons.dart index cd19bd9..1db4045 100644 --- a/lib/pages/modules/seasons.dart +++ b/lib/pages/modules/seasons.dart @@ -14,7 +14,7 @@ class SeasonsPage extends StatelessWidget { return Scaffold( appBar: AppBar( title: const Text( - 'Seasons Serenade', + AppConstants.season, style: TextStyle(fontWeight: FontWeight.bold), ), ), diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index 253e5bf..bf81d6f 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -7,6 +7,9 @@ import 'package:learn/models/occupation_model.dart'; import 'package:learn/models/season_model.dart'; import 'package:flutter/material.dart'; import 'package:learn/pages/fruits.dart'; +import '../models/colours_model.dart'; +import '../models/flower_model.dart'; +import '../models/planet_model.dart'; import '../pages/explore/quiz.dart'; import 'package:learn/pages/modules/colours.dart'; import 'package:learn/pages/modules/parts.dart'; @@ -21,6 +24,173 @@ import '../pages/modules/atoz.dart'; import '../pages/modules/birds.dart'; class AppConstants { + static List planets = [ + Planet( + name: 'Sun', + svgAsset: AssetsPath.getSolarImage(SolarSystem.sun), + description: 'Sun is the biggest star in the solar system.', + backgroundColor: const Color.fromARGB(255, 208, 211, 23), + ), + Planet( + name: 'Mercury', + svgAsset: AssetsPath.getSolarImage(SolarSystem.mercury), + description: 'Mercury is the closest planet to the Sun.', + backgroundColor: const Color.fromARGB(255, 221, 221, 221), + ), + Planet( + name: 'Venus', + svgAsset: AssetsPath.getSolarImage(SolarSystem.venus), + description: 'Venus is known for its thick atmosphere.', + backgroundColor: const Color.fromARGB(255, 240, 193, 95), + ), + Planet( + name: 'Earth', + svgAsset: AssetsPath.getSolarImage(SolarSystem.earth), + description: 'Earth is the third planet from the Sun.', + backgroundColor: const Color.fromARGB(255, 81, 149, 192), + ), + Planet( + name: 'Mars', + svgAsset: AssetsPath.getSolarImage(SolarSystem.mars), + description: 'Mars is often called the Red Planet.', + backgroundColor: const Color.fromARGB(255, 238, 118, 96), + ), + Planet( + name: 'Jupiter', + svgAsset: AssetsPath.getSolarImage(SolarSystem.jupiter), + description: 'Jupiter is the largest planet in our solar system.', + backgroundColor: const Color.fromARGB(255, 204, 164, 122), + ), + Planet( + name: 'Saturn', + svgAsset: AssetsPath.getSolarImage(SolarSystem.saturn), + description: 'Saturn is known for its beautiful rings.', + backgroundColor: const Color.fromARGB(255, 229, 215, 194), + ), + Planet( + name: 'Uranus', + svgAsset: AssetsPath.getSolarImage(SolarSystem.uranus), + description: 'Uranus is an ice giant with a unique rotation axis.', + backgroundColor: const Color.fromARGB(255, 169, 222, 246), + ), + Planet( + name: 'Neptune', + svgAsset: AssetsPath.getSolarImage(SolarSystem.neptune), + description: 'Neptune is the farthest planet from the Sun.', + backgroundColor: const Color.fromARGB(255, 64, 90, 200), + ), + ]; + + static List 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), + ]; + + static List colours = [ + Colours( + name: 'Blue', + jpgAsset: AssetsPath.getColoursImage(ColorImages.blue), + bgColor: Colors.lightBlueAccent, + fontColor: Colors.lightBlueAccent, + ), + Colours( + name: 'Yellow', + jpgAsset: AssetsPath.getColoursImage(ColorImages.yellow), + bgColor: Colors.yellow.shade600, + fontColor: Colors.yellow.shade600, + ), + Colours( + name: 'Black', + jpgAsset: AssetsPath.getColoursImage(ColorImages.black), + bgColor: Colors.black, + fontColor: Colors.black, + ), + Colours( + name: 'Green', + jpgAsset: AssetsPath.getColoursImage(ColorImages.green), + bgColor: Colors.green, + fontColor: Colors.green, + ), + Colours( + name: 'Pink', + jpgAsset: AssetsPath.getColoursImage(ColorImages.pink), + bgColor: Colors.pink.shade300, + fontColor: Colors.pink.shade300, + ), + Colours( + name: 'White', + jpgAsset: AssetsPath.getColoursImage(ColorImages.white), + bgColor: Colors.grey.shade400, + fontColor: Colors.grey.shade400, + ), + Colours( + name: 'Red', + jpgAsset: AssetsPath.getColoursImage(ColorImages.red), + bgColor: Colors.red, + fontColor: Colors.red, + ), + Colours( + name: 'Violet', + jpgAsset: AssetsPath.getColoursImage(ColorImages.violet), + bgColor: Colors.deepPurple, + fontColor: Colors.deepPurple, + ), + Colours( + name: 'Brown', + jpgAsset: AssetsPath.getColoursImage(ColorImages.brown), + bgColor: const Color(0xFF964B00), + fontColor: const Color(0xFF964B00), + ), + Colours( + name: 'Orange', + jpgAsset: AssetsPath.getColoursImage(ColorImages.orange), + bgColor: Colors.orange, + fontColor: Colors.orange, + ), + ]; + static List modules = [ Module( name: 'Quiz', @@ -856,8 +1026,11 @@ class AppConstants { static const String parts = 'Body Parts'; static const String shape = 'Shapes'; static const String solar = 'Solar System'; - static const String flowers = 'Flowers'; + static const String color = 'Colours'; + static const String flower = 'Flowers'; static const String fruit = 'Fruits & Vegetables'; + static const String occupation = 'Occupations'; + static const String season = 'Seasons Serenade'; static const String description = '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'; }