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

Pfe master f3.1 #1003

Merged
merged 29 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
f90f55d
implementation of seperate widgets for about_view
charlcl180 Jun 29, 2024
5457642
implementation of seperation widget of author_view
charlcl180 Jun 29, 2024
9889248
impementation of seperation widget of choose_language_view
charlcl180 Jun 29, 2024
eaf523c
implementation of seperation widget of contributors_view
charlcl180 Jun 29, 2024
f9b25f5
implementation of seperation widget of emergency_view
charlcl180 Jun 29, 2024
d8fdb39
implementation of seperation widget of faq_view
charlcl180 Jun 29, 2024
ac8e3da
implementation of seperation widget of feedback view
charlcl180 Jun 29, 2024
7e4605e
implementation of seperation widget of more_view
charlcl180 Jun 29, 2024
ae6a2d5
implementation of seperation widget of grade_view
charlcl180 Jun 29, 2024
be9d469
implementation of seperation widget of grade_details_view +contributors
charlcl180 Jun 29, 2024
b4c34c8
implementation of seperation widget of login_view
charlcl180 Jun 29, 2024
737ab1c
[BOT] Applying format.
charlcl180 Jun 29, 2024
78bab18
fix for test to pass
charlcl180 Jun 29, 2024
6ad718e
Merge branch 'PFE-master-F3.1' of https://github.com/ApplETS/Notre-Da…
charlcl180 Jun 29, 2024
8783679
change name grade session courses
charlcl180 Jun 29, 2024
ddbe929
change in more_view
charlcl180 Jun 29, 2024
3fc8315
[BOT] Applying format.
charlcl180 Jun 29, 2024
d9d39c8
change for warning and imports
charlcl180 Jun 29, 2024
eb47836
Merge branch 'PFE-master-F3.1' of https://github.com/ApplETS/Notre-Da…
charlcl180 Jun 29, 2024
2e26f20
[BOT] Applying format.
charlcl180 Jun 29, 2024
3105a84
change test more_view
charlcl180 Jun 29, 2024
a009e84
Merge branch 'PFE-master-F3.1' of https://github.com/ApplETS/Notre-Da…
charlcl180 Jun 29, 2024
2233b98
change moreview model
charlcl180 Jun 29, 2024
b9780d0
change more view model
charlcl180 Jun 29, 2024
6d67ad5
implementation of seperation widget of dashboard_view
charlcl180 Jun 30, 2024
faab77f
fix so app works but need insert the widgets
charlcl180 Jun 30, 2024
f01dc25
[BOT] Applying format.
charlcl180 Jul 2, 2024
be0b6e7
Fix more viewmodels tests
XavierPaquet-Rapold Jul 6, 2024
5776616
[BOT] Update golden files
XavierPaquet-Rapold Jul 6, 2024
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
112 changes: 112 additions & 0 deletions lib/features/dashboard/widgets-dashboard/about_us_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import 'package:flutter/material.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:notredame/features/app/analytics/analytics_service.dart';
import 'package:notredame/features/dashboard/dashboard_viewmodel.dart';
import 'package:notredame/utils/utils.dart';
import 'package:notredame/constants/urls.dart';
import 'package:notredame/utils/app_theme.dart';
import 'package:notredame/features/app/widgets/dismissible_card.dart';
import 'package:notredame/constants/preferences_flags.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class AboutUsCard extends StatelessWidget {
final DashboardViewModel model;
final PreferencesFlag flag;
final AnalyticsService analyticsService;
static const String tag = "DashboardView";

const AboutUsCard({
super.key,
required this.model,
required this.flag,
required this.analyticsService,
});

@override
Widget build(BuildContext context) {
return DismissibleCard(
key: UniqueKey(),
onDismissed: (DismissDirection direction) {
model.hideCard(flag);
},
cardColor: AppTheme.appletsPurple,
child: Column(mainAxisSize: MainAxisSize.min, children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.fromLTRB(17, 15, 0, 0),
child: Text(AppIntl.of(context)!.card_applets_title,
style: Theme.of(context).primaryTextTheme.titleLarge),
)),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.fromLTRB(17, 10, 15, 10),
child: Text(AppIntl.of(context)!.card_applets_text,
style: Theme.of(context).primaryTextTheme.bodyMedium),
),
Container(
padding: const EdgeInsets.fromLTRB(10, 0, 0, 0),
child: Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: Wrap(spacing: 15.0, children: [
IconButton(
onPressed: () {
analyticsService.logEvent(tag, "Facebook clicked");
Utils.launchURL(Urls.clubFacebook, AppIntl.of(context)!);
},
icon: const FaIcon(
FontAwesomeIcons.facebook,
color: Colors.white,
),
),
IconButton(
onPressed: () {
analyticsService.logEvent(tag, "Instagram clicked");
Utils.launchURL(Urls.clubInstagram, AppIntl.of(context)!);
},
icon: const FaIcon(
FontAwesomeIcons.instagram,
color: Colors.white,
),
),
IconButton(
onPressed: () {
analyticsService.logEvent(tag, "Github clicked");
Utils.launchURL(Urls.clubGithub, AppIntl.of(context)!);
},
icon: const FaIcon(
FontAwesomeIcons.github,
color: Colors.white,
),
),
IconButton(
onPressed: () {
analyticsService.logEvent(tag, "Email clicked");
Utils.launchURL(Urls.clubEmail, AppIntl.of(context)!);
},
icon: const FaIcon(
FontAwesomeIcons.envelope,
color: Colors.white,
),
),
IconButton(
onPressed: () {
analyticsService.logEvent(tag, "Discord clicked");
Utils.launchURL(Urls.clubDiscord, AppIntl.of(context)!);
},
icon: const FaIcon(
FontAwesomeIcons.discord,
color: Colors.white,
),
),
]),
),
),
],
),
]),
);
}
}
74 changes: 74 additions & 0 deletions lib/features/dashboard/widgets-dashboard/grades_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'package:flutter/material.dart';
import 'package:notredame/features/app/navigation/navigation_service.dart';
import 'package:notredame/features/app/navigation/router_paths.dart';
import 'package:notredame/features/app/widgets/dismissible_card.dart';
import 'package:notredame/features/dashboard/dashboard_viewmodel.dart';
import 'package:notredame/features/student/grades/widgets/grade_button.dart';
import 'package:notredame/utils/app_theme.dart';
import 'package:notredame/constants/preferences_flags.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class GradesCard extends StatelessWidget {
final DashboardViewModel model;
final PreferencesFlag flag;
final VoidCallback dismissCard;

const GradesCard({
required this.model,
required this.flag,
required this.dismissCard,
super.key,
});

@override
Widget build(BuildContext context) {
final NavigationService navigationService = NavigationService();

return DismissibleCard(
key: UniqueKey(),
onDismissed: (DismissDirection direction) {
dismissCard();
},
isBusy: model.busy(model.courses),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min,
children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.fromLTRB(17, 15, 0, 0),
child: GestureDetector(
onTap: () => navigationService
.pushNamedAndRemoveUntil(RouterPaths.student),
child: Text(AppIntl.of(context)!.grades_title,
style: Theme.of(context).textTheme.titleLarge),
),
),
),
if (model.courses.isEmpty)
SizedBox(
height: 100,
child: Center(
child: Text(AppIntl.of(context)!
.grades_msg_no_grades
.split("\n")
.first)),
)
else
Container(
padding: const EdgeInsets.fromLTRB(17, 10, 15, 10),
child: Wrap(
children: model.courses
.map((course) => GradeButton(course,
color:
Theme.of(context).brightness == Brightness.light
? AppTheme.lightThemeBackground
: AppTheme.darkThemeBackground))
.toList(),
),
)
]),
);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import 'package:flutter/material.dart';
import 'package:notredame/features/app/widgets/dismissible_card.dart';

class MessageBroadcastCard extends StatelessWidget {
final String title;
final String content;
final VoidCallback onDismissed;
final String broadcastColor;

const MessageBroadcastCard({
required this.title,
required this.content,
required this.onDismissed,
required this.broadcastColor,
super.key,
});

@override
Widget build(BuildContext context) {
final broadcastMsgColor = Color(int.parse(broadcastColor));
return DismissibleCard(
key: UniqueKey(),
onDismissed: (DismissDirection direction) {
onDismissed();
},
cardColor: broadcastMsgColor,
child: Column(mainAxisSize: MainAxisSize.min, children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.fromLTRB(17, 15, 0, 0),
child: Text(title,
style: Theme.of(context).primaryTextTheme.titleLarge),
)),
Container(
padding: const EdgeInsets.fromLTRB(17, 0, 17, 8),
child: Text(content,
style: Theme.of(context).primaryTextTheme.bodyMedium),
),
]),
);
}
}
97 changes: 97 additions & 0 deletions lib/features/dashboard/widgets-dashboard/progress_bar_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import 'package:flutter/material.dart';
import 'package:notredame/constants/preferences_flags.dart';
import 'package:notredame/features/app/widgets/dismissible_card.dart';
import 'package:notredame/utils/app_theme.dart';
import 'package:notredame/features/dashboard/dashboard_viewmodel.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

class ProgressBarCard extends StatefulWidget {
final DashboardViewModel model;
final PreferencesFlag flag;
final Text? progressBarText;
final VoidCallback dismissCard;
final VoidCallback changeProgressBarText;
final VoidCallback setText;

const ProgressBarCard({
required this.model,
required this.flag,
required this.progressBarText,
required this.dismissCard,
required this.changeProgressBarText,
required this.setText,
super.key,
});

@override
_ProgressBarCardState createState() => _ProgressBarCardState();
}

class _ProgressBarCardState extends State<ProgressBarCard> {
@override
Widget build(BuildContext context) {
return DismissibleCard(
isBusy: widget.model.busy(widget.model.progress),
key: UniqueKey(),
onDismissed: (DismissDirection direction) {
widget.dismissCard();
},
child: Column(mainAxisSize: MainAxisSize.min, children: [
Align(
alignment: Alignment.centerLeft,
child: Container(
padding: const EdgeInsets.fromLTRB(17, 15, 0, 0),
child: Text(AppIntl.of(context)!.progress_bar_title,
style: Theme.of(context).textTheme.titleLarge),
)),
if (widget.model.progress >= 0.0)
Stack(children: [
Container(
padding: const EdgeInsets.fromLTRB(17, 10, 15, 20),
child: ClipRRect(
borderRadius: const BorderRadius.all(Radius.circular(10)),
child: GestureDetector(
onTap: () => setState(() {
widget.changeProgressBarText();
widget.setText();
}),
child: LinearProgressIndicator(
value: widget.model.progress,
minHeight: 30,
valueColor: const AlwaysStoppedAnimation<Color>(
AppTheme.gradeGoodMax),
backgroundColor: AppTheme.etsDarkGrey,
),
),
),
),
GestureDetector(
onTap: () => setState(() {
widget.changeProgressBarText();
widget.setText();
}),
child: Container(
padding: const EdgeInsets.only(top: 16),
child: Center(
child: widget.progressBarText ??
Text(
AppIntl.of(context)!.progress_bar_message(
widget.model.sessionDays[0],
widget.model.sessionDays[1]),
style: const TextStyle(color: Colors.white),
),
),
),
),
])
else
Container(
padding: const EdgeInsets.all(16),
child: Center(
child: Text(AppIntl.of(context)!.session_without),
),
),
]),
);
}
}
Loading