-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* implementation of seperate widgets for about_view * implementation of seperation widget of author_view * impementation of seperation widget of choose_language_view * implementation of seperation widget of contributors_view * implementation of seperation widget of emergency_view * implementation of seperation widget of faq_view * implementation of seperation widget of feedback view * implementation of seperation widget of more_view * implementation of seperation widget of grade_view * implementation of seperation widget of grade_details_view +contributors * implementation of seperation widget of login_view * [BOT] Applying format. * fix for test to pass * change name grade session courses * change in more_view * [BOT] Applying format. * change for warning and imports * [BOT] Applying format. * change test more_view * change moreview model * change more view model * implementation of seperation widget of dashboard_view * fix so app works but need insert the widgets * [BOT] Applying format. * Fix more viewmodels tests * [BOT] Update golden files --------- Co-authored-by: charlcl180 <[email protected]> Co-authored-by: Xavier Paquet-Rapold <[email protected]> Co-authored-by: XavierPaquet-Rapold <[email protected]>
- Loading branch information
1 parent
831c2d0
commit 276822e
Showing
59 changed files
with
2,386 additions
and
1,572 deletions.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
lib/features/dashboard/widgets-dashboard/about_us_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
), | ||
), | ||
]), | ||
), | ||
), | ||
], | ||
), | ||
]), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
), | ||
) | ||
]), | ||
); | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
lib/features/dashboard/widgets-dashboard/message_broadcast_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
97
lib/features/dashboard/widgets-dashboard/progress_bar_card.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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), | ||
), | ||
), | ||
]), | ||
); | ||
} | ||
} |
Oops, something went wrong.