fix: alot

This commit is contained in:
2026-10-19 21:41:34 +02:00
parent 30dd74af90
commit b0074aeb3f
40 changed files with 1979 additions and 405 deletions
+1 -3
View File
@@ -65,9 +65,7 @@ class AppUpdateUtil {
final url = Uri.parse('$serverUrl/api/update?version=$version');
final response = await http.get(url);
debugPrint('Response from update server: ${response.body}');
final response = await http.get(url).timeout(const Duration(seconds: 15));
if (response.statusCode != 200) {
throw Exception('Update server unavailable');
+13
View File
@@ -2,6 +2,19 @@ import 'package:intl/intl.dart';
final _euro = NumberFormat.currency(locale: 'nl_BE', symbol: '€');
final _euroInput = RegExp(r'^(\d{1,6})(?:[.,](\d{1,2}))?$');
extension Cents on int {
String get asEuro => _euro.format(this / 100);
}
/// Parses a typed price like `2,50` or `3` without going through doubles.
/// Returns null for anything else, including more than two decimals.
int? parseEuroToCents(String input) {
final match = _euroInput.firstMatch(input.trim());
if (match == null) return null;
final euros = int.parse(match.group(1)!);
final cents = int.parse((match.group(2) ?? '0').padRight(2, '0'));
return euros * 100 + cents;
}