Fehlerkorrekturen, #578

This commit is contained in:
Sven committed 2024-05-13 15:44:50 +02:00
1 parent c81df4be41
commit 7c2f5369ab
7 files changed
+163 -16

No files matched your search

+22 -2
View File
@@ -11,6 +11,7 @@ import 'package:stadtbote/tools/constants.dart';
import 'package:stadtbote/tools/message_service.dart'; import 'package:stadtbote/tools/message_service.dart';
import 'package:stadtbote/tools/messages/publish_payload_message.dart'; import 'package:stadtbote/tools/messages/publish_payload_message.dart';
import 'package:stadtbote/tools/messages/ranking_updated.dart'; import 'package:stadtbote/tools/messages/ranking_updated.dart';
import 'package:badges/badges.dart' as badges;
import '../tools/util.dart'; import '../tools/util.dart';
@@ -138,7 +139,25 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
var vehicle = rank.vehicles[j]; var vehicle = rank.vehicles[j];
var imageFilename = vehicle.self == true ? "assets/mein_${mapVehicleTypeToImageName(vehicle.type)}" : "assets/${mapVehicleTypeToImageName(vehicle.type)}"; var imageFilename = vehicle.self == true ? "assets/mein_${mapVehicleTypeToImageName(vehicle.type)}" : "assets/${mapVehicleTypeToImageName(vehicle.type)}";
entries.add(Container( entries.add(
badges.Badge(
showBadge: vehicle.cnt != null && vehicle.cnt! > 0,
position: badges.BadgePosition.topEnd(top: -12, end: 0),
badgeContent: Text(
vehicle.cnt.toString(),
style: const TextStyle(
color: Colors.white,
fontSize: 12,
),
),
badgeStyle: badges.BadgeStyle(
badgeColor: Colors.red,
padding: const EdgeInsets.all(8),
borderRadius: BorderRadius.circular(4),
borderSide: const BorderSide(color: Colors.white, width: 0),
elevation: 0,
),
child: Container(
padding: const EdgeInsets.all(4), padding: const EdgeInsets.all(4),
margin: const EdgeInsets.all(2), margin: const EdgeInsets.all(2),
decoration: BoxDecoration( decoration: BoxDecoration(
@@ -160,7 +179,8 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
), ),
], ],
), ),
)); )),
);
} }
columns.add(Align( columns.add(Align(
-1
View File
@@ -1,4 +1,3 @@
import 'package:flutter/foundation.dart';
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
part 'pictures.g.dart'; part 'pictures.g.dart';
+2
View File
@@ -44,6 +44,8 @@ class Vehicle {
late int type; late int type;
late int? cnt;
@JsonKey(name: 'self', defaultValue: false) @JsonKey(name: 'self', defaultValue: false)
late bool? self; late bool? self;
+90 -11
View File
@@ -949,18 +949,23 @@ const VehicleSchema = Schema(
name: r'Vehicle', name: r'Vehicle',
id: -21624847921258799, id: -21624847921258799,
properties: { properties: {
r'id': PropertySchema( r'cnt': PropertySchema(
id: 0, id: 0,
name: r'cnt',
type: IsarType.long,
),
r'id': PropertySchema(
id: 1,
name: r'id', name: r'id',
type: IsarType.long, type: IsarType.long,
), ),
r'self': PropertySchema( r'self': PropertySchema(
id: 1, id: 2,
name: r'self', name: r'self',
type: IsarType.bool, type: IsarType.bool,
), ),
r'type': PropertySchema( r'type': PropertySchema(
id: 2, id: 3,
name: r'type', name: r'type',
type: IsarType.long, type: IsarType.long,
) )
@@ -986,9 +991,10 @@ void _vehicleSerialize(
List<int> offsets, List<int> offsets,
Map<Type, List<int>> allOffsets, Map<Type, List<int>> allOffsets,
) { ) {
writer.writeLong(offsets[0], object.id); writer.writeLong(offsets[0], object.cnt);
writer.writeBool(offsets[1], object.self); writer.writeLong(offsets[1], object.id);
writer.writeLong(offsets[2], object.type); writer.writeBool(offsets[2], object.self);
writer.writeLong(offsets[3], object.type);
} }
Vehicle _vehicleDeserialize( Vehicle _vehicleDeserialize(
@@ -998,9 +1004,10 @@ Vehicle _vehicleDeserialize(
Map<Type, List<int>> allOffsets, Map<Type, List<int>> allOffsets,
) { ) {
final object = Vehicle(); final object = Vehicle();
object.id = reader.readLong(offsets[0]); object.cnt = reader.readLongOrNull(offsets[0]);
object.self = reader.readBoolOrNull(offsets[1]); object.id = reader.readLong(offsets[1]);
object.type = reader.readLong(offsets[2]); object.self = reader.readBoolOrNull(offsets[2]);
object.type = reader.readLong(offsets[3]);
return object; return object;
} }
@@ -1012,10 +1019,12 @@ P _vehicleDeserializeProp<P>(
) { ) {
switch (propertyId) { switch (propertyId) {
case 0: case 0:
return (reader.readLong(offset)) as P; return (reader.readLongOrNull(offset)) as P;
case 1: case 1:
return (reader.readBoolOrNull(offset)) as P; return (reader.readLong(offset)) as P;
case 2: case 2:
return (reader.readBoolOrNull(offset)) as P;
case 3:
return (reader.readLong(offset)) as P; return (reader.readLong(offset)) as P;
default: default:
throw IsarError('Unknown property with id $propertyId'); throw IsarError('Unknown property with id $propertyId');
@@ -1024,6 +1033,74 @@ P _vehicleDeserializeProp<P>(
extension VehicleQueryFilter extension VehicleQueryFilter
on QueryBuilder<Vehicle, Vehicle, QFilterCondition> { on QueryBuilder<Vehicle, Vehicle, QFilterCondition> {
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntIsNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNull(
property: r'cnt',
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntIsNotNull() {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(const FilterCondition.isNotNull(
property: r'cnt',
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntEqualTo(int? value) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo(
property: r'cnt',
value: value,
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntGreaterThan(
int? value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.greaterThan(
include: include,
property: r'cnt',
value: value,
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntLessThan(
int? value, {
bool include = false,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.lessThan(
include: include,
property: r'cnt',
value: value,
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> cntBetween(
int? lower,
int? upper, {
bool includeLower = true,
bool includeUpper = true,
}) {
return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.between(
property: r'cnt',
lower: lower,
includeLower: includeLower,
upper: upper,
includeUpper: includeUpper,
));
});
}
QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> idEqualTo(int value) { QueryBuilder<Vehicle, Vehicle, QAfterFilterCondition> idEqualTo(int value) {
return QueryBuilder.apply(this, (query) { return QueryBuilder.apply(this, (query) {
return query.addFilterCondition(FilterCondition.equalTo( return query.addFilterCondition(FilterCondition.equalTo(
@@ -1191,10 +1268,12 @@ Map<String, dynamic> _$RankToJson(Rank instance) => <String, dynamic>{
Vehicle _$VehicleFromJson(Map<String, dynamic> json) => Vehicle() Vehicle _$VehicleFromJson(Map<String, dynamic> json) => Vehicle()
..id = json['id'] as int ..id = json['id'] as int
..type = json['type'] as int ..type = json['type'] as int
..cnt = json['cnt'] as int?
..self = json['self'] as bool? ?? false; ..self = json['self'] as bool? ?? false;
Map<String, dynamic> _$VehicleToJson(Vehicle instance) => <String, dynamic>{ Map<String, dynamic> _$VehicleToJson(Vehicle instance) => <String, dynamic>{
'id': instance.id, 'id': instance.id,
'type': instance.type, 'type': instance.type,
'cnt': instance.cnt,
'self': instance.self, 'self': instance.self,
}; };
+7 -1
View File
@@ -52,6 +52,8 @@ import 'util.dart';
enum ConnectionStateEnum { notConnected, connected } enum ConnectionStateEnum { notConnected, connected }
//const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('app_icon');
class MqttCore { class MqttCore {
late ConnectionStateEnum connectionState = ConnectionStateEnum.notConnected; late ConnectionStateEnum connectionState = ConnectionStateEnum.notConnected;
@@ -356,6 +358,8 @@ class MqttCore {
await Util.playMp3('asbeep.mp3'); await Util.playMp3('asbeep.mp3');
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage)); MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
} }
@@ -442,7 +446,9 @@ class MqttCore {
var jsonMap = handshakeMessage.toJson(); var jsonMap = handshakeMessage.toJson();
var json = Uri.encodeFull(jsonEncode(jsonMap)); var json = Uri.encodeFull(jsonEncode(jsonMap));
var uri = "https://test-app-server.assecutor.org/bootstrap?json=$json"; //var uri = "https://test-app-server.assecutor.org/bootstrap?json=$json";
var uri = "https://bootstrap.assecutor.de/bootstrap?json=$json";
Util.logInfo("Bootstrap request: $uri"); Util.logInfo("Bootstrap request: $uri");
var response = await http.get(Uri.parse(uri)); var response = await http.get(Uri.parse(uri));
+40
View File
@@ -305,6 +305,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.2.0" version: "1.2.0"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
device_info_plus: device_info_plus:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -502,6 +510,30 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.3" version: "2.0.3"
flutter_local_notifications:
dependency: "direct main"
description:
name: flutter_local_notifications
sha256: "40e6fbd2da7dcc7ed78432c5cdab1559674b4af035fddbfb2f9a8f9c2112fcef"
url: "https://pub.dev"
source: hosted
version: "17.1.2"
flutter_local_notifications_linux:
dependency: transitive
description:
name: flutter_local_notifications_linux
sha256: "33f741ef47b5f63cc7f78fe75eeeac7e19f171ff3c3df054d84c1e38bedb6a03"
url: "https://pub.dev"
source: hosted
version: "4.0.0+1"
flutter_local_notifications_platform_interface:
dependency: transitive
description:
name: flutter_local_notifications_platform_interface
sha256: "340abf67df238f7f0ef58f4a26d2a83e1ab74c77ab03cd2b2d5018ac64db30b7"
url: "https://pub.dev"
source: hosted
version: "7.1.0"
flutter_map: flutter_map:
dependency: "direct main" dependency: "direct main"
description: description:
@@ -1357,6 +1389,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.4" version: "2.1.4"
timezone:
dependency: transitive
description:
name: timezone
sha256: a6ccda4a69a442098b602c44e61a1e2b4bf6f5516e875bbf0f427d5df14745d5
url: "https://pub.dev"
source: hosted
version: "0.9.3"
timing: timing:
dependency: transitive dependency: transitive
description: description:
+2 -1
View File
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts # In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix. # of the product and file versions while build-number is used as the build suffix.
version: 303.0.0+303 version: 306.0.0+306
environment: environment:
sdk: '>=2.19.6 <3.0.0' sdk: '>=2.19.6 <3.0.0'
@@ -71,6 +71,7 @@ dependencies:
package_info_plus: ^5.0.1 package_info_plus: ^5.0.1
device_info_plus: ^9.1.2 device_info_plus: ^9.1.2
is_lock_screen: ^2.0.0 is_lock_screen: ^2.0.0
flutter_local_notifications: ^17.1.2
dev_dependencies: dev_dependencies:
flutter_test: flutter_test: