This commit is contained in:
Mohamed Nouffer
2022-05-18 19:09:26 +05:30
parent 80a976baa0
commit ee0440e6b6
26 changed files with 411 additions and 59 deletions

View File

@ -5,11 +5,13 @@ import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/services/maxtrix_service.dart';
class DestinationController extends GetxController {
List<dynamic> destinations = <dynamic>[].obs;
Map<String, dynamic> matrix = {};
final IndexController indexController = Get.find<IndexController>();
@ -24,8 +26,16 @@ class DestinationController extends GetxController {
int user_id = indexController.currentUser[0]["user"]["id"] as int;
//print(user_id);
DestinationService.getDestinations(user_id).then((value){
destinations.clear();
destinations = value;
MatrixService.getDestinations(value).then((mat){
print(mat);
matrix = mat;
destinations.clear();
destinations = value;
});
//var val = value[2]["location"]["id"];
//print("-----current destinations ----- ${val}");
});

View File

@ -110,8 +110,8 @@ class _DestinationPageState extends State<DestinationPage> {
startChild: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("12:30"),
Text("01:20"),
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
],
),
);