This commit is contained in:
Mohamed Nouffer
2022-06-27 12:15:54 +05:30
parent ba70fa0080
commit 7b9d029bb0
16 changed files with 578 additions and 175 deletions

View File

@ -103,6 +103,8 @@ class DestinationController extends GetxController {
void onInit() {
PopulateDestinations();
print("------ in iniit");
if (defaultTargetPlatform == TargetPlatform.android) {
@ -165,7 +167,7 @@ class DestinationController extends GetxController {
void PopulateDestinations(){
if(indexController.currentUser.isNotEmpty){
int user_id = indexController.currentUser[0]["user"]["id"];
//print(user_id);
print(user_id);
DestinationService.getDestinations(user_id).then((value){
MatrixService.getDestinations(value).then((mat){

View File

@ -57,67 +57,73 @@ class _DestinationPageState extends State<DestinationPage> {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
return Scaffold(
bottomNavigationBar: BottomAppBar(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
const Expanded(child: Text('')),
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
if(indexController.currentUser.isNotEmpty){
Get.toNamed(AppPages.TRAVEL);
}
else{
Get.toNamed(AppPages.LOGIN);
}
}),),
return WillPopScope(
onWillPop: () async {
indexController.switchPage(AppPages.INITIAL);
return false;
},
child: Scaffold(
bottomNavigationBar: BottomAppBar(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
const Expanded(child: Text('')),
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
if(indexController.currentUser.isNotEmpty){
Get.toNamed(AppPages.TRAVEL);
}
else{
Get.toNamed(AppPages.LOGIN);
}
}),),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: (){
//print("######");
indexController.toggleDestinationMode();
},
tooltip: 'Increment',
child: const Icon(Icons.document_scanner),
elevation: 4.0,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
appBar:AppBar(
title: Text("Iternery"),
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: (){
indexController.switchPage(AppPages.INITIAL);
},
),
actions: [
ToggleButtons(
disabledColor: Colors.grey.shade200,
selectedColor: Colors.red,
children: <Widget>[
Icon(Icons.explore
)],
onPressed: (int index) {
setState(() {
destinationController.isSelected[index] = !destinationController.isSelected[index];
});
},
isSelected: destinationController.isSelected,
),
IconButton(onPressed: (){
showCurrentPosition();
},
icon: Icon(Icons.location_on_outlined))
],
),
body: Obx(() =>
indexController.desination_mode.value == 0 ?
DestinationWidget():
DestinationMapPage()
)
),
floatingActionButton: FloatingActionButton(
onPressed: (){
//print("######");
indexController.toggleDestinationMode();
},
tooltip: 'Increment',
child: const Icon(Icons.document_scanner),
elevation: 4.0,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
appBar:AppBar(
title: Text("Iternery"),
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: (){
indexController.switchPage(AppPages.INITIAL);
},
),
actions: [
ToggleButtons(
disabledColor: Colors.grey.shade200,
selectedColor: Colors.red,
children: <Widget>[
Icon(Icons.explore
)],
onPressed: (int index) {
setState(() {
destinationController.isSelected[index] = !destinationController.isSelected[index];
});
},
isSelected: destinationController.isSelected,
),
IconButton(onPressed: (){
showCurrentPosition();
},
icon: Icon(Icons.location_on_outlined))
],
),
body: Obx(() =>
indexController.desination_mode.value == 0 ?
DestinationWidget():
DestinationMapPage()
)
);
}

View File

@ -14,6 +14,7 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
//import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class DestinationMapPage extends StatefulWidget {
@ -69,30 +70,6 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
}
final List<LatLng> _markerPositions = [
LatLng(35.728728732933455, 137.06878077038706),
LatLng(35.958218259568305, 137.06187578986646),
LatLng(35.76795686324816, 137.08949571194879),
];
List<Marker> get _markers => _markerPositions
.map(
(markerPosition) => Marker(
point: markerPosition,
width: 40,
height: 40,
builder: (_) => const Icon(Icons.location_on, size: 40),
anchorPos: AnchorPos.align(AnchorAlign.top),
),
)
.toList();
List<LatLng>? getPoints(){
//print("##### --- route point ${indexController.routePoints.length}");
List<LatLng> pts = [];
@ -123,7 +100,8 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
builder:((context) => BottomSheetWidget())
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
}
},

View File

@ -7,6 +7,9 @@ import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/destination/destination_binding.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';
@ -77,6 +80,8 @@ class IndexController extends GetxController {
case AppPages.TRAVEL : {
rog_mode.value = 1;
Get.toNamed(page);
//Get.off(DestinationPage(), binding: DestinationBinding());
}
break;
case AppPages.LOGIN :{
@ -334,7 +339,15 @@ void login(String email, String password, BuildContext context){
return;
}
if(value != null && value.collection.isEmpty){
Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
Get.snackbar(
"Too many Points",
"please zoom in",
icon: Icon(Icons.person, color: Colors.white),
snackPosition: SnackPosition.BOTTOM,
duration: Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
);
//Get.showSnackbar(GetSnackBar(message: "Too many points, please zoom in",));
}
if(value != null && value.collection.isNotEmpty){
//print("---- added---");