Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

redesign: Academic Path - Schedule #1445

Open
wants to merge 20 commits into
base: ui/redesign
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
aaa16ba
Started working on integrating a schedule tab into the academic path …
Granja5 Jan 18, 2025
91afb0d
Small Code Refactor
Granja5 Jan 18, 2025
a853981
Changed tabs to timeline (need to sync the current day to the default…
Granja5 Jan 18, 2025
8a4e915
Working on the Day Tab Visuals
Granja5 Jan 18, 2025
381096f
Tabs organized from Sunday to Saturday (still need to sync to the con…
Granja5 Jan 19, 2025
77e8c91
Tab day correctly associated to the corresponding week day content
Granja5 Jan 19, 2025
db2085d
Week day tab bar complete
Granja5 Jan 19, 2025
2f95f6c
Small visual changes to the tab bar
Granja5 Jan 20, 2025
8e27725
Merge branch 'ui/redesign' into redesign/schedule-page
Granja5 Jan 20, 2025
4891c3c
Adding the new Schedule Cards
Granja5 Jan 20, 2025
1fd369d
Card Timeline Mock
Granja5 Jan 21, 2025
8f178d1
Reformatted the Daily Cards Association and Created a Specific Timeli…
Granja5 Jan 21, 2025
007b0e1
Visually almost complete
Granja5 Jan 21, 2025
8652802
"No classes for the week" image added and tab bar now fits the screen
Granja5 Jan 21, 2025
70096c7
Page using Lecture Provider instead of Mock Lecture List
Granja5 Jan 21, 2025
5f57aa5
Refactored to use CardTimeline and added the schedule_timeline functi…
Granja5 Jan 21, 2025
60307bc
refactor: separated the page state, view and helper widget logics int…
Granja5 Jan 21, 2025
91ba9dc
Merge branch 'ui/redesign' into redesign/schedule-page
Granja5 Jan 30, 2025
5ac6615
fix: Timeline initial tab and initial content correctly and instantly…
Granja5 Jan 30, 2025
54ae46d
fix: timeline tab displays today's date correctly when there are no l…
Granja5 Jan 30, 2025
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
13 changes: 7 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_all.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
import 'package:intl/src/intl_helpers.dart';
Expand All @@ -20,8 +21,8 @@ import 'messages_pt_PT.dart' as messages_pt_pt;

typedef Future<dynamic> LibraryLoader();
Map<String, LibraryLoader> _deferredLibraries = {
'en': () => new Future.value(null),
'pt_PT': () => new Future.value(null),
'en': () => new SynchronousFuture(null),
'pt_PT': () => new SynchronousFuture(null),
};

MessageLookupByLibrary? _findExact(String localeName) {
Expand All @@ -36,18 +37,18 @@ MessageLookupByLibrary? _findExact(String localeName) {
}

/// User programs should call this before using [localeName] for messages.
Future<bool> initializeMessages(String localeName) async {
Future<bool> initializeMessages(String localeName) {
var availableLocale = Intl.verifiedLocale(
localeName, (locale) => _deferredLibraries[locale] != null,
onFailure: (_) => null);
if (availableLocale == null) {
return new Future.value(false);
return new SynchronousFuture(false);
}
var lib = _deferredLibraries[availableLocale];
await (lib == null ? new Future.value(false) : lib());
lib == null ? new SynchronousFuture(false) : lib();
initializeInternalMessageLookup(() => new CompositeMessageLookup());
messageLookup.addLocale(availableLocale, _findGeneratedMessagesFor);
return new Future.value(true);
return new SynchronousFuture(true);
}

bool _messagesExistFor(String locale) {
Expand Down
13 changes: 7 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -19,12 +20,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'en';

static m0(time) => "last refresh at ${time}";
static String m0(time) => "last refresh at ${time}";

static m1(time) =>
static String m1(time) =>
"${Intl.plural(time, zero: 'Refreshed ${time} minutes ago', one: 'Refreshed ${time} minute ago', other: 'Refreshed ${time} minutes ago')}";

static m2(title) => "${Intl.select(title, {
static String m2(title) => "${Intl.select(title, {
'horario': 'Schedule',
'exames': 'Exams',
'area': 'Personal Area',
Expand All @@ -41,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function>{
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("About us"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Academic services"),
Expand Down Expand Up @@ -161,7 +162,6 @@ class MessageLookup extends MessageLookupByLibrary {
"language": MessageLookupByLibrary.simpleMessage("Language"),
"last_refresh_time": m0,
"last_timestamp": m1,
"lectures": MessageLookupByLibrary.simpleMessage("Lectures"),
"library_occupation":
MessageLookupByLibrary.simpleMessage("Library Occupation"),
"load_error": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -270,6 +270,7 @@ class MessageLookup extends MessageLookupByLibrary {
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Do you want to see your favorite restaurants in the main page?"),
"room": MessageLookupByLibrary.simpleMessage("Room"),
"schedule": MessageLookupByLibrary.simpleMessage("Schedule"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("School Calendar"),
"search": MessageLookupByLibrary.simpleMessage("Search"),
Expand Down
13 changes: 7 additions & 6 deletions packages/uni_app/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
// ignore_for_file:unnecessary_brace_in_string_interps, unnecessary_new
// ignore_for_file:prefer_single_quotes,comment_references, directives_ordering
// ignore_for_file:annotate_overrides,prefer_generic_function_type_aliases
// ignore_for_file:unused_import, file_names
// ignore_for_file:unused_import, file_names, avoid_escaping_inner_quotes
// ignore_for_file:unnecessary_string_interpolations, unnecessary_string_escapes

import 'package:intl/intl.dart';
import 'package:intl/message_lookup_by_library.dart';
Expand All @@ -19,12 +20,12 @@ typedef String MessageIfAbsent(String messageStr, List<dynamic> args);
class MessageLookup extends MessageLookupByLibrary {
String get localeName => 'pt_PT';

static m0(time) => "última atualização às ${time}";
static String m0(time) => "última atualização às ${time}";

static m1(time) =>
static String m1(time) =>
"${Intl.plural(time, zero: 'Atualizado há ${time} minutos', one: 'Atualizado há ${time} minuto', other: 'Atualizado há ${time} minutos')}";

static m2(title) => "${Intl.select(title, {
static String m2(title) => "${Intl.select(title, {
'horario': 'Horário',
'exames': 'Exames',
'area': 'Área Pessoal',
Expand All @@ -41,7 +42,7 @@ class MessageLookup extends MessageLookupByLibrary {
})}";

final messages = _notInlinedMessages(_notInlinedMessages);
static _notInlinedMessages(_) => <String, Function>{
static Map<String, Function> _notInlinedMessages(_) => <String, Function>{
"about": MessageLookupByLibrary.simpleMessage("Sobre nós"),
"academic_services":
MessageLookupByLibrary.simpleMessage("Serviços académicos"),
Expand Down Expand Up @@ -160,7 +161,6 @@ class MessageLookup extends MessageLookupByLibrary {
"language": MessageLookupByLibrary.simpleMessage("Idioma"),
"last_refresh_time": m0,
"last_timestamp": m1,
"lectures": MessageLookupByLibrary.simpleMessage("Aulas"),
"library_occupation":
MessageLookupByLibrary.simpleMessage("Ocupação da Biblioteca"),
"load_error": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -271,6 +271,7 @@ class MessageLookup extends MessageLookupByLibrary {
"restaurant_main_page": MessageLookupByLibrary.simpleMessage(
"Queres ver os teus restaurantes favoritos na página principal?"),
"room": MessageLookupByLibrary.simpleMessage("Sala"),
"schedule": MessageLookupByLibrary.simpleMessage("Aulas"),
"school_calendar":
MessageLookupByLibrary.simpleMessage("Calendário Escolar"),
"search": MessageLookupByLibrary.simpleMessage("Pesquisar"),
Expand Down
10 changes: 5 additions & 5 deletions packages/uni_app/lib/generated/l10n.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/uni_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@
"@wrong_credentials_exception": {},
"internet_status_exception": "Check your internet connection",
"@internet_status_exception": {},
"lectures": "Lectures",
"@lectures": {},
"schedule": "Schedule",
"@schedule": {},
"exams": "Exams",
"@exams": {},
"courses": "Courses",
Expand Down
4 changes: 2 additions & 2 deletions packages/uni_app/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@
"@wrong_credentials_exception": {},
"internet_status_exception": "Verifique sua conexão com a internet",
"@internet_status_exception": {},
"lectures": "Aulas",
"@lectures": {},
"schedule": "Aulas",
"@schedule": {},
"exams": "Exames",
"@exams": {},
"courses": "Cursos",
Expand Down
13 changes: 6 additions & 7 deletions packages/uni_app/lib/view/academic_path/academic_path.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';
import 'package:uni/generated/l10n.dart';
import 'package:uni/utils/navigation_items.dart';
import 'package:uni/view/academic_path/exam_page.dart';
import 'package:uni/view/academic_path/schedule_page.dart';
import 'package:uni/view/common_widgets/pages_layouts/general/general.dart';
import 'package:uni_ui/icons.dart';
import 'package:uni_ui/tabs/tab_icon.dart';
Expand Down Expand Up @@ -41,7 +42,7 @@ class AcademicPathPageViewState extends GeneralPageViewState
tabs: [
TabIcon(
icon: UniIcons.lecture,
text: S.of(context).lectures,
text: S.of(context).schedule,
),
TabIcon(icon: UniIcons.exam, text: S.of(context).exams),
TabIcon(icon: UniIcons.course, text: S.of(context).courses),
Expand All @@ -53,12 +54,10 @@ class AcademicPathPageViewState extends GeneralPageViewState
Widget getBody(BuildContext context) {
return TabBarView(
controller: tabController,
children: const [
Center(
child: Text('To be implemented'),
),
ExamsPage(),
Center(
children: [
SchedulePage(),
const ExamsPage(),
const Center(
child: Text('To be implemented'),
),
],
Expand Down
120 changes: 120 additions & 0 deletions packages/uni_app/lib/view/academic_path/schedule_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:uni/model/entities/lecture.dart';
import 'package:uni/model/providers/lazy/lecture_provider.dart';
import 'package:uni/view/academic_path/widgets/schedule_page_view.dart';
import 'package:uni/view/lazy_consumer.dart';

class SchedulePage extends StatelessWidget {
SchedulePage({super.key, DateTime? now}) : now = now ?? DateTime.now();

final DateTime now;

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Theme.of(context).colorScheme.surface,
body: RefreshIndicator(
onRefresh: () async {
await context.read<LectureProvider>().forceRefresh(context);
},
child: LazyConsumer<LectureProvider, List<Lecture>>(
builder: (context, lectures) {
return SchedulePageView(
getMockLectures(), // change to lectures
now: now,
);
},
hasContent: (lectures) => lectures.isNotEmpty,
onNullContent: SchedulePageView(const [], now: now),
),
),
);
}
}

// Since there are no classes, we can use this to test the schedule page populated
List<Lecture> getMockLectures() {
return [
Lecture(
'Fundamentos de Segurança Informática',
'T',
DateTime.now().subtract(const Duration(hours: 2)),
DateTime.now().subtract(const Duration(hours: 1)),
'B101',
'Dr. Smith',
'Class 1',
1,
),
Lecture(
'Fundamentos de Segurança Informática',
'TP',
DateTime.now().add(Duration.zero),
DateTime.now().add(const Duration(hours: 1)),
'B102',
'Dr. Johnson',
'Class 2',
2,
),
Lecture(
'Interação Pessoa Computador',
'T',
DateTime.now().subtract(const Duration(hours: 5)),
DateTime.now().subtract(const Duration(hours: 4)),
'B201',
'Dr. Brown',
'Class 3',
3,
),
Lecture(
'Interação Pessoa Computador',
'TP',
DateTime.now().subtract(const Duration(days: 2, hours: 3)),
DateTime.now().subtract(const Duration(days: 2, hours: 4)),
'103',
'Dr. Taylor',
'Class 4',
4,
),
Lecture(
'Laboratório de Bases de Dados e Aplicações Web',
'T',
DateTime.now().add(const Duration(days: 3, hours: 4)),
DateTime.now().add(const Duration(days: 3, hours: 5)),
'B104',
'Dr. Martinez',
'Class 5',
5,
),
Lecture(
'Programação Funcional e em Lógica',
'TP',
DateTime.now().add(const Duration(days: 1, hours: 5)),
DateTime.now().add(const Duration(days: 1, hours: 6)),
'B105',
'Dr. Lee',
'Class 6',
6,
),
Lecture(
'Redes de Computadores',
'TP',
DateTime.now().subtract(const Duration(days: 1, hours: 1)),
DateTime.now().subtract(const Duration(days: 1)),
'B106',
'Dr. Williams',
'Class 7',
7,
),
Lecture(
'Redes de Computadores',
'T',
DateTime.now().add(const Duration(days: 1, hours: 7)),
DateTime.now().add(const Duration(days: 1, hours: 8)),
'B107',
'Dr. Harris',
'Class 8',
8,
),
];
}
17 changes: 17 additions & 0 deletions packages/uni_app/lib/view/academic_path/widgets/empty_week.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import 'package:flutter/material.dart';
import 'package:uni/view/common_widgets/expanded_image_label.dart';

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

@override
Widget build(BuildContext context) {
return const Center(
child: ImageLabel(
imagePath: 'assets/images/schedule.png',
label: 'You have no classes this week.',
labelTextStyle: TextStyle(fontSize: 15),
),
);
}
}
Loading