Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions edu_play/.metadata
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This file should be version controlled and should not be manually edited.

version:
revision: "ac4e799d237041cf905519190471f657b657155a"
revision: "3b62efc2a3da49882f43c372e0bc53daef7295a6"
channel: "stable"

project_type: app
Expand All @@ -13,14 +13,11 @@ project_type: app
migration:
platforms:
- platform: root
create_revision: ac4e799d237041cf905519190471f657b657155a
base_revision: ac4e799d237041cf905519190471f657b657155a
- platform: android
create_revision: ac4e799d237041cf905519190471f657b657155a
base_revision: ac4e799d237041cf905519190471f657b657155a
- platform: ios
create_revision: ac4e799d237041cf905519190471f657b657155a
base_revision: ac4e799d237041cf905519190471f657b657155a
create_revision: 3b62efc2a3da49882f43c372e0bc53daef7295a6
base_revision: 3b62efc2a3da49882f43c372e0bc53daef7295a6
- platform: web
create_revision: 3b62efc2a3da49882f43c372e0bc53daef7295a6
base_revision: 3b62efc2a3da49882f43c372e0bc53daef7295a6

# User provided section

Expand Down
19 changes: 19 additions & 0 deletions edu_play/lib/data/mock_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import 'package:edu_play/models/lesson_model.dart';

final List<Grade> mockGrades = [
Grade(id: '1', name: 'Primary 1'),
Grade(id: '2', name: 'Primary 2'),
Grade(id: '3', name: 'Primary 3'),
];

final List<Subject> mockSubjects = [
Subject(id: 'math', name: 'Mathematics', icon: 'numbers'),
Subject(id: 'english', name: 'English', icon: 'book'),
Subject(id: 'science', name: 'Basic Science', icon: 'science'),
];

final List<Topic> mockTopics = [
Topic(id: 't1', subjectId: 'math', name: 'Addition'),
Topic(id: 't2', subjectId: 'math', name: 'Subtraction'),
Topic(id: 't3', subjectId: 'english', name: 'Nouns'),
];
46 changes: 21 additions & 25 deletions edu_play/lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,39 +1,35 @@
import 'package:edu_play/screens/onboarding_screen.dart';
import 'package:edu_play/main_wrapper.dart';
import 'package:edu_play/services/auth_service.dart';
import 'package:edu_play/styles/app_theme.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'package:provider/provider.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();

// Initialize Hive for local storage
await Hive.initFlutter();
await Hive.openBox('settings'); // Box for app settings and user session

void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'EduPlay',
theme: ThemeData(
// Define the default brightness and colors.
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF3B82F6), // Primary: Sky Blue
primary: const Color(0xFF3B82F6),
secondary: const Color(0xFFFACC15), // Accent: Warm Yellow
error: const Color(0xFFF87171), // Secondary: Coral Red
// Other colors can be defined here as needed
),

// Define the default font family.
textTheme: GoogleFonts.nunitoTextTheme(
Theme.of(context).textTheme,
),

// Use Material 3 design.
useMaterial3: true,
return MultiProvider(
providers: [
ChangeNotifierProvider(create: (_) => AuthService()),
],
child: MaterialApp(
title: 'EduPlay',
theme: AppTheme.lightTheme,
home: const MainWrapper(),
debugShowCheckedModeBanner: false,
),
home: const OnboardingScreen(),
debugShowCheckedModeBanner: false,
);
}
}
34 changes: 34 additions & 0 deletions edu_play/lib/main_wrapper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import 'package:edu_play/models/user_model.dart';
import 'package:edu_play/screens/admin/admin_dashboard_screen.dart';
import 'package:edu_play/screens/onboarding_screen.dart';
import 'package:edu_play/screens/parent/parent_dashboard_screen.dart';
import 'package:edu_play/screens/student/student_dashboard_screen.dart';
import 'package:edu_play/screens/teacher/teacher_dashboard_screen.dart';
import 'package:edu_play/services/auth_service.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class MainWrapper extends StatelessWidget {
const MainWrapper({super.key});

@override
Widget build(BuildContext context) {
final authService = Provider.of<AuthService>(context);

if (!authService.isAuthenticated) {
return const OnboardingScreen();
}

final user = authService.currentUser!;
switch (user.role) {
case UserRole.student:
return const StudentDashboardScreen();
case UserRole.parent:
return const ParentDashboardScreen();
case UserRole.teacher:
return const TeacherDashboardScreen();
case UserRole.admin:
return const AdminDashboardScreen();
}
}
}
30 changes: 28 additions & 2 deletions edu_play/lib/models/lesson_model.dart
Original file line number Diff line number Diff line change
@@ -1,12 +1,38 @@
// Represents a single lesson in a topic.
class Grade {
final String id;
final String name; // e.g., "Primary 1"

Grade({required this.id, required this.name});
}

class Subject {
final String id;
final String name; // e.g., "Mathematics"
final String icon;

Subject({required this.id, required this.name, required this.icon});
}

class Topic {
final String id;
final String subjectId;
final String name; // e.g., "Addition"

Topic({required this.id, required this.subjectId, required this.name});
}

class Lesson {
final String id;
final String topicId;
final String title;
final String content;
final List<String> mediaUrls;

Lesson({
required this.id,
required this.topicId,
required this.title,
required this.content,
required this.mediaUrls,
});
}
}
25 changes: 19 additions & 6 deletions edu_play/lib/models/quiz_model.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
// Represents a single quiz question.
class QuizItem {
class QuizQuestion {
final String id;
final String question;
final List<String> options;
final String correctAnswer;
final int correctAnswerIndex;
final String explanation;

QuizItem({
QuizQuestion({
required this.id,
required this.question,
required this.options,
required this.correctAnswer,
required this.correctAnswerIndex,
required this.explanation,
});
}
}

class Quiz {
final String id;
final String lessonId;
final List<QuizQuestion> questions;

Quiz({
required this.id,
required this.lessonId,
required this.questions,
});
}
21 changes: 17 additions & 4 deletions edu_play/lib/models/reward_model.dart
Original file line number Diff line number Diff line change
@@ -1,14 +1,27 @@
// Represents a reward, such as a badge or avatar item.
class Reward {
class Badge {
final String id;
final String name;
final String description;
final String iconUrl;

Badge({
required this.id,
required this.name,
required this.description,
required this.iconUrl,
});
}

class Reward {
final String id;
final String name;
final int costXP;
final String imageUrl;

Reward({
required this.id,
required this.name,
required this.description,
required this.costXP,
required this.imageUrl,
});
}
}
55 changes: 49 additions & 6 deletions edu_play/lib/models/user_model.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,56 @@
// Represents a user in the EduPlay app.
// This will be expanded to include properties for each user role.
class User {
enum UserRole {
student,
parent,
teacher,
admin,
}

class UserModel {
final String id;
final String email;
final String role; // "Student", "Parent", "Teacher", "Admin"
final String name;
final UserRole role;
final String? schoolCode;

// Student specific fields
final int? xp;
final int? streak;
final String? grade; // e.g., "Primary 1"

User({
UserModel({
required this.id,
required this.email,
required this.name,
required this.role,
this.schoolCode,
this.xp,
this.streak,
this.grade,
});
}

factory UserModel.fromJson(Map<String, dynamic> json) {
return UserModel(
id: json['id'],
email: json['email'],
name: json['name'],
role: UserRole.values.firstWhere((e) => e.toString().split('.').last == json['role']),
schoolCode: json['schoolCode'],
xp: json['xp'],
streak: json['streak'],
grade: json['grade'],
);
}

Map<String, dynamic> toJson() {
return {
'id': id,
'email': email,
'name': name,
'role': role.toString().split('.').last,
'schoolCode': schoolCode,
'xp': xp,
'streak': streak,
'grade': grade,
};
}
}
Loading