Skip to content

Commit

Permalink
Adding null course units information check (#1332)
Browse files Browse the repository at this point in the history
  • Loading branch information
limwa committed Sep 16, 2024
2 parents 0e46476 + 5bc73f9 commit 00fc389
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 12 deletions.
3 changes: 3 additions & 0 deletions packages/uni_app/lib/generated/intl/messages_en.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class MessageLookup extends MessageLookupByLibrary {
"balance": MessageLookupByLibrary.simpleMessage("Balance:"),
"banner_info": MessageLookupByLibrary.simpleMessage(
"We do now collect anonymous usage statistics in order to improve your experience. You can change it in settings."),
"bibliography": MessageLookupByLibrary.simpleMessage("Bibliography"),
"bs_description": MessageLookupByLibrary.simpleMessage(
"Did you find any bugs in the application?\nDo you have any suggestions for the app?\nTell us so we can improve!"),
"bug_description": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -120,6 +121,7 @@ class MessageLookup extends MessageLookupByLibrary {
"edit_on": MessageLookupByLibrary.simpleMessage("Finish editing"),
"empty_text":
MessageLookupByLibrary.simpleMessage("Please fill in this field"),
"evaluation": MessageLookupByLibrary.simpleMessage("Evaluation"),
"exams_filter":
MessageLookupByLibrary.simpleMessage("Exams Filter Settings"),
"exit_confirm":
Expand Down Expand Up @@ -248,6 +250,7 @@ class MessageLookup extends MessageLookupByLibrary {
"prints": MessageLookupByLibrary.simpleMessage("Prints"),
"problem_id": MessageLookupByLibrary.simpleMessage(
"Brief identification of the problem"),
"program": MessageLookupByLibrary.simpleMessage("Program"),
"reference_sigarra_help": MessageLookupByLibrary.simpleMessage(
"The generated reference data will appear in Sigarra, checking account.\nProfile > Checking Account"),
"reference_success": MessageLookupByLibrary.simpleMessage(
Expand Down
3 changes: 3 additions & 0 deletions packages/uni_app/lib/generated/intl/messages_pt_PT.dart
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ class MessageLookup extends MessageLookupByLibrary {
"balance": MessageLookupByLibrary.simpleMessage("Saldo:"),
"banner_info": MessageLookupByLibrary.simpleMessage(
"Agora recolhemos estatísticas de uso anónimas para melhorar a tua experiência. Podes alterá-lo nas definições."),
"bibliography": MessageLookupByLibrary.simpleMessage("Bibliografia"),
"bs_description": MessageLookupByLibrary.simpleMessage(
"Encontraste algum bug na aplicação?\nTens alguma sugestão para a app?\nConta-nos para que possamos melhorar!"),
"bug_description": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -119,6 +120,7 @@ class MessageLookup extends MessageLookupByLibrary {
"edit_on": MessageLookupByLibrary.simpleMessage("Concluir edição"),
"empty_text": MessageLookupByLibrary.simpleMessage(
"Por favor preenche este campo"),
"evaluation": MessageLookupByLibrary.simpleMessage("Avaliação"),
"exams_filter":
MessageLookupByLibrary.simpleMessage("Definições Filtro de Exames"),
"exit_confirm": MessageLookupByLibrary.simpleMessage(
Expand Down Expand Up @@ -249,6 +251,7 @@ class MessageLookup extends MessageLookupByLibrary {
"prints": MessageLookupByLibrary.simpleMessage("Impressões"),
"problem_id": MessageLookupByLibrary.simpleMessage(
"Breve identificação do problema"),
"program": MessageLookupByLibrary.simpleMessage("Programa"),
"reference_sigarra_help": MessageLookupByLibrary.simpleMessage(
"Os dados da referência gerada aparecerão no Sigarra, conta corrente. Perfil > Conta Corrente"),
"reference_success": MessageLookupByLibrary.simpleMessage(
Expand Down
30 changes: 30 additions & 0 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.

6 changes: 6 additions & 0 deletions packages/uni_app/lib/l10n/intl_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
"@banner_info": {},
"balance": "Balance:",
"@balance": {},
"bibliography": "Bibliography",
"@bibliography": {},
"bs_description": "Did you find any bugs in the application?\nDo you have any suggestions for the app?\nTell us so we can improve!",
"@bs_description": {},
"bug_description": "Bug found, how to reproduce it, etc.",
Expand Down Expand Up @@ -106,6 +108,8 @@
"@edit_on": {},
"empty_text": "Please fill in this field",
"@empty_text": {},
"evaluation": "Evaluation",
"@evaluation": {},
"exams_filter": "Exams Filter Settings",
"@exams_filter": {},
"expired_password": "Your password has expired",
Expand Down Expand Up @@ -248,6 +252,8 @@
"@successful_open": {},
"permission_denied": "Permission denied",
"@permission_denied": {},
"program": "Program",
"@program": {},
"open_error": "Error opening the file",
"@open_error": {},
"no_app": "No app found to open the file",
Expand Down
6 changes: 6 additions & 0 deletions packages/uni_app/lib/l10n/intl_pt_PT.arb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"@banner_info": {},
"balance": "Saldo:",
"@balance": {},
"bibliography": "Bibliografia",
"@bibliography": {},
"bs_description": "Encontraste algum bug na aplicação?\nTens alguma sugestão para a app?\nConta-nos para que possamos melhorar!",
"@bs_description": {},
"bug_description": "Bug encontrado, como o reproduzir, etc",
Expand Down Expand Up @@ -108,6 +110,8 @@
"@edit_on": {},
"empty_text": "Por favor preenche este campo",
"@empty_text": {},
"evaluation": "Avaliação",
"@evaluation": {},
"exams_filter": "Definições Filtro de Exames",
"@exams_filter": {},
"expired_password": "A tua palavra-passe expirou",
Expand Down Expand Up @@ -252,6 +256,8 @@
"@personal_assistance": {},
"press_again": "Pressione novamente para sair",
"@press_again": {},
"program": "Programa",
"@program": {},
"print": "Impressão",
"@print": {},
"prints": "Impressões",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:flutter_widget_from_html_core/flutter_widget_from_html_core.dart';
import 'package:provider/provider.dart';
import 'package:uni/controller/fetchers/book_fetcher.dart';
import 'package:uni/generated/l10n.dart';
import 'package:uni/model/entities/course_units/sheet.dart';
import 'package:uni/model/providers/startup/profile_provider.dart';
import 'package:uni/model/providers/startup/session_provider.dart';
Expand Down Expand Up @@ -37,18 +38,23 @@ class CourseUnitSheetView extends StatelessWidget {
secondChild:
buildExpandedProfessors(context, courseUnitSheet.professors),
),
_buildCard('Programa', courseUnitSheet.content),
_buildCard('Avaliação', courseUnitSheet.evaluation),
const Opacity(
opacity: 0.25,
child: Divider(color: Colors.grey),
_buildCard(S.of(context).program, courseUnitSheet.content, context),
_buildCard(
S.of(context).evaluation,
courseUnitSheet.evaluation,
context,
),
const Text(
'Bibliografia',
style: TextStyle(fontSize: 20),
),
if (courseUnitSheet.books.isNotEmpty)
if (courseUnitSheet.books.isNotEmpty) ...[
const Opacity(
opacity: 0.25,
child: Divider(color: Colors.grey),
),
Text(
S.of(context).bibliography,
style: const TextStyle(fontSize: 20),
),
buildBooksRow(context, courseUnitSheet.books),
],
],
),
),
Expand Down Expand Up @@ -215,7 +221,8 @@ Widget buildBooksRow(BuildContext context, List<Book> books) {

Widget _buildCard(
String sectionTitle,
dynamic sectionContent,
String sectionContent,
BuildContext context,
) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
Expand All @@ -226,7 +233,9 @@ Widget _buildCard(
child: Divider(color: Colors.grey),
),
GenericExpandable(
content: HtmlWidget(sectionContent.toString()),
content: HtmlWidget(
sectionContent != 'null' ? sectionContent : S.of(context).no_info,
),
title: sectionTitle,
),
],
Expand Down

0 comments on commit 00fc389

Please sign in to comment.