diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d29021..3100643 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -7,6 +7,9 @@ # The following line activates a set of recommended lints for Flutter apps, # packages, and plugins designed to encourage good coding practices. +analyzer: + errors: + library_prefixes: ignore include: package:flutter_lints/flutter.yaml linter: diff --git a/android/gradle/wrapper/gradle-wrapper.properties b/android/gradle/wrapper/gradle-wrapper.properties index 5ae2905..37aef8d 100644 --- a/android/gradle/wrapper/gradle-wrapper.properties +++ b/android/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Sun Jun 23 18:56:31 IST 2024 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip distributionPath=wrapper/dists -zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip +networkTimeout=10000 zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/assets/images/numbers/eight.png b/assets/images/numbers/eight.png new file mode 100644 index 0000000..352cda5 Binary files /dev/null and b/assets/images/numbers/eight.png differ diff --git a/assets/images/numbers/five.png b/assets/images/numbers/five.png new file mode 100644 index 0000000..a309d92 Binary files /dev/null and b/assets/images/numbers/five.png differ diff --git a/assets/images/numbers/four.png b/assets/images/numbers/four.png new file mode 100644 index 0000000..2c2bbd6 Binary files /dev/null and b/assets/images/numbers/four.png differ diff --git a/assets/images/numbers/nine.png b/assets/images/numbers/nine.png new file mode 100644 index 0000000..75f1678 Binary files /dev/null and b/assets/images/numbers/nine.png differ diff --git a/assets/images/numbers/numbers.jpg b/assets/images/numbers/numbers.jpg new file mode 100644 index 0000000..dfeb1d5 Binary files /dev/null and b/assets/images/numbers/numbers.jpg differ diff --git a/assets/images/numbers/one.png b/assets/images/numbers/one.png new file mode 100644 index 0000000..a61a560 Binary files /dev/null and b/assets/images/numbers/one.png differ diff --git a/assets/images/numbers/seven.png b/assets/images/numbers/seven.png new file mode 100644 index 0000000..c882816 Binary files /dev/null and b/assets/images/numbers/seven.png differ diff --git a/assets/images/numbers/six.png b/assets/images/numbers/six.png new file mode 100644 index 0000000..9db497b Binary files /dev/null and b/assets/images/numbers/six.png differ diff --git a/assets/images/numbers/three.png b/assets/images/numbers/three.png new file mode 100644 index 0000000..8aa8ac1 Binary files /dev/null and b/assets/images/numbers/three.png differ diff --git a/assets/images/numbers/two.png b/assets/images/numbers/two.png new file mode 100644 index 0000000..63dac00 Binary files /dev/null and b/assets/images/numbers/two.png differ diff --git a/assets/images/numbers/zero.png b/assets/images/numbers/zero.png new file mode 100644 index 0000000..fa7db8f Binary files /dev/null and b/assets/images/numbers/zero.png differ diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 2d7d3ca..ca80fb0 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -1,3 +1,5 @@ +// ignore_for_file: use_build_context_synchronously + import 'package:flutter/material.dart'; import 'package:animated_text_kit/animated_text_kit.dart'; import 'package:learn/utils/route/route_constant.dart'; @@ -88,9 +90,12 @@ class _LandingPageState extends State { //bool check initiates final SharedPreferences prefs = await SharedPreferences.getInstance(); - if (!prefs.containsKey('visitedGettingStartedPageOnce') || prefs.getBool('visitedGettingStartedPageOnce')==false) { //if it never existed or if it is false somehow - await prefs.setBool( - 'visitedGettingStartedPageOnce', true); //set to true + if (!prefs.containsKey('visitedGettingStartedPageOnce') || + prefs.getBool('visitedGettingStartedPageOnce') == + false) { + //if it never existed or if it is false somehow + await prefs.setBool('visitedGettingStartedPageOnce', + true); //set to true } Navigator.popAndPushNamed( context, diff --git a/lib/models/number_model.dart b/lib/models/number_model.dart new file mode 100644 index 0000000..ce70d1e --- /dev/null +++ b/lib/models/number_model.dart @@ -0,0 +1,13 @@ +import 'package:flutter/material.dart'; + +class Number { + final String name; + final String resource; + final Color background; + + Number({ + required this.name, + required this.resource, + required this.background, + }); +} diff --git a/lib/pages/explore/explore.dart b/lib/pages/explore/explore.dart index d72913f..0249fd9 100644 --- a/lib/pages/explore/explore.dart +++ b/lib/pages/explore/explore.dart @@ -1,20 +1,18 @@ +// ignore_for_file: unused_import + import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:learn/pages/explore/quiz.dart'; import 'package:learn/pages/modules/atoz.dart'; import 'package:learn/pages/modules/birds.dart'; import 'package:learn/pages/modules/colours.dart'; import 'package:learn/pages/modules/planets.dart'; import 'package:learn/pages/modules/shapes.dart'; import 'package:learn/utils/constants.dart'; +import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/utils/route/route_constant.dart'; -import 'package:provider/provider.dart'; -import '../../favorite_page_provider.dart'; -import '../../theme_provider.dart'; -import '../../utils/const_dimensions.dart'; -import '../../widgets/drawer.dart'; + // Explore Page class ExplorePage extends StatefulWidget { @@ -55,276 +53,7 @@ class _ExplorePageState extends State { 'Explore', style: TextStyle(fontWeight: FontWeight.bold), ), - actions: [ - Padding( - padding: const EdgeInsets.only(right: 16, top: 1), - child: IconButton( - icon: Icon( - themeProvider.themeMode == ThemeMode.dark - ? Icons.dark_mode - : Icons.light_mode, - ), - onPressed: () { - themeProvider.toggleTheme(); - }, - ), - ), - ], - ), - body: SafeArea( - child: CustomScrollView( - slivers: [ - // SliverAppBar( - // pinned: true, - // title: Padding( - // padding: const EdgeInsets.fromLTRB(0, 12, 16, 4), - // child: Text( - // "Explore", - // style: Theme.of(context) - // .textTheme - // .headlineLarge! - // .copyWith(fontWeight: FontWeight.bold, fontSize: 30.0), - // ), - // ), - // ), - SliverList( - delegate: SliverChildListDelegate( - [ - // GestureDetector( - // onTap: () { - // Navigator.push( - // context, - // (MaterialPageRoute( - // builder: (context) => const Quiz()))); - // }, - // child: Container( - // margin: const EdgeInsets.symmetric( - // horizontal: 18.0, vertical: 8), - // padding: const EdgeInsets.all(8.0), - // decoration: BoxDecoration( - // border: Border.all(color: Colors.black, width: 1.0), - // borderRadius: BorderRadius.circular(8.0), - // color: Colors.blueAccent, - // ), - // child: Row( - // children: [ - // SizedBox( - // width: ConstantDimensions.widthExtraLarge, - // height: ConstantDimensions.heightExtraLarge, - // child: - // SvgPicture.asset('assets/explore/notebook.svg'), - // ), - // const SizedBox( - // width: ConstantDimensions.widthMedium_Large), - // const Text( - // 'Quiz', - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 30.0, - // fontFamily: 'Comic', - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // ), - GestureDetector( - onTap: () { - Navigator.pushNamed( - context, AllRoutesConstant.drawingboardRoute); - }, - child: Container( - margin: const EdgeInsets.symmetric( - horizontal: 24, vertical: 12), - height: ConstantDimensions.heightExtraLarge * 4, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.2), - spreadRadius: 2, - blurRadius: 5, - offset: const Offset(0, 3), - ), - ], - ), - child: ClipRRect( - borderRadius: BorderRadius.circular(16), - child: Stack( - fit: StackFit.expand, - alignment: Alignment.center, - children: [ - ImageFiltered( - imageFilter: ImageFilter.blur( - sigmaX: 5, sigmaY: 5), - child: SvgPicture.asset( - 'assets/explore/drawing_board.svg', - fit: BoxFit.cover, - ), - ), - Positioned.fill( - child: Align( - child: Column( - mainAxisAlignment: - MainAxisAlignment.center, - children: [ - Text( - "Drawing Board", - style: Theme.of(context) - .textTheme - .headlineMedium! - .copyWith( - color: Colors.white, - fontWeight: FontWeight.bold, - shadows: [ - const Shadow( - color: Colors.black, - offset: Offset(2, 1), - blurRadius: 4, - ), - ], - ), - ), - Text( - "Drawing Board for Artist Kids!", - style: Theme.of(context) - .textTheme - .bodyMedium! - .copyWith( - color: Colors.white, - fontWeight: FontWeight.bold, - shadows: [ - const Shadow( - color: Colors.black, - offset: Offset(2, 1), - blurRadius: 2, - ), - ], - ), - ), - ], - ), - ), - ), - Row( - crossAxisAlignment: - CrossAxisAlignment.start, - mainAxisAlignment: MainAxisAlignment.end, - children: [ - Container( - width: 40, - height: 40, - margin: const EdgeInsets.all(5), - decoration: BoxDecoration( - color: Colors.white, - borderRadius: - BorderRadius.circular(10), - ), - child: - Consumer( - builder: (context, item, child) { - return IconButton( - onPressed: () { - item.setDrawingBoard(); - }, - icon: item.drawingBoard - ? const Icon( - Icons.favorite, - size: 25, - color: Colors.red, - ) - : const Icon( - Icons.favorite_border, - size: 25, - ), - ); - }, - ), - ), - ], - ) - ], - ), - )), - ), - ], - ), - ), - SliverList( - delegate: SliverChildBuilderDelegate( - (context, index) { - return GestureDetector( - onTap: () { - try { - switch (index) { - case 0: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => const Quiz()))); - break; - case 1: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => const AtoZ()))); - break; - case 2: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => BirdsPage()))); - break; - case 3: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => - const ColoursPage()))); - break; - case 4: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => BirdsPage()))); - break; - case 5: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => - const ShapesPage()))); - break; - case 6: - Navigator.push( - context, - (MaterialPageRoute( - builder: (context) => - PlanetsPage()))); - break; - default: - break; - } - } catch (e) { - // ignore: avoid_print - print(e); - } - }, - child: Container( - margin: const EdgeInsets.symmetric( - horizontal: 24, vertical: 12), - height: ConstantDimensions.heightExtraLarge * 4, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16), - boxShadow: [ - BoxShadow( - color: Colors.black.withOpacity(0.2), - spreadRadius: 2, - blurRadius: 5, - offset: const Offset(0, 3), - ), - ], + ), child: ClipRRect( borderRadius: BorderRadius.circular(16), diff --git a/lib/pages/explore/quiz.dart b/lib/pages/explore/quiz.dart index 1723f64..9e4378d 100644 --- a/lib/pages/explore/quiz.dart +++ b/lib/pages/explore/quiz.dart @@ -1,3 +1,5 @@ +// ignore_for_file: non_constant_identifier_names + import 'package:flutter/material.dart'; import 'package:learn/utils/constants.dart'; import 'package:learn/utils/route/route_constant.dart'; @@ -31,13 +33,12 @@ class _QuizState extends State { int questionnumber = 0; @override Widget build(BuildContext context) { - print(_score); double height = MediaQuery.of(context).size.height; double width = MediaQuery.of(context).size.width; double toppadding = MediaQuery.of(context).padding.top; return Scaffold( body: Padding( - padding: EdgeInsets.all(10), + padding: const EdgeInsets.all(10), child: Column( children: [ SizedBox( @@ -136,7 +137,6 @@ class _QuizState extends State { istappable = true; }); } else { - print("Quiz Completed"); showDialog( context: context, builder: (context) => AlertDialog( @@ -171,9 +171,10 @@ class _QuizState extends State { // Navigator.of(context).pop(); Navigator.of(context) .pushReplacementNamed( - AllRoutesConstant.mainhomeRoute); + AllRoutesConstant + .mainhomeRoute); }, - child: Text( + child: const Text( "Go Back", style: TextStyle(color: Colors.white), )) diff --git a/lib/pages/fruits.dart b/lib/pages/fruits.dart index 96e7087..ad604fd 100644 --- a/lib/pages/fruits.dart +++ b/lib/pages/fruits.dart @@ -115,7 +115,7 @@ class _FruitsPageState extends State { ), ElevatedButton( style: ButtonStyle( - fixedSize: MaterialStateProperty.all( + fixedSize: WidgetStateProperty.all( Size(MediaQuery.of(context).size.width * .3, 50))), onPressed: () { if (AppConstants.Fruits[_currentIndex].isfruit == true) { @@ -131,7 +131,7 @@ class _FruitsPageState extends State { ), ElevatedButton( style: ButtonStyle( - fixedSize: MaterialStateProperty.all( + fixedSize: WidgetStateProperty.all( Size(MediaQuery.of(context).size.width * .3, 50))), onPressed: () { if (AppConstants.Fruits[_currentIndex].isfruit == false) { diff --git a/lib/pages/home.dart b/lib/pages/home.dart index f2d4f37..921d1c1 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -17,7 +17,7 @@ class MyHomePage extends StatefulWidget { } class _MyHomePageState extends State { - final List _isImageClicked = List.generate(7, (index) => false); + final List _isImageClicked = List.generate(8, (index) => false); @override Widget build(BuildContext context) { @@ -33,7 +33,9 @@ class _MyHomePageState extends State { padding: const EdgeInsets.only(right: 16, top: 1), child: IconButton( icon: Icon( - themeProvider.themeMode == ThemeMode.dark ? Icons.dark_mode : Icons.light_mode, + themeProvider.themeMode == ThemeMode.dark + ? Icons.dark_mode + : Icons.light_mode, ), onPressed: () { themeProvider.toggleTheme(); @@ -51,13 +53,25 @@ class _MyHomePageState extends State { context: context, title: "ALPHABETS", image: AssetsPath.getAlphabetImage(Alphabets.alphabets), - shortDescription: "Learn A to Z with pronunciation and an example", + shortDescription: + "Learn A to Z with pronunciation and an example", route: AllRoutesConstant.atozRoute, index: 0, ), const SizedBox( height: ConstantDimensions.heightMedium, ), + categoryCard( + context: context, + title: "NUMBERS", // Added this block for "NUMBERS" + image: 'assets/numbers/numbers.jpg', + shortDescription: "Learn numbers and their pronunciations.", + route: AllRoutesConstant.numberRoute, + index: 7, + ), + const SizedBox( + height: ConstantDimensions.heightMedium, + ), categoryCard( context: context, title: "ANIMALS", @@ -73,7 +87,8 @@ class _MyHomePageState extends State { context: context, title: "BODY PARTS", image: AssetsPath.getBodyImage(Body.body), - shortDescription: "Know about body parts and their pronunciation.", + shortDescription: + "Know about body parts and their pronunciation.", route: AllRoutesConstant.partsRoute, index: 2, ), @@ -117,7 +132,8 @@ class _MyHomePageState extends State { context: context, title: "FRUITS & VEGETABLES", image: 'assets/fruitsVeges/cover.jpg', - shortDescription: "Explore and learn about Fruits and Vegetables!", + shortDescription: + "Explore and learn about Fruits and Vegetables!", route: AllRoutesConstant.fruitRoute, index: 6, ), diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index f7678ec..e7bfe09 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'dart:async'; import 'package:flutter_tts/flutter_tts.dart'; +// ignore: unused_import import 'package:learn/pages/fruits.dart'; import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/models/itemdata_model.dart'; @@ -214,7 +215,6 @@ class _PopupDialogState extends State<_PopupDialog> { child: const Text('Next'), ), ], - ), ], ), @@ -254,9 +254,10 @@ class _AtoZState extends State { alignment: Alignment.centerRight, child: ElevatedButton( style: ButtonStyle( - backgroundColor: isTimerEnabled - ? MaterialStateProperty.all(Colors.green) - : MaterialStateProperty.all(Colors.red ), + // ignore: deprecated_member_use + backgroundColor: MaterialStateProperty.all( + isTimerEnabled ? Colors.green : Colors.red, + ), ), onPressed: () { setState(() { @@ -276,9 +277,8 @@ class _AtoZState extends State { body: Padding( padding: const EdgeInsets.all(9), child: GridView.count( - crossAxisCount: MediaQuery.of(context).size.width ~/ - 200, // Adjust the value based on screen width - childAspectRatio: 0.8, // Aspect ratio of items + crossAxisCount: MediaQuery.of(context).size.width ~/ 200, + childAspectRatio: 0.8, children: List.generate( items.length, (index) => ItemTile( diff --git a/lib/pages/modules/numbers.dart b/lib/pages/modules/numbers.dart new file mode 100644 index 0000000..06011f2 --- /dev/null +++ b/lib/pages/modules/numbers.dart @@ -0,0 +1,300 @@ +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/utils/const_dimensions.dart'; +import 'package:learn/models/itemdata_model.dart'; +import 'package:learn/utils/constants.dart'; // Adjust the import as per your project structure + +class ItemTile extends StatelessWidget { + final int index; + final List items; + final bool isTimerEnabled; + + const ItemTile({ + Key? key, + required this.index, + required this.items, + required this.isTimerEnabled, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + final item = items[index]; + return Card( + color: item.backgroundColor, + child: InkWell( + onTap: () { + showDialog( + context: context, + builder: (BuildContext context) { + return _PopupDialog( + items: items, + currentIndex: index, + isAutoNextEnabled: isTimerEnabled, + ); + }, + ); + }, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 5), + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.stretch, + children: [ + Text( + item.title, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 25, + ), + textAlign: TextAlign.center, + ), + LayoutBuilder( + builder: (BuildContext context, BoxConstraints constraints) { + if (MediaQuery.of(context).orientation == + Orientation.portrait) { + return SvgPicture.asset( + item.iconAsset, + width: MediaQuery.of(context).size.width * 0.2, + height: MediaQuery.of(context).size.height * 0.1, + alignment: Alignment.center, + ); + } else { + return SvgPicture.asset( + item.iconAsset, + width: MediaQuery.of(context).size.width * 0.2, + height: MediaQuery.of(context).size.height * 0.2, + alignment: Alignment.center, + ); + } + }, + ), + const SizedBox(height: ConstantDimensions.heightExtraSmall / 2), + Text(item.description, textAlign: TextAlign.center), + ], + ), + ), + ), + ); + } +} + +class _PopupDialog extends StatefulWidget { + final List items; + final int currentIndex; + final bool isAutoNextEnabled; + + const _PopupDialog({ + Key? key, + required this.items, + required this.currentIndex, + required this.isAutoNextEnabled, + }) : super(key: key); + + @override + _PopupDialogState createState() => _PopupDialogState(); +} + +class _PopupDialogState extends State<_PopupDialog> { + late FlutterTts flutterTts; + late int currentIndex; + late Timer? timer; + late bool isAutoNextEnabled; + + @override + void initState() { + super.initState(); + flutterTts = FlutterTts(); + currentIndex = widget.currentIndex; + isAutoNextEnabled = widget.isAutoNextEnabled; + + _speakDescription(); + if (isAutoNextEnabled) { + timer = Timer.periodic(const Duration(seconds: 3), (Timer t) { + _nextItem(); + }); + } + } + + @override + void dispose() { + timer?.cancel(); + super.dispose(); + } + + Future _speakDescription() async { + final currentItem = widget.items[currentIndex]; + await flutterTts.setLanguage("EN-IN"); + await flutterTts.speak(currentItem.title); + await flutterTts.speak(currentItem.description); + } + + Future _speakText(String text) async { + await flutterTts.speak(text); + } + + void _previousItem() { + setState(() { + if (currentIndex > 0) { + currentIndex--; + _speakDescription(); + } + }); + } + + void _nextItem() { + setState(() { + if (currentIndex < widget.items.length - 1) { + currentIndex++; + _speakDescription(); + } + }); + } + + @override + Widget build(BuildContext context) { + final currentItem = widget.items[currentIndex]; + return AlertDialog( + contentPadding: EdgeInsets.zero, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + content: Container( + padding: EdgeInsets.zero, + width: MediaQuery.of(context).size.width * 0.75, + height: MediaQuery.of(context).size.height * 0.75, + decoration: BoxDecoration( + color: currentItem.backgroundColor, + borderRadius: BorderRadius.circular(15), + ), + child: Padding( + padding: const EdgeInsets.all(18), + child: Center( + child: SingleChildScrollView( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + currentItem.title, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 40, + ), + textAlign: TextAlign.center, + ), + const SizedBox(height: ConstantDimensions.heightMedium), + GestureDetector( + onTap: () { + _speakText(currentItem.description); + }, + child: SvgPicture.asset( + currentItem.iconAsset, + width: MediaQuery.of(context).size.width * 0.5, + height: MediaQuery.of(context).size.height * 0.3, + alignment: Alignment.center, + ), + ), + const SizedBox(height: ConstantDimensions.heightMedium), + Text( + currentItem.description, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 28, + ), + ), + const SizedBox(height: ConstantDimensions.heightMedium), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + ElevatedButton( + onPressed: _previousItem, + child: const Text('Prev'), + ), + ElevatedButton( + onPressed: _nextItem, + child: const Text('Next'), + ), + ], + ), + ], + ), + ), + ), + ), + ), + ); + } +} + +class NumbersPage extends StatefulWidget { + const NumbersPage({Key? key}) : super(key: key); + + @override + State createState() => _NumbersState(); +} + +class _NumbersState extends State { + bool isTimerEnabled = false; + + List items = AppConstants + .numberItems; // Ensure you have numberItems list in AppConstants + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + const Text( + 'Numbers', + style: TextStyle(fontWeight: FontWeight.bold), + ), + Expanded( + child: Align( + alignment: Alignment.centerRight, + child: ElevatedButton( + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all( + isTimerEnabled ? Colors.green : Colors.red, + ), + ), + onPressed: () { + setState(() { + isTimerEnabled = !isTimerEnabled; + }); + }, + child: const Text( + 'Auto', + style: TextStyle(color: Colors.white), + ), + ), + ), + ), + ], + ), + ), + body: Padding( + padding: const EdgeInsets.all(9), + child: GridView.count( + crossAxisCount: MediaQuery.of(context).size.width ~/ 200, + childAspectRatio: 0.8, + children: List.generate( + items.length, + (index) => ItemTile( + index: index, + items: items, + isTimerEnabled: isTimerEnabled, + ), + ), + ), + ), + ); + } +} + +void main() { + runApp(const MaterialApp( + home: NumbersPage(), + )); +} diff --git a/lib/pages/modules/seasons.dart b/lib/pages/modules/seasons.dart index 3ad143b..3beb405 100644 --- a/lib/pages/modules/seasons.dart +++ b/lib/pages/modules/seasons.dart @@ -3,7 +3,6 @@ import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:learn/models/season_model.dart'; -import 'package:learn/pages/fruits.dart'; import 'package:learn/utils/constants.dart'; import '../../utils/const_dimensions.dart'; @@ -40,7 +39,8 @@ class SeasonsPage extends StatelessWidget { width: ConstantDimensions.widthExtraLarge, height: ConstantDimensions.heightExtraLarge, child: SvgPicture.asset( - AppConstants.seasons[index].imageAsset), + AppConstants.seasons[index].imageAsset, + ), ), const SizedBox(width: ConstantDimensions.widthMedium_Large), Text( @@ -80,10 +80,10 @@ class SeasonPopup extends StatefulWidget { final List seasons; const SeasonPopup({ - super.key, + Key? key, required this.currentIndex, required this.seasons, - }); + }) : super(key: key); @override _SeasonPopupState createState() => _SeasonPopupState(); @@ -137,7 +137,7 @@ class _SeasonPopupState extends State { ), ElevatedButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: WidgetStateProperty.all(Colors.red), ), onPressed: () { Navigator.of(context).pop(); @@ -170,3 +170,22 @@ class _SeasonPopupState extends State { }); } } + +void main() { + runApp(const SeasonsApp()); +} + +class SeasonsApp extends StatelessWidget { + const SeasonsApp({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return MaterialApp( + title: 'Seasons App', + theme: ThemeData( + primarySwatch: Colors.blue, + ), + home: const SeasonsPage(), + ); + } +} diff --git a/lib/utils/assets_path.dart b/lib/utils/assets_path.dart index 255a61c..1d7f25f 100644 --- a/lib/utils/assets_path.dart +++ b/lib/utils/assets_path.dart @@ -3,6 +3,7 @@ class AssetsPath { static const String _images = 'assets/images/'; static const String _flowerImages = 'assets/images/flowers/'; static const String _alphabetImages = 'assets/images/alphabet/'; + static const String _numberImages = 'assets/images/numbers/'; static const String _animalImages = 'assets/images/animal/'; static const String _birdImages = 'assets/images/birds/'; static const String _bodyImages = 'assets/images/body/'; @@ -14,7 +15,6 @@ class AssetsPath { static const String _animalSound = 'assets/sounds/animals/'; static const String _birdSound = 'assets/sounds/birds/'; - //Image assets static String getImage(String name) { @@ -25,6 +25,10 @@ class AssetsPath { return _alphabetImages + name; } + static getNumberImage(String name) { + return _numberImages + name; + } + static String getAnimalImage(String name) { return _animalImages + name; } @@ -45,12 +49,10 @@ class AssetsPath { return _coloursImages + name; } - static String getFlowerImage(String name) { return _flowerImages + name; } - //Sound assets static String getSound(String name) { @@ -64,10 +66,9 @@ class AssetsPath { static String getBirdSound(String name) { return _birdSound + name; } - } -class Alphabets{ +class Alphabets { static const String alphabets = 'alphabets.jpg'; static const String apple = 'apple.svg'; static const String ball = 'ball.svg'; @@ -97,7 +98,21 @@ class Alphabets{ static const String zero = 'zero.svg'; } -class Animals{ +class Numbers { + static const String numbers = 'numbers.jpg'; + static const String zero = 'zero.png'; + static const String one = 'one.png'; + static const String two = 'two.png'; + static const String three = 'three.png'; + static const String four = 'four.png'; + static const String five = 'five.png'; + static const String six = 'six.png'; + static const String seven = 'seven.png'; + static const String eight = 'eight.png'; + static const String nine = 'nine.png'; +} + +class Animals { static const String animals = 'animals.jpg'; static const String bear = 'bear.svg'; static const String cat = 'cat.svg'; @@ -141,10 +156,9 @@ class Animals{ static const String squirrelSound = 'squirrel_sound.mp3'; static const String tigerSound = 'tiger_sound.mp3'; static const String zebraSound = 'zebra_sound.mp3'; - } -class Birds{ +class Birds { static const String birds = 'birds.jpg'; static const String bagula = 'Bagula.svg'; static const String baya = 'Baya.svg'; @@ -229,7 +243,7 @@ class Body { static const String wrist = 'Wrist.svg'; } -class ColorImages{ +class ColorImages { static const String colorsCover = 'colours-cover.png'; static const String black = 'black.svg'; static const String blue = 'blue.svg'; @@ -256,10 +270,9 @@ class Flowers { static const String dandelion = 'dandelion.svg'; static const String jasmine = 'jasmine.svg'; static const String lotus = 'lotus.svg'; - static const String carnation= 'carnation.svg'; - static const String poppy= 'poppy.svg'; - static const String daffodil = 'daffodil.svg'; - + static const String carnation = 'carnation.svg'; + static const String poppy = 'poppy.svg'; + static const String daffodil = 'daffodil.svg'; } class SolarSystem { @@ -272,4 +285,4 @@ class SolarSystem { static const String saturn = 'saturn.svg'; static const String uranus = 'uranus.svg'; static const String venus = 'venus.svg'; -} \ No newline at end of file +} diff --git a/lib/utils/constants.dart b/lib/utils/constants.dart index c06683c..9f0eb64 100644 --- a/lib/utils/constants.dart +++ b/lib/utils/constants.dart @@ -5,6 +5,8 @@ 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'; +// ignore: unused_import +import 'package:learn/models/number_model.dart'; import 'package:flutter/material.dart'; import 'package:learn/pages/fruits.dart'; import '../models/colours_model.dart'; @@ -206,6 +208,13 @@ class AppConstants { route: MaterialPageRoute(builder: (context) => const AtoZ()), backgroundColor: const Color.fromARGB(193, 76, 175, 79), ), + Module( + name: 'Number', + description: 'Learn numbers with production and an example', + thumbnailPath: AssetsPath.getNumberImage(Numbers.numbers), + route: MaterialPageRoute(builder: (context) => const AtoZ()), + backgroundColor: const Color.fromARGB(193, 76, 175, 79), + ), Module( name: 'Animals', description: 'Learn about animals and their sounds', @@ -336,7 +345,68 @@ class AppConstants { answer: 2, // Index of the correct option, in this case, "1492" ), ]; - + static List numberItems = [ + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.zero), + title: '0', + description: 'zero', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.one), + title: '1', + description: 'one', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.two), + title: '2', + description: 'two', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.three), + title: '3', + description: 'three', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.four), + title: '4', + description: 'four', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.five), + title: '5', + description: 'five', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.six), + title: '6', + description: 'six', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.seven), + title: '7', + description: 'seven', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.eight), + title: '8', + description: 'eight', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ItemData( + iconAsset: AssetsPath.getNumberImage(Numbers.nine), + title: '9', + description: 'nine', + backgroundColor: const Color.fromARGB(115, 171, 171, 171), + ), + ]; static List alphabetItems = [ ItemData( iconAsset: AssetsPath.getAlphabetImage(Alphabets.apple), @@ -988,6 +1058,7 @@ class AppConstants { 'Page Under Construction.\nIt will not take much time.'; static const String a_z = 'A-Z'; + static const String numbers = 'Numbers'; static const String bird = 'Birds'; static const String animal = 'Animals'; static const String parts = 'Body Parts'; diff --git a/lib/utils/route/route_constant.dart b/lib/utils/route/route_constant.dart index 485cda7..94518b8 100644 --- a/lib/utils/route/route_constant.dart +++ b/lib/utils/route/route_constant.dart @@ -9,6 +9,7 @@ class AllRoutesConstant { static const String partsRoute = "/parts"; static const String solarRoute = "/solar"; static const String atozRoute = "/atoz"; + static const String numberRoute = "/number"; static const String aboutRoute = "/about"; static const String colourRoute = "/colours"; static const String flowerRoute = "/flowers"; diff --git a/lib/utils/route/routes.dart b/lib/utils/route/routes.dart index f2dac3a..8a0dfb7 100644 --- a/lib/utils/route/routes.dart +++ b/lib/utils/route/routes.dart @@ -8,6 +8,7 @@ import 'package:learn/pages/fruits.dart'; import 'package:learn/pages/home.dart'; import 'package:learn/pages/main_home.dart'; import 'package:learn/pages/modules/animals.dart'; +import 'package:learn/pages/modules/numbers.dart'; import 'package:learn/pages/modules/atoz.dart'; import 'package:learn/pages/modules/birds.dart'; import 'package:learn/pages/modules/colours.dart'; @@ -39,6 +40,8 @@ class Routers { return slidePageRoute(PlanetsPage()); case AllRoutesConstant.animalRoute: return slidePageRoute(AnimalsPage()); + case AllRoutesConstant.numberRoute: + return slidePageRoute(const NumbersPage()); case AllRoutesConstant.colourRoute: return slidePageRoute(const ColoursPage()); case AllRoutesConstant.aboutRoute: @@ -57,10 +60,9 @@ class Routers { return slidePageRoute(FruitsPage()); case AllRoutesConstant.landingRoute: return slidePageRoute(const LandingPage()); - case AllRoutesConstant.mainhomeRoute: + case AllRoutesConstant.mainhomeRoute: return slidePageRoute(const MainHome()); - default: return MaterialPageRoute( builder: (context) => const Scaffold( diff --git a/pubspec.yaml b/pubspec.yaml index ec33ea6..d84972a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -82,6 +82,7 @@ flutter: - assets/images/solar/ - assets/colours/ - assets/images/flowers/ + - assets/images/numbers/ - assets/explore/ - assets/seasons/ - assets/occupations/ diff --git a/web/index.html b/web/index.html index 8fc4e4e..b6daea5 100644 --- a/web/index.html +++ b/web/index.html @@ -1,5 +1,6 @@ + - + learn + - + + \ No newline at end of file