From c7d9e17d6b85cc3bc90129acbd5d2428a698d57b Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Tue, 28 May 2024 00:03:01 +0530 Subject: [PATCH 01/21] Added Drawing Board --- assets/explore/drawing_board.svg | 26 ++++ lib/main.dart | 2 + lib/pages/explore/drawingboard.dart | 184 ++++++++++++++++++++++++++++ lib/pages/explore/explore.dart | 150 ++++++++++++++++------- lib/utils/routes.dart | 1 + 5 files changed, 317 insertions(+), 46 deletions(-) create mode 100644 assets/explore/drawing_board.svg create mode 100644 lib/pages/explore/drawingboard.dart diff --git a/assets/explore/drawing_board.svg b/assets/explore/drawing_board.svg new file mode 100644 index 0000000..d0a52e9 --- /dev/null +++ b/assets/explore/drawing_board.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/lib/main.dart b/lib/main.dart index 8739239..de3e861 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -19,6 +19,7 @@ import 'package:learn/pages/modules/colours.dart'; import 'package:learn/widgets/navbar/navbar.dart'; import 'cubit/index_cubit.dart'; +import 'pages/explore/drawingboard.dart'; import 'pages/explore/quiz.dart'; import 'pages/home.dart'; import 'landing_page.dart'; @@ -78,6 +79,7 @@ class MyApp extends StatelessWidget { AllRoutes.seasonRoute: (context) => const SeasonsPage(), AllRoutes.occupationRoute: (context) => OccupationPage(), AllRoutes.fruitRoute: (context) => FruitsPage(), + AllRoutes.drawingboardRoute: (context) => DrawingBoardPage(), "/landing_page": (context) => const LandingPage(), }, ); diff --git a/lib/pages/explore/drawingboard.dart b/lib/pages/explore/drawingboard.dart new file mode 100644 index 0000000..556c25f --- /dev/null +++ b/lib/pages/explore/drawingboard.dart @@ -0,0 +1,184 @@ +import 'dart:ui'; +import 'package:flutter/material.dart'; + +class DrawingBoardPage extends StatelessWidget { + const DrawingBoardPage({Key? key}); + + @override + Widget build(BuildContext context) { + return DrawingBoard(); + } +} + +class DrawingBoard extends StatefulWidget { + const DrawingBoard({Key? key}) : super(key: key); + + @override + _DrawingBoardState createState() => _DrawingBoardState(); +} + +class _DrawingBoardState extends State { + Color selectedColor = Colors.black; + double strokeWidth = 5; + List drawingPoints = []; + List colors = [ + Colors.pink, + Colors.red, + Colors.blue, + Colors.orange, + Colors.yellow, + Colors.purple, + Colors.green, + Colors.black, + ]; + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: Text("Drawing Board"), + actions: [ + IconButton( + icon:Icon(Icons.clear), + onPressed: () => setState(() => drawingPoints = []), + ), + ], + ), + body: Stack( + children: [ + GestureDetector( + onPanStart: (details) { + setState(() { + drawingPoints.add( + DrawingPoint( + details.localPosition, + Paint() + ..color = selectedColor + ..isAntiAlias = true + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ), + ); + }); + }, + onPanUpdate: (details) { + setState(() { + drawingPoints.add( + DrawingPoint( + details.localPosition, + Paint() + ..color = selectedColor + ..isAntiAlias = true + ..strokeWidth = strokeWidth + ..strokeCap = StrokeCap.round, + ), + ); + }); + }, + onPanEnd: (details) { + setState(() { + drawingPoints.add(null); + }); + }, + child: CustomPaint( + painter: _DrawingPainter(drawingPoints), + child: Container( + height: MediaQuery.of(context).size.height, + width: MediaQuery.of(context).size.width, + ), + ), + ), + Positioned( + top: 40, + right: 30, + child: Row( + children: [ + Slider( + min: 0, + max: 40, + value: strokeWidth, + onChanged:(val) => setState(() => strokeWidth = val), + ), + + ElevatedButton.icon(onPressed: () => setState(() => drawingPoints = []), + icon: Icon(Icons.clear), + label: Text("Clear Board"), + ), + ], + ), + ), + ], + ), + + bottomNavigationBar: BottomAppBar( + child: Container( + color: Colors.grey[200], + padding: EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: List.generate( + colors.length, + (index) => _buildColorChoser(colors[index]), + ), + ), + ), + ), + ); + } + + GestureDetector _buildColorChoser(Color color) { + bool isSelected = selectedColor == color; + return GestureDetector( + onTap: () => setState(() => selectedColor = color), + child: Container( + height: isSelected ? 47 : 40, + width: isSelected ? 47 : 40, + decoration: BoxDecoration( + color: color, + shape: BoxShape.circle, + border: isSelected + ? Border.all( + color: Colors.white, + width: 3, + ) + : null, + ), + ), + ); + } +} + +class _DrawingPainter extends CustomPainter { + final List drawingPoints; + + _DrawingPainter(this.drawingPoints); + + @override + void paint(Canvas canvas, Size size) { + for (int i = 0; i < drawingPoints.length - 1; i++) { + if (drawingPoints[i] != null && drawingPoints[i + 1] != null) { + canvas.drawLine( + drawingPoints[i]!.offset, + drawingPoints[i + 1]!.offset, + drawingPoints[i]!.paint, + ); + } else if (drawingPoints[i] != null && drawingPoints[i + 1] == null) { + canvas.drawPoints( + PointMode.points, + [drawingPoints[i]!.offset], + drawingPoints[i]!.paint, + ); + } + } + } + + @override + bool shouldRepaint(covariant CustomPainter oldDelegate) => true; +} + +class DrawingPoint { + Offset offset; + Paint paint; + + DrawingPoint(this.offset, this.paint); +} diff --git a/lib/pages/explore/explore.dart b/lib/pages/explore/explore.dart index f8b868b..63b4ae9 100644 --- a/lib/pages/explore/explore.dart +++ b/lib/pages/explore/explore.dart @@ -1,10 +1,9 @@ import 'dart:ui'; - import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; +import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/utils/constants.dart'; - -import '../../utils/const_dimensions.dart'; +import '../../utils/routes.dart'; // Explore Page class ExplorePage extends StatelessWidget { @@ -27,49 +26,9 @@ class ExplorePage extends StatelessWidget { ), ), ), - SliverList( - delegate: SliverChildListDelegate( - [ - GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/quiz'); - }, - 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: 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, - ), - ), - ], - ), - ), - ), - ], - ), - ), SliverList( delegate: SliverChildBuilderDelegate( - (context, index) { + (context, index) { return GestureDetector( onTap: () => Navigator.push( context, @@ -97,8 +56,7 @@ class ExplorePage extends StatelessWidget { alignment: Alignment.center, children: [ ImageFiltered( - imageFilter: - ImageFilter.blur(sigmaX: 5, sigmaY: 5), + imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), child: Image.asset( AppConstants.modules[index].thumbnailPath, fit: BoxFit.cover, @@ -155,6 +113,106 @@ class ExplorePage extends StatelessWidget { childCount: AppConstants.modules.length, ), ), + GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/quiz'); + }, + 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: Colors.blueAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset('assets/explore/notebook.svg'), + ), + const SizedBox(width: 28.0), + const Text( + 'Quiz', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.pushNamed(context, AllRoutes.drawingboardRoute); + }, + 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: Colors.greenAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset('assets/explore/drawing_board.svg'), + ), + const SizedBox(width: 28.0), + const Text( + 'Drawing Board', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), + ), + ), + + // GestureDetector( + // onTap: () { + // Navigator.pushNamed(context, '/quiz'); + // }, + // 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: Colors.blueAccent, + // ), + // child: Row( + // children: [ + // SizedBox( + // width: 50, + // height: 50, + // child: SvgPicture.asset('assets/explore/notebook.svg'), + // ), + // const SizedBox(width: 28.0), + // const Text( + // 'Quiz', + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 30.0, + // fontFamily: 'Comic', + // color: Colors.white, + // ), + // ), + // ], + // ), + // ), + // ), ], ), ); diff --git a/lib/utils/routes.dart b/lib/utils/routes.dart index c64b442..143bdef 100644 --- a/lib/utils/routes.dart +++ b/lib/utils/routes.dart @@ -16,4 +16,5 @@ class AllRoutes { static const String seasonRoute = "/seasons"; static const String occupationRoute = '/occupations'; static const String fruitRoute = "/fruit"; + static const String drawingboardRoute = "/drawingboard.dart"; } From b1d255d9e0bf704fcec9b4e4afa3edd8869147db Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Tue, 28 May 2024 00:09:54 +0530 Subject: [PATCH 02/21] Added Drawing Board --- lib/pages/explore.dart | 324 +++++++++++++++++++++++++---------------- 1 file changed, 196 insertions(+), 128 deletions(-) diff --git a/lib/pages/explore.dart b/lib/pages/explore.dart index 42cdf60..c2a76f9 100644 --- a/lib/pages/explore.dart +++ b/lib/pages/explore.dart @@ -1,7 +1,8 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:flutter_svg/flutter_svg.dart'; import 'package:learn/utils/constants.dart'; - +import '../utils/routes.dart'; import '../utils/const_dimensions.dart'; // Explore Page @@ -11,142 +12,209 @@ class ExplorePage extends StatelessWidget { @override Widget build(BuildContext context) { return SafeArea( - child: CustomScrollView( - slivers: [ - SliverAppBar( - 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), + child: CustomScrollView( + slivers: [ + SliverAppBar( + 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: SliverChildBuilderDelegate( - (context, index) { - return GestureDetector( - onTap: () => Navigator.push( - context, - AppConstants.modules[index].route, - ), - 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: Image.asset( - AppConstants.modules[index].thumbnailPath, - fit: BoxFit.cover, - ), + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) { + return GestureDetector( + onTap: () => Navigator.push( + context, + AppConstants.modules[index].route, + ), + 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), ), - Positioned.fill( - child: Align( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AppConstants.modules[index].name, - 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, - ), - ], + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(16), + child: Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + ImageFiltered( + imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Image.asset( + AppConstants.modules[index].thumbnailPath, + fit: BoxFit.cover, + ), + ), + Positioned.fill( + child: Align( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppConstants.modules[index].name, + 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( - AppConstants.modules[index].description, - 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, - ), - ], + Text( + AppConstants.modules[index].description, + 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, + ), + ], + ), ), - ), - ], + ], + ), ), ), - ), - ], - ), - )), - ); + ], + ), + )), + ); + }, + childCount: AppConstants.modules.length, + ), + ), + GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/quiz'); + }, + 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: Colors.blueAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset('assets/explore/notebook.svg'), + ), + const SizedBox(width: 28.0), + const Text( + 'Quiz', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), + ), + ), + GestureDetector( + onTap: () { + Navigator.pushNamed(context, AllRoutes.drawingboardRoute); }, - childCount: AppConstants.modules.length, + 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: Colors.greenAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset('assets/explore/drawing_board.svg'), + ), + const SizedBox(width: 28.0), + const Text( + 'Drawing Board', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), + ), ), - ), - // GestureDetector( - // onTap: () { - // Navigator.pushNamed(context, '/quiz'); - // }, - // 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: Colors.blueAccent, - // ), - // child: Row( - // children: [ - // SizedBox( - // width: 50, - // height: 50, - // child: SvgPicture.asset('assets/explore/notebook.svg'), - // ), - // const SizedBox(width: 28.0), - // const Text( - // 'Quiz', - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 30.0, - // fontFamily: 'Comic', - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // ), - ], - )); + // GestureDetector( + // onTap: () { + // Navigator.pushNamed(context, '/quiz'); + // }, + // 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: Colors.blueAccent, + // ), + // child: Row( + // children: [ + // SizedBox( + // width: 50, + // height: 50, + // child: SvgPicture.asset('assets/explore/notebook.svg'), + // ), + // const SizedBox(width: 28.0), + // const Text( + // 'Quiz', + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 30.0, + // fontFamily: 'Comic', + // color: Colors.white, + // ), + // ), + // ], + // ), + // ), + // ), + ], + ), + ); } } From a6df22895e5061fb54191537d22f7d583e282c2d Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Tue, 28 May 2024 00:12:33 +0530 Subject: [PATCH 03/21] Added Drawing Board --- lib/pages/explore.dart | 34 ---------------------------------- 1 file changed, 34 deletions(-) diff --git a/lib/pages/explore.dart b/lib/pages/explore.dart index c2a76f9..0c47547 100644 --- a/lib/pages/explore.dart +++ b/lib/pages/explore.dart @@ -179,40 +179,6 @@ class ExplorePage extends StatelessWidget { ), ), ), - - // GestureDetector( - // onTap: () { - // Navigator.pushNamed(context, '/quiz'); - // }, - // 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: Colors.blueAccent, - // ), - // child: Row( - // children: [ - // SizedBox( - // width: 50, - // height: 50, - // child: SvgPicture.asset('assets/explore/notebook.svg'), - // ), - // const SizedBox(width: 28.0), - // const Text( - // 'Quiz', - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 30.0, - // fontFamily: 'Comic', - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // ), ], ), ); From ebc4cb02fa1edc92a0c78ed5840ad83cf90db274 Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Wed, 29 May 2024 01:47:38 +0530 Subject: [PATCH 04/21] Added Drawing Board --- lib/utils/route/routes.dart | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lib/utils/route/routes.dart b/lib/utils/route/routes.dart index e6c8de0..3ef276d 100644 --- a/lib/utils/route/routes.dart +++ b/lib/utils/route/routes.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:learn/landing_page.dart'; import 'package:learn/pages/about.dart'; import 'package:learn/pages/explore.dart'; +import 'package:learn/pages/explore/drawingboard.dart'; import 'package:learn/pages/explore/quiz.dart'; import 'package:learn/pages/favorite.dart'; import 'package:learn/pages/fruits.dart'; @@ -55,6 +56,8 @@ class Routers { return slidePageRoute(OccupationPage()); case AllRoutesConstant.fruitRoute: return slidePageRoute(FruitsPage()); + case AllRoutesConstant.drawingboardRoute: + return slidePageRoute(const DrawingBoardPage()); case AllRoutesConstant.landing: return slidePageRoute(const LandingPage()); case AllRoutesConstant.mainhome: From fb74aad294e3bb436572c7b80b1278ef31232c2e Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Wed, 29 May 2024 02:42:25 +0530 Subject: [PATCH 05/21] Added Drawing Board --- lib/landing_page.dart | 2 +- lib/main.dart | 80 +------- lib/pages/explore.dart | 321 +++++++++++++++++---------------- lib/pages/explore/explore.dart | 184 ++++++++----------- lib/utils/route/routes.dart | 6 +- 5 files changed, 257 insertions(+), 336 deletions(-) diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 09da76b..ba68fb0 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -86,7 +86,7 @@ class _LandingPageState extends State { onPressed: () { Navigator.popAndPushNamed( context, - AllRoutesConstant.mainhome, + AllRoutesConstant.mainhomeRoute, ); }, child: Text( diff --git a/lib/main.dart b/lib/main.dart index 571142b..d7f3bd0 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,29 +1,7 @@ import 'package:flutter/material.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; -import 'package:flutter_bloc/flutter_bloc.dart'; -import 'package:learn/pages/about.dart'; -import 'package:learn/pages/modules/flowers.dart'; -import 'package:learn/pages/modules/atoz.dart'; -import 'package:learn/pages/modules/birds.dart'; -import 'package:learn/pages/modules/animals.dart'; -import 'package:learn/pages/fruits.dart'; -import 'package:learn/pages/explore.dart'; -import 'package:learn/pages/favorite.dart'; -import 'package:learn/pages/modules/occupation.dart'; -import 'package:learn/pages/modules/parts.dart'; -import 'package:learn/pages/modules/seasons.dart'; -import 'package:learn/pages/modules/shapes.dart'; -import 'package:learn/pages/modules/planets.dart'; +import 'package:learn/landing_page.dart'; import 'package:learn/utils/route/routes.dart'; -import 'package:learn/utils/routes.dart'; -import 'package:learn/pages/modules/colours.dart'; -import 'package:learn/widgets/navbar/navbar.dart'; - -import 'cubit/index_cubit.dart'; -import 'pages/explore/drawingboard.dart'; -import 'pages/explore/quiz.dart'; -import 'pages/home.dart'; -import 'landing_page.dart'; DateTime? currentBackPressTime; @@ -40,54 +18,12 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return AdaptiveTheme( - light: ThemeData.light(), - dark: ThemeData.dark(), - initial: savedThemeMode ?? AdaptiveThemeMode.light, - builder: (theme, darkTheme) => BlocProvider( - create: (context) => IndexCubit(), - child: BlocBuilder( - builder: (context, index) { - return MaterialApp( - debugShowCheckedModeBanner: false, - title: 'Learn', - theme: theme, - darkTheme: darkTheme, - initialRoute: '/landing_page', - home: Scaffold( - body: const [ - MyHomePage(), - ExplorePage(), - FavoritePage(), - AboutPage(), - ][index], - bottomNavigationBar: const BottomNavBar(), - ), - onGenerateRoute: Routers.generateRoute, - routes: { - AllRoutes.homeRoute: (context) => const MyHomePage(), - AllRoutes.atozRoute: (context) => const AtoZ(), - AllRoutes.birdsRoute: (context) => BirdsPage(), - AllRoutes.shapesRoute: (context) => const ShapesPage(), - AllRoutes.partsRoute: (context) => const PartsPage(), - AllRoutes.solarRoute: (context) => PlanetsPage(), - 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(), - AllRoutes.quizRoute: (context) => const QuizPage(), - AllRoutes.seasonRoute: (context) => const SeasonsPage(), - AllRoutes.occupationRoute: (context) => OccupationPage(), - AllRoutes.fruitRoute: (context) => FruitsPage(), - AllRoutes.drawingboardRoute: (context) => DrawingBoardPage(), - "/landing_page": (context) => const LandingPage(), - }, - ); - }, - ), - ), + return const MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Learn', + themeMode: ThemeMode.system, + home: LandingPage(), + onGenerateRoute: Routers.generateRoute, ); } -} +} \ No newline at end of file diff --git a/lib/pages/explore.dart b/lib/pages/explore.dart index 0c47547..2fb78ea 100644 --- a/lib/pages/explore.dart +++ b/lib/pages/explore.dart @@ -2,7 +2,8 @@ import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:learn/utils/constants.dart'; -import '../utils/routes.dart'; +import 'package:learn/utils/route/route_constant.dart'; + import '../utils/const_dimensions.dart'; // Explore Page @@ -12,175 +13,183 @@ class ExplorePage extends StatelessWidget { @override Widget build(BuildContext context) { return SafeArea( - child: CustomScrollView( - slivers: [ - SliverAppBar( - 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), + child: CustomScrollView( + slivers: [ + SliverAppBar( + 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: SliverChildBuilderDelegate( - (context, index) { - return GestureDetector( - onTap: () => Navigator.push( - context, - AppConstants.modules[index].route, - ), - 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: Image.asset( - AppConstants.modules[index].thumbnailPath, - fit: BoxFit.cover, - ), + SliverList( + delegate: SliverChildBuilderDelegate( + (context, index) { + return GestureDetector( + onTap: () => Navigator.push( + context, + AppConstants.modules[index].route, + ), + 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), ), - Positioned.fill( - child: Align( - child: Column( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text( - AppConstants.modules[index].name, - 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, - ), - ], + ], + ), + child: ClipRRect( + borderRadius: BorderRadius.circular(16), + child: Stack( + fit: StackFit.expand, + alignment: Alignment.center, + children: [ + ImageFiltered( + imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + child: Image.asset( + AppConstants.modules[index].thumbnailPath, + fit: BoxFit.cover, + ), + ), + Positioned.fill( + child: Align( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text( + AppConstants.modules[index].name, + 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( - AppConstants.modules[index].description, - 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, - ), - ], + Text( + AppConstants.modules[index].description, + 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, + ), + ], + ), ), - ), - ], + ], + ), ), ), - ), - ], + ], + ), ), - )), - ); - }, - childCount: AppConstants.modules.length, - ), - ), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/quiz'); - }, - 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: Colors.blueAccent, - ), - child: Row( - children: [ - SizedBox( - width: 50, - height: 50, - child: SvgPicture.asset('assets/explore/notebook.svg'), - ), - const SizedBox(width: 28.0), - const Text( - 'Quiz', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 30.0, - fontFamily: 'Comic', - color: Colors.white, ), - ), - ], + ); + }, + childCount: AppConstants.modules.length, ), ), - ), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, AllRoutes.drawingboardRoute); - }, - 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: Colors.greenAccent, - ), - child: Row( - children: [ - SizedBox( - width: 50, - height: 50, - child: SvgPicture.asset('assets/explore/drawing_board.svg'), - ), - const SizedBox(width: 28.0), - const Text( - 'Drawing Board', - 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.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: Colors.greenAccent, + ), + child: Row( + children: [ + SizedBox( + width: 50, + height: 50, + child: SvgPicture.asset( + 'assets/explore/drawing_board.svg', + ), ), - ), - ], + const SizedBox(width: 28.0), + const Text( + 'Drawing Board', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), ), ), - ), - ], - ), + ], + ), ); } } + + // GestureDetector( + // onTap: () { + // Navigator.pushNamed(context, '/quiz'); + // }, + // 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: Colors.blueAccent, + // ), + // child: Row( + // children: [ + // SizedBox( + // width: 50, + // height: 50, + // child: SvgPicture.asset('assets/explore/notebook.svg'), + // ), + // const SizedBox(width: 28.0), + // const Text( + // 'Quiz', + // style: TextStyle( + // fontWeight: FontWeight.bold, + // fontSize: 30.0, + // fontFamily: 'Comic', + // color: Colors.white, + // ), + // ), + // ], + // ), + // ), + // ), diff --git a/lib/pages/explore/explore.dart b/lib/pages/explore/explore.dart index 63b4ae9..a2fbfdc 100644 --- a/lib/pages/explore/explore.dart +++ b/lib/pages/explore/explore.dart @@ -1,9 +1,11 @@ import 'dart:ui'; + import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; -import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/utils/constants.dart'; -import '../../utils/routes.dart'; +import 'package:learn/utils/route/route_constant.dart'; + +import '../../utils/const_dimensions.dart'; // Explore Page class ExplorePage extends StatelessWidget { @@ -26,6 +28,79 @@ class ExplorePage extends StatelessWidget { ), ), ), + SliverList( + delegate: SliverChildListDelegate( + [ + GestureDetector( + onTap: () { + Navigator.pushNamed(context, '/quiz'); + }, + 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: 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.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: Colors.greenAccent, + ), + child: Row( + children: [ + SizedBox( + width: ConstantDimensions.widthExtraLarge, + height: ConstantDimensions.heightExtraLarge, + child: SvgPicture.asset('assets/explore/drawing_board.svg'), + ), + const SizedBox(width: ConstantDimensions.widthMedium_Large), + const Text( + 'Drawing Board', + style: TextStyle( + fontWeight: FontWeight.bold, + fontSize: 30.0, + fontFamily: 'Comic', + color: Colors.white, + ), + ), + ], + ), + ), + ), + ], + ), + ), SliverList( delegate: SliverChildBuilderDelegate( (context, index) { @@ -56,7 +131,8 @@ class ExplorePage extends StatelessWidget { alignment: Alignment.center, children: [ ImageFiltered( - imageFilter: ImageFilter.blur(sigmaX: 5, sigmaY: 5), + imageFilter: + ImageFilter.blur(sigmaX: 5, sigmaY: 5), child: Image.asset( AppConstants.modules[index].thumbnailPath, fit: BoxFit.cover, @@ -113,108 +189,8 @@ class ExplorePage extends StatelessWidget { childCount: AppConstants.modules.length, ), ), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, '/quiz'); - }, - 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: Colors.blueAccent, - ), - child: Row( - children: [ - SizedBox( - width: 50, - height: 50, - child: SvgPicture.asset('assets/explore/notebook.svg'), - ), - const SizedBox(width: 28.0), - const Text( - 'Quiz', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 30.0, - fontFamily: 'Comic', - color: Colors.white, - ), - ), - ], - ), - ), - ), - GestureDetector( - onTap: () { - Navigator.pushNamed(context, AllRoutes.drawingboardRoute); - }, - 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: Colors.greenAccent, - ), - child: Row( - children: [ - SizedBox( - width: 50, - height: 50, - child: SvgPicture.asset('assets/explore/drawing_board.svg'), - ), - const SizedBox(width: 28.0), - const Text( - 'Drawing Board', - style: TextStyle( - fontWeight: FontWeight.bold, - fontSize: 30.0, - fontFamily: 'Comic', - color: Colors.white, - ), - ), - ], - ), - ), - ), - - // GestureDetector( - // onTap: () { - // Navigator.pushNamed(context, '/quiz'); - // }, - // 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: Colors.blueAccent, - // ), - // child: Row( - // children: [ - // SizedBox( - // width: 50, - // height: 50, - // child: SvgPicture.asset('assets/explore/notebook.svg'), - // ), - // const SizedBox(width: 28.0), - // const Text( - // 'Quiz', - // style: TextStyle( - // fontWeight: FontWeight.bold, - // fontSize: 30.0, - // fontFamily: 'Comic', - // color: Colors.white, - // ), - // ), - // ], - // ), - // ), - // ), ], ), ); } -} +} \ No newline at end of file diff --git a/lib/utils/route/routes.dart b/lib/utils/route/routes.dart index 3ef276d..4fb1872 100644 --- a/lib/utils/route/routes.dart +++ b/lib/utils/route/routes.dart @@ -58,9 +58,9 @@ class Routers { return slidePageRoute(FruitsPage()); case AllRoutesConstant.drawingboardRoute: return slidePageRoute(const DrawingBoardPage()); - case AllRoutesConstant.landing: + case AllRoutesConstant.landingRoute: return slidePageRoute(const LandingPage()); - case AllRoutesConstant.mainhome: + case AllRoutesConstant.mainhomeRoute: return slidePageRoute(MainHome()); default: return MaterialPageRoute( @@ -72,4 +72,4 @@ class Routers { ); } } -} +} \ No newline at end of file From 7b03e50457e6090da5753605e8ae58d0ccb54a31 Mon Sep 17 00:00:00 2001 From: Hetkumar Prajapati Date: Wed, 29 May 2024 07:32:12 +0530 Subject: [PATCH 06/21] (A-Zpage) overflow-fixed --- lib/pages/modules/atoz.dart | 164 ++++++++++++++++++------------------ 1 file changed, 81 insertions(+), 83 deletions(-) diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 219cc01..3dcc04e 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -1,4 +1,3 @@ - import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'dart:async'; @@ -38,7 +37,7 @@ class ItemTile extends StatelessWidget { ); }, child: Padding( - padding: const EdgeInsets.all(6), + padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 5), child: Column( mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.stretch, @@ -51,27 +50,25 @@ class ItemTile extends StatelessWidget { ), textAlign: TextAlign.center, ), - const SizedBox(height: 3), 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.3, - height: MediaQuery.of(context).size.width * 0.3, - alignment: Alignment.center, - ); - } else { - return SvgPicture.asset( - item.iconAsset, - width: MediaQuery.of(context).size.width * 0.3, - height: MediaQuery.of(context).size.width * 0.2, - alignment: Alignment.center, - ); - } + 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), ], @@ -163,80 +160,81 @@ class _PopupDialogState extends State<_PopupDialog> { shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), content: Container( padding: EdgeInsets.zero, - width: MediaQuery.of(context).size.width * 0.7, + 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(20), - child: Column( - crossAxisAlignment: CrossAxisAlignment.stretch, - mainAxisSize: MainAxisSize.min, - children: [ - Text( - currentItem.title, - style: const TextStyle( - fontWeight: FontWeight.bold, - fontSize: 40, + padding: const EdgeInsets.all(18), + child: Center( + child: Column( + crossAxisAlignment: CrossAxisAlignment.stretch, + mainAxisSize: MainAxisSize.min, + children: [ + Text( + currentItem.title, + style: const TextStyle( + fontWeight: FontWeight.bold, + fontSize: 40, + ), + textAlign: TextAlign.center, ), - 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.width * 0.5, - alignment: Alignment.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'), + const SizedBox(height: ConstantDimensions.heightMedium), + Text( + currentItem.description, + textAlign: TextAlign.center, + style: const TextStyle( + fontSize: 28, + ), ), - ElevatedButton( - onPressed: _nextItem, - child: const Text('Next'), + const SizedBox(height: ConstantDimensions.heightMedium), + Row( + mainAxisAlignment: MainAxisAlignment.spaceEvenly, + children: [ + ElevatedButton( + onPressed: _previousItem, + child: const Text('Prev'), + ), + ElevatedButton( + onPressed: _nextItem, + child: const Text('Next'), + ), + ], ), - ], - ), - const SizedBox(height: ConstantDimensions.heightMedium), - ElevatedButton( - style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( - const Color.fromARGB(216, 233, 101, 92), + const SizedBox(height: ConstantDimensions.heightMedium), + ElevatedButton( + style: ButtonStyle( + backgroundColor: WidgetStateProperty.all( + const Color.fromARGB(216, 233, 101, 92), + ), + ), + onPressed: () { + Navigator.pop(context); + }, + child: const Text( + 'Close', + style: TextStyle(color: Colors.white), + ), ), - ), - onPressed: () { - Navigator.pop(context); - }, - child: const Text( - 'Close', - style: TextStyle(color: Colors.white), - ), + ], ), - const SizedBox(height: ConstantDimensions.heightExtraLarge), - ], + ), ), ), ), - ) ); } } @@ -293,7 +291,7 @@ class _AtoZState extends State { child: GridView.count( crossAxisCount: MediaQuery.of(context).size.width ~/ 200, // Adjust the value based on screen width - childAspectRatio: 1.0, // Aspect ratio of items + childAspectRatio: 0.8, // Aspect ratio of items children: List.generate( items.length, (index) => ItemTile( From c2313a6863f8f6b2ce7b970a19682b12e5d65625 Mon Sep 17 00:00:00 2001 From: Siva Ramana H V Date: Wed, 29 May 2024 18:04:52 +0530 Subject: [PATCH 07/21] About UI and content is addes --- lib/landing_page.dart | 130 +++++----- lib/pages/about.dart | 436 ++++++++++++++++++++++++-------- lib/pages/fruits.dart | 4 +- lib/pages/home.dart | 2 + lib/pages/modules/atoz.dart | 6 +- lib/pages/modules/colours.dart | 4 +- lib/pages/modules/flowers.dart | 4 +- lib/pages/modules/seasons.dart | 2 +- lib/utils/const_dimensions.dart | 3 +- pubspec.yaml | 2 +- 10 files changed, 408 insertions(+), 185 deletions(-) diff --git a/lib/landing_page.dart b/lib/landing_page.dart index 33be147..00e20d4 100644 --- a/lib/landing_page.dart +++ b/lib/landing_page.dart @@ -18,85 +18,83 @@ class _LandingPageState extends State { body: SingleChildScrollView( child: Padding( padding: const EdgeInsets.all(20), - child: Container( - child: Column( - children: [ - - Center( - child: Container( - width: width, - height: height/2, - decoration: const BoxDecoration( - image: DecorationImage( - image: AssetImage("assets/images/studying.png"), - fit: BoxFit.contain - ), + child: Column( + children: [ + + Center( + child: Container( + width: width, + height: height/2, + decoration: const BoxDecoration( + image: DecorationImage( + image: AssetImage("assets/images/studying.png"), + fit: BoxFit.contain ), ), ), - - Center( - child: SizedBox( - child: DefaultTextStyle( - style: TextStyle( - fontSize: width/19, - ), - child: AnimatedTextKit( - animatedTexts: [ - ColorizeAnimatedText( - 'Learn', - textStyle: TextStyle(fontSize: width/12, fontWeight: FontWeight.w900), - colors: [ const Color.fromRGBO(255, 183, 77, 1),const Color.fromARGB(255, 231, 225, 208)], - ), - ], - isRepeatingAnimation: true, - ), + ), + + Center( + child: SizedBox( + child: DefaultTextStyle( + style: TextStyle( + fontSize: width/19, + ), + child: AnimatedTextKit( + animatedTexts: [ + ColorizeAnimatedText( + 'Learn', + textStyle: TextStyle(fontSize: width/12, fontWeight: FontWeight.w900), + colors: [ const Color.fromRGBO(255, 183, 77, 1),const Color.fromARGB(255, 231, 225, 208)], + ), + ], + isRepeatingAnimation: true, ), ), ), - - const Padding(padding: EdgeInsets.only(top: 20)), - // - Center( - child: SizedBox( - child: Text( - "Learning Made Easy", - style: TextStyle( - fontWeight: FontWeight.w400, - fontSize: width/18 - ), + ), + + const Padding(padding: EdgeInsets.only(top: 20)), + // + Center( + child: SizedBox( + child: Text( + "Learning Made Easy", + style: TextStyle( + fontWeight: FontWeight.w400, + fontSize: width/18 ), ), ), - - const Padding(padding: EdgeInsets.only(top: 30)), - - Center( - child: SizedBox( - width: width/1.5, - height: height/10, - child: ElevatedButton( - style: ElevatedButton.styleFrom( - backgroundColor: const Color.fromRGBO(255, 183, 77, 1), - shape: const RoundedRectangleBorder( - borderRadius: BorderRadius.all(Radius.circular(20)), - ) - ), - onPressed: () { - Navigator.push(context, MaterialPageRoute(builder: (context) => MyHomePage())); - }, - child: Text("Get started", - style: TextStyle( - color: Colors.white, - fontSize: (width < height) ? width/19 : height/19 - ), + ), + + const Padding(padding: EdgeInsets.only(top: 30)), + + Center( + child: SizedBox( + width: width/1.5, + height: height/10, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: const Color.fromRGBO(255, 183, 77, 1), + shape: const RoundedRectangleBorder( + borderRadius: BorderRadius.all(Radius.circular(20)), + ) + ), + onPressed: () { + Navigator.push(context, MaterialPageRoute(builder: (context) => const MyHomePage())); + }, + child: Text("Get started", + style: TextStyle( + color: Colors.white, + fontSize: (width < height) ? width/19 : height/19 ), ), ), ), - - ], - ), + ), + + ], ), ), ), diff --git a/lib/pages/about.dart b/lib/pages/about.dart index 4221de2..980a34c 100644 --- a/lib/pages/about.dart +++ b/lib/pages/about.dart @@ -2,11 +2,8 @@ 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'; -import '../utils/const_dimensions.dart'; - class AboutPage extends StatelessWidget { const AboutPage({Key? key}) : super(key: key); @@ -16,143 +13,234 @@ class AboutPage extends StatelessWidget { appBar: AppBar( title: const Text( 'About', - style: TextStyle(fontWeight: FontWeight.bold), + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), ), + backgroundColor: Colors.deepPurple, ), body: SingleChildScrollView( child: Padding( - padding: const EdgeInsets.all(10.0), + padding: const EdgeInsets.all(16.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - const Text( - 'Learning app for kids', - style: TextStyle( - fontSize: 24.0, - fontWeight: FontWeight.bold, + const Center( + child: Text( + 'Learn', + style: TextStyle( + fontSize: 32.0, + fontWeight: FontWeight.bold, + color: Colors.deepPurple, + ), ), ), - - const SizedBox(height: 16.0), - const Text( - 'Version: 1.1.0', - style: TextStyle(fontSize: 18.0), + const SizedBox(height: 8.0), + const Center( + child: Text( + 'Learning app for kids', + style: TextStyle( + fontSize: 18.0, + color: Colors.grey, + ), + ), ), + const SizedBox(height: 32.0), + _buildSectionTitle(context, 'Version: 1.1.0'), const SizedBox(height: 8.0), - const Text( - 'Developed by: sapatevaibhav', - style: TextStyle(fontSize: 18.0), + _buildSectionContent(context, 'Developed by: sapatevaibhav'), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Purpose of the App:'), + const SizedBox(height: 8.0), + _buildSectionContent( + context, + 'Learn is designed to provide a fun and interactive learning experience for kids. ' + 'Our mission is to make learning enjoyable and accessible, encouraging curiosity and discovery in young minds. ' + 'The app covers a wide range of topics to help children build a solid foundation of knowledge in a playful and engaging way.', ), const SizedBox(height: 16.0), - const Text( - 'Description:', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), + _buildSectionTitle(context, 'Features:'), + const SizedBox(height: 8.0), + _buildFeature( + context, + 'A-Z Alphabets', + 'Learn the alphabets with examples and pronunciation guides, making it easier for kids to recognize and remember letters.', + ), + _buildFeature( + context, + 'Animals', + 'Discover animals, hear their sounds, and learn how to pronounce their names, fostering a love for nature and wildlife.', + ), + _buildFeature( + context, + 'Body Parts', + 'Learn about different body parts, how to pronounce them, and gain short information, promoting awareness of their own bodies.', ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Upcoming Features:'), const SizedBox(height: 8.0), - const Text( - AppConstants.description, - style: TextStyle(fontSize: 18.0), + _buildFeature( + context, + 'Birds', + 'Explore different birds and their voices, adding to the child’s knowledge about avian species.', ), - const SizedBox(height: 6.0), - const Text( - 'Source code:', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), + _buildFeature( + context, + 'Solar System', + 'Gain knowledge about the solar system, sparking interest in space and astronomy.', ), + _buildFeature( + context, + 'Shapes', + 'Learn about different shapes and their properties, enhancing cognitive and visual-spatial skills.', + ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Source Code:'), + const SizedBox(height: 8.0), GestureDetector( onTap: () { - _launchURL(context, "https://github.com/VaibhavCodeClub/learn"); + _launchURL( + context, "https://github.com/VaibhavCodeClub/learn"); }, - child: SvgPicture.asset( - 'assets/images/git.svg', - width: 32.0, - height: 32.0, - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black, + child: Row( + children: [ + SvgPicture.asset( + 'assets/images/git.svg', + width: 32.0, + height: 32.0, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + ), + const SizedBox(width: 8.0), + Text( + 'github.com/VaibhavCodeClub/learn', + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + decoration: TextDecoration.underline, + ), + ), + ], ), ), const SizedBox(height: 16.0), - const Text( - 'Connect:', - style: TextStyle( - fontSize: 20.0, - fontWeight: FontWeight.bold, - ), - ), - Row( - children: [ - GestureDetector( - onTap: () { - _launchURL(context, "https://github.com/sapatevaibhav"); - }, - child: SvgPicture.asset( - 'assets/images/github.svg', - width: ConstantDimensions.widthSmall_Medium * 2, - height: ConstantDimensions.heightSmall_Medium * 2, - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black, - ), - ), - const SizedBox(width: ConstantDimensions.widthSmall_Medium), - GestureDetector( - onTap: () { - _launchURL(context, "mailto:sapatevaibhav@duck.com"); - }, - child: SvgPicture.asset( - 'assets/images/email.svg', - width: ConstantDimensions.widthSmall_Medium * 2, - height: ConstantDimensions.heightSmall_Medium * 2, - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black , - ), - ), - const SizedBox(width: ConstantDimensions.widthSmall_Medium), - GestureDetector( - onTap: () { - _launchURL( - context, "https://linkedin.com/in/sapatevaibhav"); - }, - child: SvgPicture.asset( - 'assets/images/linkedin.svg', - width: ConstantDimensions.widthSmall_Medium * 2, - height: ConstantDimensions.heightSmall_Medium * 2, + _buildSectionTitle(context, 'Connect:'), + const SizedBox(height: 8.0), + Row( + children: [ + _buildIcon(context, 'https://github.com/sapatevaibhav', + 'assets/images/github.svg'), + const SizedBox(width: 16.0), + _buildIcon(context, 'mailto:sapatevaibhav@duck.com', + 'assets/images/email.svg'), + const SizedBox(width: 16.0), + GestureDetector( + onTap: () { + _launchURL( + context, 'https://linkedin.com/in/sapatevaibhav'); + }, + child: SvgPicture.asset( + 'assets/images/linkedin.svg', + width: 32.0, + height: 32.0, + ), ), - ), - const SizedBox(width: ConstantDimensions.widthSmall_Medium), - GestureDetector( - onTap: () { - _launchURL(context, "https://instagram.com/v.d.r.sapate"); + const SizedBox(width: 16.0), + _buildIcon(context, 'https://instagram.com/v.d.r.sapate', + 'assets/images/instagram.svg'), + ], + ), + const SizedBox(height: 16.0), + Center( + child: ElevatedButton( + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => const LearnMorePage(), + ), + ); }, - child: SvgPicture.asset( - 'assets/images/instagram.svg', - width: ConstantDimensions.widthSmall_Medium * 2, - height: ConstantDimensions.heightSmall_Medium * 2, - color: Theme.of(context).brightness == Brightness.dark - ? Colors.white - : Colors.black, + style: ElevatedButton.styleFrom( + foregroundColor: Colors.white, + backgroundColor: Colors.deepPurple, + padding: const EdgeInsets.symmetric( + horizontal: 24, vertical: 12), + textStyle: const TextStyle(fontSize: 18.0), ), + child: const Text('Learn More'), ), - - ] - ) - ], - ), + ], ), - ), + ), + ); + } - ); + Widget _buildSectionTitle(BuildContext context, String title) { + return Text( + title, + style: const TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + color: Colors.deepPurple, + ), + ); + } + Widget _buildSectionContent(BuildContext context, String content) { + return Text( + content, + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context).textTheme.bodyLarge!.color, + ), + ); + } + + Widget _buildFeature(BuildContext context, String title, String description) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + color: Colors.deepPurple, + ), + ), + const SizedBox(height: 4.0), + Text( + description, + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context).textTheme.bodyLarge!.color, + ), + ), + ], + ), + ); + } + Widget _buildIcon(BuildContext context, String url, String assetPath) { + return GestureDetector( + onTap: () { + _launchURL(context, url); + }, + child: SvgPicture.asset( + assetPath, + width: 32.0, + height: 32.0, + color: Theme.of(context).brightness == Brightness.dark + ? Colors.white + : Colors.black, + ), + ); } void _launchURL(BuildContext context, String url) async { @@ -163,3 +251,137 @@ class AboutPage extends StatelessWidget { } } } + +class LearnMorePage extends StatelessWidget { + const LearnMorePage({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + title: const Text( + 'Learn More', + style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white), + ), + backgroundColor: Colors.deepPurple, + ), + body: SingleChildScrollView( + padding: const EdgeInsets.all(16.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + _buildSectionTitle(context, 'Detailed Features:'), + const SizedBox(height: 8.0), + _buildFeature( + context, + 'A-Z Alphabets', + 'Each letter of the alphabet is accompanied by an example image and pronunciation guide. Children can interact with the letters to hear how they sound, helping them to learn the alphabet in a fun and engaging way.', + ), + _buildFeature( + context, + 'Animals', + 'The animals section introduces children to various animals, providing sounds and fun facts about each one. This feature helps children to develop a love for nature and learn more about the animal kingdom.', + ), + _buildFeature( + context, + 'Body Parts', + 'This feature includes a diagram of the human body with clickable parts that provide information and pronunciation. It helps children to learn about their own bodies and understand the function of each part.', + ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Upcoming Features:'), + const SizedBox(height: 8.0), + _buildFeature( + context, + 'Birds', + 'The upcoming birds section will introduce various birds and their calls, helping children to recognize and learn more about avian species.', + ), + _buildFeature( + context, + 'Solar System', + 'The solar system feature will teach children about the planets and other celestial bodies, fostering an interest in space and astronomy.', + ), + _buildFeature( + context, + 'Shapes', + 'Children will learn about different shapes and their properties, which helps in developing cognitive and visual-spatial skills.', + ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'User Guide:'), + const SizedBox(height: 8.0), + _buildSectionContent( + context, + 'Navigate through the app using the bottom navigation bar. Each section is designed to be interactive and user-friendly. Parents can help guide their children through each feature and use the app as a supplementary learning tool.', + ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'FAQ:'), + const SizedBox(height: 8.0), + _buildSectionContent( + context, + 'Q: How do I use the app?\n' + 'A: Simply navigate through the sections using the bottom navigation bar. Each section is designed to be intuitive and easy to use.\n\n' + 'Q: Is the app free?\n' + 'A: Yes, the app is free to use. Some additional features may be available for purchase in the future.\n\n' + 'Q: How can I provide feedback?\n' + 'A: You can provide feedback through the contact options available in the About section of the app.', + ), + const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Feedback and Contact Information:'), + const SizedBox(height: 8.0), + _buildSectionContent( + context, + 'We value your feedback! If you have any suggestions or issues, please contact us at sapatevaibhav@duck.com or through our social media channels.', + ), + ], + ), + ), + ); + } + + Widget _buildSectionTitle(BuildContext context, String title) { + return Text( + title, + style: const TextStyle( + fontSize: 20.0, + fontWeight: FontWeight.bold, + color: Colors.deepPurple, + ), + ); + } + + Widget _buildSectionContent(BuildContext context, String content) { + return Text( + content, + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context).textTheme.bodyLarge!.color, + ), + ); + } + + Widget _buildFeature(BuildContext context, String title, String description) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 8.0), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text( + title, + style: const TextStyle( + fontSize: 18.0, + fontWeight: FontWeight.bold, + color: Colors.deepPurple, + ), + ), + const SizedBox(height: 4.0), + Text( + description, + style: TextStyle( + fontSize: 16.0, + color: Theme.of(context).textTheme.bodyLarge!.color, + ), + ), + ], + ), + ); + } +} diff --git a/lib/pages/fruits.dart b/lib/pages/fruits.dart index 9954f88..78ca834 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 bf0100a..e33e024 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -1,3 +1,5 @@ +// ignore_for_file: deprecated_member_use + import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; import 'package:fluttertoast/fluttertoast.dart'; diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 219cc01..1236de5 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -219,7 +219,7 @@ class _PopupDialogState extends State<_PopupDialog> { const SizedBox(height: ConstantDimensions.heightMedium), ElevatedButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( const Color.fromARGB(216, 233, 101, 92), ), ), @@ -270,8 +270,8 @@ class _AtoZState extends State { child: ElevatedButton( style: ButtonStyle( backgroundColor: isTimerEnabled - ? MaterialStateProperty.all(Colors.green) - : MaterialStateProperty.all(Colors.red), + ? WidgetStateProperty.all(Colors.green) + : WidgetStateProperty.all(Colors.red), ), onPressed: () { setState(() { diff --git a/lib/pages/modules/colours.dart b/lib/pages/modules/colours.dart index 5c407ab..a0f068d 100644 --- a/lib/pages/modules/colours.dart +++ b/lib/pages/modules/colours.dart @@ -4,7 +4,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'; -import '../../utils/const_dimensions.dart'; +// import '../../utils/const_dimensions.dart'; import 'package:learn/models/colours_model.dart'; class ColoursPage extends StatefulWidget { @@ -135,7 +135,7 @@ class _ColoursPageState extends State { children: [ GestureDetector( onTap: _navigateToNextColour, - child: Container( + child: SizedBox( width: double.infinity, height: 300, child: SvgPicture.asset( diff --git a/lib/pages/modules/flowers.dart b/lib/pages/modules/flowers.dart index 075f0d2..f5f51a7 100644 --- a/lib/pages/modules/flowers.dart +++ b/lib/pages/modules/flowers.dart @@ -4,7 +4,7 @@ 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'; +// import '../../utils/const_dimensions.dart'; class FlowerPage extends StatefulWidget { const FlowerPage({super.key}); @@ -119,7 +119,7 @@ class _FlowerPageState extends State { children: [ GestureDetector( onTap: _navigateToNextFlower, - child: Container( + child: SizedBox( width: double.infinity, height: 300, child: SvgPicture.asset( diff --git a/lib/pages/modules/seasons.dart b/lib/pages/modules/seasons.dart index 5f4c9c4..cd19bd9 100644 --- a/lib/pages/modules/seasons.dart +++ b/lib/pages/modules/seasons.dart @@ -136,7 +136,7 @@ class _SeasonPopupState extends State { ), ElevatedButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: WidgetStateProperty.all(Colors.red), ), onPressed: () { Navigator.of(context).pop(); diff --git a/lib/utils/const_dimensions.dart b/lib/utils/const_dimensions.dart index bb30064..8abac52 100644 --- a/lib/utils/const_dimensions.dart +++ b/lib/utils/const_dimensions.dart @@ -1,3 +1,5 @@ +// ignore_for_file: constant_identifier_names + class ConstantDimensions { static const double heightExtraSmall = 6; static const double heightSmall = 10; @@ -15,7 +17,6 @@ class ConstantDimensions { static const double widthLarge = 30; static const double widthExtraLarge = 50; - static const double heightSmallImage = 325; static const double heightBigImage = 350; diff --git a/pubspec.yaml b/pubspec.yaml index a284a1a..b5f6453 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,7 +42,7 @@ dependencies: card_swiper: ^3.0.1 flutter_card_swiper: ^7.0.0 adaptive_theme: ^3.6.0 - fluttertoast: ^8.2.5 + fluttertoast: 8.0.9 google_nav_bar: ^5.0.6 flutter_bloc: ^8.1.5 animated_text_kit: ^4.2.2 From 096b03a2b43164a4d746c45c28eeee89e14af2f5 Mon Sep 17 00:00:00 2001 From: Maheen Ilyas Date: Thu, 30 May 2024 13:01:58 +0300 Subject: [PATCH 08/21] Replaced MaterialStateProperty to WidgetStateProperty --- lib/pages/fruits.dart | 4 ++-- lib/pages/main_home.dart | 13 ++++++++----- lib/pages/modules/atoz.dart | 6 +++--- lib/pages/modules/seasons.dart | 2 +- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/pages/fruits.dart b/lib/pages/fruits.dart index 9954f88..78ca834 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/main_home.dart b/lib/pages/main_home.dart index 3c38b3d..f9bc566 100644 --- a/lib/pages/main_home.dart +++ b/lib/pages/main_home.dart @@ -12,6 +12,7 @@ import 'package:learn/widgets/navbar/navbar.dart'; class MainHome extends StatefulWidget { final AdaptiveThemeMode? savedThemeMode; + const MainHome({ super.key, this.savedThemeMode, @@ -22,7 +23,7 @@ class MainHome extends StatefulWidget { } class _MainHomeState extends State { - Future _onBackPressed() { + bool _onBackPressed(bool canPop) { DateTime now = DateTime.now(); if (currentBackPressTime == null || now.difference(currentBackPressTime!) > const Duration(seconds: 2)) { @@ -32,15 +33,17 @@ class _MainHomeState extends State { toastLength: Toast.LENGTH_SHORT, gravity: ToastGravity.BOTTOM, ); - return Future.value(false); + canPop = false; + } else { + canPop = true; } - return Future.value(true); + return canPop; } @override Widget build(BuildContext context) { - return WillPopScope( - onWillPop: _onBackPressed, + return PopScope( + onPopInvoked: _onBackPressed, child: AdaptiveTheme( light: ThemeData.light(), dark: ThemeData.dark(), diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 219cc01..1236de5 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -219,7 +219,7 @@ class _PopupDialogState extends State<_PopupDialog> { const SizedBox(height: ConstantDimensions.heightMedium), ElevatedButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all( + backgroundColor: WidgetStateProperty.all( const Color.fromARGB(216, 233, 101, 92), ), ), @@ -270,8 +270,8 @@ class _AtoZState extends State { child: ElevatedButton( style: ButtonStyle( backgroundColor: isTimerEnabled - ? MaterialStateProperty.all(Colors.green) - : MaterialStateProperty.all(Colors.red), + ? WidgetStateProperty.all(Colors.green) + : WidgetStateProperty.all(Colors.red), ), onPressed: () { setState(() { diff --git a/lib/pages/modules/seasons.dart b/lib/pages/modules/seasons.dart index 5f4c9c4..cd19bd9 100644 --- a/lib/pages/modules/seasons.dart +++ b/lib/pages/modules/seasons.dart @@ -136,7 +136,7 @@ class _SeasonPopupState extends State { ), ElevatedButton( style: ButtonStyle( - backgroundColor: MaterialStateProperty.all(Colors.red), + backgroundColor: WidgetStateProperty.all(Colors.red), ), onPressed: () { Navigator.of(context).pop(); From fb56e624940b1e8a4c3b236af971beef0e141582 Mon Sep 17 00:00:00 2001 From: Sapate Vaibhav Date: Fri, 31 May 2024 11:27:24 +0530 Subject: [PATCH 09/21] Update about.dart --- lib/pages/about.dart | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/pages/about.dart b/lib/pages/about.dart index 980a34c..294bbfe 100644 --- a/lib/pages/about.dart +++ b/lib/pages/about.dart @@ -287,9 +287,7 @@ class LearnMorePage extends StatelessWidget { 'Body Parts', 'This feature includes a diagram of the human body with clickable parts that provide information and pronunciation. It helps children to learn about their own bodies and understand the function of each part.', ), - const SizedBox(height: 16.0), - _buildSectionTitle(context, 'Upcoming Features:'), - const SizedBox(height: 8.0), + _buildFeature( context, 'Birds', @@ -299,7 +297,9 @@ class LearnMorePage extends StatelessWidget { context, 'Solar System', 'The solar system feature will teach children about the planets and other celestial bodies, fostering an interest in space and astronomy.', - ), + ),const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Upcoming Features:'), + const SizedBox(height: 8.0), _buildFeature( context, 'Shapes', @@ -320,7 +320,7 @@ class LearnMorePage extends StatelessWidget { 'Q: How do I use the app?\n' 'A: Simply navigate through the sections using the bottom navigation bar. Each section is designed to be intuitive and easy to use.\n\n' 'Q: Is the app free?\n' - 'A: Yes, the app is free to use. Some additional features may be available for purchase in the future.\n\n' + 'A: Yes, the app is free to use.\n\n' 'Q: How can I provide feedback?\n' 'A: You can provide feedback through the contact options available in the About section of the app.', ), From f1c9f6d6b9a0ebacb3cf2cbb25e19476a7d60063 Mon Sep 17 00:00:00 2001 From: Sapate Vaibhav Date: Fri, 31 May 2024 11:30:38 +0530 Subject: [PATCH 10/21] Update about.dart --- lib/pages/about.dart | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/pages/about.dart b/lib/pages/about.dart index 294bbfe..b3c485f 100644 --- a/lib/pages/about.dart +++ b/lib/pages/about.dart @@ -74,9 +74,7 @@ class AboutPage extends StatelessWidget { 'Body Parts', 'Learn about different body parts, how to pronounce them, and gain short information, promoting awareness of their own bodies.', ), - const SizedBox(height: 16.0), - _buildSectionTitle(context, 'Upcoming Features:'), - const SizedBox(height: 8.0), + _buildFeature( context, 'Birds', @@ -86,7 +84,9 @@ class AboutPage extends StatelessWidget { context, 'Solar System', 'Gain knowledge about the solar system, sparking interest in space and astronomy.', - ), + ),const SizedBox(height: 16.0), + _buildSectionTitle(context, 'Upcoming Features:'), + const SizedBox(height: 8.0), _buildFeature( context, 'Shapes', From 2003a978b4e32726b425eca5cdb8339e2d69deeb Mon Sep 17 00:00:00 2001 From: Hetkumar Prajapati Date: Fri, 31 May 2024 12:27:40 +0530 Subject: [PATCH 11/21] confiltResolved --- lib/pages/modules/atoz.dart | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 3dcc04e..e79e827 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -268,8 +268,8 @@ class _AtoZState extends State { child: ElevatedButton( style: ButtonStyle( backgroundColor: isTimerEnabled - ? MaterialStateProperty.all(Colors.green) - : MaterialStateProperty.all(Colors.red), + ? WidgetStateProperty.all(Colors.green) + : WidgetStateProperty.all(Colors.red), ), onPressed: () { setState(() { From 82484e71f0888462b795f6c699676db2c81db63e Mon Sep 17 00:00:00 2001 From: Hetkumar Prajapati Date: Fri, 31 May 2024 12:38:52 +0530 Subject: [PATCH 12/21] solved --- lib/pages/modules/atoz.dart | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index e79e827..7a5d56a 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -110,7 +110,7 @@ class _PopupDialogState extends State<_PopupDialog> { _speakDescription(); if (isAutoNextEnabled) { - timer = Timer.periodic(const Duration(seconds: 3), (Timer t) { + timer = Timer.periodic(const Duration(seconds: 2), (Timer t) { _nextItem(); }); } From fdf6218c3f68cc58e27b6b0cd3097fc861cd91a0 Mon Sep 17 00:00:00 2001 From: Hetkumar Prajapati Date: Fri, 31 May 2024 12:46:02 +0530 Subject: [PATCH 13/21] packageupdated --- pubspec.yaml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pubspec.yaml b/pubspec.yaml index b5f6453..430862d 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: learn description: "Learning app for kids" # The following line prevents the package from being accidentally published to # pub.dev using `flutter pub publish`. This is preferred for private packages. -publish_to: 'none' # Remove this line if you wish to publish to pub.dev +publish_to: "none" # Remove this line if you wish to publish to pub.dev # The following defines the version and build number for your application. # A version number is three numbers separated by dots, like 1.2.43 @@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.1.0+15 environment: - sdk: '>=3.2.0 <4.0.0' + sdk: ">=3.2.0 <4.0.0" # Dependencies specify other packages that your package needs in order to work. # To automatically upgrade your package dependencies to the latest versions @@ -31,7 +31,6 @@ dependencies: flutter: sdk: flutter - # The following adds the Cupertino Icons font to your application. # Use with the CupertinoIcons class for iOS style icons. google_fonts: ^6.1.0 @@ -42,7 +41,7 @@ dependencies: card_swiper: ^3.0.1 flutter_card_swiper: ^7.0.0 adaptive_theme: ^3.6.0 - fluttertoast: 8.0.9 + fluttertoast: ^8.2.5 google_nav_bar: ^5.0.6 flutter_bloc: ^8.1.5 animated_text_kit: ^4.2.2 @@ -63,7 +62,6 @@ dev_dependencies: # The following section is specific to Flutter packages. flutter: - # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. From e503bacc7d06391bc8cd6780e20f232daef1c3a5 Mon Sep 17 00:00:00 2001 From: DS-1090 <126580400+DS-1090@users.noreply.github.com> Date: Fri, 31 May 2024 13:18:23 +0530 Subject: [PATCH 14/21] Add files via upload --- lib/pages/modules/flowers.dart | 362 +++++++++++++++++---------------- 1 file changed, 183 insertions(+), 179 deletions(-) diff --git a/lib/pages/modules/flowers.dart b/lib/pages/modules/flowers.dart index f5f51a7..db1ae9a 100644 --- a/lib/pages/modules/flowers.dart +++ b/lib/pages/modules/flowers.dart @@ -1,179 +1,183 @@ -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.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; - }); - } - - 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: 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: SizedBox( - 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, - ), - ) - ], - ), - ], - ), - ), - ), - ), - ); - } -} +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, + ), + ) + ], + ), + ], + ), + ), + ), + ), + ), + ); + } +} From 5eaf1db60d8cd14321eaf687b38d4a76a302bc7b Mon Sep 17 00:00:00 2001 From: DS-1090 <126580400+DS-1090@users.noreply.github.com> Date: Fri, 31 May 2024 13:22:50 +0530 Subject: [PATCH 15/21] Updated Flowers Page - Resolved image lag issue - Enhanced UI to make it more adaptive to theme changes - Added commonly used flowers From 8727afa277b45372c97dcea4ae6d8ee7afc9a924 Mon Sep 17 00:00:00 2001 From: DS-1090 <126580400+DS-1090@users.noreply.github.com> Date: Fri, 31 May 2024 13:24:52 +0530 Subject: [PATCH 16/21] Added updated flower images --- assets/images/flowers/daisy.svg | 57 +- assets/images/flowers/dandelion.svg | 11 + assets/images/flowers/flower-icon.svg | 44 +- assets/images/flowers/hibiscus.svg | 11 +- assets/images/flowers/jasmine.svg | 10 + assets/images/flowers/lavender.svg | 3332 +------------------------ assets/images/flowers/lily.svg | 55 +- assets/images/flowers/lotus.svg | 10 + assets/images/flowers/marigold.svg | 12 +- assets/images/flowers/rose.svg | 12 +- assets/images/flowers/sunflower.svg | 3 +- assets/images/flowers/tulip.svg | 11 +- 12 files changed, 217 insertions(+), 3351 deletions(-) create mode 100644 assets/images/flowers/dandelion.svg create mode 100644 assets/images/flowers/jasmine.svg create mode 100644 assets/images/flowers/lotus.svg diff --git a/assets/images/flowers/daisy.svg b/assets/images/flowers/daisy.svg index 6103b4d..a6f8d04 100644 --- a/assets/images/flowers/daisy.svg +++ b/assets/images/flowers/daisy.svg @@ -1 +1,56 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/dandelion.svg b/assets/images/flowers/dandelion.svg new file mode 100644 index 0000000..992111d --- /dev/null +++ b/assets/images/flowers/dandelion.svg @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/flower-icon.svg b/assets/images/flowers/flower-icon.svg index 16574cc..c8790b0 100644 --- a/assets/images/flowers/flower-icon.svg +++ b/assets/images/flowers/flower-icon.svg @@ -1,23 +1,23 @@ - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/hibiscus.svg b/assets/images/flowers/hibiscus.svg index 374b693..e10ddf0 100644 --- a/assets/images/flowers/hibiscus.svg +++ b/assets/images/flowers/hibiscus.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/jasmine.svg b/assets/images/flowers/jasmine.svg new file mode 100644 index 0000000..fb78e3f --- /dev/null +++ b/assets/images/flowers/jasmine.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/lavender.svg b/assets/images/flowers/lavender.svg index 5b8b037..1ec5e80 100644 --- a/assets/images/flowers/lavender.svg +++ b/assets/images/flowers/lavender.svg @@ -1,3322 +1,10 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/lily.svg b/assets/images/flowers/lily.svg index faa1785..9bce177 100644 --- a/assets/images/flowers/lily.svg +++ b/assets/images/flowers/lily.svg @@ -1 +1,54 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/lotus.svg b/assets/images/flowers/lotus.svg new file mode 100644 index 0000000..b0cc6be --- /dev/null +++ b/assets/images/flowers/lotus.svg @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/marigold.svg b/assets/images/flowers/marigold.svg index ad4fa2c..0c1cc01 100644 --- a/assets/images/flowers/marigold.svg +++ b/assets/images/flowers/marigold.svg @@ -1 +1,11 @@ - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/rose.svg b/assets/images/flowers/rose.svg index 55172e3..2ea1228 100644 --- a/assets/images/flowers/rose.svg +++ b/assets/images/flowers/rose.svg @@ -1 +1,11 @@ - \ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/assets/images/flowers/sunflower.svg b/assets/images/flowers/sunflower.svg index b178b76..e4f44ea 100644 --- a/assets/images/flowers/sunflower.svg +++ b/assets/images/flowers/sunflower.svg @@ -1 +1,2 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/assets/images/flowers/tulip.svg b/assets/images/flowers/tulip.svg index f754c50..6d910c1 100644 --- a/assets/images/flowers/tulip.svg +++ b/assets/images/flowers/tulip.svg @@ -1 +1,10 @@ - \ No newline at end of file + + + + + + + + + + \ No newline at end of file From f847a4bfa098bc859c5e3ac137db820d28a95134 Mon Sep 17 00:00:00 2001 From: DS-1090 <126580400+DS-1090@users.noreply.github.com> Date: Fri, 31 May 2024 13:26:31 +0530 Subject: [PATCH 17/21] Updated Flower Icon --- lib/widgets/drawer.dart | 364 ++++++++++++++++++++-------------------- 1 file changed, 182 insertions(+), 182 deletions(-) diff --git a/lib/widgets/drawer.dart b/lib/widgets/drawer.dart index e107f50..d4d063f 100644 --- a/lib/widgets/drawer.dart +++ b/lib/widgets/drawer.dart @@ -1,182 +1,182 @@ -import 'package:flutter/material.dart'; -import 'package:flutter_svg/flutter_svg.dart'; -import 'package:learn/utils/assets_path.dart'; -import 'package:learn/utils/route/route_constant.dart'; - -class MyDrawer extends StatelessWidget { - const MyDrawer({Key? key}) : super(key: key); - - @override - Widget build(BuildContext context) { - return Drawer( - child: SafeArea( - child: SingleChildScrollView( - child: Container( - color: Theme.of(context).canvasColor, - child: Column( - children: [ - DrawerHeader( - padding: const EdgeInsets.all(0), - decoration: - BoxDecoration(color: Theme.of(context).canvasColor), - child: UserAccountsDrawerHeader( - margin: const EdgeInsets.all(0), - decoration: - BoxDecoration(color: Theme.of(context).canvasColor), - accountName: Text( - "Learning App for kids", - style: Theme.of(context) - .textTheme - .titleLarge - ?.copyWith(fontWeight: FontWeight.bold), - ), - accountEmail: Text( - "Made by sapatevaibhav", - style: Theme.of(context).textTheme.bodyLarge, - ), - currentAccountPicture: const CircleAvatar( - backgroundImage: AssetImage("assets/images/dp.png"), - ), - ), - ), - _buildListTile( - icon: Icons.home, - title: "Home", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.homeRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.text_fields, - title: "A - Z", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.atozRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.pest_control_rodent_outlined, - title: "Animals", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.animalRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.egg, - title: "Birds", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.birdsRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.cloud, - title: "Seasons", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.seasonRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.pentagon_outlined, - title: "Shapes", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.shapesRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.back_hand_rounded, - title: "Body parts", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.partsRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.work, - title: "Occupations", - onTap: () { - Navigator.pushNamed( - context, AllRoutesConstant.occupationRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.sunny, - title: "Solar System", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.solarRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.palette, - title: "Colours", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.colourRoute); - }, - context: context, - ), - _buildListTileSVG( - icon: AssetsPath.getFlowerImage(Flowers.flowerIcon), - title: "Flowers", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.flowerRoute); - }, - context: context, - ), - _buildListTile( - icon: Icons.question_mark_outlined, - title: "About us", - onTap: () { - Navigator.pushNamed(context, AllRoutesConstant.aboutRoute); - }, - context: context, - ), - ], - ), - ), - ), - ), - ); - } - - Widget _buildListTile({ - required BuildContext context, - required IconData icon, - required String title, - required VoidCallback onTap, - }) { - return ListTile( - leading: Icon(icon), - title: Text( - title, - style: Theme.of(context).textTheme.bodyLarge, - ), - onTap: onTap, - ); - } - - Widget _buildListTileSVG({ - required BuildContext context, - required String icon, - required String title, - required VoidCallback onTap, - }) { - return ListTile( - leading: SvgPicture.asset( - icon, - width: 24, - height: 24, - ), - title: Text( - title, - style: Theme.of(context).textTheme.bodyLarge, - ), - onTap: onTap, - ); - } -} +import 'package:flutter/material.dart'; +// import 'package:flutter_svg/flutter_svg.dart'; +import 'package:learn/utils/assets_path.dart'; +import 'package:learn/utils/route/route_constant.dart'; + +class MyDrawer extends StatelessWidget { + const MyDrawer({Key? key}) : super(key: key); + + @override + Widget build(BuildContext context) { + return Drawer( + child: SafeArea( + child: SingleChildScrollView( + child: Container( + color: Theme.of(context).canvasColor, + child: Column( + children: [ + DrawerHeader( + padding: const EdgeInsets.all(0), + decoration: + BoxDecoration(color: Theme.of(context).canvasColor), + child: UserAccountsDrawerHeader( + margin: const EdgeInsets.all(0), + decoration: + BoxDecoration(color: Theme.of(context).canvasColor), + accountName: Text( + "Learning App for kids", + style: Theme.of(context) + .textTheme + .titleLarge + ?.copyWith(fontWeight: FontWeight.bold), + ), + accountEmail: Text( + "Made by sapatevaibhav", + style: Theme.of(context).textTheme.bodyLarge, + ), + currentAccountPicture: const CircleAvatar( + backgroundImage: AssetImage("assets/images/dp.png"), + ), + ), + ), + _buildListTile( + icon: Icons.home, + title: "Home", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.homeRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.text_fields, + title: "A - Z", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.atozRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.pest_control_rodent_outlined, + title: "Animals", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.animalRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.egg, + title: "Birds", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.birdsRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.cloud, + title: "Seasons", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.seasonRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.pentagon_outlined, + title: "Shapes", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.shapesRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.back_hand_rounded, + title: "Body parts", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.partsRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.work, + title: "Occupations", + onTap: () { + Navigator.pushNamed( + context, AllRoutesConstant.occupationRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.sunny, + title: "Solar System", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.solarRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.palette, + title: "Colours", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.colourRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.local_florist, + title: "Flowers", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.flowerRoute); + }, + context: context, + ), + _buildListTile( + icon: Icons.question_mark_outlined, + title: "About us", + onTap: () { + Navigator.pushNamed(context, AllRoutesConstant.aboutRoute); + }, + context: context, + ), + ], + ), + ), + ), + ), + ); + } + + Widget _buildListTile({ + required BuildContext context, + required IconData icon, + required String title, + required VoidCallback onTap, + }) { + return ListTile( + leading: Icon(icon), + title: Text( + title, + style: Theme.of(context).textTheme.bodyLarge, + ), + onTap: onTap, + ); + } + + // Widget _buildListTileSVG({ + // required BuildContext context, + // required String icon, + // required String title, + // required VoidCallback onTap, + // }) { + // return ListTile( + // leading: SvgPicture.asset( + // icon, + // width: 24, + // height: 24, + // ), + // title: Text( + // title, + // style: Theme.of(context).textTheme.bodyLarge, + // ), + // onTap: onTap, + // ); + // } +} From 92d20e140c34d89dd234fe5482220fad87a8a047 Mon Sep 17 00:00:00 2001 From: DS-1090 <126580400+DS-1090@users.noreply.github.com> Date: Fri, 31 May 2024 13:28:06 +0530 Subject: [PATCH 18/21] Updated flower asset paths --- lib/utils/assets_path.dart | 542 ++++++++++++++++++------------------- 1 file changed, 270 insertions(+), 272 deletions(-) diff --git a/lib/utils/assets_path.dart b/lib/utils/assets_path.dart index 5b1260f..0cebf9c 100644 --- a/lib/utils/assets_path.dart +++ b/lib/utils/assets_path.dart @@ -1,273 +1,271 @@ -class AssetsPath { - //Image assets - static const String _images = 'assets/images/'; - static const String _flowerImages = 'assets/images/flowers/'; - static const String _alphabetImages = 'assets/images/alphabet/'; - static const String _animalImages = 'assets/images/animal/'; - static const String _birdImages = 'assets/images/birds/'; - static const String _bodyImages = 'assets/images/body/'; - static const String _solarImages = 'assets/images/solar/'; - static const String _coloursImages = 'assets/colours/'; - - //Sound assets - static const String _sounds = 'assets/sounds/'; - static const String _animalSound = 'assets/sounds/animals/'; - static const String _birdSound = 'assets/sounds/birds/'; - - - //Image assets - - static String getImage(String name) { - return _images + name; - } - - static String getAlphabetImage(String name) { - return _alphabetImages + name; - } - - static String getAnimalImage(String name) { - return _animalImages + name; - } - - static String getBirdImage(String name) { - return _birdImages + name; - } - - static String getBodyImage(String name) { - return _bodyImages + name; - } - - static String getSolarImage(String name) { - return _solarImages + name; - } - - static String getColoursImage(String name) { - return _coloursImages + name; - } - - - static String getFlowerImage(String name) { - return _flowerImages + name; - } - - - //Sound assets - - static String getSound(String name) { - return _sounds + name; - } - - static String getAnimalSound(String name) { - return _animalSound + name; - } - - static String getBirdSound(String name) { - return _birdSound + name; - } - -} - -class Alphabets{ - static const String alphabets = 'alphabets.jpg'; - static const String apple = 'apple.svg'; - static const String ball = 'ball.svg'; - static const String cat = 'cat.svg'; - static const String dog = 'dog.svg'; - static const String elephant = 'elephant.svg'; - static const String fish = 'fish.svg'; - static const String grapes = 'grapes.svg'; - static const String horse = 'horse.svg'; - static const String icecream = 'icecream.svg'; - static const String joker = 'joker.svg'; - static const String king = 'king.svg'; - static const String lion = 'lion.svg'; - static const String money = 'money.svg'; - static const String nest = 'nest.svg'; - static const String orange = 'orange.svg'; - static const String parrot = 'parrot.svg'; - static const String queen = 'queen.svg'; - static const String rabbit = 'rabbit.svg'; - static const String shiva = 'shiva.svg'; - static const String table = 'table.svg'; - static const String umbrella = 'umbrella.svg'; - static const String van = 'van.svg'; - static const String window = 'window.svg'; - static const String xerox = 'xerox.svg'; - static const String yellow = 'yellow.svg'; - static const String zero = 'zero.svg'; -} - -class Animals{ - static const String animals = 'animals.jpg'; - static const String bear = 'bear.svg'; - static const String cat = 'cat.svg'; - static const String cow = 'cow.svg'; - static const String deer = 'deer.svg'; - static const String dog = 'dog.svg'; - static const String elephant = 'elephant.svg'; - static const String fox = 'fox.svg'; - static const String giraffe = 'giraffe.svg'; - static const String goat = 'goat.svg'; - static const String horse = 'horse.svg'; - static const String kangaroo = 'kangaroo.svg'; - static const String lion = 'lion.svg'; - static const String monkey = 'monkey.svg'; - static const String pig = 'pig.svg'; - static const String rabbit = 'rabbit.svg'; - static const String sheep = 'sheep.svg'; - static const String snake = 'snake.svg'; - static const String squirrel = 'squirrel.svg'; - static const String tiger = 'tiger.svg'; - static const String zebra = 'zebra.svg'; - - //sound - static const String bearSound = 'bear_sound.mp3'; - static const String catSound = 'cat_sound.wav'; - static const String cowSound = 'cow_sound.mp3'; - static const String deerSound = 'deer_sound.mp3'; - static const String dogSound = 'dog_sound.mp3'; - static const String elephantSound = 'elephant_sound.mp3'; - static const String foxSound = 'fox_sound.mp3'; - static const String giraffeSound = 'giraffe_sound.mp3'; - static const String goatSound = 'goat_sound.mp3'; - static const String horseSound = 'horse_sound.mp3'; - static const String kangarooSound = 'kangaroo_sound.mp3'; - static const String lionSound = 'lion_sound.mp3'; - static const String monkeySound = 'monkey_sound.mp3'; - static const String pigSound = 'pig_sound.mp3'; - static const String rabbitSound = 'rabbit_sound.mp3'; - static const String sheepSound = 'sheep_sound.mp3'; - static const String snakeSound = 'snake_sound.mp3'; - static const String squirrelSound = 'squirrel_sound.mp3'; - static const String tigerSound = 'tiger_sound.mp3'; - static const String zebraSound = 'zebra_sound.mp3'; - -} - -class Birds{ - static const String birds = 'birds.jpg'; - static const String bagula = 'Bagula.svg'; - static const String baya = 'Baya.svg'; - static const String bulbul = 'Bulbul.svg'; - static const String crow = 'Crow.svg'; - static const String duck = 'Duck.svg'; - static const String eagle = 'Eagle.svg'; - static const String goose = 'Goose.svg'; - static const String hen = 'Hen.svg'; - static const String hummingbird = 'Hummingbird.svg'; - static const String kingfisher = 'Kingfisher.svg'; - static const String koel = 'Koel.svg'; - static const String maina = 'Maina.svg'; - static const String ostrich = 'Ostrich.svg'; - static const String owl = 'Owl.svg'; - static const String parrot = 'Parrot.svg'; - static const String pigeon = 'Pigeon.svg'; - static const String robin = 'Robin.svg'; - static const String seagull = 'Seagull.svg'; - static const String sparrow = 'Sparrow.svg'; - static const String swan = 'Swan.svg'; - static const String vulture = 'Vulture.svg'; - static const String woodpecker = 'Woodpecker.svg'; - - //sound - - static const String bagulaSound = 'Bagula.mp3'; - static const String bayaSound = 'Baya.mp3'; - static const String bulbulSound = 'Bulbul.mp3'; - static const String crowSound = 'Crow.mp3'; - static const String duckSound = 'Duck.mp3'; - static const String eagleSound = 'Eagle.mp3'; - static const String gooseSound = 'Goose.mp3'; - static const String henSound = 'Hen.mp3'; - static const String hummingbirdSound = 'Hummingbird.mp3'; - static const String kingfisherSound = 'Kingfisher.mp3'; - static const String koelSound = 'Koel.mp3'; - static const String mainaSound = 'Maina.mp3'; - static const String ostrichSound = 'Ostrich.mp3'; - static const String owlSound = 'Owl.mp3'; - static const String parrotSound = 'Parrot.mp3'; - static const String pigeonSound = 'Pigeon.mp3'; - static const String robinSound = 'Robin.mp3'; - static const String seagullSound = 'Seagull.mp3'; - static const String sparrowSound = 'Sparrow.mp3'; - static const String swanSound = 'Swan.mp3'; - static const String vultureSound = 'Vulture.mp3'; - static const String woodpeckerSound = 'Woodpecker.mp3'; -} - -class Body { - static const String body = 'body.jpg'; - static const String ankle = 'Ankle.svg'; - static const String arm = 'Arm.svg'; - static const String back = 'Back.svg'; - static const String bally = 'Belly.svg'; - static const String cheek = 'Cheek.svg'; - static const String chest = 'Chest.svg'; - static const String chin = 'Chin.svg'; - static const String ear = 'Ear.svg'; - static const String elbow = 'Elbow.svg'; - static const String eye = 'Eye.svg'; - static const String finger = 'Finger.svg'; - static const String foot = 'Foot.svg'; - static const String hair = 'Hair.svg'; - static const String hips = 'Hips.svg'; - static const String knee = 'Knee.svg'; - static const String leg = 'Leg.svg'; - static const String lips = 'Lips.svg'; - static const String nail = 'Nail.svg'; - static const String neck = 'Neck.svg'; - static const String nose = 'Nose.svg'; - static const String palm = 'Palm.svg'; - static const String shoulder = 'Shoulder.svg'; - static const String stomach = 'Stomach.svg'; - static const String teeth = 'Teeth.svg'; - static const String thigh = 'Thigh.svg'; - static const String thumb = 'Thumb.svg'; - static const String toe = 'Toe.svg'; - static const String tongue = 'Tongue.svg'; - static const String waist = 'Waist.svg'; - static const String wrist = 'Wrist.svg'; -} - -class ColorImages{ - static const String colorsCover = 'colours-cover.png'; - static const String black = 'black.svg'; - static const String blue = 'blue.svg'; - static const String brown = 'brown.svg'; - static const String green = 'green.svg'; - static const String orange = 'orange.svg'; - static const String pink = 'pink.svg'; - static const String red = 'red.svg'; - static const String violet = 'violet.svg'; - static const String white = 'white.svg'; - static const String yellow = 'yellow.svg'; -} - -class Flowers { - static const String flowerBanner = 'flower_banner.jpeg'; - static const String flowerIcon = 'flower-icon.svg'; - static const String carnation = 'carnation.svg'; - static const String daffodil = 'daffodil.svg'; - static const String daisy = 'daisy.svg'; - static const String hibiscus = 'hibiscus.svg'; - static const String lavender = 'lavender.svg'; - static const String lily = 'lily.svg'; - static const String marigold = 'marigold.svg'; - static const String poppy = 'poppy.svg'; - static const String rose = 'rose.svg'; - static const String sunflower = 'sunflower.svg'; - static const String tulip = 'tulip.svg'; - -} - -class SolarSystem { - static const String sun = 'sun.svg'; - static const String earth = 'earth.svg'; - static const String jupiter = 'jupiter.svg'; - static const String mars = 'mars.svg'; - static const String mercury = 'mercury.svg'; - static const String neptune = 'neptune.svg'; - static const String saturn = 'saturn.svg'; - static const String uranus = 'uranus.svg'; - static const String venus = 'venus.svg'; +class AssetsPath { + //Image assets + static const String _images = 'assets/images/'; + static const String _flowerImages = 'assets/images/flowers/'; + static const String _alphabetImages = 'assets/images/alphabet/'; + static const String _animalImages = 'assets/images/animal/'; + static const String _birdImages = 'assets/images/birds/'; + static const String _bodyImages = 'assets/images/body/'; + static const String _solarImages = 'assets/images/solar/'; + static const String _coloursImages = 'assets/colours/'; + + //Sound assets + static const String _sounds = 'assets/sounds/'; + static const String _animalSound = 'assets/sounds/animals/'; + static const String _birdSound = 'assets/sounds/birds/'; + + + //Image assets + + static String getImage(String name) { + return _images + name; + } + + static String getAlphabetImage(String name) { + return _alphabetImages + name; + } + + static String getAnimalImage(String name) { + return _animalImages + name; + } + + static String getBirdImage(String name) { + return _birdImages + name; + } + + static String getBodyImage(String name) { + return _bodyImages + name; + } + + static String getSolarImage(String name) { + return _solarImages + name; + } + + static String getColoursImage(String name) { + return _coloursImages + name; + } + + + static String getFlowerImage(String name) { + return _flowerImages + name; + } + + + //Sound assets + + static String getSound(String name) { + return _sounds + name; + } + + static String getAnimalSound(String name) { + return _animalSound + name; + } + + static String getBirdSound(String name) { + return _birdSound + name; + } + +} + +class Alphabets{ + static const String alphabets = 'alphabets.jpg'; + static const String apple = 'apple.svg'; + static const String ball = 'ball.svg'; + static const String cat = 'cat.svg'; + static const String dog = 'dog.svg'; + static const String elephant = 'elephant.svg'; + static const String fish = 'fish.svg'; + static const String grapes = 'grapes.svg'; + static const String horse = 'horse.svg'; + static const String icecream = 'icecream.svg'; + static const String joker = 'joker.svg'; + static const String king = 'king.svg'; + static const String lion = 'lion.svg'; + static const String money = 'money.svg'; + static const String nest = 'nest.svg'; + static const String orange = 'orange.svg'; + static const String parrot = 'parrot.svg'; + static const String queen = 'queen.svg'; + static const String rabbit = 'rabbit.svg'; + static const String shiva = 'shiva.svg'; + static const String table = 'table.svg'; + static const String umbrella = 'umbrella.svg'; + static const String van = 'van.svg'; + static const String window = 'window.svg'; + static const String xerox = 'xerox.svg'; + static const String yellow = 'yellow.svg'; + static const String zero = 'zero.svg'; +} + +class Animals{ + static const String animals = 'animals.jpg'; + static const String bear = 'bear.svg'; + static const String cat = 'cat.svg'; + static const String cow = 'cow.svg'; + static const String deer = 'deer.svg'; + static const String dog = 'dog.svg'; + static const String elephant = 'elephant.svg'; + static const String fox = 'fox.svg'; + static const String giraffe = 'giraffe.svg'; + static const String goat = 'goat.svg'; + static const String horse = 'horse.svg'; + static const String kangaroo = 'kangaroo.svg'; + static const String lion = 'lion.svg'; + static const String monkey = 'monkey.svg'; + static const String pig = 'pig.svg'; + static const String rabbit = 'rabbit.svg'; + static const String sheep = 'sheep.svg'; + static const String snake = 'snake.svg'; + static const String squirrel = 'squirrel.svg'; + static const String tiger = 'tiger.svg'; + static const String zebra = 'zebra.svg'; + + //sound + static const String bearSound = 'bear_sound.mp3'; + static const String catSound = 'cat_sound.wav'; + static const String cowSound = 'cow_sound.mp3'; + static const String deerSound = 'deer_sound.mp3'; + static const String dogSound = 'dog_sound.mp3'; + static const String elephantSound = 'elephant_sound.mp3'; + static const String foxSound = 'fox_sound.mp3'; + static const String giraffeSound = 'giraffe_sound.mp3'; + static const String goatSound = 'goat_sound.mp3'; + static const String horseSound = 'horse_sound.mp3'; + static const String kangarooSound = 'kangaroo_sound.mp3'; + static const String lionSound = 'lion_sound.mp3'; + static const String monkeySound = 'monkey_sound.mp3'; + static const String pigSound = 'pig_sound.mp3'; + static const String rabbitSound = 'rabbit_sound.mp3'; + static const String sheepSound = 'sheep_sound.mp3'; + static const String snakeSound = 'snake_sound.mp3'; + static const String squirrelSound = 'squirrel_sound.mp3'; + static const String tigerSound = 'tiger_sound.mp3'; + static const String zebraSound = 'zebra_sound.mp3'; + +} + +class Birds{ + static const String birds = 'birds.jpg'; + static const String bagula = 'Bagula.svg'; + static const String baya = 'Baya.svg'; + static const String bulbul = 'Bulbul.svg'; + static const String crow = 'Crow.svg'; + static const String duck = 'Duck.svg'; + static const String eagle = 'Eagle.svg'; + static const String goose = 'Goose.svg'; + static const String hen = 'Hen.svg'; + static const String hummingbird = 'Hummingbird.svg'; + static const String kingfisher = 'Kingfisher.svg'; + static const String koel = 'Koel.svg'; + static const String maina = 'Maina.svg'; + static const String ostrich = 'Ostrich.svg'; + static const String owl = 'Owl.svg'; + static const String parrot = 'Parrot.svg'; + static const String pigeon = 'Pigeon.svg'; + static const String robin = 'Robin.svg'; + static const String seagull = 'Seagull.svg'; + static const String sparrow = 'Sparrow.svg'; + static const String swan = 'Swan.svg'; + static const String vulture = 'Vulture.svg'; + static const String woodpecker = 'Woodpecker.svg'; + + //sound + + static const String bagulaSound = 'Bagula.mp3'; + static const String bayaSound = 'Baya.mp3'; + static const String bulbulSound = 'Bulbul.mp3'; + static const String crowSound = 'Crow.mp3'; + static const String duckSound = 'Duck.mp3'; + static const String eagleSound = 'Eagle.mp3'; + static const String gooseSound = 'Goose.mp3'; + static const String henSound = 'Hen.mp3'; + static const String hummingbirdSound = 'Hummingbird.mp3'; + static const String kingfisherSound = 'Kingfisher.mp3'; + static const String koelSound = 'Koel.mp3'; + static const String mainaSound = 'Maina.mp3'; + static const String ostrichSound = 'Ostrich.mp3'; + static const String owlSound = 'Owl.mp3'; + static const String parrotSound = 'Parrot.mp3'; + static const String pigeonSound = 'Pigeon.mp3'; + static const String robinSound = 'Robin.mp3'; + static const String seagullSound = 'Seagull.mp3'; + static const String sparrowSound = 'Sparrow.mp3'; + static const String swanSound = 'Swan.mp3'; + static const String vultureSound = 'Vulture.mp3'; + static const String woodpeckerSound = 'Woodpecker.mp3'; +} + +class Body { + static const String body = 'body.jpg'; + static const String ankle = 'Ankle.svg'; + static const String arm = 'Arm.svg'; + static const String back = 'Back.svg'; + static const String bally = 'Belly.svg'; + static const String cheek = 'Cheek.svg'; + static const String chest = 'Chest.svg'; + static const String chin = 'Chin.svg'; + static const String ear = 'Ear.svg'; + static const String elbow = 'Elbow.svg'; + static const String eye = 'Eye.svg'; + static const String finger = 'Finger.svg'; + static const String foot = 'Foot.svg'; + static const String hair = 'Hair.svg'; + static const String hips = 'Hips.svg'; + static const String knee = 'Knee.svg'; + static const String leg = 'Leg.svg'; + static const String lips = 'Lips.svg'; + static const String nail = 'Nail.svg'; + static const String neck = 'Neck.svg'; + static const String nose = 'Nose.svg'; + static const String palm = 'Palm.svg'; + static const String shoulder = 'Shoulder.svg'; + static const String stomach = 'Stomach.svg'; + static const String teeth = 'Teeth.svg'; + static const String thigh = 'Thigh.svg'; + static const String thumb = 'Thumb.svg'; + static const String toe = 'Toe.svg'; + static const String tongue = 'Tongue.svg'; + static const String waist = 'Waist.svg'; + static const String wrist = 'Wrist.svg'; +} + +class ColorImages{ + static const String colorsCover = 'colours-cover.png'; + static const String black = 'black.svg'; + static const String blue = 'blue.svg'; + static const String brown = 'brown.svg'; + static const String green = 'green.svg'; + static const String orange = 'orange.svg'; + static const String pink = 'pink.svg'; + static const String red = 'red.svg'; + static const String violet = 'violet.svg'; + static const String white = 'white.svg'; + static const String yellow = 'yellow.svg'; +} + +class Flowers { + static const String flowerBanner = 'flower_banner.jpeg'; + static const String daisy = 'daisy.svg'; + static const String hibiscus = 'hibiscus.svg'; + static const String lavender = 'lavender.svg'; + static const String lily = 'lily.svg'; + static const String marigold = 'marigold.svg'; + static const String rose = 'rose.svg'; + static const String sunflower = 'sunflower.svg'; + static const String tulip = 'tulip.svg'; + static const String dandelion = 'dandelion.svg'; + static const String jasmine = 'jasmine.svg'; + static const String lotus = 'lotus.svg'; +} + +class SolarSystem { + static const String sun = 'sun.svg'; + static const String earth = 'earth.svg'; + static const String jupiter = 'jupiter.svg'; + static const String mars = 'mars.svg'; + static const String mercury = 'mercury.svg'; + static const String neptune = 'neptune.svg'; + static const String saturn = 'saturn.svg'; + static const String uranus = 'uranus.svg'; + static const String venus = 'venus.svg'; } \ No newline at end of file From 229c851ceffffec9d12dc50794271089c400c4c7 Mon Sep 17 00:00:00 2001 From: AsmitaMishra24 <146121869+AsmitaMishra24@users.noreply.github.com> Date: Fri, 31 May 2024 19:38:39 +0530 Subject: [PATCH 19/21] Added Drawing Board --- lib/pages/explore/drawingboard.dart | 56 ++++++++++++++++++++++------- pubspec.yaml | 1 + 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/lib/pages/explore/drawingboard.dart b/lib/pages/explore/drawingboard.dart index 556c25f..b3c33de 100644 --- a/lib/pages/explore/drawingboard.dart +++ b/lib/pages/explore/drawingboard.dart @@ -1,5 +1,6 @@ import 'dart:ui'; import 'package:flutter/material.dart'; +import 'package:font_awesome_flutter/font_awesome_flutter.dart'; class DrawingBoardPage extends StatelessWidget { const DrawingBoardPage({Key? key}); @@ -20,6 +21,7 @@ class DrawingBoard extends StatefulWidget { class _DrawingBoardState extends State { Color selectedColor = Colors.black; double strokeWidth = 5; + bool isEraser = false; List drawingPoints = []; List colors = [ Colors.pink, @@ -38,12 +40,20 @@ class _DrawingBoardState extends State { appBar: AppBar( title: Text("Drawing Board"), actions: [ - IconButton( - icon:Icon(Icons.clear), + TextButton.icon( onPressed: () => setState(() => drawingPoints = []), + icon: Icon(Icons.clear), + label: Text("Clear Board"), + style: TextButton.styleFrom( + backgroundColor: Color(0xfff7f2fa), + ), + ), + SizedBox( + width: 10, ), ], - ), + ), + body: Stack( children: [ GestureDetector( @@ -53,7 +63,7 @@ class _DrawingBoardState extends State { DrawingPoint( details.localPosition, Paint() - ..color = selectedColor + ..color = isEraser? Color(0xfffef7ff) : selectedColor ..isAntiAlias = true ..strokeWidth = strokeWidth ..strokeCap = StrokeCap.round, @@ -61,13 +71,14 @@ class _DrawingBoardState extends State { ); }); }, + onPanUpdate: (details) { setState(() { drawingPoints.add( DrawingPoint( details.localPosition, Paint() - ..color = selectedColor + ..color = isEraser? Color(0xfffef7ff) : selectedColor ..isAntiAlias = true ..strokeWidth = strokeWidth ..strokeCap = StrokeCap.round, @@ -75,11 +86,13 @@ class _DrawingBoardState extends State { ); }); }, + onPanEnd: (details) { setState(() { drawingPoints.add(null); }); }, + child: CustomPaint( painter: _DrawingPainter(drawingPoints), child: Container( @@ -88,21 +101,33 @@ class _DrawingBoardState extends State { ), ), ), + Positioned( - top: 40, - right: 30, + top: 20, + right: 10, + left: 10, child: Row( children: [ Slider( min: 0, max: 40, value: strokeWidth, - onChanged:(val) => setState(() => strokeWidth = val), + onChanged: (val) => setState(() => strokeWidth = val), ), - - ElevatedButton.icon(onPressed: () => setState(() => drawingPoints = []), - icon: Icon(Icons.clear), - label: Text("Clear Board"), + SizedBox( + width: 50 + ), + ElevatedButton.icon( + onPressed: () { + setState(() { + isEraser =!isEraser; + if (isEraser) { + selectedColor = Color(0xfffef7ff); + } + }); + }, + icon: Icon(FontAwesomeIcons.eraser), + label: Text("Eraser"), ), ], ), @@ -129,7 +154,12 @@ class _DrawingBoardState extends State { GestureDetector _buildColorChoser(Color color) { bool isSelected = selectedColor == color; return GestureDetector( - onTap: () => setState(() => selectedColor = color), + onTap: () { + setState(() { + selectedColor = color; + isEraser = false; + }); + }, child: Container( height: isSelected ? 47 : 40, width: isSelected ? 47 : 40, diff --git a/pubspec.yaml b/pubspec.yaml index a284a1a..99a1538 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -46,6 +46,7 @@ dependencies: google_nav_bar: ^5.0.6 flutter_bloc: ^8.1.5 animated_text_kit: ^4.2.2 + font_awesome_flutter: ^10.1.0 dev_dependencies: flutter_test: From 21c5b106e831856949b8cd9b6760cfc551e06c88 Mon Sep 17 00:00:00 2001 From: Nikita Date: Sat, 1 Jun 2024 16:05:42 +0530 Subject: [PATCH 20/21] added dark mode feature --- lib/main.dart | 27 ++++++++++++++++++++------- lib/pages/home.dart | 26 ++++++++------------------ lib/theme_provider.dart | 12 ++++++++++++ pubspec.yaml | 1 + 4 files changed, 41 insertions(+), 25 deletions(-) create mode 100644 lib/theme_provider.dart diff --git a/lib/main.dart b/lib/main.dart index f3b3b3c..910c5aa 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -2,13 +2,20 @@ import 'package:flutter/material.dart'; import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:learn/landing_page.dart'; import 'package:learn/utils/route/routes.dart'; +import 'package:learn/theme_provider.dart'; +import 'package:provider/provider.dart'; DateTime? currentBackPressTime; void main() async { WidgetsFlutterBinding.ensureInitialized(); final savedThemeMode = await AdaptiveTheme.getThemeMode(); - runApp(MyApp(savedThemeMode: savedThemeMode)); + runApp( + ChangeNotifierProvider( + create: (context) => ThemeProvider(), + child: MyApp(savedThemeMode: savedThemeMode), + ), + ); } class MyApp extends StatelessWidget { @@ -18,12 +25,18 @@ class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { - return const MaterialApp( - debugShowCheckedModeBanner: false, - title: 'Learn', - themeMode: ThemeMode.system, - home: LandingPage(), - onGenerateRoute: Routers.generateRoute, + return Consumer( + builder: (context, themeProvider, child) { + return MaterialApp( + debugShowCheckedModeBanner: false, + title: 'Learn', + theme: ThemeData.light(), + darkTheme: ThemeData.dark(), + themeMode: themeProvider.themeMode, + home: const LandingPage(), + onGenerateRoute: Routers.generateRoute, + ); + }, ); } } diff --git a/lib/pages/home.dart b/lib/pages/home.dart index 3f70e28..9375deb 100644 --- a/lib/pages/home.dart +++ b/lib/pages/home.dart @@ -1,11 +1,11 @@ -// ignore_for_file: deprecated_member_use - import 'package:adaptive_theme/adaptive_theme.dart'; import 'package:flutter/material.dart'; import 'package:learn/utils/assets_path.dart'; import 'package:learn/utils/const_dimensions.dart'; import 'package:learn/utils/route/route_constant.dart'; +import 'package:provider/provider.dart'; import '../widgets/drawer.dart'; +import '../theme_provider.dart'; class MyHomePage extends StatefulWidget { const MyHomePage({Key? key}) : super(key: key); @@ -16,10 +16,10 @@ class MyHomePage extends StatefulWidget { class _MyHomePageState extends State { final List _isImageClicked = List.generate(7, (index) => false); - bool _isDarkTheme = false; @override Widget build(BuildContext context) { + final themeProvider = Provider.of(context); return Scaffold( appBar: AppBar( title: const Text( @@ -31,17 +31,10 @@ class _MyHomePageState extends State { padding: const EdgeInsets.only(right: 16, top: 1), child: IconButton( icon: Icon( - _isDarkTheme ? Icons.dark_mode : Icons.light_mode, + themeProvider.themeMode == ThemeMode.dark ? Icons.dark_mode : Icons.light_mode, ), onPressed: () { - setState(() { - _isDarkTheme = !_isDarkTheme; - }); - final themeMode = - Theme.of(context).brightness == Brightness.dark - ? AdaptiveThemeMode.light - : AdaptiveThemeMode.dark; - AdaptiveTheme.of(context).setThemeMode(themeMode); + themeProvider.toggleTheme(); }, ), ), @@ -56,8 +49,7 @@ 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, ), @@ -79,8 +71,7 @@ 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, ), @@ -124,8 +115,7 @@ 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/theme_provider.dart b/lib/theme_provider.dart new file mode 100644 index 0000000..6523b4e --- /dev/null +++ b/lib/theme_provider.dart @@ -0,0 +1,12 @@ +import 'package:flutter/material.dart'; + +class ThemeProvider with ChangeNotifier { + ThemeMode _themeMode = ThemeMode.light; + + ThemeMode get themeMode => _themeMode; + + void toggleTheme() { + _themeMode = _themeMode == ThemeMode.light ? ThemeMode.dark : ThemeMode.light; + notifyListeners(); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index b5f6453..21b5df2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -50,6 +50,7 @@ dependencies: dev_dependencies: flutter_test: sdk: flutter + provider: ^6.0.3 # The "flutter_lints" package below contains a set of recommended lints to # encourage good coding practices. The lint set provided by the package is From 54215bd108b5167a2045d3cde098ffba805e5929 Mon Sep 17 00:00:00 2001 From: Hetkumar Prajapati Date: Sun, 2 Jun 2024 08:42:25 +0530 Subject: [PATCH 21/21] uifixed --- lib/pages/modules/animals.dart | 28 ++++++++++++++-------------- lib/pages/modules/atoz.dart | 30 +++++++++++++++--------------- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lib/pages/modules/animals.dart b/lib/pages/modules/animals.dart index 81fe262..c40495b 100644 --- a/lib/pages/modules/animals.dart +++ b/lib/pages/modules/animals.dart @@ -10,8 +10,6 @@ import 'package:learn/utils/constants.dart'; import '../../utils/const_dimensions.dart'; class AnimalsPage extends StatelessWidget { - - final FlutterTts flutterTts = FlutterTts(); final AudioPlayer audioPlayer = AudioPlayer(); @@ -31,7 +29,7 @@ class AnimalsPage extends StatelessWidget { itemBuilder: (context, index) { return GestureDetector( onTap: () { - _showAnimalPopup(context, AppConstants.animals[index],index); + _showAnimalPopup(context, AppConstants.animals[index], index); }, child: Container( margin: const EdgeInsets.all(5.0), @@ -46,7 +44,8 @@ class AnimalsPage extends StatelessWidget { SizedBox( width: ConstantDimensions.widthExtraLarge, height: ConstantDimensions.heightExtraLarge, - child: SvgPicture.asset(AppConstants.animals[index].svgAsset), + child: + SvgPicture.asset(AppConstants.animals[index].svgAsset), ), const SizedBox(width: ConstantDimensions.widthMedium_Large), Text( @@ -66,7 +65,8 @@ class AnimalsPage extends StatelessWidget { ); } - Future _showAnimalPopup(BuildContext context, Animal animal, int currentIndex) async { + Future _showAnimalPopup( + BuildContext context, Animal animal, int currentIndex) async { await flutterTts.setVolume(1.0); await flutterTts.setSpeechRate(.5); await flutterTts.setLanguage("EN-IN"); @@ -140,13 +140,11 @@ class _AnimalPopupState extends State { isTapped = !isTapped; }); }, - child: SizedBox( - width: ConstantDimensions.widthExtraLarge * 4, - height: ConstantDimensions.heightExtraLarge * 4, - child: SvgPicture.asset( - widget.animal.svgAsset, - color: isTapped ? const Color.fromARGB(81, 118, 96, 94) : null, - ), + child: SvgPicture.asset( + widget.animal.svgAsset, + color: isTapped ? const Color.fromARGB(81, 118, 96, 94) : null, + width: MediaQuery.of(context).size.width * 0.3, + height: MediaQuery.of(context).size.height * 0.3, ), ), const SizedBox(height: ConstantDimensions.heightSmall_Medium), @@ -157,12 +155,14 @@ class _AnimalPopupState extends State { child: const Text('Play Sound'), ), Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ IconButton( onPressed: () { _navigateToPreviousAnimal(); }, icon: const Icon(Icons.arrow_back), + iconSize: 30, ), SizedBox( width: ConstantDimensions.exceptions[0], @@ -172,6 +172,7 @@ class _AnimalPopupState extends State { _navigateToNextAnimal(); }, icon: const Icon(Icons.arrow_forward), + iconSize: 30, ), ], ) @@ -195,7 +196,7 @@ class _AnimalPopupState extends State { ); } -void _navigateToPreviousAnimal() { + void _navigateToPreviousAnimal() { setState(() { widget.currentIndex = (widget.currentIndex - 1) % widget.animals.length; if (widget.currentIndex < 0) { @@ -212,7 +213,6 @@ void _navigateToPreviousAnimal() { }); } - Future _playAnimalSound(String soundAsset) async { await widget.audioPlayer.setAsset(soundAsset); await widget.audioPlayer.play(); diff --git a/lib/pages/modules/atoz.dart b/lib/pages/modules/atoz.dart index 7a5d56a..ba6fea6 100644 --- a/lib/pages/modules/atoz.dart +++ b/lib/pages/modules/atoz.dart @@ -110,7 +110,7 @@ class _PopupDialogState extends State<_PopupDialog> { _speakDescription(); if (isAutoNextEnabled) { - timer = Timer.periodic(const Duration(seconds: 2), (Timer t) { + timer = Timer.periodic(const Duration(seconds: 3), (Timer t) { _nextItem(); }); } @@ -154,20 +154,20 @@ class _PopupDialogState extends State<_PopupDialog> { @override Widget build(BuildContext context) { final currentItem = widget.items[currentIndex]; - return SingleChildScrollView( - child: 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( + 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,