diff --git a/lib/main.dart b/lib/main.dart index d9f6ebd..bf0fe50 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -73,11 +73,12 @@ class _MyHomePageState extends State { _counter++; }); } + // TODO :find a better way to show the list void show_result(Future> future_id) async { var tmp = await future_id; id = tmp[0]; - setState(() { }); + setState(() {}); } @override @@ -123,12 +124,14 @@ class _MyHomePageState extends State { style: Theme.of(context).textTheme.headlineMedium, ), Text('API key from ENV is $API_KEY'), - MaterialButton(onPressed: () { show_result(ApiHandler.findStations('S Biesdorf')); setState(() {}); }, - child: Text( - 'Search for \'S Biesdorf\'' - ), + MaterialButton( + onPressed: () { + show_result(ApiHandler.findStations('S Biesdorf')); + setState(() {}); + }, + child: Text('Search for \'S Biesdorf\''), ), - Text(id) + Text(id), ], ), ), @@ -139,4 +142,4 @@ class _MyHomePageState extends State { ), ); } -} +} \ No newline at end of file diff --git a/lib/transport_helper.dart b/lib/transport_helper.dart index 621d951..bdf06fa 100644 --- a/lib/transport_helper.dart +++ b/lib/transport_helper.dart @@ -8,7 +8,6 @@ class Route { }); // from trip API request - factory Route.fromJson(Map json) => Route( segments: json["LegList"]["Leg"].map((leg) => Segment.fromJson(leg)), duration: @@ -58,8 +57,9 @@ class Station { id: json["id"] as String? ?? json["extId"] as String, name: json["name"], transportLines: json.containsKey("productAtStop") - ? json["productAtStop"].map((jsonLine) => - Line.fromJson(jsonLine as Map)) + ? json["productAtStop"].map( + (jsonLine) => Line.fromJson(jsonLine as Map), + ) : const [], ); } @@ -126,7 +126,7 @@ class Departure { Departure({ required this.vehicle, required this.station, - required this.departureTime + required this.departureTime, }); } @@ -138,22 +138,21 @@ class Color { Color({ required this.r, required this.g, - required this.b + required this.b, }); factory Color.fromJson(Map json) => Color( r: json["r"], g: json["g"], - b: json["b"] + b: json["b"], ); } - -enum VehicleType{ +enum VehicleType { bus, tram, metro, subway, regionalTrain, - PLACEHOLDER + PLACEHOLDER, }