Fehlerkorrekturen, #578
This commit is contained in:
1 parent
c81df4be41
commit
7c2f5369ab
7 files changed
+183
-36
No files matched your search
@@ -11,6 +11,7 @@ import 'package:stadtbote/tools/constants.dart';
|
||||
import 'package:stadtbote/tools/message_service.dart';
|
||||
import 'package:stadtbote/tools/messages/publish_payload_message.dart';
|
||||
import 'package:stadtbote/tools/messages/ranking_updated.dart';
|
||||
import 'package:badges/badges.dart' as badges;
|
||||
|
||||
import '../tools/util.dart';
|
||||
|
||||
@@ -138,29 +139,48 @@ class _ApproachAreaPageState extends State<ApproachAreaPage> {
|
||||
var vehicle = rank.vehicles[j];
|
||||
|
||||
var imageFilename = vehicle.self == true ? "assets/mein_${mapVehicleTypeToImageName(vehicle.type)}" : "assets/${mapVehicleTypeToImageName(vehicle.type)}";
|
||||
entries.add(Container(
|
||||
padding: const EdgeInsets.all(4),
|
||||
margin: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
width: 80,
|
||||
height: 60,
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(imageFilename, width: 30, height: 30),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
mapVehicleTypeToText(vehicle.type)
|
||||
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),
|
||||
margin: const EdgeInsets.all(2),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(10),
|
||||
color: Colors.white,
|
||||
border: Border.all(
|
||||
color: Colors.grey,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
width: 80,
|
||||
height: 60,
|
||||
child: Column(
|
||||
children: [
|
||||
Image.asset(imageFilename, width: 30, height: 30),
|
||||
const SizedBox(width: 10),
|
||||
Text(
|
||||
mapVehicleTypeToText(vehicle.type)
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
|
||||
columns.add(Align(
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:isar/isar.dart';
|
||||
|
||||
part 'pictures.g.dart';
|
||||
|
||||
@@ -44,6 +44,8 @@ class Vehicle {
|
||||
|
||||
late int type;
|
||||
|
||||
late int? cnt;
|
||||
|
||||
@JsonKey(name: 'self', defaultValue: false)
|
||||
late bool? self;
|
||||
|
||||
|
||||
+90
-11
@@ -949,18 +949,23 @@ const VehicleSchema = Schema(
|
||||
name: r'Vehicle',
|
||||
id: -21624847921258799,
|
||||
properties: {
|
||||
r'id': PropertySchema(
|
||||
r'cnt': PropertySchema(
|
||||
id: 0,
|
||||
name: r'cnt',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'id': PropertySchema(
|
||||
id: 1,
|
||||
name: r'id',
|
||||
type: IsarType.long,
|
||||
),
|
||||
r'self': PropertySchema(
|
||||
id: 1,
|
||||
id: 2,
|
||||
name: r'self',
|
||||
type: IsarType.bool,
|
||||
),
|
||||
r'type': PropertySchema(
|
||||
id: 2,
|
||||
id: 3,
|
||||
name: r'type',
|
||||
type: IsarType.long,
|
||||
)
|
||||
@@ -986,9 +991,10 @@ void _vehicleSerialize(
|
||||
List<int> offsets,
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
writer.writeLong(offsets[0], object.id);
|
||||
writer.writeBool(offsets[1], object.self);
|
||||
writer.writeLong(offsets[2], object.type);
|
||||
writer.writeLong(offsets[0], object.cnt);
|
||||
writer.writeLong(offsets[1], object.id);
|
||||
writer.writeBool(offsets[2], object.self);
|
||||
writer.writeLong(offsets[3], object.type);
|
||||
}
|
||||
|
||||
Vehicle _vehicleDeserialize(
|
||||
@@ -998,9 +1004,10 @@ Vehicle _vehicleDeserialize(
|
||||
Map<Type, List<int>> allOffsets,
|
||||
) {
|
||||
final object = Vehicle();
|
||||
object.id = reader.readLong(offsets[0]);
|
||||
object.self = reader.readBoolOrNull(offsets[1]);
|
||||
object.type = reader.readLong(offsets[2]);
|
||||
object.cnt = reader.readLongOrNull(offsets[0]);
|
||||
object.id = reader.readLong(offsets[1]);
|
||||
object.self = reader.readBoolOrNull(offsets[2]);
|
||||
object.type = reader.readLong(offsets[3]);
|
||||
return object;
|
||||
}
|
||||
|
||||
@@ -1012,10 +1019,12 @@ P _vehicleDeserializeProp<P>(
|
||||
) {
|
||||
switch (propertyId) {
|
||||
case 0:
|
||||
return (reader.readLong(offset)) as P;
|
||||
return (reader.readLongOrNull(offset)) as P;
|
||||
case 1:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
return (reader.readLong(offset)) as P;
|
||||
case 2:
|
||||
return (reader.readBoolOrNull(offset)) as P;
|
||||
case 3:
|
||||
return (reader.readLong(offset)) as P;
|
||||
default:
|
||||
throw IsarError('Unknown property with id $propertyId');
|
||||
@@ -1024,6 +1033,74 @@ P _vehicleDeserializeProp<P>(
|
||||
|
||||
extension VehicleQueryFilter
|
||||
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) {
|
||||
return QueryBuilder.apply(this, (query) {
|
||||
return query.addFilterCondition(FilterCondition.equalTo(
|
||||
@@ -1191,10 +1268,12 @@ Map<String, dynamic> _$RankToJson(Rank instance) => <String, dynamic>{
|
||||
Vehicle _$VehicleFromJson(Map<String, dynamic> json) => Vehicle()
|
||||
..id = json['id'] as int
|
||||
..type = json['type'] as int
|
||||
..cnt = json['cnt'] as int?
|
||||
..self = json['self'] as bool? ?? false;
|
||||
|
||||
Map<String, dynamic> _$VehicleToJson(Vehicle instance) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'type': instance.type,
|
||||
'cnt': instance.cnt,
|
||||
'self': instance.self,
|
||||
};
|
||||
@@ -52,6 +52,8 @@ import 'util.dart';
|
||||
|
||||
enum ConnectionStateEnum { notConnected, connected }
|
||||
|
||||
//const AndroidInitializationSettings initializationSettingsAndroid = AndroidInitializationSettings('app_icon');
|
||||
|
||||
class MqttCore {
|
||||
late ConnectionStateEnum connectionState = ConnectionStateEnum.notConnected;
|
||||
|
||||
@@ -356,6 +358,8 @@ class MqttCore {
|
||||
|
||||
await Util.playMp3('asbeep.mp3');
|
||||
|
||||
|
||||
|
||||
MessageService().publish<MessageReceivedMessage>(Constants.messageTopicMessageReceived, arguments: MessageReceivedMessage(message: newMessage));
|
||||
}
|
||||
|
||||
@@ -442,7 +446,9 @@ class MqttCore {
|
||||
|
||||
var jsonMap = handshakeMessage.toJson();
|
||||
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");
|
||||
|
||||
var response = await http.get(Uri.parse(uri));
|
||||
|
||||
Reference in new issue
Block a user