Skip to content

Commit

Permalink
chore: material 3 design theme
Browse files Browse the repository at this point in the history
  • Loading branch information
IamMuuo committed Sep 27, 2024
1 parent 183b6db commit f94db5f
Show file tree
Hide file tree
Showing 37 changed files with 1,153 additions and 394 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion lib/constants/common.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// const String urlPrefix = "https://daystar-backend-atrocious-jpg.vercel.app";
// For local development

import 'package:magnet/magnet.dart';
import 'package:academia/exports/barrel.dart';

late Magnet magnet;

Expand Down
19 changes: 11 additions & 8 deletions lib/constants/tools.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ final List<Map<String, dynamic>> allTools = [
"id": 8,
"name": "Exam Timetable",
"action": "Show exam timetable",
"image": "assets/images/star_trek.png",
"image": "assets/images/sketchbook-man-analyzing-business-data.png",
"ontap": () {
Get.to(const ExamTimeTablePage());
},
Expand All @@ -17,7 +17,8 @@ final List<Map<String, dynamic>> allTools = [
"id": 1,
"name": "GPA Calculator",
"action": "Calculate GPA",
"image": "assets/images/khaby-lame-shrug.png",
"image":
"assets/images/sketchbook-young-businesswoman-giving-a-presentation-1.png",
"ontap": () {
Get.to(GpaCalculator());
},
Expand All @@ -27,7 +28,7 @@ final List<Map<String, dynamic>> allTools = [
"id": 2,
"name": "Fees statements",
"action": "Preview my fees statements",
"image": "assets/images/doodle-character-holding-money.png",
"image": "assets/images/sketchbook-woman-and-a-man-analyze-data-2.png",
"ontap": () {
Get.to(const FeesPage());
},
Expand All @@ -37,7 +38,7 @@ final List<Map<String, dynamic>> allTools = [
{
"id": 2,
"name": "Elearning",
"image": "assets/images/young-man-trying-to-explain-something.png",
"image": "assets/images/sketchbook-coworkers-discussing-something-1.png",
"action": "Visit Elearning",
"ontap": () {
Platform.isIOS || Platform.isAndroid
Expand Down Expand Up @@ -115,9 +116,10 @@ final List<Map<String, dynamic>> allTools = [
},
{
"id": 10,
"name": "Academia Anki",
"name": "Anki Flash Cards",
"action": "Lets Up That Grade",
"image": "assets/images/tasks_manager.png",
"image":
"assets/images/sketchbook-young-man-and-his-dog-are-having-a-picnic-in-the-park-1.png",
"ontap": () {
Get.to(const AnkiHomePage());
},
Expand All @@ -127,8 +129,9 @@ final List<Map<String, dynamic>> allTools = [
{
"id": 11,
"name": "Ask Me",
"action": "Ask Me",
"image": "assets/images/think.jpeg",
"action": "Study with Ai",
"image":
"assets/images/sketchbook-woman-taking-pictures-of-packaged-goods.png",
"ontap": () {
Get.to(const AskMeHome());
},
Expand Down
30 changes: 19 additions & 11 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,14 @@ void main() async {
await BackgroundWorker().initialize();

runApp(
GetMaterialApp(
home: const Academia(),
theme: lightModeTheme,
debugShowCheckedModeBanner: false,
darkTheme: darkModeTheme,
),
const Academia(),
);
}

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

@override
Widget build(BuildContext context) {
Expand All @@ -34,10 +31,21 @@ class Academia extends StatelessWidget {
Get.put(EventsController());

LocalNotifierService().requestPermission();
return Obx(
() => userController.isLoggedIn.value
? const LayoutPage()
: const IntroPage(),
return GetMaterialApp(
theme: ThemeData(
useMaterial3: true,
colorSchemeSeed: Colors.amber,
),
darkTheme: ThemeData(
brightness: Brightness.dark,
useMaterial3: true,
colorSchemeSeed: Colors.amber,
),
home: Obx(
() => userController.isLoggedIn.value
? const LayoutPage()
: const IntroPage(),
),
);
}
}
134 changes: 20 additions & 114 deletions lib/models/core/course/course_model.dart
Original file line number Diff line number Diff line change
@@ -1,115 +1,21 @@
// /// The course model represents a course just as its name implies
// class Course {
// final String unit;
// final String section;
// final String dayOfWeek;
// final String period;
// final String campus;
// final String room;
// final String lecturer;
//
// Course({
// required this.unit,
// required this.section,
// required this.dayOfWeek,
// required this.period,
// required this.campus,
// required this.room,
// required this.lecturer,
// });
//
// // Method to convert Course instance to a Map (JSON format)
// Map<String, dynamic> toJson() {
// return {
// 'unit': unit,
// 'section': section,
// 'day_of_the_week': dayOfWeek,
// 'period': period,
// 'campus': campus,
// 'room': room,
// 'lecturer': lecturer,
// };
// }
//
// // Static method to create a Course instance from a Map (JSON format)
// static Course fromJson(Map<String, dynamic> json) {
// return Course(
// unit: json['unit'],
// section: json['section'],
// dayOfWeek: json['day_of_the_week'],
// period: json['period'],
// campus: json['campus'],
// room: json['room'],
// lecturer: json['lecturer'],
// );
// }
// }

import 'package:intl/intl.dart';

/// The course model represents a course just as its name implies
class Course {
final String unit;
final String section;
final String dayOfWeek;
final String
period; // This contains the time range (e.g., "02:10 PM-05:10 PM")
final String campus;
final String room;
final String lecturer;
late DateTime startTime;
late DateTime stopTime;

Course({
required this.unit,
required this.section,
required this.dayOfWeek,
required this.period,
required this.campus,
required this.room,
required this.lecturer,
}) {
extractTimesFromPeriod(period);
}

// Method to convert Course instance to a Map (JSON format)
Map<String, dynamic> toJson() {
return {
'unit': unit,
'section': section,
'day_of_the_week': dayOfWeek,
'period': period,
'campus': campus,
'room': room,
'lecturer': lecturer,
'start_time': startTime.toIso8601String(),
'stop_time': stopTime.toIso8601String(),
};
}

// Static method to create a Course instance from a Map (JSON format)
static Course fromJson(Map<String, dynamic> json) {
return Course(
unit: json['unit'],
section: json['section'],
dayOfWeek: json['day_of_the_week'],
period: json['period'],
campus: json['campus'],
room: json['room'],
lecturer: json['lecturer'],
)..extractTimesFromPeriod(json['period']);
}

// Private method to extract start and stop times from the period string
void extractTimesFromPeriod(String period) {
// Split the period by the dash ('-')
List<String> times = period.split('-');

// Define a DateFormat to parse the time strings
DateFormat formatter = DateFormat("hh:mm a");

// Parse start and stop times
startTime = formatter.parse(times[0].trim());
stopTime = formatter.parse(times[1].trim());
}
import 'package:freezed_annotation/freezed_annotation.dart';

part 'course_model.freezed.dart';
part 'course_model.g.dart';

@freezed
class Course with _$Course {
const factory Course({
required String unit,
required String section,
@JsonKey(name: "day_of_the_week") required String dayOfWeek,
required String period,
required String campus,
required String room,
required String lecturer,
@JsonKey(name: "start_time") DateTime? startTime,
@JsonKey(name: "stop_time") DateTime? stopTime,
}) = _Course;

factory Course.fromJson(Map<String, dynamic> json) => _$CourseFromJson(json);
}
Loading

0 comments on commit f94db5f

Please sign in to comment.