Skip to content

Commit

Permalink
Add localized title to grades page
Browse files Browse the repository at this point in the history
  • Loading branch information
vyPal committed Nov 19, 2024
1 parent 07fb6c1 commit aa1f003
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 26 deletions.
52 changes: 28 additions & 24 deletions lib/grades.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import 'package:eduapge2/api.dart';
import 'package:eduapge2/main.dart';
import 'package:flutter/material.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:flutter_session_manager/flutter_session_manager.dart';

class GradesPage extends StatefulWidget {
final SessionManager sessionManager;
Expand All @@ -17,7 +17,7 @@ class GradesPageState extends BaseState<GradesPage> {
bool loading = true;
late List<TimelineItem> apidataMsg;

late Widget messages;
List<Widget> messages = [];

@override
void initState() {
Expand All @@ -44,8 +44,30 @@ class GradesPageState extends BaseState<GradesPage> {
toolbarHeight: 0,
),
body: !loading
? Stack(
children: <Widget>[messages],
? Card(

Check warning on line 47 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L47

Added line #L47 was not covered by tests
elevation: 5,
child: Padding(

Check warning on line 49 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L49

Added line #L49 was not covered by tests
padding: const EdgeInsets.all(10),
child: Stack(
children: <Widget>[
Text(
AppLocalizations.of(context)!.gradesTitle,

Check warning on line 54 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L51-L54

Added lines #L51 - L54 were not covered by tests
style: const TextStyle(
fontSize: 24,
),
),
Padding(

Check warning on line 59 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L59

Added line #L59 was not covered by tests
padding: const EdgeInsets.only(top: 40),
child: RefreshIndicator(
onRefresh: _pullRefresh,
child: ListView(
children: messages,

Check warning on line 64 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L61-L64

Added lines #L61 - L64 were not covered by tests
),
),
),
],
),
),
)
: Text(AppLocalizations.of(context)!.loading),
backgroundColor: Theme.of(context).colorScheme.surface,
Expand All @@ -64,7 +86,7 @@ class GradesPageState extends BaseState<GradesPage> {
setState(() {}); //refresh UI
}

Widget getMessages(List<TimelineItem> apidataMsg) {
List<Widget> getMessages(List<TimelineItem> apidataMsg) {

Check warning on line 89 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L89

Added line #L89 was not covered by tests
List<Widget> rows = <Widget>[];
apidataMsg = apidataMsg.where((msg) => msg.type == "znamka").toList();

Check warning on line 91 in lib/grades.dart

View check run for this annotation

Codecov / codecov/patch

lib/grades.dart#L91

Added line #L91 was not covered by tests
Map<String, List<String>> grades = {};
Expand All @@ -84,24 +106,6 @@ class GradesPageState extends BaseState<GradesPage> {
),
));
}
return Card(
elevation: 5,
child: Padding(
padding: const EdgeInsets.all(10),
child: Stack(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 40),
child: RefreshIndicator(
onRefresh: _pullRefresh,
child: ListView(
children: rows,
),
),
),
],
),
),
);
return rows;
}
}
3 changes: 2 additions & 1 deletion lib/l10n/app_cs.arb
Original file line number Diff line number Diff line change
Expand Up @@ -149,5 +149,6 @@
"createMessageNotifError": "Chyba",
"createMessageNotifErrorBody": "Při odesílání zprávy se vyskytla chyba, tato chyba byla nahlášena.",
"qrLoginPleaseLogin": "EduPage2 QR Přihlášení",
"qrLoginUseExistingCredentials": "Chystáte se přihlásit pomocí QR kódu"
"qrLoginUseExistingCredentials": "Chystáte se přihlásit pomocí QR kódu",
"gradesTitle": "Známky"
}
3 changes: 2 additions & 1 deletion lib/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -81,5 +81,6 @@
"createMessageNotifError": "Error",
"createMessageNotifErrorBody": "There was an issue sending your message, it has been reported!",
"qrLoginPleaseLogin": "EduPage2 QR Login",
"qrLoginUseExistingCredentials": "You are about to login to EduPage2 using a QR code"
"qrLoginUseExistingCredentials": "You are about to login to EduPage2 using a QR code",
"gradesTitle": "Grades"
}

0 comments on commit aa1f003

Please sign in to comment.