-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from Metatavu/feature-1-task-details-view
Added task details view without functionality
- Loading branch information
Showing
42 changed files
with
1,721 additions
and
259 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
{ | ||
"flutter": "3.19.6", | ||
"flavors": {} | ||
"flavors": {}, | ||
"runPubGetOnSdkChanges": true, | ||
"updateVscodeSettings": true, | ||
"updateGitIgnore": true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
// Openapi Generator last run: : 2024-04-24T09:27:04.483875 | ||
// Openapi Generator last run: : 2024-05-02T16:32:35.026923 | ||
import "package:openapi_generator_annotations/openapi_generator_annotations.dart"; | ||
|
||
@Openapi( | ||
inputSpec: InputSpec( | ||
path: "specs/specs/app.yaml", | ||
path: "../vp-kuljetus-transport-management-specs/specs/app.yaml", | ||
), | ||
generatorName: Generator.dio, | ||
outputDirectory: "../packages/tms_api", | ||
outputDirectory: "./packages/tms_api", | ||
additionalProperties: DioProperties(pubName: "tms_api"), | ||
) | ||
class OpenApiGeneratorConfig {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import "package:tms_api/tms_api.dart"; | ||
|
||
class FreightCardData { | ||
const FreightCardData({ | ||
required this.freight, | ||
required this.senderSite, | ||
required this.recipientSite, | ||
required this.pointOfDepartureSite, | ||
required this.destinationSite, | ||
required this.freightUnits, | ||
}); | ||
|
||
final Freight freight; | ||
final Site senderSite; | ||
final Site recipientSite; | ||
final Site pointOfDepartureSite; | ||
final Site destinationSite; | ||
final List<FreightUnit> freightUnits; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import "package:tms_api/tms_api.dart"; | ||
|
||
class RouteTasksScreenData { | ||
const RouteTasksScreenData({ | ||
required this.route, | ||
required this.tasks, | ||
}); | ||
|
||
final Route route; | ||
final List<Task> tasks; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import "package:flutter/foundation.dart"; | ||
import "package:tms_api/tms_api.dart"; | ||
|
||
class TaskDetailsScreenData { | ||
const TaskDetailsScreenData({ | ||
required this.tasks, | ||
required this.customerSite, | ||
}); | ||
|
||
final List<Task> tasks; | ||
final Site customerSite; | ||
} | ||
|
||
class TaskIdList { | ||
const TaskIdList({required this.list}); | ||
|
||
final List<String> list; | ||
|
||
@override | ||
bool operator ==(final Object other) { | ||
if (identical(this, other)) return true; | ||
|
||
return other is TaskIdList && listEquals(other.list, list); | ||
} | ||
|
||
@override | ||
int get hashCode => list.map((final id) => id.hashCode).join("").hashCode; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import "dart:developer"; | ||
|
||
import "package:dio/dio.dart"; | ||
import "package:riverpod_annotation/riverpod_annotation.dart"; | ||
import "package:tms_api/tms_api.dart"; | ||
import "package:vp_kuljetus_driver_app/services/api/api.dart"; | ||
import "package:vp_kuljetus_driver_app/utils/provider_cache.dart"; | ||
|
||
part "freight_units_providers.g.dart"; | ||
|
||
@riverpod | ||
Future<List<FreightUnit>> listFreightUnits( | ||
final ListFreightUnitsRef ref, { | ||
required final String freightId, | ||
}) async { | ||
final cancelToken = CancelToken(); | ||
ref.onDispose(cancelToken.cancel); | ||
|
||
try { | ||
final response = await tmsApi.getFreightUnitsApi().listFreightUnits( | ||
cancelToken: cancelToken, | ||
freightId: freightId, | ||
); | ||
|
||
ref.cacheFor(const Duration(minutes: 5)); | ||
return response.data!.asList(); | ||
} on DioException catch (error) { | ||
log("Failed to list freight units: $error"); | ||
log(error.requestOptions.toString()); | ||
rethrow; | ||
} | ||
} |
160 changes: 160 additions & 0 deletions
160
lib/providers/freight_units/freight_units_providers.g.dart
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import "dart:developer"; | ||
|
||
import "package:dio/dio.dart"; | ||
import "package:riverpod_annotation/riverpod_annotation.dart"; | ||
import "package:tms_api/tms_api.dart"; | ||
import "package:vp_kuljetus_driver_app/services/api/api.dart"; | ||
import "package:vp_kuljetus_driver_app/utils/provider_cache.dart"; | ||
|
||
part "freights_providers.g.dart"; | ||
|
||
@riverpod | ||
Future<Freight> findFreight( | ||
final FindFreightRef ref, { | ||
required final String freightId, | ||
}) async { | ||
final cancelToken = CancelToken(); | ||
ref.onDispose(cancelToken.cancel); | ||
|
||
try { | ||
final response = await tmsApi.getFreightsApi().findFreight( | ||
cancelToken: cancelToken, | ||
freightId: freightId, | ||
); | ||
|
||
ref.cacheFor(const Duration(minutes: 5)); | ||
return response.data!; | ||
} on DioException catch (error) { | ||
log("Failed to find freight: $error"); | ||
log(error.requestOptions.toString()); | ||
rethrow; | ||
} | ||
} |
Oops, something went wrong.