diff --git a/assets/images/flowers/carnation.svg b/assets/images/flowers/carnation.svg new file mode 100644 index 0000000..0c0d1d0 --- /dev/null +++ b/assets/images/flowers/carnation.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/daffodil.svg b/assets/images/flowers/daffodil.svg new file mode 100644 index 0000000..371a236 --- /dev/null +++ b/assets/images/flowers/daffodil.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/daisy.svg b/assets/images/flowers/daisy.svg new file mode 100644 index 0000000..6103b4d --- /dev/null +++ b/assets/images/flowers/daisy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/flower-icon.svg b/assets/images/flowers/flower-icon.svg new file mode 100644 index 0000000..16574cc --- /dev/null +++ b/assets/images/flowers/flower-icon.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/flower_banner.jpeg b/assets/images/flowers/flower_banner.jpeg new file mode 100644 index 0000000..642db9f Binary files /dev/null and b/assets/images/flowers/flower_banner.jpeg differ diff --git a/assets/images/flowers/hibiscus.svg b/assets/images/flowers/hibiscus.svg new file mode 100644 index 0000000..374b693 --- /dev/null +++ b/assets/images/flowers/hibiscus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/lavender.svg b/assets/images/flowers/lavender.svg new file mode 100644 index 0000000..5b8b037 --- /dev/null +++ b/assets/images/flowers/lavender.svg @@ -0,0 +1,3322 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/assets/images/flowers/lily.svg b/assets/images/flowers/lily.svg new file mode 100644 index 0000000..faa1785 --- /dev/null +++ b/assets/images/flowers/lily.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/marigold.svg b/assets/images/flowers/marigold.svg new file mode 100644 index 0000000..ad4fa2c --- /dev/null +++ b/assets/images/flowers/marigold.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/poppy.svg b/assets/images/flowers/poppy.svg new file mode 100644 index 0000000..430213e --- /dev/null +++ b/assets/images/flowers/poppy.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/rose.svg b/assets/images/flowers/rose.svg new file mode 100644 index 0000000..55172e3 --- /dev/null +++ b/assets/images/flowers/rose.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/sunflower.svg b/assets/images/flowers/sunflower.svg new file mode 100644 index 0000000..b178b76 --- /dev/null +++ b/assets/images/flowers/sunflower.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/flowers/tulip.svg b/assets/images/flowers/tulip.svg new file mode 100644 index 0000000..f754c50 --- /dev/null +++ b/assets/images/flowers/tulip.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index 4c476fb..95a9fe7 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ import 'package:flutter/material.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:learn/cubit/index_cubit.dart'; import 'package:learn/pages/about.dart'; +import 'package:learn/pages/flowers.dart'; import 'package:learn/pages/modules/atoz.dart'; import 'package:learn/pages/modules/birds.dart'; import 'package:learn/pages/modules/animals.dart'; @@ -12,11 +12,10 @@ import 'package:learn/pages/modules/parts.dart'; import 'package:learn/pages/modules/shapes.dart'; import 'package:learn/pages/modules/solar.dart'; import 'package:learn/utils/routes.dart'; -import 'package:learn/widgets/drawer.dart'; import 'package:learn/pages/modules/colours.dart'; -import 'package:fluttertoast/fluttertoast.dart'; import 'package:learn/widgets/navbar/navbar.dart'; +import 'cubit/index_cubit.dart'; import 'pages/home.dart'; DateTime? currentBackPressTime; @@ -66,6 +65,7 @@ class MyApp extends StatelessWidget { AllRoutes.animalRoute: (context) => AnimalsPage(), AllRoutes.colourRoute: (context) => const ColoursPage(), AllRoutes.aboutRoute: (context) => const AboutPage(), + AllRoutes.flowerRoute: (context) => const FlowerPage(), AllRoutes.exploreRoute: (context) => const ExplorePage(), AllRoutes.favoriteRoute: (context) => const FavoritePage(), }, diff --git a/lib/pages/flowers.dart b/lib/pages/flowers.dart new file mode 100644 index 0000000..9a7eba8 --- /dev/null +++ b/lib/pages/flowers.dart @@ -0,0 +1,154 @@ +import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:flutter_tts/flutter_tts.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}); + + @override + State createState() => _FlowerPageState(); +} + +class _FlowerPageState extends State { + + final List flowers = [ + Flower(name: "Rose", resource: AssetsPath.getFlowerImage("rose.svg"), background: Colors.redAccent), + Flower(name: "Sunflower", resource: AssetsPath.getFlowerImage("sunflower.svg"), background: Colors.yellowAccent), + Flower(name: "Lily", resource: AssetsPath.getFlowerImage("lily.svg"), background: Colors.greenAccent), + Flower(name: "Marigold", resource: AssetsPath.getFlowerImage("marigold.svg"), background: Colors.yellow), + Flower(name: "Carnation", resource: AssetsPath.getFlowerImage("carnation.svg"), background: Colors.redAccent), + Flower(name: "Daffodil", resource: AssetsPath.getFlowerImage("daffodil.svg"), background: Colors.purpleAccent), + Flower(name: "Daisy", resource: AssetsPath.getFlowerImage("daisy.svg"), background: Colors.green), + Flower(name: "Poppy", resource: AssetsPath.getFlowerImage("poppy.svg"), background: Colors.redAccent), + Flower(name: "Tulip", resource: AssetsPath.getFlowerImage("tulip.svg"), background: Colors.pink), + Flower(name: "Lavender", resource: AssetsPath.getFlowerImage("lavender.svg"), background: Colors.purple), + Flower(name: "Hibiscus", resource: AssetsPath.getFlowerImage("hibiscus.svg"), background: Colors.red), + + ]; + + 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: 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: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 60, + fontFamily: 'Comic', + ), + ), + 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, + ), + ), + ], + ), + ], + ), + ), + ), + ); + } +} diff --git a/lib/pages/home.dart b/lib/pages/home.dart index cb749e3..86b9844 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -18,6 +18,7 @@ class _MyHomePageState extends State { bool _isImageClicked2 = false; bool _isImageClicked3 = false; bool _isImageClicked4 = false; + bool _isImageClicked5 = false; bool _isDarkTheme = false; Future _onBackPressed() { @@ -262,6 +263,44 @@ class _MyHomePageState extends State { style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), ), const Text("Explore and learn about the colours!"), + const SizedBox(height: 20), + GestureDetector( + onTap: () { + setState(() { + _isImageClicked5 = !_isImageClicked5; + }); + Future.delayed(const Duration(milliseconds: 300), () { + Navigator.pushNamed(context, AllRoutes.flowerRoute); + }); + }, + child: AnimatedContainer( + duration: const Duration(milliseconds: 300), + curve: Curves.easeInOut, + height: _isImageClicked5 ? 325 : 350, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(12), + border: Border.all(color: Colors.black, width: 2), + boxShadow: [ + BoxShadow( + color: Colors.black.withOpacity(0.2), + spreadRadius: 2, + blurRadius: 5, + offset: const Offset(0, 3), + ), + ], + image: const DecorationImage( + image: AssetImage('assets/images/flowers/flower_banner.jpeg'), + fit: BoxFit.cover, + ), + ), + ), + ), + const SizedBox(height: 20), + const Text( + 'FLOWERS', + style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold), + ), + const Text("Explore beauty of nature flowers."), ], ), ), diff --git a/lib/utils/assets_path.dart b/lib/utils/assets_path.dart new file mode 100644 index 0000000..478641d --- /dev/null +++ b/lib/utils/assets_path.dart @@ -0,0 +1,7 @@ +class AssetsPath { + static const String _flowerImages = 'assets/images/flowers/'; + + static String getFlowerImage(String name) { + return _flowerImages + name; + } +} diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index b3159dc..b2c4175 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -458,6 +458,7 @@ 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 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'; } diff --git a/lib/utils/routes.dart b/lib/utils/routes.dart index fa39316..981ed55 100644 --- a/lib/utils/routes.dart +++ b/lib/utils/routes.dart @@ -1,3 +1,4 @@ + class AllRoutes { static String loginRoute = "/login"; static String homeRoute = "/home"; @@ -11,4 +12,6 @@ class AllRoutes { static String atozRoute = "/atoz"; static String aboutRoute = "/about"; static String colourRoute = "/colours"; + static String flowerRoute = "/flowers"; + } diff --git a/lib/widgets/drawer.dart b/lib/widgets/drawer.dart index d328762..b60c5ac 100644 --- a/lib/widgets/drawer.dart +++ b/lib/widgets/drawer.dart @@ -1,4 +1,6 @@ import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; +import 'package:learn/utils/assets_path.dart'; import 'package:learn/utils/routes.dart'; class MyDrawer extends StatelessWidget { @@ -98,6 +100,14 @@ class MyDrawer extends StatelessWidget { }, context: context, ), + _buildListTileSVG( + icon: AssetsPath.getFlowerImage('flower-icon.svg'), + title: "Flowers", + onTap: () { + Navigator.pushNamed(context, AllRoutes.flowerRoute); + }, + context: context, + ), _buildListTile( icon: Icons.question_mark_outlined, title: "About us", @@ -127,4 +137,19 @@ class MyDrawer extends StatelessWidget { onTap: onTap, ); } + Widget _buildListTileSVG({ + required BuildContext context, + required String icon, + required String title, + required VoidCallback onTap, + }) { + return ListTile( + leading: SvgPicture.asset(icon,height: 24,width: 24,color: const Color(0xFF49454f),), + title: Text( + title, + style: Theme.of(context).textTheme.bodyLarge, + ), + onTap: onTap, + ); + } } diff --git a/pubspec.yaml b/pubspec.yaml index 1488252..ec70bb6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -76,6 +76,7 @@ flutter: - assets/birds/ - assets/solar/ - assets/images/colours/ + - assets/images/flowers/ # An image asset can refer to one or more resolution-specific "variants", see