Skip to content

Commit 2b2b615

Browse files
update schoolday event image icons, get rid of lints
1 parent 5de304f commit 2b2b615

144 files changed

Lines changed: 422 additions & 507 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
1.54 KB
Loading
4.29 KB
Loading
6.74 KB
Loading

school_data_hub_flutter/lib/app_utils/create_and_crop_image_file.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Future<File?> createAndCropImageFile(BuildContext context) async {
2626
}
2727
final File? imageFile = await Navigator.push<File?>(
2828
context,
29-
MaterialPageRoute(builder: (context) => CropAvatarView(image: image)),
29+
MaterialPageRoute<File?>(builder: (context) => CropAvatarView(image: image)),
3030
);
3131
return imageFile;
3232
}

school_data_hub_flutter/lib/app_utils/custom_encrypter.dart

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import 'dart:convert';
22
import 'dart:io';
33
import 'dart:math';
4-
import 'dart:typed_data';
54

65
import 'package:flutter/foundation.dart';
76
import 'package:flutter/material.dart';
@@ -19,7 +18,9 @@ Uint8List _normalizeKeyTopLevel(Uint8List keyBytes) {
1918
if (keyBytes.length == 32) return keyBytes;
2019
if (keyBytes.length < 32) {
2120
final k = Uint8List(32);
22-
for (int i = 0; i < keyBytes.length; i++) k[i] = keyBytes[i];
21+
for (int i = 0; i < keyBytes.length; i++) {
22+
k[i] = keyBytes[i];
23+
}
2324
return k;
2425
}
2526
return Uint8List.fromList(keyBytes.sublist(0, 32));
@@ -93,7 +94,9 @@ class CustomEncrypter {
9394
if (keyBytes.length == 32) return Uint8List.fromList(keyBytes);
9495
if (keyBytes.length < 32) {
9596
final k = Uint8List(32);
96-
for (int i = 0; i < keyBytes.length; i++) k[i] = keyBytes[i];
97+
for (int i = 0; i < keyBytes.length; i++) {
98+
k[i] = keyBytes[i];
99+
}
97100
return k;
98101
}
99102
return Uint8List.fromList(keyBytes.sublist(0, 32));
@@ -105,7 +108,9 @@ class CustomEncrypter {
105108

106109
Uint8List _pad16(List<int> b) {
107110
final out = Uint8List(16);
108-
for (int i = 0; i < b.length && i < 16; i++) out[i] = b[i];
111+
for (int i = 0; i < b.length && i < 16; i++) {
112+
out[i] = b[i];
113+
}
109114
return out;
110115
}
111116

@@ -244,37 +249,38 @@ class CustomEncrypter {
244249
// Try new format first (IV prepended).
245250
final iv = encryptedBytes.sublist(0, 16);
246251
final ciphertext = encryptedBytes.sublist(16);
247-
final newResult =
248-
Uint8List.fromList(_decryptCbc(iv, ciphertext, _keyBytes));
252+
final newResult = Uint8List.fromList(
253+
_decryptCbc(iv, ciphertext, _keyBytes),
254+
);
249255
if (_looksLikeImage(newResult)) return newResult;
250256
// Legacy format: entire blob is ciphertext, fixed IV from env (old encrypt package).
251257
if (encryptedBytes.length % 16 != 0) return newResult;
252258
final fixedIv = _fixedIv();
253-
return Uint8List.fromList(
254-
_decryptCbc(fixedIv, encryptedBytes, _keyBytes),
255-
);
259+
return Uint8List.fromList(_decryptCbc(fixedIv, encryptedBytes, _keyBytes));
256260
}
257261

258262
/// Async decryption: resolves key on main isolate and runs CBC in [compute] when in release/profile.
259263
/// Supports both new format (IV + ciphertext) and legacy encrypt-package format (ciphertext only, fixed IV).
260264
Future<Uint8List> decryptTheseBytesAsync(Uint8List encryptedBytes) async {
261265
if (encryptedBytes.length <= 16) return encryptedBytes;
262-
final keyBytes =
263-
Uint8List.fromList(utf8.encode(di<EnvManager>().activeEnv!.key!));
266+
final keyBytes = Uint8List.fromList(
267+
utf8.encode(di<EnvManager>().activeEnv!.key!),
268+
);
264269
if (kReleaseMode || kProfileMode) {
265270
// Try new format first.
266-
Uint8List result = await compute(
267-
decryptBytesWithKey,
268-
<dynamic>[encryptedBytes, keyBytes],
269-
);
271+
Uint8List result = await compute(decryptBytesWithKey, <dynamic>[
272+
encryptedBytes,
273+
keyBytes,
274+
]);
270275
if (_looksLikeImage(result)) return result;
271276
// Legacy format: ciphertext-only with fixed IV (old encrypt package).
272277
if (encryptedBytes.length % 16 != 0) return result;
273278
final fixedIv = _fixedIv();
274-
return compute(
275-
decryptBytesWithKey,
276-
<dynamic>[encryptedBytes, keyBytes, fixedIv],
277-
);
279+
return compute(decryptBytesWithKey, <dynamic>[
280+
encryptedBytes,
281+
keyBytes,
282+
fixedIv,
283+
]);
278284
}
279285
return decryptTheseBytes(encryptedBytes);
280286
}

school_data_hub_flutter/lib/features/_attendance/presentation/widgets/missed_classes_badges_info_dialog.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import 'package:school_data_hub_flutter/features/_attendance/presentation/widget
88
void missedSchooldaysBadgesInformationDialog({
99
required BuildContext context,
1010
bool? isAttendancePage,
11-
}) => showDialog(
11+
}) => showDialog<void>(
1212
context: context,
1313
builder: (newContext) => AlertDialog(
1414
title: const Text('Legende', style: TextStyle(fontWeight: FontWeight.bold)),

school_data_hub_flutter/lib/features/_authorizations/domain/authorization_manager.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import 'dart:io';
44
import 'package:flutter/foundation.dart';
55
import 'package:flutter_cache_manager/flutter_cache_manager.dart';
66
import 'package:flutter_it/flutter_it.dart';
7-
import 'package:listen_it/listen_it.dart';
87
import 'package:school_data_hub_client/school_data_hub_client.dart';
98
import 'package:school_data_hub_flutter/app_utils/custom_encrypter.dart';
109
import 'package:school_data_hub_flutter/common/services/hub_stream_service.dart';
@@ -29,8 +28,8 @@ class AuthorizationManager with ChangeNotifier {
2928

3029
Map<int, Authorization> _authorizationsMap = {};
3130

32-
final Map<String, ValueListenable<PupilAuthorization?>> _pupilAuthListenables =
33-
{};
31+
final Map<String, ValueListenable<PupilAuthorization?>>
32+
_pupilAuthListenables = {};
3433

3534
StreamSubscription<dynamic>? _hubSubscription; // ignore: unused_field
3635

@@ -124,8 +123,7 @@ class AuthorizationManager with ChangeNotifier {
124123
}
125124

126125
void _removePupilAuthListenablesForAuth(int authId) {
127-
_pupilAuthListenables
128-
.removeWhere((key, _) => key.startsWith('$authId-'));
126+
_pupilAuthListenables.removeWhere((key, _) => key.startsWith('$authId-'));
129127
}
130128

131129
/// Returns a [ValueListenable] that notifies only when this pupil's

school_data_hub_flutter/lib/features/_authorizations/presentation/new_authorization_page/new_authorization_page.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ class NewAuthorizationPageState extends State<NewAuthorizationPage> {
257257
onPressed: () async {
258258
final List<int> selectedPupilIds =
259259
await Navigator.of(context).push(
260-
MaterialPageRoute(
260+
MaterialPageRoute<List<int>>(
261261
builder: (ctx) => SelectPupilsListPage(
262262
selectablePupils: _pupilManager
263263
.getPupilsNotListed(pupilIds.toList()),

school_data_hub_flutter/lib/features/_pupil/domain/pupil_identity_helper.dart

Lines changed: 35 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -48,18 +48,22 @@ class PupilIdentityHelper {
4848
return decodedJson.map(
4949
(key, value) => MapEntry(
5050
int.parse(key),
51-
PupilIdentity.fromJson(_normalizeLegacyPupilIdentityJson(
52-
Map<String, dynamic>.from(value as Map))),
51+
PupilIdentity.fromJson(
52+
_normalizeLegacyPupilIdentityJson(
53+
Map<String, dynamic>.from(value as Map),
54+
),
55+
),
5356
),
5457
);
5558
}
5659

5760
/// Normalizes legacy stored identities so fromJson succeeds after model changes.
58-
/// Converts specialNeeds String (e.g. "LE*SQ") to List<String>; ensures new
61+
/// Converts specialNeeds String (e.g. "LE*SQ") to [List<String>]; ensures new
5962
/// fields (deputyGroupTutor, nationality, schoolTransitionRecommendation) exist.
6063
/// TODO: remove after transition has been made in production
6164
static Map<String, dynamic> _normalizeLegacyPupilIdentityJson(
62-
Map<String, dynamic> raw) {
65+
Map<String, dynamic> raw,
66+
) {
6367
final normalized = Map<String, dynamic>.from(raw);
6468

6569
// Legacy: specialNeeds was stored as String, often with '*' between two codes
@@ -77,9 +81,9 @@ class PupilIdentityHelper {
7781
}
7882
}
7983

80-
normalized['deputyGroupTutor'] ??= null;
81-
normalized['nationality'] ??= null;
82-
normalized['schoolTransitionRecommendation'] ??= null;
84+
normalized['deputyGroupTutor'];
85+
normalized['nationality'];
86+
normalized['schoolTransitionRecommendation'];
8387
normalized['migrationBackground'] ??= false;
8488

8589
return normalized;
@@ -179,16 +183,19 @@ class PupilIdentityHelper {
179183
groupTutor: pupilIdentityStringItems[4],
180184
schoolGrade: schoolgrade,
181185
specialNeeds: _specialNeedsListFromCanonical(
182-
pupilIdentityStringItems[6], pupilIdentityStringItems[7]),
186+
pupilIdentityStringItems[6],
187+
pupilIdentityStringItems[7],
188+
),
183189
deputyGroupTutor: pupilIdentityStringItems.length > 21
184190
? _emptyToNull(pupilIdentityStringItems[21])
185191
: null,
186192
gender: pupilIdentityStringItems[8],
187193
language: pupilIdentityStringItems[9],
188194
migrationBackground: _parseBoolCanonical(
189-
pupilIdentityStringItems.length > 10
190-
? pupilIdentityStringItems[10]
191-
: ''),
195+
pupilIdentityStringItems.length > 10
196+
? pupilIdentityStringItems[10]
197+
: '',
198+
),
192199
nationality: pupilIdentityStringItems.length > 22
193200
? _emptyToNull(pupilIdentityStringItems[22])
194201
: null,
@@ -216,20 +223,22 @@ class PupilIdentityHelper {
216223
leavingDate: pupilIdentityStringItems[20] == ''
217224
? null
218225
: pupilIdentityStringItems[20].tryToDateOnlyUtc(),
219-
schoolTransitionRecommendation:
220-
pupilIdentityStringItems.length > 23
221-
? _emptyToNull(pupilIdentityStringItems[23])
222-
: null,
226+
schoolTransitionRecommendation: pupilIdentityStringItems.length > 23
227+
? _emptyToNull(pupilIdentityStringItems[23])
228+
: null,
223229
);
224230

225231
return newPupilIdentity;
226232
}
227233

228-
static List<String>? _specialNeedsListFromCanonical(String col6, String col7) {
229-
final list = [col6, col7]
230-
.map((e) => e.trim())
231-
.where((e) => e.isNotEmpty)
232-
.toList();
234+
static List<String>? _specialNeedsListFromCanonical(
235+
String col6,
236+
String col7,
237+
) {
238+
final list = [
239+
col6,
240+
col7,
241+
].map((e) => e.trim()).where((e) => e.isNotEmpty).toList();
233242
return list.isEmpty ? null : list;
234243
}
235244

@@ -240,7 +249,12 @@ class PupilIdentityHelper {
240249

241250
static bool _parseBoolCanonical(String s) {
242251
final t = s.trim().toLowerCase();
243-
return t == 'true' || t == '1' || t == 'ja' || t == 'j' || t == 'x' || t == 'yes';
252+
return t == 'true' ||
253+
t == '1' ||
254+
t == 'ja' ||
255+
t == 'j' ||
256+
t == 'x' ||
257+
t == 'yes';
244258
}
245259

246260
Future<String> generateEncryptedPupilIdentitiesTransferString(

school_data_hub_flutter/lib/features/_pupil/domain/pupil_identity_stream_suscription.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class PupilIdentityStream {
203203
);
204204
return false;
205205
}
206-
final session = await crypto!.completeSession(
206+
final session = await crypto.completeSession(
207207
pendingHandshakeResult!.myEphemeralPrivateBytes,
208208
pendingHandshakeResult!.myEphemeralPublicBytes,
209209
handshake.pubKeyBase64,

0 commit comments

Comments
 (0)