Warnings removed

main
joschy2002 2025-06-26 12:25:07 +02:00
parent 1c0734b6e7
commit 58080c09f1
3 changed files with 10 additions and 29 deletions

View File

@ -201,8 +201,8 @@ class _CalendarTabState extends State<CalendarTab> {
final timeParts = (timeStr as String).split(':'); final timeParts = (timeStr as String).split(':');
if (timeParts.length != 2) return; if (timeParts.length != 2) return;
final hour = int.tryParse(timeParts[0]) ?? 0; //final hour = int.tryParse(timeParts[0]) ?? 0;
final minute = int.tryParse(timeParts[1]) ?? 0; //final minute = int.tryParse(timeParts[1]) ?? 0;
final duration = trainingDurations[day] ?? 60; final duration = trainingDurations[day] ?? 60;
final targetWeekday = weekdays[day] ?? 1; final targetWeekday = weekdays[day] ?? 1;
@ -391,7 +391,7 @@ class _CalendarTabState extends State<CalendarTab> {
), ),
], ],
), ),
) ?? false; ); //?? false;
} }
} }
} }
@ -512,7 +512,7 @@ class _CalendarTabState extends State<CalendarTab> {
if (trainingId != null && trainingId.startsWith('weekly_')) { if (trainingId != null && trainingId.startsWith('weekly_')) {
// Füge das Datum zu cancelledTrainings hinzu, wenn es noch nicht existiert // Füge das Datum zu cancelledTrainings hinzu, wenn es noch nicht existiert
if (!cancelledTrainings.any((cancelled) => if (!cancelledTrainings.any((cancelled) =>
cancelled is Map<String, dynamic> && //cancelled is Map<String, dynamic> &&
cancelled['date'] == dateString cancelled['date'] == dateString
)) { )) {
cancelledTrainings.add({ cancelledTrainings.add({
@ -552,7 +552,7 @@ class _CalendarTabState extends State<CalendarTab> {
// Wenn an diesem Tag kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings // Wenn an diesem Tag kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings
if (!trainingTimes.containsKey(weekdayName)) { if (!trainingTimes.containsKey(weekdayName)) {
cancelledTrainings.removeWhere((cancelled) => cancelledTrainings.removeWhere((cancelled) =>
cancelled is Map<String, dynamic> && //cancelled is Map<String, dynamic> &&
cancelled.containsKey('date') && cancelled.containsKey('date') &&
cancelled['date'] == dateString cancelled['date'] == dateString
); );
@ -671,25 +671,6 @@ class _CalendarTabState extends State<CalendarTab> {
} }
} }
int _getDaysUntilNext(String day, int currentWeekday) {
final weekdays = {
'Montag': 1,
'Dienstag': 2,
'Mittwoch': 3,
'Donnerstag': 4,
'Freitag': 5,
'Samstag': 6,
'Sonntag': 7,
};
final targetWeekday = weekdays[day] ?? 1;
var daysUntilNext = targetWeekday - currentWeekday;
if (daysUntilNext <= 0) {
daysUntilNext += 7;
}
return daysUntilNext;
}
List<Map<String, dynamic>> _getEventsForDay(DateTime day) { List<Map<String, dynamic>> _getEventsForDay(DateTime day) {
final normalizedDate = DateTime(day.year, day.month, day.day); final normalizedDate = DateTime(day.year, day.month, day.day);
return _events[normalizedDate] ?? []; return _events[normalizedDate] ?? [];
@ -1141,7 +1122,7 @@ class _CalendarTabState extends State<CalendarTab> {
// Wenn an diesem Tag ein regelmäßiges Training stattfindet, füge es zu cancelledTrainings hinzu // Wenn an diesem Tag ein regelmäßiges Training stattfindet, füge es zu cancelledTrainings hinzu
if (trainingTimes.containsKey(weekdayName)) { if (trainingTimes.containsKey(weekdayName)) {
if (!cancelledTrainings.any((cancelled) => if (!cancelledTrainings.any((cancelled) =>
cancelled is Map<String, dynamic> && //cancelled is Map<String, dynamic> &&
cancelled['date'] == dateString cancelled['date'] == dateString
)) { )) {
cancelledTrainings.add({ cancelledTrainings.add({
@ -1151,7 +1132,7 @@ class _CalendarTabState extends State<CalendarTab> {
} else { } else {
// Wenn kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings // Wenn kein regelmäßiges Training stattfindet, entferne den Eintrag aus cancelledTrainings
cancelledTrainings.removeWhere((cancelled) => cancelledTrainings.removeWhere((cancelled) =>
cancelled is Map<String, dynamic> && //cancelled is Map<String, dynamic> &&
cancelled.containsKey('date') && cancelled.containsKey('date') &&
cancelled['date'] == dateString cancelled['date'] == dateString
); );

View File

@ -76,7 +76,7 @@ class _HomeScreenState extends State<HomeScreen> {
final exercisesSnapshot = await FirebaseFirestore.instance.collection('Training').get(); final exercisesSnapshot = await FirebaseFirestore.instance.collection('Training').get();
final allExercises = exercisesSnapshot.docs.map((doc) { final allExercises = exercisesSnapshot.docs.map((doc) {
return {'id': doc.id, ...doc.data() as Map<String, dynamic>}; return {'id': doc.id, ...doc.data()};
}).toList(); }).toList();
// 3. Filter for unused and highly rated exercises // 3. Filter for unused and highly rated exercises

View File

@ -18,7 +18,7 @@ class ProfileTab extends StatefulWidget {
class _ProfileTabState extends State<ProfileTab> { class _ProfileTabState extends State<ProfileTab> {
// Form key for validating the profile form. // Form key for validating the profile form.
final _formKey = GlobalKey<FormState>(); //final _formKey = GlobalKey<FormState>();
// Indicates if the user is a trainer. // Indicates if the user is a trainer.
bool _isTrainer = false; bool _isTrainer = false;
// Indicates if data is currently loading. // Indicates if data is currently loading.
@ -157,7 +157,7 @@ class _ProfileTabState extends State<ProfileTab> {
// Remove cancelledTrainings for these dates. // Remove cancelledTrainings for these dates.
cancelledTrainings.removeWhere((cancelled) => cancelledTrainings.removeWhere((cancelled) =>
cancelled is Map<String, dynamic> && //cancelled is Map<String, dynamic> &&
cancelled.containsKey('date') && cancelled.containsKey('date') &&
newTrainingDates.contains(cancelled['date']) newTrainingDates.contains(cancelled['date'])
); );