Skip to content

Commit

Permalink
Added quiz
Browse files Browse the repository at this point in the history
Errors resolved in running of app
  • Loading branch information
sapatevaibhav authored Jun 28, 2024
2 parents cceddc7 + c394693 commit 9fbac3c
Show file tree
Hide file tree
Showing 26 changed files with 2,040 additions and 385 deletions.
5 changes: 3 additions & 2 deletions android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Sun Jun 23 18:56:31 IST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:learn/landing_page.dart';
import 'package:learn/pages/main_home.dart';
import 'package:learn/utils/route/routes.dart';
import 'package:learn/theme_provider.dart';
// ignore: depend_on_referenced_packages
import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart';

Expand Down
79 changes: 36 additions & 43 deletions lib/pages/explore/drawingboard.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
// ignore_for_file: library_private_types_in_public_api

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});
const DrawingBoardPage({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return DrawingBoard();
return const DrawingBoard();
}
}

Expand All @@ -20,7 +23,7 @@ class DrawingBoard extends StatefulWidget {

class _DrawingBoardState extends State<DrawingBoard> {
Color selectedColor = Colors.black;
double strokeWidth = 5;
double strokeWidth = 5.0;
bool isEraser = false;
List<DrawingPoint?> drawingPoints = [];
List<Color> colors = [
Expand All @@ -38,22 +41,20 @@ class _DrawingBoardState extends State<DrawingBoard> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Drawing Board"),
title: const Text("Drawing Board"),
actions: [
TextButton.icon(
onPressed: () => setState(() => drawingPoints = []),
icon: Icon(Icons.clear),
label: Text("Clear Board"),
icon: const Icon(Icons.clear),
label: const Text("Clear Board"),
style: TextButton.styleFrom(
backgroundColor: Color(0xfff7f2fa),
foregroundColor: Colors.black, // Changed for better visibility
backgroundColor: const Color(0xfff7f2fa),
),
),
SizedBox(
width: 10,
),
const SizedBox(width: 10),
],
),

),
body: Stack(
children: [
GestureDetector(
Expand All @@ -63,95 +64,87 @@ class _DrawingBoardState extends State<DrawingBoard> {
DrawingPoint(
details.localPosition,
Paint()
..color = isEraser? Color(0xfffef7ff) : selectedColor
..color = isEraser ? const Color(0xfffef7ff) : selectedColor
..isAntiAlias = true
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round,
),
);
});
},

onPanUpdate: (details) {
setState(() {
drawingPoints.add(
DrawingPoint(
details.localPosition,
Paint()
..color = isEraser? Color(0xfffef7ff) : selectedColor
..color = isEraser ? const Color(0xfffef7ff) : selectedColor
..isAntiAlias = true
..strokeWidth = strokeWidth
..strokeCap = StrokeCap.round,
),
);
});
},

onPanEnd: (details) {
setState(() {
drawingPoints.add(null);
});
},

child: CustomPaint(
painter: _DrawingPainter(drawingPoints),
child: Container(
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width,
),
),
),

Positioned(
top: 20,
right: 10,
left: 10,
child: Row(
children: [
Slider(
min: 0,
max: 40,
value: strokeWidth,
onChanged: (val) => setState(() => strokeWidth = val),
),
SizedBox(
width: 50
Expanded(
child: Slider(
min: 0,
max: 40,
value: strokeWidth,
onChanged: (val) => setState(() => strokeWidth = val),
),
),
const SizedBox(width: 10),
ElevatedButton.icon(
onPressed: () {
setState(() {
isEraser =!isEraser;
isEraser = !isEraser;
if (isEraser) {
selectedColor = Color(0xfffef7ff);
selectedColor = const Color(0xfffef7ff);
}
});
},
icon: Icon(FontAwesomeIcons.eraser),
label: Text("Eraser"),
icon: const Icon(FontAwesomeIcons.eraser),
label: const Text("Eraser"),
),
],
),
),
],
),

bottomNavigationBar: BottomAppBar(
child: Container(
color: Colors.grey[200],
padding: EdgeInsets.all(10),
padding: const EdgeInsets.all(10),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: List.generate(
colors.length,
(index) => _buildColorChoser(colors[index]),
),
children: colors.map((color) => _buildColorChooser(color)).toList(),
),
),
),
);
}

GestureDetector _buildColorChoser(Color color) {
GestureDetector _buildColorChooser(Color color) {
bool isSelected = selectedColor == color;
return GestureDetector(
onTap: () {
Expand All @@ -168,9 +161,9 @@ class _DrawingBoardState extends State<DrawingBoard> {
shape: BoxShape.circle,
border: isSelected
? Border.all(
color: Colors.white,
width: 3,
)
color: Colors.white,
width: 3,
)
: null,
),
),
Expand Down Expand Up @@ -207,8 +200,8 @@ class _DrawingPainter extends CustomPainter {
}

class DrawingPoint {
Offset offset;
Paint paint;
final Offset offset;
final Paint paint;

DrawingPoint(this.offset, this.paint);
}
88 changes: 50 additions & 38 deletions lib/pages/explore/explore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,41 @@ class _ExplorePageState extends State<ExplorePage> {
[
GestureDetector(
onTap: () {
Navigator.pushNamed(
context, AllRoutesConstant.drawingboardRoute);
Navigator.push(context, (MaterialPageRoute(builder: (context) => const 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),
Expand All @@ -60,11 +93,9 @@ class _ExplorePageState extends State<ExplorePage> {
SizedBox(
width: ConstantDimensions.widthExtraLarge,
height: ConstantDimensions.heightExtraLarge,
child: SvgPicture.asset(
'assets/explore/drawing_board.svg'),
child: SvgPicture.asset('assets/explore/drawing_board.svg'),
),
const SizedBox(
width: ConstantDimensions.widthMedium_Large),
const SizedBox(width: ConstantDimensions.widthMedium_Large),
const Text(
'Drawing Board',
style: TextStyle(
Expand All @@ -83,57 +114,38 @@ class _ExplorePageState extends State<ExplorePage> {
),
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) {
(context, index) {
return GestureDetector(
onTap: () {
try {
try{
switch (index) {
case 0:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => const Quiz())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => const Quiz())));
break;
case 1:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => const AtoZ())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => const AtoZ())));
break;
case 2:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => BirdsPage())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => BirdsPage())));
break;
case 3:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => const ColoursPage())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => const ColoursPage())));
break;
case 4:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => BirdsPage())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => BirdsPage())));
break;
case 5:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => const ShapesPage())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => const ShapesPage())));
break;
case 6:
Navigator.push(
context,
(MaterialPageRoute(
builder: (context) => PlanetsPage())));
Navigator.push(context, (MaterialPageRoute(builder: (context) => PlanetsPage())));
break;
default:
break;
}
} catch (e) {
}
catch (e) {
// ignore: avoid_print
print(e);
}
},
Expand All @@ -160,7 +172,7 @@ class _ExplorePageState extends State<ExplorePage> {
children: [
ImageFiltered(
imageFilter:
ImageFilter.blur(sigmaX: 5, sigmaY: 5),
ImageFilter.blur(sigmaX: 5, sigmaY: 5),
child: Image.asset(
AppConstants.modules[index].thumbnailPath,
fit: BoxFit.cover,
Expand Down
4 changes: 4 additions & 0 deletions lib/pages/fruits.dart
Original file line number Diff line number Diff line change
Expand Up @@ -175,3 +175,7 @@ class _FruitsPageState extends State<FruitsPage> {
bgColorInit();
}
}

class WidgetStateProperty {
static all(Size size) {}
}
3 changes: 3 additions & 0 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// ignore: unused_import
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';
// ignore: depend_on_referenced_packages
import 'package:provider/provider.dart';
import '../widgets/drawer.dart';
import '../theme_provider.dart';
Expand Down
2 changes: 2 additions & 0 deletions lib/pages/main_home.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


import 'package:adaptive_theme/adaptive_theme.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
Expand Down
Loading

0 comments on commit 9fbac3c

Please sign in to comment.