update for routing
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class IndexBinding extends Bindings {
|
||||
|
||||
@ -11,7 +11,6 @@ import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_binding.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination/destination_page.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/action_service.dart';
|
||||
import 'package:rogapp/services/auth_service.dart';
|
||||
@ -36,6 +35,7 @@ class IndexController extends GetxController {
|
||||
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
|
||||
List<dynamic> currentAction = <dynamic>[].obs;
|
||||
List<PointLatLng> routePoints = <PointLatLng>[].obs;
|
||||
var routePointLenght = 0.obs;
|
||||
|
||||
var is_loading = false.obs;
|
||||
|
||||
@ -94,7 +94,7 @@ class IndexController extends GetxController {
|
||||
case AppPages.TRAVEL : {
|
||||
rog_mode.value = 1;
|
||||
//Get.back();
|
||||
Get.off(DestinationPage(), binding: DestinationBinding());
|
||||
Get.off(DestnationPage(), binding: DestinationBinding());
|
||||
|
||||
}
|
||||
break;
|
||||
@ -199,6 +199,18 @@ void login(String email, String password, BuildContext context){
|
||||
});
|
||||
}
|
||||
|
||||
void logout() async{
|
||||
locations.clear();
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.deleteAllDestinations().then((value){
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
if(destinationController != null){
|
||||
destinationController.PopulateDestinations();
|
||||
}
|
||||
});
|
||||
currentUser.clear();
|
||||
}
|
||||
|
||||
void register(String email, String password, BuildContext context){
|
||||
AuthService.register(email, password).then((value){
|
||||
if(value.isNotEmpty){
|
||||
|
||||
@ -3,6 +3,7 @@ import 'dart:ui';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
@ -19,6 +20,7 @@ class IndexPage extends GetView<IndexController> {
|
||||
IndexPage({Key? key}) : super(key: key);
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
@ -59,13 +61,31 @@ class IndexPage extends GetView<IndexController> {
|
||||
),
|
||||
bottomNavigationBar: BottomAppBar(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: <Widget>[
|
||||
Expanded(child: Container(width: 0, height: 0,),),
|
||||
const Expanded(child: Text('')),
|
||||
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
|
||||
indexController.switchPage(AppPages.TRAVEL);
|
||||
}),),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child:
|
||||
Obx(() =>
|
||||
destinationController.isSelected == true ?
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: Image(image: AssetImage('assets/images/route3_off.png'), width: 35, height: 35,),
|
||||
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
|
||||
),
|
||||
) :
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
|
||||
child: InkWell(
|
||||
child: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,),
|
||||
onTap: (){Get.toNamed(AppPages.DESTINATION_MAP);},
|
||||
),
|
||||
)
|
||||
)
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
@ -78,7 +98,12 @@ class IndexPage extends GetView<IndexController> {
|
||||
|
||||
},
|
||||
tooltip: 'Increment',
|
||||
child: const Icon(Icons.document_scanner),
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
Image(image: AssetImage('assets/images/list2.png'))
|
||||
:
|
||||
Image(image: AssetImage('assets/images/map.png')),
|
||||
),
|
||||
elevation: 4.0,
|
||||
),
|
||||
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
|
||||
Reference in New Issue
Block a user