added goal feature
This commit is contained in:
77
lib/pages/camera/camera_page.dart
Normal file
77
lib/pages/camera/camera_page.dart
Normal file
@ -0,0 +1,77 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
CameraPage({Key? key}) : super(key: key);
|
||||
DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
ImageProvider getFinishImage(){
|
||||
if(destinationController.photos.isNotEmpty){
|
||||
return FileImage(destinationController.photos[0]);
|
||||
}
|
||||
else{
|
||||
return AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
}
|
||||
|
||||
// void finishRog(){
|
||||
// destinationController.addToRogaining(destinationController.current_lat, destinationController.current_lon, destination_id)
|
||||
// }
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("finishing_rogaining".tr),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(() =>
|
||||
Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image:
|
||||
DecorationImage(
|
||||
image: getFinishImage(),
|
||||
fit: BoxFit.cover
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
destinationController.openCamera(context);
|
||||
},
|
||||
child: Text("take_photo of the clock".tr)
|
||||
),
|
||||
Obx(() =>
|
||||
destinationController.photos.isNotEmpty ?
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
primary: Colors.red
|
||||
),
|
||||
onPressed: (){
|
||||
|
||||
},
|
||||
child: Text("finish_goal".tr)
|
||||
):
|
||||
Container()
|
||||
)
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
163
lib/pages/changepassword/change_password_page.dart
Normal file
163
lib/pages/changepassword/change_password_page.dart
Normal file
@ -0,0 +1,163 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class ChangePasswordPage extends StatelessWidget {
|
||||
ChangePasswordPage({Key? key}) : super(key: key);
|
||||
|
||||
IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
TextEditingController oldPasswordController = TextEditingController();
|
||||
TextEditingController newPasswordController = TextEditingController();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
resizeToAvoidBottomInset: false,
|
||||
backgroundColor: Colors.white,
|
||||
appBar: AppBar(
|
||||
elevation: 0,
|
||||
brightness: Brightness.light,
|
||||
backgroundColor: Colors.white,
|
||||
leading:
|
||||
IconButton( onPressed: (){
|
||||
Navigator.pop(context);
|
||||
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
|
||||
),
|
||||
body:
|
||||
Container(
|
||||
width: double.infinity,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),),
|
||||
),
|
||||
SizedBox(height: 30,),
|
||||
],
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: 40
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
makeInput(label: "old_password".tr, controller: oldPasswordController),
|
||||
makeInput(label: "new_password".tr, controller: newPasswordController, obsureText: true),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 40),
|
||||
child: Container(
|
||||
padding: EdgeInsets.only(top: 3,left: 3),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(40),
|
||||
),
|
||||
child: Obx((() =>
|
||||
indexController.is_loading == true ? MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
|
||||
},
|
||||
color: Colors.grey[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: CircularProgressIndicator(),
|
||||
) :
|
||||
Column(
|
||||
children: [
|
||||
MaterialButton(
|
||||
minWidth: double.infinity,
|
||||
height:60,
|
||||
onPressed: (){
|
||||
if(oldPasswordController.text.isEmpty || newPasswordController.text.isEmpty){
|
||||
Get.snackbar(
|
||||
"no_values".tr,
|
||||
"values_required".tr,
|
||||
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
return;
|
||||
}
|
||||
indexController.is_loading.value = true;
|
||||
indexController.changePassword(oldPasswordController.text, newPasswordController.text, context);
|
||||
//indexController.login(oldPasswordController.text, newPasswordController.text, context);
|
||||
},
|
||||
color: Colors.indigoAccent[400],
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(40)
|
||||
),
|
||||
child: Text("ログイン",style: TextStyle(
|
||||
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 10.0,),
|
||||
|
||||
],
|
||||
)
|
||||
),
|
||||
),
|
||||
)
|
||||
),
|
||||
SizedBox(height: 20,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(label,style:TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w400,
|
||||
color: Colors.black87
|
||||
),),
|
||||
SizedBox(height: 5,),
|
||||
TextField(
|
||||
controller: controller,
|
||||
obscureText: obsureText,
|
||||
decoration: InputDecoration(
|
||||
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(
|
||||
color: (Colors.grey[400])!,
|
||||
),
|
||||
),
|
||||
border: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: (Colors.grey[400])!
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 30.0,)
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,16 +1,20 @@
|
||||
|
||||
|
||||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera_camera/camera_camera.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/model/Rogaining.dart';
|
||||
import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:rogapp/services/action_service.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/services/maxtrix_service.dart';
|
||||
import 'package:rogapp/services/reacking_service.dart';
|
||||
@ -18,6 +22,7 @@ import 'package:rogapp/utils/database_helper.dart';
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:sqflite/sqlite_api.dart';
|
||||
|
||||
class DestinationController extends GetxController {
|
||||
|
||||
@ -26,9 +31,14 @@ class DestinationController extends GetxController {
|
||||
var destinationCount = 0.obs;
|
||||
List<Destination> destinations = <Destination>[].obs;
|
||||
List<Map<String, dynamic>> destination_index_data = <Map<String, dynamic>>[].obs;
|
||||
double current_lat = 0.0;
|
||||
double current_lon = 0.0;
|
||||
|
||||
List<Destination> currentSelectedDestinations = <Destination>[].obs;
|
||||
|
||||
var is_in_rog = false.obs;
|
||||
List<Rogaining> rogainings = <Rogaining>[].obs;
|
||||
|
||||
bool checking_in = false;
|
||||
var isSelected = false.obs;
|
||||
BuildContext? context;
|
||||
@ -41,8 +51,56 @@ class DestinationController extends GetxController {
|
||||
|
||||
Map<String, dynamic> matrix = {};
|
||||
|
||||
final photos = <File>[].obs;
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
Timer? _timer;
|
||||
int _start = 1;
|
||||
var rogaining_counted = false.obs;
|
||||
|
||||
void startTimer(Destination d, double distance) {
|
||||
const oneSec = const Duration(seconds: 1);
|
||||
_timer = Timer.periodic(
|
||||
oneSec,
|
||||
(Timer timer) {
|
||||
if (_start == 0) {
|
||||
if(is_in_rog.value == false){
|
||||
is_in_rog.value = true;
|
||||
addToRogaining(current_lat, current_lon, d.location_id!);
|
||||
Get.snackbar("Rogaining Started ", "Rogaining session started");
|
||||
}
|
||||
else{
|
||||
//finish rogiain
|
||||
//is_in_rog.value = true;
|
||||
if (rogaining_counted.value && distance <=250){
|
||||
Get.toNamed(AppPages.CAMERA_PAGE);
|
||||
}
|
||||
}
|
||||
timer.cancel();
|
||||
} else {
|
||||
_start--;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void openCamera(BuildContext context) {
|
||||
photos.clear();
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (_) => CameraCamera(
|
||||
onFile: (file) {
|
||||
photos.add(file);
|
||||
Navigator.pop(context);
|
||||
print("----image file is : ${file}----");
|
||||
//setState(() {});
|
||||
},
|
||||
)));
|
||||
}
|
||||
|
||||
|
||||
void getRoutePoints() {
|
||||
indexController.routePoints = [];
|
||||
indexController.routePointLenght.value = 0;
|
||||
@ -63,7 +121,12 @@ class DestinationController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
checkForCheckin(double la, double ln){
|
||||
// void addToRogaining(Rogaining rog){
|
||||
// DatabaseHelper db = DatabaseHelper.instance;
|
||||
// db.insertRogaining(rog);
|
||||
// }
|
||||
|
||||
checkForCheckin(double la, double ln){
|
||||
|
||||
for(final d in destinations){
|
||||
|
||||
@ -79,6 +142,14 @@ class DestinationController extends GetxController {
|
||||
double rad = value!.checkin_radious ?? double.infinity;
|
||||
bool auto_checkin = value.auto_checkin == 0 ? false : true;
|
||||
|
||||
if(d.cp != -1 && is_in_rog == true){
|
||||
rogaining_counted.value == true;
|
||||
}
|
||||
|
||||
if(d.cp == -1 && dist <= 250 && rogaining_counted.value == false){
|
||||
startTimer(d, dist);
|
||||
}
|
||||
|
||||
indexController.currentDestinationFeature.add(value);
|
||||
//indexController.getAction();
|
||||
|
||||
@ -127,6 +198,22 @@ class DestinationController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
void addToRogaining(double lat, double lon, int destination_id){
|
||||
Rogaining rog = Rogaining(
|
||||
rog_id: null,
|
||||
course_id: 1,
|
||||
user_id: indexController.currentUser[0]['user']['id'],
|
||||
location_id: destination_id,
|
||||
lat: lat,
|
||||
lon:lon,
|
||||
time_stamp: DateTime.now().toUtc().microsecondsSinceEpoch
|
||||
);
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
db.insertRogaining(rog).then((value){
|
||||
print("----- inserted value ${value} ---------");
|
||||
});
|
||||
}
|
||||
|
||||
void makeCheckin(Destination destination, bool action) async {
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
@ -139,6 +226,15 @@ class DestinationController extends GetxController {
|
||||
PopulateDestinations();
|
||||
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
|
||||
print("---- database update resulr ------ res : ${res}-------");
|
||||
|
||||
/// post to NATNAT
|
||||
if(indexController.currentUser.length > 0){
|
||||
String cp_num = destination.cp.toString();
|
||||
String team_name = indexController.currentUser[0]['user']['group'];
|
||||
ActionService.postCheckin(cp_num, team_name).then((value){
|
||||
print('------- NATNAT RES ${value} ------------');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -187,6 +283,9 @@ class DestinationController extends GetxController {
|
||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||
|
||||
(Position? position) {
|
||||
current_lat = position != null ? position.latitude : 0;
|
||||
current_lon = position != null ? position.longitude : 0;
|
||||
|
||||
if(isSelected.value){
|
||||
double czoom = indexController.rogMapController!.zoom;
|
||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||
@ -220,6 +319,19 @@ class DestinationController extends GetxController {
|
||||
}
|
||||
}
|
||||
|
||||
Destination? destinationById(int id){
|
||||
Destination? d = null;
|
||||
print("--- target des - ${id} ----");
|
||||
for(Destination ss in destinations){
|
||||
print("--- des - ${ss.location_id} ----");
|
||||
if(ss.location_id == id){
|
||||
d = ss;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return d;
|
||||
}
|
||||
|
||||
void deleteDestination(Destination d){
|
||||
//int id = destinations[index].location_id!;
|
||||
//print("---- index ${destinations[index].location_id!}-----");
|
||||
|
||||
@ -1,9 +1,12 @@
|
||||
import 'dart:developer';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:camera_camera/camera_camera.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:rogapp/pages/camera/camera_page.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/destination_map/destination_map_page.dart';
|
||||
import 'package:rogapp/pages/drawer/drawer_page.dart';
|
||||
@ -156,6 +159,13 @@ class DestnationPage extends StatelessWidget {
|
||||
automaticallyImplyLeading: true,
|
||||
title: Text("app_title".tr),
|
||||
actions: [
|
||||
// TextButton(
|
||||
// onPressed: (){
|
||||
// //destinationController.openCamera(context);
|
||||
// Get.toNamed(AppPages.CAMERA_PAGE);
|
||||
// },
|
||||
// child: Icon(Icons.ac_unit),
|
||||
// ),
|
||||
Obx(() =>
|
||||
ToggleButtons(
|
||||
disabledColor: Colors.grey.shade200,
|
||||
@ -185,193 +195,3 @@ class DestnationPage extends StatelessWidget {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// class DestinationPage extends StatefulWidget {
|
||||
// DestinationPage({ Key? key }) : super(key: key);
|
||||
|
||||
// @override
|
||||
// State<DestinationPage> createState() => _DestinationPageState();
|
||||
// }
|
||||
|
||||
// class DestinationPage extends State<DestinationPage> {
|
||||
// final DestinationController destinationController = Get.find<DestinationController>();
|
||||
|
||||
// final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
// final List<int> _items = List<int>.generate(50, (int index) => index);
|
||||
|
||||
// DestinationWidget dest = DestinationWidget();
|
||||
// DestinationMapPage destMap = DestinationMapPage();
|
||||
|
||||
// Future<void> showCurrentPosition() async {
|
||||
// LocationPermission permission = await Geolocator.checkPermission();
|
||||
// if (permission != LocationPermission.whileInUse ||
|
||||
// permission != LocationPermission.always) {
|
||||
// permission = await Geolocator.requestPermission();
|
||||
// }
|
||||
// Position position = await Geolocator.getCurrentPosition(
|
||||
// desiredAccuracy: LocationAccuracy.high);
|
||||
// indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14);
|
||||
// }
|
||||
|
||||
// Image getImage(int index){
|
||||
// if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
|
||||
// return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
// }
|
||||
// else{
|
||||
// return Image(image: NetworkImage(destinationController.destinations[index].photos!));
|
||||
// }
|
||||
// }
|
||||
|
||||
// Widget getRoutingImage(int route){
|
||||
// switch (route) {
|
||||
// case 0:
|
||||
// return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 27.0,);
|
||||
// case 1:
|
||||
// return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 27.0,);
|
||||
// case 2:
|
||||
// return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 27.0,);
|
||||
// default:
|
||||
// return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 27.0,);
|
||||
// }
|
||||
// }
|
||||
|
||||
// @override
|
||||
// void initState() {
|
||||
// //destinationController.context = context;
|
||||
// //destinationController.PopulateDestinations();
|
||||
// super.initState();
|
||||
// }
|
||||
|
||||
// @override
|
||||
// Widget build(BuildContext context) {
|
||||
// final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
||||
// final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
|
||||
// final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
|
||||
// return WillPopScope(
|
||||
// onWillPop: () async {
|
||||
// indexController.switchPage(AppPages.INITIAL);
|
||||
// return false;
|
||||
// },
|
||||
// child: Scaffold(
|
||||
// drawer: DrawerPage(),
|
||||
// bottomNavigationBar: BottomAppBar(
|
||||
// child: Row(
|
||||
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
// children: <Widget>[
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(left:13.0),
|
||||
// child: InkWell(
|
||||
// child: Obx((() => getRoutingImage(destinationController.travelMode.value))),
|
||||
// onTap: (){
|
||||
// Get.bottomSheet(
|
||||
// Obx(() =>
|
||||
// ListView(
|
||||
// children: [
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(top:30.0, bottom: 30),
|
||||
// child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 0 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
|
||||
// title: Text("walking".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 0;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 1 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
|
||||
// title: Text("driving".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 1;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ListTile(
|
||||
// selected: destinationController.travelMode == 2 ? true : false,
|
||||
// selectedTileColor: Colors.amber.shade200,
|
||||
// leading: Image(image: AssetImage('assets/images/p4_10_train.png'),),
|
||||
// title: Text("transit".tr),
|
||||
// onTap:(){
|
||||
// destinationController.travelMode.value = 2;
|
||||
// Get.back();
|
||||
// },
|
||||
// ),
|
||||
// ],
|
||||
|
||||
// ),
|
||||
// ),
|
||||
// isScrollControlled:false,
|
||||
// backgroundColor: Colors.white,
|
||||
// );
|
||||
// destinationController.PopulateDestinations();
|
||||
// destMap.
|
||||
// }
|
||||
// ),
|
||||
// )
|
||||
// ,
|
||||
// IconButton(
|
||||
// icon: const Icon(Icons.travel_explore),
|
||||
// onPressed: (){
|
||||
// indexController.switchPage(AppPages.INITIAL);
|
||||
// }
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// floatingActionButton: FloatingActionButton(
|
||||
// onPressed: (){
|
||||
// //print("######");
|
||||
// indexController.toggleDestinationMode();
|
||||
// },
|
||||
// tooltip: 'Increment',
|
||||
// child: Obx(() =>
|
||||
// indexController.desination_mode == 1 ?
|
||||
// Image(image: AssetImage('assets/images/list2.png'))
|
||||
// :
|
||||
// Image(image: AssetImage('assets/images/map.png'))
|
||||
// ),
|
||||
// elevation: 4.0,
|
||||
// ),
|
||||
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
|
||||
// appBar:AppBar(
|
||||
// automaticallyImplyLeading: true,
|
||||
// title: Text("app_title".tr),
|
||||
// actions: [
|
||||
// //Obx(() =>
|
||||
// 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 ?
|
||||
// dest:
|
||||
// destMap
|
||||
// )
|
||||
// ),
|
||||
// );
|
||||
|
||||
// }
|
||||
// }
|
||||
@ -14,6 +14,7 @@ import 'package:rogapp/model/destination.dart';
|
||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/services/destination_service.dart';
|
||||
import 'package:rogapp/utils/text_util.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||
import 'package:rogapp/widgets/bread_crum_widget.dart';
|
||||
@ -38,21 +39,6 @@ class DestinationMapPage extends StatelessWidget {
|
||||
return pts;
|
||||
}
|
||||
|
||||
String getDisplaytext(Destination dp){
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
String txt = "";
|
||||
if(dp.cp! > 0){
|
||||
txt = "${dp.cp.toString().replaceAll(regex, '')}";
|
||||
if(dp.checkin_point != null && dp.checkin_point! > 0){
|
||||
txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}";
|
||||
}
|
||||
if(dp.buy_point != null && dp.buy_point! > 0){
|
||||
txt = txt + "[${dp.buy_point.toString().replaceAll(regex, '')}]";
|
||||
}
|
||||
}
|
||||
return txt;
|
||||
}
|
||||
|
||||
List<Marker>? getMarkers() {
|
||||
List<Marker> pts = [];
|
||||
int index = -1;
|
||||
@ -99,7 +85,7 @@ class DestinationMapPage extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
Container( color: Colors.yellow, child: Text(getDisplaytext(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
||||
Container( color: Colors.yellow, child: Text(TextUtils.getDisplaytext(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
|
||||
],
|
||||
),
|
||||
);
|
||||
@ -119,7 +105,10 @@ class DestinationMapPage extends StatelessWidget {
|
||||
indexController.is_rog_mapcontroller_loaded.value == false ?
|
||||
Center(child: CircularProgressIndicator())
|
||||
:
|
||||
BreadCrumbWidget(mapController:indexController.rogMapController),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(left:8.0),
|
||||
child: BreadCrumbWidget(mapController:indexController.rogMapController),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top:50.0),
|
||||
//child: TravelMap(),
|
||||
|
||||
@ -62,7 +62,9 @@ class DrawerPage extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text("change_password".tr),
|
||||
onTap: (){},
|
||||
onTap: (){
|
||||
Get.toNamed(AppPages.CHANGE_PASSWORD);
|
||||
},
|
||||
) :
|
||||
Container(width: 0, height: 0,),
|
||||
indexController.currentUser.length == 0 ?
|
||||
|
||||
@ -173,6 +173,8 @@ void login(String email, String password, BuildContext context){
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
loadUserDetails();
|
||||
loadLocationsBound();
|
||||
cats.clear();
|
||||
if(currentFeature.isNotEmpty){
|
||||
getAction();
|
||||
}
|
||||
@ -199,6 +201,37 @@ void login(String email, String password, BuildContext context){
|
||||
});
|
||||
}
|
||||
|
||||
void changePassword(String oldpassword, String newpassword, BuildContext context){
|
||||
String _token = currentUser[0]['token'];
|
||||
//print("------- change password ######## ${currentUser[0]['token']} ###### --------");
|
||||
AuthService.changePassword(oldpassword, newpassword, _token).then((value){
|
||||
print("------- change password ######## ${value} ###### --------");
|
||||
if(value.isNotEmpty){
|
||||
is_loading.value = false;
|
||||
Navigator.pop(context);
|
||||
if(rog_mode.value == 1){
|
||||
switchPage(AppPages.TRAVEL);
|
||||
}
|
||||
else{
|
||||
switchPage(AppPages.INITIAL);
|
||||
}
|
||||
//Get.toNamed(AppPages.INITIAL);
|
||||
}else{
|
||||
Get.snackbar(
|
||||
'failed'.tr,
|
||||
'password_change_failed_please_try_again'.tr,
|
||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
backgroundColor: Colors.yellow,
|
||||
//icon:Image(image:AssetImage("assets/images/dora.png"))
|
||||
);
|
||||
}
|
||||
|
||||
});
|
||||
is_loading.value = false;
|
||||
}
|
||||
|
||||
void logout() async{
|
||||
locations.clear();
|
||||
DatabaseHelper db = DatabaseHelper.instance;
|
||||
@ -209,6 +242,7 @@ void login(String email, String password, BuildContext context){
|
||||
}
|
||||
});
|
||||
currentUser.clear();
|
||||
cats.clear();
|
||||
}
|
||||
|
||||
void register(String email, String password, BuildContext context){
|
||||
@ -223,8 +257,8 @@ void login(String email, String password, BuildContext context){
|
||||
}else{
|
||||
is_loading.value = false;
|
||||
Get.snackbar(
|
||||
"Failed",
|
||||
"User registration failed, please try again.",
|
||||
'failed'.tr,
|
||||
'user_registration_failed_please_try_again'.tr,
|
||||
icon: Icon(Icons.error, size: 40.0, color: Colors.blue),
|
||||
snackPosition: SnackPosition.TOP,
|
||||
duration: Duration(milliseconds: 800),
|
||||
@ -248,9 +282,23 @@ void login(String email, String password, BuildContext context){
|
||||
|
||||
}
|
||||
|
||||
String getCatText(){
|
||||
String _cat = 'all'.tr;
|
||||
if(currentUser.length > 0){
|
||||
Map<String, dynamic> _urs = currentUser[0];
|
||||
print('-- is_rogaining :-- ${_urs['user']['is_rogaining']} ------');
|
||||
if(_urs['user']['is_rogaining'] == true){
|
||||
_cat = 'rogaining'.tr;
|
||||
}
|
||||
else {
|
||||
_cat = 'sight_seeing'.tr;
|
||||
}
|
||||
}
|
||||
return _cat;
|
||||
}
|
||||
|
||||
void loadCatsv2(){
|
||||
dynamic initVal = {'category':'-all-'};
|
||||
dynamic initVal = {'category':getCatText()};
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
CatService.loadCats(bounds.southWest!.latitude, bounds.southWest!.longitude, bounds.northWest.latitude, bounds.northWest.longitude, bounds.northEast!.latitude, bounds.northEast!.longitude, bounds.southEast.latitude, bounds.southEast.longitude).then((value) {
|
||||
@ -266,7 +314,7 @@ void login(String email, String password, BuildContext context){
|
||||
}
|
||||
|
||||
void loadCatForCity(String city){
|
||||
dynamic initVal = {'category':'-all-'};
|
||||
dynamic initVal = {'category':getCatText()};
|
||||
LatLngBounds bounds = mapController!.bounds!;
|
||||
if(bounds.southEast != null && bounds.southWest != null && bounds.northEast != null && bounds.southEast != null ){
|
||||
CatService.loadCatByCity(city).then((value) {
|
||||
|
||||
@ -111,7 +111,7 @@ class IndexPage extends GetView<IndexController> {
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 8.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
//child: SingleChildScrollView(
|
||||
|
||||
Reference in New Issue
Block a user