Ajout parsing route
This commit is contained in:
@@ -17,19 +17,58 @@ class Registration {
|
||||
}
|
||||
}
|
||||
|
||||
class Coordinates {
|
||||
String? symbol;
|
||||
String? type;
|
||||
String? systemSymbol;
|
||||
int? x;
|
||||
int? y;
|
||||
|
||||
Coordinates({this.symbol, this.type, this.systemSymbol, this.x, this.y });
|
||||
|
||||
factory Coordinates.fromJson(Map<String, dynamic> json) {
|
||||
return Coordinates(
|
||||
symbol: json['symbol'],
|
||||
type: json['type'],
|
||||
systemSymbol: json['systemSymbol'],
|
||||
x: json['x'],
|
||||
y: json['y'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Route {
|
||||
Coordinates? departure;
|
||||
Coordinates? destination;
|
||||
String? arrival;
|
||||
String? departureTime;
|
||||
|
||||
Route({this.departure, this.destination, this.arrival, this.departureTime});
|
||||
|
||||
factory Route.fromJson(Map<String, dynamic> json) {
|
||||
return Route(
|
||||
departure: Coordinates.fromJson(json['departure']),
|
||||
destination: Coordinates.fromJson(json['destination']),
|
||||
arrival: json['arrival'],
|
||||
departureTime: json['departureTime'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class Nav {
|
||||
String? systemSymbol;
|
||||
String? waypointSymbol;
|
||||
//TODO Route
|
||||
Route? route;
|
||||
String? status;
|
||||
String? flightMode;
|
||||
|
||||
Nav({this.systemSymbol, this.waypointSymbol, this.status, this.flightMode});
|
||||
Nav({this.systemSymbol, this.waypointSymbol, this.route, this.status, this.flightMode});
|
||||
|
||||
factory Nav.fromJson(Map<String, dynamic> json) {
|
||||
return Nav(
|
||||
systemSymbol: json['systemSymbol'],
|
||||
waypointSymbol: json['waypointSymbol'],
|
||||
route: Route.fromJson(json['route']),
|
||||
status: json['status'],
|
||||
flightMode: json['flightMode'],
|
||||
);
|
||||
|
||||
@@ -90,7 +90,7 @@ class ShipPage extends StatelessWidget {
|
||||
Column(
|
||||
children:[
|
||||
Text('${ship.nav?.waypointSymbol ?? 'N/A'}'),
|
||||
Text('Asteroid Field'),
|
||||
Text('${ship.nav?.route?.destination?.type ?? 'N/A'}'),
|
||||
],
|
||||
),
|
||||
SizedBox(height: 32),
|
||||
|
||||
Reference in New Issue
Block a user