Skip to content

Commit

Permalink
Localisation, Bugfix Disappearing Keyboard in Web App (#86)
Browse files Browse the repository at this point in the history
Co-authored-by: Frank Elsinga <[email protected]>
  • Loading branch information
jakobkoerber and CommanderStorm authored Oct 2, 2023
1 parent 03239de commit 71bcd9a
Show file tree
Hide file tree
Showing 145 changed files with 2,061 additions and 1,463 deletions.
7 changes: 2 additions & 5 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
This version provides the following updates:
- A responsive design for iPad, Tablets and Web App (more improvements coming soon)
- A web app which offers all functionalities
- Several bug fixes
- general UI improvements
- Temporarily the digital student card
- Add Localisation which enables German and English
- Bugfix where users were not able to enter their TUM id while logging in
2 changes: 1 addition & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ SPEC CHECKSUMS:
geolocator_apple: cc556e6844d508c95df1e87e3ea6fa4e58c50401
map_launcher: e325db1261d029ff33e08e03baccffe09593ffea
package_info_plus: fd030dabf36271f146f1f3beacd48f564b0f17f7
path_provider_foundation: eaf5b3e458fc0e5fbb9940fb09980e853fe058b8
path_provider_foundation: 29f094ae23ebbca9d3d0cec13889cd9060c0e943
ReachabilitySwift: 985039c6f7b23a1da463388634119492ff86c825
shared_preferences_foundation: 5b919d13b803cadd15ed2dc053125c68730e5126
sqflite: 31f7eba61e3074736dff8807a9b41581e4f7f15a
Expand Down
2 changes: 1 addition & 1 deletion ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1300;
LastUpgradeCheck = 1430;
ORGANIZATIONNAME = "";
TargetAttributes = {
97C146ED1CF9000F007C117D = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1300"
LastUpgradeVersion = "1430"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
5 changes: 5 additions & 0 deletions ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleLocalizations</key>
<array>
<string>en</string>
<string>de</string>
</array>
<key>CADisableMinimumFrameDurationOnPhone</key>
<true/>
<key>CFBundleDevelopmentRegion</key>
Expand Down
4 changes: 4 additions & 0 deletions l10n.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
arb-dir: lib/base/localization/l10n
template-arb-file: app_en.arb
untranslated-messages-file: lib/base/localization/l10n/translation_todo.json
output-localization-file: app_localizations.dart
5 changes: 3 additions & 2 deletions lib/base/classes/location.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ class Location {

Location({required this.latitude, required this.longitude});

factory Location.fromJson(Map<String, dynamic> json) => _$LocationFromJson(json);
factory Location.fromJson(Map<String, dynamic> json) =>
_$LocationFromJson(json);

Map<String, dynamic> toJson() => _$LocationToJson(this);
}
}
60 changes: 40 additions & 20 deletions lib/base/enums/campus.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,23 @@ extension CampusExtension on Campus {
Location get location {
switch (this) {
case Campus.stammgelaende:
return Location(latitude: 48.14887567648079, longitude: 11.568029074814328);
return Location(
latitude: 48.14887567648079, longitude: 11.568029074814328);
case Campus.olympiapark:
return Location(latitude: 48.17957305879896, longitude: 11.546601863009668);
return Location(
latitude: 48.17957305879896, longitude: 11.546601863009668);
case Campus.klinikumRechts:
return Location(latitude: 48.13760759635786, longitude: 11.60083902677729);
return Location(
latitude: 48.13760759635786, longitude: 11.60083902677729);
case Campus.grosshadern:
return Location(latitude: 48.1116433849602, longitude: 11.47027262422505);
return Location(
latitude: 48.1116433849602, longitude: 11.47027262422505);
case Campus.garching:
return Location(latitude: 48.26513710129958, longitude: 11.671590834492283);
return Location(
latitude: 48.26513710129958, longitude: 11.671590834492283);
case Campus.freising:
return Location(latitude: 48.39549985559942, longitude: 11.727904526510946);
return Location(
latitude: 48.39549985559942, longitude: 11.727904526510946);
}
}

Expand All @@ -42,32 +48,38 @@ extension CampusExtension on Campus {
return Station(
name: "Technische Universität",
apiName: "91000095",
location: Location(latitude: 48.148145129847244, longitude: 11.566048520744298));
location: Location(
latitude: 48.148145129847244, longitude: 11.566048520744298));
case Campus.olympiapark:
return Station(
name: "Olympiazentrum",
apiName: "91000350",
location: Location(latitude: 48.17946648767361, longitude: 11.555783595899824));
location: Location(
latitude: 48.17946648767361, longitude: 11.555783595899824));
case Campus.klinikumRechts:
return Station(
name: "Max-Weber-Platz",
apiName: "91000580",
location: Location(latitude: 48.13573243097588, longitude: 11.599014647301777));
location: Location(
latitude: 48.13573243097588, longitude: 11.599014647301777));
case Campus.grosshadern:
return Station(
name: "Klinikum Großhadern",
apiName: "91001540",
location: Location(latitude: 48.10889880944028, longitude: 11.47363212095666));
location: Location(
latitude: 48.10889880944028, longitude: 11.47363212095666));
case Campus.garching:
return Station(
name: "Forschungszentrum",
apiName: "1000460",
location: Location(latitude: 48.26519145730091, longitude: 11.671545161597082));
location: Location(
latitude: 48.26519145730091, longitude: 11.671545161597082));
case Campus.freising:
return Station(
name: "Freising, Weihenstephan",
apiName: "1002911",
location: Location(latitude: 48.39799498961109, longitude: 11.723989661968458));
location: Location(
latitude: 48.39799498961109, longitude: 11.723989661968458));
}
}

Expand All @@ -79,11 +91,13 @@ extension CampusExtension on Campus {
Station(
name: "Theresienstraße",
apiName: "91000120",
location: Location(latitude: 48.1512235719802, longitude: 11.564211669898931)),
location: Location(
latitude: 48.1512235719802, longitude: 11.564211669898931)),
Station(
name: "Pinakotheken",
apiName: "91000051",
location: Location(latitude: 48.148780089472, longitude: 11.571870970398924))
location: Location(
latitude: 48.148780089472, longitude: 11.571870970398924))
];
case Campus.olympiapark:
return [defaultStation];
Expand All @@ -93,39 +107,45 @@ extension CampusExtension on Campus {
Station(
name: "Friedensengel/Villa Stuck",
apiName: "91000073",
location: Location(latitude: 48.14074544433942, longitude: 11.600075277341709)),
location: Location(
latitude: 48.14074544433942, longitude: 11.600075277341709)),
];
case Campus.grosshadern:
return [
defaultStation,
Station(
name: "Klinikum Großhadern Ost",
apiName: "91001472",
location: Location(latitude: 48.11092668280441, longitude: 11.473909030506093)),
location: Location(
latitude: 48.11092668280441, longitude: 11.473909030506093)),
Station(
name: "Klinikum Großhadern Nord",
apiName: "91001474",
location: Location(latitude: 48.11250562334001, longitude: 11.467122898318992))
location: Location(
latitude: 48.11250562334001, longitude: 11.467122898318992))
];
case Campus.garching:
return [
defaultStation,
Station(
name: "Lichtenbergstraße",
apiName: "1002070",
location: Location(latitude: 48.26777168760462, longitude: 11.665502685140389))
location: Location(
latitude: 48.26777168760462, longitude: 11.665502685140389))
];
case Campus.freising:
return [
defaultStation,
Station(
name: "Freising, Forstzentrum",
apiName: "1009413",
location: Location(latitude: 48.39924842116169, longitude: 11.716601891310122)),
location: Location(
latitude: 48.39924842116169, longitude: 11.716601891310122)),
Station(
name: "Freising, Weihenstephaner Berg",
apiName: "1002617",
location: Location(latitude: 48.39581877364193, longitude: 11.725859432987532))
location: Location(
latitude: 48.39581877364193, longitude: 11.725859432987532))
];
}
}
Expand Down
7 changes: 1 addition & 6 deletions lib/base/enums/gender.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
enum Gender {
male,
female,
nonBinary,
unknown
}
enum Gender { male, female, nonBinary, unknown }
2 changes: 1 addition & 1 deletion lib/base/enums/home_widget.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
enum HomeWidget { cafeteria, studyRoom, calendar, departures }
enum HomeWidget { cafeteria, studyRoom, calendar, departures }
2 changes: 1 addition & 1 deletion lib/base/enums/role.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ enum Role {
final String name;

const Role(this.name);
}
}
2 changes: 1 addition & 1 deletion lib/base/extensions/cast.dart
Original file line number Diff line number Diff line change
@@ -1 +1 @@
T? cast<T>(x) => x is T ? x : null;
T? cast<T>(x) => x is T ? x : null;
4 changes: 2 additions & 2 deletions lib/base/extensions/date_time_week_number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ extension NumberOfWeeks on DateTime {

int weekNumber() {
int dayOfYear = int.parse(DateFormat("D").format(this));
int woy = ((dayOfYear - weekday + 10) / 7).floor();
int woy = ((dayOfYear - weekday + 10) / 7).floor();
if (woy < 1) {
woy = _numOfWeeks(year - 1);
} else if (woy > _numOfWeeks(year)) {
woy = 1;
}
return woy;
}
}
}
13 changes: 13 additions & 0 deletions lib/base/extensions/locale+fullname.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'dart:ui';

extension FullName on Locale {
String fullName() {
switch (languageCode) {
case 'en':
return 'English';
case 'de':
return 'Deutsch';
}
return 'fullName not defined';
}
}
3 changes: 2 additions & 1 deletion lib/base/helpers/card_with_padding.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class CardWithPadding extends StatelessWidget {
final EdgeInsetsGeometry? margin;
final double? height;

const CardWithPadding({super.key, required this.child, this.color, this.margin, this.height});
const CardWithPadding(
{super.key, required this.child, this.color, this.margin, this.height});

@override
Widget build(BuildContext context) {
Expand Down
21 changes: 10 additions & 11 deletions lib/base/helpers/delayed_loading_indicator.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import 'package:campus_flutter/theme.dart';
import 'package:flutter/material.dart';

class DelayedLoadingIndicator extends StatelessWidget {
const DelayedLoadingIndicator({
super.key,
this.name,
this.alternativeLoadingIndicator, this.delayWidget = const SizedBox.shrink()
required this.name,
this.alternativeLoadingIndicator,
this.delayWidget = const SizedBox.shrink(),
});

final String? name;
final String name;
final Widget? alternativeLoadingIndicator;
final Widget delayWidget;

Expand All @@ -22,18 +24,15 @@ class DelayedLoadingIndicator extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const CircularProgressIndicator.adaptive(),
Text(name != null ? "Loading $name" : "Loading")
]
)
);
const CircularProgressIndicator.adaptive(),
Text(context.localizations.loading(name))
]));
} else {
return alternativeLoadingIndicator!;
}
} else {
return delayWidget;
}
}
);
});
}
}
}
45 changes: 25 additions & 20 deletions lib/base/helpers/horizontal_slider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ import 'package:flutter/material.dart';

class HorizontalSlider<E> extends StatelessWidget {
const HorizontalSlider(
{super.key, required this.data, required this.height, required this.child});
{super.key,
required this.data,
required this.height,
required this.child});

final List<E> data;
final Widget Function(E data) child;
Expand All @@ -14,24 +17,26 @@ class HorizontalSlider<E> extends StatelessWidget {
return SizedBox(
height: height,
child: Padding(
padding: EdgeInsets.only(right: orientation == Orientation.landscape ? 10 : 0),
child: ListView(scrollDirection: Axis.horizontal, children: [
for (var indexAndValue in data.indexed) ...[
if (indexAndValue.$1 == 0) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2)
],
if (indexAndValue.$1 == data.length - 1) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2),
if (orientation != Orientation.landscape)
const Padding(padding: EdgeInsets.symmetric(horizontal: 5))
],
if (indexAndValue.$1 != 0 && indexAndValue.$1 != data.length - 1) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2)
]
]
])));
padding: EdgeInsets.only(
right: orientation == Orientation.landscape ? 10 : 0),
child: ListView(scrollDirection: Axis.horizontal, children: [
for (var indexAndValue in data.indexed) ...[
if (indexAndValue.$1 == 0) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2)
],
if (indexAndValue.$1 == data.length - 1) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2),
if (orientation != Orientation.landscape)
const Padding(padding: EdgeInsets.symmetric(horizontal: 5))
],
if (indexAndValue.$1 != 0 &&
indexAndValue.$1 != data.length - 1) ...[
const Padding(padding: EdgeInsets.symmetric(horizontal: 5)),
child(indexAndValue.$2)
]
]
])));
}
}
4 changes: 1 addition & 3 deletions lib/base/helpers/hyperlink_text.dart
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,7 @@ class _HyperlinkTextState extends ConsumerState<HyperLinkText> {
RichText(
text: TextSpan(
text: widget.label,
style: Theme.of(context)
.textTheme
.bodyMedium,
style: Theme.of(context).textTheme.bodyMedium,
recognizer: tapGestureRecognizer
..onTap = () {
if (widget.link != null) {
Expand Down
Loading

0 comments on commit 71bcd9a

Please sign in to comment.