fixed warns and timetable thing again

This commit is contained in:
Kima 2023-09-18 20:22:42 +02:00
parent 6d7a21dc02
commit c4dc03f41d
4 changed files with 10 additions and 7 deletions

View File

@ -20,7 +20,6 @@ class Ad {
});
factory Ad.fromJson(Map json) {
print(json);
return Ad(
title: json['title'] ?? 'Ad',
description: json['description'] ?? '',

View File

@ -26,6 +26,8 @@ class KretaClient {
late final UserProvider _user;
late final StatusProvider _status;
bool _loginRefreshing = false;
KretaClient({
this.accessToken,
required SettingsProvider settings,
@ -164,6 +166,9 @@ class KretaClient {
}
Future<void> refreshLogin() async {
if (_loginRefreshing) return;
_loginRefreshing = true;
User? loginUser = _user.user;
if (loginUser == null) return;
@ -215,5 +220,7 @@ class KretaClient {
}
}
}
_loginRefreshing = false;
}
}

View File

@ -5,7 +5,7 @@ import 'package:filcnaplo_kreta_api/client/api.dart';
import 'package:filcnaplo_kreta_api/client/client.dart';
import 'package:filcnaplo_kreta_api/models/lesson.dart';
import 'package:filcnaplo_kreta_api/models/week.dart';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
class TimetableProvider with ChangeNotifier {
Map<Week, List<Lesson>> lessons = {};
@ -69,14 +69,14 @@ class TimetableProvider with ChangeNotifier {
.getAPI(KretaAPI.timetable(iss, start: week.start, end: week.end));
if (lessonsJson == null) {
if (kDebugMode) print('Cannot fetch Lessons for User ${user.id}');
return;
// throw "Cannot fetch Lessons for User ${user.id}";
} else {
List<Lesson> lessonsList =
lessonsJson.map((e) => Lesson.fromJson(e)).toList();
if (lessons.isEmpty) return;
lessons[week] = lessonsList;
await store();

View File

@ -13,9 +13,6 @@ class AdTile extends StatelessWidget {
@override
Widget build(BuildContext context) {
print('geic');
print(ad);
return Padding(
padding: padding ?? const EdgeInsets.symmetric(horizontal: 8.0),
child: PanelButton(