Skip to content

Commit 4383330

Browse files
Update color scheme for dark/light mode and remove beta message (#333)
Co-authored-by: Kordian Bruck <kordianbruck@users.noreply.github.com>
1 parent 076b999 commit 4383330

7 files changed

Lines changed: 90 additions & 47 deletions

File tree

assets/translations/de.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
"other": "{} freie Räume"
111111
},
112112
"mealPlans": "Essenspläne",
113+
"studentCardUnavailableSummer": "Dein Studierendenausweiß ist derzeit nicht verfügbar. Er wird zu Beginn des Sommersemesters am {} verfügbar sein.",
114+
"studentCardUnavailableWinter": "Dein Studierendenausweiß ist derzeit nicht verfügbar. Er wird zu Beginn des Wintersemesters am {} verfügbar sein.",
113115
"noEntriesFound": "Keine {} gefunden!",
114116
"enterQueryStart": "Stelle eine Suchanfrage",
115117
"personalLectures": "Persönliche Vorlesungen",
@@ -176,7 +178,7 @@
176178
"delete": "Löschen",
177179
"deviceSettings": "Geräte-Einstellungen",
178180
"edit": "Editieren",
179-
"digitalStudentCard": "Digitale StudentCard",
181+
"digitalStudentCard": "StudentCard",
180182
"currentlyInBeta": "Aktuell in Testphase mit eingeschränkter Funktionalität!",
181183
"validUntil": "Gültig bis",
182184
"libraryBarcode": "Bibliotheks-Barcode",

assets/translations/en.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@
110110
"other": "{} free rooms"
111111
},
112112
"mealPlans": "Meal Plans",
113+
"studentCardUnavailableSummer": "Your Student Card is currently not available. It will become available at the start of the Summer Semester on {}.",
114+
"studentCardUnavailableWinter": "Your Student Card is currently not available. It will become available at the start of the start of the Winter Semester on {}.",
113115
"noEntriesFound": "No {} Found!",
114116
"enterQueryStart": "Enter a Query to Start",
115117
"personalLectures": "Personal Lectures",
@@ -176,7 +178,7 @@
176178
"delete": "Delete",
177179
"deviceSettings": "Device Settings",
178180
"edit": "Edit",
179-
"digitalStudentCard": "Digital StudentCard",
181+
"digitalStudentCard": "StudentCard",
180182
"currentlyInBeta": "Currently in Beta with Limited Functionality!",
181183
"validUntil": "Valid until",
182184
"libraryBarcode": "Library Barcode",

lib/base/theme/constants.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import 'package:flutter/material.dart';
22

33
const Color primaryLightColor = Color(0xff0064BC);
4-
const Color primaryDarkColor = Color(0xff3070B3);
4+
const Color primaryDarkColor = Color.fromARGB(255, 100, 160, 200);
55
const Color lightBackground = Color(0xfff2f2f7);
66
const Color darkBackground = Color(0xff191919);
77
const Color lightGray = Color(0xffAAAAAA);

lib/navigation_service.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,12 @@ class NavigationService {
2828
Widget title(int index, BuildContext context) {
2929
switch (index) {
3030
case 0:
31+
final isDark = Theme.of(context).brightness == Brightness.dark;
32+
3133
return Image.asset(
32-
'assets/images/logos/tum-logo-blue.png',
34+
isDark
35+
? 'assets/images/logos/tum-logo-white.png'
36+
: 'assets/images/logos/tum-logo-blue.png',
3337
fit: BoxFit.cover,
3438
height: 20,
3539
);

lib/studentCardComponent/views/information_view.dart

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -69,26 +69,43 @@ class InformationView extends StatelessWidget {
6969
);
7070
}
7171

72+
7273
Widget _titleLogo(BuildContext context) {
73-
return Row(
74-
mainAxisAlignment: MainAxisAlignment.center,
75-
children: [
76-
const Spacer(flex: 2),
77-
_tumLogo(),
78-
const Spacer(),
79-
_title(context),
80-
const Spacer(flex: 2),
81-
],
82-
);
83-
}
74+
return Row(
75+
children: [
76+
Expanded(
77+
flex: 1, // 1/3 of the width
78+
child: Center(
79+
child: Padding(
80+
padding: const EdgeInsets.only( right: 10.0),
81+
child: _tumLogo(context),
82+
),
83+
),
84+
),
85+
Expanded(
86+
flex: 2, // 2/3 of the width
87+
child: Center(
88+
child: _title(context),
89+
),
90+
),
91+
],
92+
);
93+
}
8494

85-
Widget _tumLogo() {
86-
return Image.asset(
87-
'assets/images/logos/tum-logo-blue.png',
95+
Widget _tumLogo(BuildContext context) {
96+
final isDark = Theme.of(context).brightness == Brightness.dark;
97+
98+
return Padding(
99+
padding: const EdgeInsets.all(0.0),
100+
child: Image.asset(
101+
isDark
102+
? 'assets/images/logos/tum-logo-white.png'
103+
: 'assets/images/logos/tum-logo-blue.png',
88104
fit: BoxFit.contain,
89105
height: 25,
90-
);
91-
}
106+
),
107+
);
108+
}
92109

93110
Widget _profileImage() {
94111
return Expanded(
@@ -106,7 +123,7 @@ class InformationView extends StatelessWidget {
106123
context.tr("digitalStudentCard"),
107124
style: Theme.of(
108125
context,
109-
).textTheme.titleLarge?.apply(color: context.primaryColor),
126+
).textTheme.titleLarge?.apply(color: Theme.of(context).colorScheme.onSurface),
110127
);
111128
}
112129

@@ -115,7 +132,7 @@ class InformationView extends StatelessWidget {
115132
studentCard.name,
116133
style: Theme.of(
117134
context,
118-
).textTheme.titleLarge?.copyWith(color: context.primaryColor),
135+
).textTheme.titleLarge?.copyWith(color: Theme.of(context).colorScheme.onSurface),
119136
);
120137
}
121138

lib/studentCardComponent/views/student_card_view.dart

Lines changed: 42 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'package:campus_flutter/base/enums/error_handling_view_type.dart';
22
import 'package:campus_flutter/base/errorHandling/error_handling_router.dart';
33
import 'package:campus_flutter/base/extensions/context.dart';
4-
import 'package:campus_flutter/base/util/card_with_padding.dart';
54
import 'package:campus_flutter/base/util/delayed_loading_indicator.dart';
65
import 'package:campus_flutter/base/util/last_updated_text.dart';
76
import 'package:campus_flutter/studentCardComponent/viewModel/student_card_viewmodel.dart';
@@ -30,16 +29,14 @@ class StudentCardView extends ConsumerWidget {
3029
return Column(
3130
children: [
3231
_header(lastFetched, context, ref),
33-
_warningCard(context),
3432
InformationView(studentCard: data),
3533
if (data.libraryCode ?? data.libraryID case final payload?)
3634
BarCodeView(payload: payload),
3735
],
3836
);
3937
} else {
40-
return Center(
41-
child: Text(context.tr("noEntriesFound", args: ["StudentCard"])),
42-
);
38+
return
39+
studentCardMessage(context);
4340
}
4441
} else if (snapshot.hasError) {
4542
return ErrorHandlingRouter(
@@ -73,25 +70,45 @@ class StudentCardView extends ConsumerWidget {
7370
);
7471
}
7572

76-
Widget _warningCard(BuildContext context) {
77-
return CardWithPadding(
78-
elevation: 0,
79-
color: context.primaryColor.withValues(alpha: 0.2),
80-
child: Row(
81-
mainAxisAlignment: MainAxisAlignment.center,
82-
crossAxisAlignment: CrossAxisAlignment.center,
83-
children: [
84-
Icon(Icons.warning, color: context.primaryColor),
85-
const Padding(padding: EdgeInsets.symmetric(horizontal: 8.0)),
86-
Expanded(
87-
child: Text(
88-
context.tr("currentlyInBeta"),
89-
style: TextStyle(color: context.primaryColor),
90-
textAlign: TextAlign.center,
91-
),
92-
),
93-
],
94-
),
73+
}
74+
Widget studentCardMessage(BuildContext context) {
75+
final now = DateTime.now();
76+
77+
// Sommersemester beginnt 01.04., Wintersemester beginnt 01.10.
78+
final startSummer = DateTime(now.year, 4, 1);
79+
final startWinter = DateTime(now.year, 10, 1);
80+
81+
String message;
82+
String semesterStartDate;
83+
84+
if (now.isBefore(startSummer)) {
85+
// Nächstes Semester ist Sommersemester
86+
semesterStartDate = "01.04.";
87+
message = context.tr(
88+
"studentCardUnavailableSummer",
89+
args: [semesterStartDate],
90+
);
91+
} else if (now.isBefore(startWinter)) {
92+
// Nächstes Semester ist Wintersemester
93+
semesterStartDate = "01.10.";
94+
message = context.tr(
95+
"studentCardUnavailableWinter",
96+
args: [semesterStartDate],
97+
);
98+
} else {
99+
// Nach 01.10., nächstes Semester ist wieder Sommersemester im nächsten Jahr
100+
semesterStartDate = "01.04."; // Optional: kann auch Jahr anhängen
101+
message = context.tr(
102+
"studentCardUnavailableSummer",
103+
args: [semesterStartDate],
95104
);
96105
}
97-
}
106+
107+
return Center(
108+
child: Text(
109+
message,
110+
textAlign: TextAlign.center,
111+
style: Theme.of(context).textTheme.titleLarge, // larger than bodyMedium
112+
),
113+
);
114+
}

pubspec.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@ flutter:
113113
- assets/translations/
114114
- assets/mapStyles/
115115
- assets/images/logos/tum-logo-blue.png
116+
- assets/images/logos/tum-logo-white.png
116117
- assets/images/logos/tum-logo-blue-text.png
117118
- assets/images/logos/tum-logo-rainbow.png
118119
- assets/images/placeholders/portrait_placeholder.png

0 commit comments

Comments
 (0)