update for chech in
This commit is contained in:
@ -16,7 +16,8 @@ class Destination {
|
|||||||
String? photos;
|
String? photos;
|
||||||
double? checkin_radious;
|
double? checkin_radious;
|
||||||
int? auto_checkin;
|
int? auto_checkin;
|
||||||
bool selected = false;
|
bool? selected = false;
|
||||||
|
bool? checkedin = false;
|
||||||
|
|
||||||
Destination({
|
Destination({
|
||||||
this.name,
|
this.name,
|
||||||
@ -33,10 +34,17 @@ class Destination {
|
|||||||
this.list_order,
|
this.list_order,
|
||||||
this.photos,
|
this.photos,
|
||||||
this.checkin_radious,
|
this.checkin_radious,
|
||||||
this.auto_checkin
|
this.auto_checkin,
|
||||||
|
this.selected,
|
||||||
|
this.checkedin
|
||||||
});
|
});
|
||||||
|
|
||||||
factory Destination.fromMap(Map<String, dynamic> json) => Destination(
|
factory Destination.fromMap(Map<String, dynamic> json) {
|
||||||
|
|
||||||
|
bool selec = json['selected'] == 0 ? false : true;
|
||||||
|
bool checkin = json['checkedin'] == 0 ? false : true;
|
||||||
|
|
||||||
|
return Destination(
|
||||||
name: json['name'],
|
name: json['name'],
|
||||||
address: json['address'],
|
address: json['address'],
|
||||||
phone: json['phone'],
|
phone: json['phone'],
|
||||||
@ -49,12 +57,17 @@ class Destination {
|
|||||||
lon: json['lon'],
|
lon: json['lon'],
|
||||||
location_id: json['location_id'],
|
location_id: json['location_id'],
|
||||||
list_order: json['list_order'],
|
list_order: json['list_order'],
|
||||||
photos: json['category'],
|
photos: json['photos'],
|
||||||
checkin_radious: json['checkin_radious'],
|
checkin_radious: json['checkin_radious'],
|
||||||
auto_checkin:json['auto_checkin']
|
auto_checkin:json['auto_checkin'],
|
||||||
|
selected: selec,
|
||||||
|
checkedin: checkin
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Map<String, dynamic> toMap(){
|
Map<String, dynamic> toMap(){
|
||||||
|
int sel = selected == false ? 0 : 1;
|
||||||
|
int check = checkedin == false ? 0 : 1;
|
||||||
return {
|
return {
|
||||||
'name':name,
|
'name':name,
|
||||||
'address': address,
|
'address': address,
|
||||||
@ -70,7 +83,9 @@ class Destination {
|
|||||||
'list_order':list_order,
|
'list_order':list_order,
|
||||||
'photos':photos,
|
'photos':photos,
|
||||||
'checkin_radious': checkin_radious,
|
'checkin_radious': checkin_radious,
|
||||||
'auto_checkin': auto_checkin
|
'auto_checkin': auto_checkin,
|
||||||
|
'selected': sel,
|
||||||
|
'checkedin': check
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -61,6 +61,7 @@ class DestinationController extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
checkForCheckin(double la, double ln){
|
checkForCheckin(double la, double ln){
|
||||||
|
|
||||||
for(final d in destinations){
|
for(final d in destinations){
|
||||||
double lat = d.lat!;
|
double lat = d.lat!;
|
||||||
double lon = d.lon!;
|
double lon = d.lon!;
|
||||||
@ -74,19 +75,10 @@ class DestinationController extends GetxController {
|
|||||||
indexController.currentDestinationFeature.add(value);
|
indexController.currentDestinationFeature.add(value);
|
||||||
//indexController.getAction();
|
//indexController.getAction();
|
||||||
|
|
||||||
if(!checking_in){
|
|
||||||
checking_in = true;
|
|
||||||
if(rad >= dist){
|
if(rad >= dist){
|
||||||
if(auto_checkin){
|
if(auto_checkin){
|
||||||
if(indexController.currentAction.isNotEmpty){
|
makeCheckin(value, true);
|
||||||
print(indexController.currentAction[0]);
|
|
||||||
indexController.currentAction[0][0]["checkin"] = true;
|
|
||||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
|
||||||
indexController.currentAction.clear();
|
|
||||||
print("---temp---${temp}");
|
|
||||||
indexController.currentAction.add([temp]);
|
|
||||||
}
|
|
||||||
indexController.makeAction(Get.context!);
|
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
@ -96,19 +88,59 @@ class DestinationController extends GetxController {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
// if(!checking_in){
|
||||||
|
// checking_in = true;
|
||||||
|
// if(rad >= dist){
|
||||||
|
// if(auto_checkin){
|
||||||
|
// if(indexController.currentAction.isNotEmpty){
|
||||||
|
// print(indexController.currentAction[0]);
|
||||||
|
// indexController.currentAction[0][0]["checkin"] = true;
|
||||||
|
// Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||||
|
// indexController.currentAction.clear();
|
||||||
|
// print("---temp---${temp}");
|
||||||
|
// indexController.currentAction.add([temp]);
|
||||||
|
// }
|
||||||
|
// indexController.makeAction(Get.context!);
|
||||||
|
// }
|
||||||
|
// else{
|
||||||
|
// showModalBottomSheet(context: Get.context!, isScrollControlled: true,
|
||||||
|
// builder:((context) => BottomSheetWidget())
|
||||||
|
// ).whenComplete((){
|
||||||
|
// checking_in = false;
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// }
|
||||||
print("----- rad is ${rad}");
|
print("----- rad is ${rad}");
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void makeCheckin(Destination destination, bool action) async {
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${action}@@@@@@@@@@@");
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
int res = await db.updateAction(destination, action);
|
||||||
|
|
||||||
|
List<Destination> ddd = await db.getDestinationByLatLon(destination.lat!, destination.lon!);
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ddddd ${ddd[0].checkedin} @@@@@@@@@@@");
|
||||||
|
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ ressssss ${res}@@@@@@@@@@@");
|
||||||
|
PopulateDestinations();
|
||||||
|
print("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ after populating ${res} @@@@@@@@@@@");
|
||||||
|
print("---- database update resulr ------ res : ${res}-------");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void onInit() {
|
void onInit() async {
|
||||||
super.onInit();
|
super.onInit();
|
||||||
|
checkPermission();
|
||||||
PopulateDestinations();
|
PopulateDestinations();
|
||||||
|
|
||||||
|
|
||||||
print("------ in iniit");
|
print("------ in iniit");
|
||||||
|
|
||||||
|
|
||||||
@ -146,14 +178,16 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
|
|
||||||
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
StreamSubscription<Position> positionStream = Geolocator.getPositionStream(locationSettings: locationSettings).listen(
|
||||||
|
|
||||||
(Position? position) {
|
(Position? position) {
|
||||||
|
if(isSelected[0]){
|
||||||
double czoom = indexController.rogMapController!.zoom;
|
double czoom = indexController.rogMapController!.zoom;
|
||||||
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
indexController.rogMapController!.move(LatLng(position!.latitude, position!.longitude), czoom);
|
||||||
if(isSelected[0]){
|
//String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
||||||
String user_id = indexController.currentUser[0]["user"]["id"].toString();
|
//TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
|
||||||
TrackingService.addTrack(user_id, position!.latitude, position.longitude).then((val){
|
print("---- postion is ${position.latitude}, ${position.longitude}");
|
||||||
//checkForCheckin(position!.latitude, position.longitude);
|
checkForCheckin(position!.latitude, position.longitude);
|
||||||
});
|
//});
|
||||||
|
|
||||||
}
|
}
|
||||||
print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
print(position == null ? 'Unknown' : 'current position is ${position.latitude.toString()}, ${position.longitude.toString()}');
|
||||||
@ -161,6 +195,14 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void checkPermission() async {
|
||||||
|
LocationPermission permission = await Geolocator.checkPermission();
|
||||||
|
if (permission != LocationPermission.whileInUse ||
|
||||||
|
permission != LocationPermission.always) {
|
||||||
|
permission = await Geolocator.requestPermission();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void deleteDestination(Destination d){
|
void deleteDestination(Destination d){
|
||||||
//int id = destinations[index].location_id!;
|
//int id = destinations[index].location_id!;
|
||||||
//print("---- index ${destinations[index].location_id!}-----");
|
//print("---- index ${destinations[index].location_id!}-----");
|
||||||
@ -215,11 +257,9 @@ class DestinationController extends GetxController {
|
|||||||
DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
db.getDestinations().then((value){
|
db.getDestinations().then((value){
|
||||||
for(Destination d in value){
|
for(Destination d in value){
|
||||||
print("-- destination controller Populating destination -- ${d.name}-----::::");
|
|
||||||
|
|
||||||
for(Destination s in currentSelectedDestinations){
|
for(Destination s in currentSelectedDestinations){
|
||||||
if(d.location_id == s.location_id){
|
if(d.location_id == s.location_id){
|
||||||
d.selected = !d.selected;
|
d.selected = !d.selected!;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -90,6 +90,7 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
automaticallyImplyLeading: false,
|
automaticallyImplyLeading: false,
|
||||||
title: Text("app_title".tr),
|
title: Text("app_title".tr),
|
||||||
actions: [
|
actions: [
|
||||||
|
Obx(() =>
|
||||||
ToggleButtons(
|
ToggleButtons(
|
||||||
disabledColor: Colors.grey.shade200,
|
disabledColor: Colors.grey.shade200,
|
||||||
selectedColor: Colors.red,
|
selectedColor: Colors.red,
|
||||||
@ -103,10 +104,11 @@ class _DestinationPageState extends State<DestinationPage> {
|
|||||||
},
|
},
|
||||||
isSelected: destinationController.isSelected,
|
isSelected: destinationController.isSelected,
|
||||||
),
|
),
|
||||||
IconButton(onPressed: (){
|
),
|
||||||
showCurrentPosition();
|
// IconButton(onPressed: (){
|
||||||
},
|
// showCurrentPosition();
|
||||||
icon: Icon(Icons.location_on_outlined))
|
// },
|
||||||
|
// icon: Icon(Icons.location_on_outlined))
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
body: Obx(() =>
|
body: Obx(() =>
|
||||||
|
|||||||
@ -159,6 +159,8 @@ class _DestinationMapPageState extends State<DestinationMapPage> {
|
|||||||
// do something
|
// do something
|
||||||
}
|
}
|
||||||
if (mapEvent is MapEventMoveEnd) {
|
if (mapEvent is MapEventMoveEnd) {
|
||||||
|
destinationController.isSelected.clear();
|
||||||
|
destinationController.isSelected.add(false);
|
||||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||||
//indexController.loadLocationsBound();
|
//indexController.loadLocationsBound();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -47,6 +47,7 @@ class IndexController extends GetxController {
|
|||||||
|
|
||||||
var mode = 0.obs;
|
var mode = 0.obs;
|
||||||
|
|
||||||
|
// master mode, rog or selection
|
||||||
var rog_mode = 1.obs;
|
var rog_mode = 1.obs;
|
||||||
|
|
||||||
var desination_mode = 1.obs;
|
var desination_mode = 1.obs;
|
||||||
|
|||||||
@ -34,18 +34,18 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
//automaticallyImplyLeading: false,
|
//automaticallyImplyLeading: false,
|
||||||
title: Text("Add locations"),
|
title: Text("Add locations"),
|
||||||
actions: [
|
actions: [
|
||||||
// RaisedButton(
|
RaisedButton(
|
||||||
// child: Text("db"),
|
child: Text("db"),
|
||||||
// onPressed: (){
|
onPressed: (){
|
||||||
// DatabaseHelper db = DatabaseHelper.instance;
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
// db.getDestinations().then((value){
|
db.getDestinations().then((value){
|
||||||
// print("-------- lendth in db ${value.length} ---- :::::");
|
print("-------- lendth in db ${value.length} ---- :::::");
|
||||||
// for(Destination d in value){
|
for(Destination d in value){
|
||||||
// print("-------- values in db are ${d.toString()} ---- :::::");
|
print("-------- values in db are ${d.checkedin} ---- :::::");
|
||||||
// };
|
};
|
||||||
// });
|
});
|
||||||
// },
|
},
|
||||||
// ),
|
),
|
||||||
CatWidget(indexController: indexController,),
|
CatWidget(indexController: indexController,),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@ -65,7 +65,6 @@ class IndexPage extends GetView<IndexController> {
|
|||||||
onPressed: (){
|
onPressed: (){
|
||||||
indexController.toggleMode();
|
indexController.toggleMode();
|
||||||
if(indexController.currentCat.isNotEmpty){
|
if(indexController.currentCat.isNotEmpty){
|
||||||
print("###############");
|
|
||||||
print(indexController.currentCat[0].toString());
|
print(indexController.currentCat[0].toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -39,7 +39,9 @@ class DatabaseHelper{
|
|||||||
list_order INTEGER,
|
list_order INTEGER,
|
||||||
photos TEXT,
|
photos TEXT,
|
||||||
checkin_radious REAL,
|
checkin_radious REAL,
|
||||||
auto_checkin INTEGER
|
auto_checkin INTEGER,
|
||||||
|
selected INTEGER,
|
||||||
|
checkedin INTEGER
|
||||||
)
|
)
|
||||||
''');
|
''');
|
||||||
}
|
}
|
||||||
@ -85,6 +87,20 @@ class DatabaseHelper{
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<int> updateAction(Destination destination, bool checkin)async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
int act = checkin == false ? 0 : 1;
|
||||||
|
Map<String, dynamic> row = {
|
||||||
|
"checkedin": act
|
||||||
|
};
|
||||||
|
return await db.update(
|
||||||
|
"destination",
|
||||||
|
row,
|
||||||
|
where: 'location_id = ?',
|
||||||
|
whereArgs: [destination.location_id]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Future<int?> getPending() async{
|
// Future<int?> getPending() async{
|
||||||
// Database db = await instance.database;
|
// Database db = await instance.database;
|
||||||
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
// return await Sqflite.firstIntValue(await db.rawQuery("SELECT COUNT(*) FROM incidents"));
|
||||||
|
|||||||
@ -18,7 +18,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
final IndexController indexController = Get.find<IndexController>();
|
final IndexController indexController = Get.find<IndexController>();
|
||||||
final DestinationController destinationController = Get.find<DestinationController>();
|
final DestinationController destinationController = Get.find<DestinationController>();
|
||||||
|
|
||||||
Image getImage(GeoJsonFeature? gf){
|
Image getImage(){
|
||||||
|
|
||||||
|
if(indexController.rog_mode == 1){
|
||||||
|
if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){
|
||||||
|
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
|
||||||
|
return Image(image: NetworkImage(
|
||||||
|
indexController.currentDestinationFeature[0].photos!,
|
||||||
|
),
|
||||||
|
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
|
return Image.asset("assets/images/empty_image.png");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
GeoJsonFeature<dynamic> gf = indexController.currentFeature[0];
|
||||||
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
|
||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
}
|
||||||
@ -33,15 +51,134 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
void _launchURL(url) async {
|
void _launchURL(url) async {
|
||||||
if (!await launch(url)) throw 'Could not launch $url';
|
if (!await launch(url)) throw 'Could not launch $url';
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Wrap(
|
|
||||||
|
return indexController.rog_mode == 0 ? detailsSheet(context) : destinationSheet(context);
|
||||||
|
}
|
||||||
|
|
||||||
|
SingleChildScrollView destinationSheet(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Column(
|
Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Container(
|
||||||
|
child: Row(
|
||||||
|
children: [
|
||||||
|
MaterialButton(
|
||||||
|
onPressed: () {
|
||||||
|
indexController.makePrevious(indexController.currentFeature[0]);
|
||||||
|
},
|
||||||
|
color: Colors.blue,
|
||||||
|
textColor: Colors.white,
|
||||||
|
child: Icon(
|
||||||
|
Icons.arrow_back_ios,
|
||||||
|
size: 14,
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
shape: CircleBorder(),
|
||||||
|
),
|
||||||
|
Expanded(
|
||||||
|
child: Container(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
child: Obx(() =>
|
||||||
|
Text(indexController.currentDestinationFeature[0].name!, style: TextStyle(
|
||||||
|
fontSize: 15.0,
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
MaterialButton(
|
||||||
|
onPressed: () {
|
||||||
|
print("----- next is ${indexController.currentFeature[0]} ------");
|
||||||
|
//indexController.makeNext(indexController.currentFeature[0]);
|
||||||
|
},
|
||||||
|
color: Colors.blue,
|
||||||
|
textColor: Colors.white,
|
||||||
|
child: Icon(
|
||||||
|
Icons.arrow_forward_ios,
|
||||||
|
size: 14,
|
||||||
|
),
|
||||||
|
padding: EdgeInsets.all(16),
|
||||||
|
shape: CircleBorder(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Expanded(
|
||||||
|
child: SizedBox(
|
||||||
|
height: 260.0,
|
||||||
|
child: Obx(() => getImage()),
|
||||||
|
)
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
Obx(() =>
|
||||||
|
indexController.currentDestinationFeature[0].address!.isNotEmpty ?
|
||||||
|
getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '')
|
||||||
|
:
|
||||||
|
Container(width: 0.0, height: 0,),
|
||||||
|
),
|
||||||
|
Obx(() =>
|
||||||
|
indexController.currentDestinationFeature[0].phone!.isNotEmpty ?
|
||||||
|
getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '')
|
||||||
|
:
|
||||||
|
Container(width: 0.0, height: 0,),
|
||||||
|
),
|
||||||
|
Obx(() =>
|
||||||
|
indexController.currentDestinationFeature[0].email!.isNotEmpty ?
|
||||||
|
getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '')
|
||||||
|
:
|
||||||
|
Container(width: 0.0, height: 0,),
|
||||||
|
),
|
||||||
|
Obx(() =>
|
||||||
|
indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ?
|
||||||
|
getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true)
|
||||||
|
:
|
||||||
|
Container(width: 0.0, height: 0,),
|
||||||
|
),
|
||||||
|
Obx(() =>
|
||||||
|
indexController.currentDestinationFeature[0].videos!.isNotEmpty ?
|
||||||
|
getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true)
|
||||||
|
:
|
||||||
|
Container(width: 0.0, height: 0,),
|
||||||
|
),
|
||||||
|
SizedBox(height: 20.0,),
|
||||||
|
Obx(() =>
|
||||||
|
//wantToGo(context),
|
||||||
|
|
||||||
|
FutureBuilder<Widget>(
|
||||||
|
future: wantToGo(context),
|
||||||
|
builder: (context, snapshot) {
|
||||||
|
return Container(
|
||||||
|
child: snapshot.data,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
|
||||||
|
),
|
||||||
|
SizedBox(height: 60.0,)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
SingleChildScrollView detailsSheet(BuildContext context) {
|
||||||
|
return SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
children: [
|
children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
@ -96,38 +233,38 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
Expanded(
|
Expanded(
|
||||||
child: SizedBox(
|
child: SizedBox(
|
||||||
height: 260.0,
|
height: 260.0,
|
||||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
child: Obx(() => getImage()),
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
(indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
|
(indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
|
||||||
getDetails("address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
|
getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
|
||||||
:
|
:
|
||||||
Container(width: 0.0, height: 0,),
|
Container(width: 0.0, height: 0,),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
(indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
|
(indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
|
||||||
getDetails("telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
|
getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
|
||||||
:
|
:
|
||||||
Container(width: 0.0, height: 0,),
|
Container(width: 0.0, height: 0,),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
(indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
|
(indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
|
||||||
getDetails("email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
|
getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
|
||||||
:
|
:
|
||||||
Container(width: 0.0, height: 0,),
|
Container(width: 0.0, height: 0,),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
(indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
|
(indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
|
||||||
getDetails("web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
|
getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
|
||||||
:
|
:
|
||||||
Container(width: 0.0, height: 0,),
|
Container(width: 0.0, height: 0,),
|
||||||
),
|
),
|
||||||
Obx(() =>
|
Obx(() =>
|
||||||
(indexController.currentFeature[0].properties!["videos"] as String).isNotEmpty ?
|
(indexController.currentFeature[0].properties!["videos"] as String).isNotEmpty ?
|
||||||
getDetails("video".tr, indexController.currentFeature[0].properties!["videos"] ?? '', isurl: true)
|
getDetails(context, "video".tr, indexController.currentFeature[0].properties!["videos"] ?? '', isurl: true)
|
||||||
:
|
:
|
||||||
Container(width: 0.0, height: 0,),
|
Container(width: 0.0, height: 0,),
|
||||||
),
|
),
|
||||||
@ -147,28 +284,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
),
|
),
|
||||||
SizedBox(height: 60.0,)
|
SizedBox(height: 60.0,)
|
||||||
],
|
],
|
||||||
)
|
),
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Future<Widget> wantToGo(BuildContext context)async {
|
Future<Widget> wantToGo(BuildContext context)async {
|
||||||
DatabaseHelper db = DatabaseHelper.instance;
|
|
||||||
bool isAdded = await db.isAlreadyAvailable(indexController.currentFeature[0].properties!["location_id"]);
|
|
||||||
return
|
|
||||||
isAdded == true ? Container(child: Text("すでに追加されています"),) :
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
|
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
//bool isAdded = await db.isAlreadyAvailable(indexController.currentFeature[0].properties!["location_id"]);
|
||||||
|
return
|
||||||
|
// isAdded == true ? Container(child: Text("すでに追加されています"),) :
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
indexController.rog_mode == 0 ?
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: (){
|
|
||||||
},
|
|
||||||
child: ElevatedButton(
|
|
||||||
child: Text("want_to_go".tr),
|
child: Text("want_to_go".tr),
|
||||||
onPressed: (){
|
onPressed: (){
|
||||||
GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint;
|
GeoJsonMultiPoint mp = indexController.currentFeature[0].geometry as GeoJsonMultiPoint;
|
||||||
@ -189,12 +323,36 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
list_order: 1,
|
list_order: 1,
|
||||||
photos: indexController.currentFeature[0].properties!["photos"],
|
photos: indexController.currentFeature[0].properties!["photos"],
|
||||||
checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"],
|
checkin_radious: indexController.currentFeature[0].properties!["checkin_radious"],
|
||||||
auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0
|
auto_checkin: indexController.currentFeature[0].properties!["auto_checkin"] == true ? 1 : 0,
|
||||||
|
selected: false,
|
||||||
|
checkedin: false
|
||||||
);
|
);
|
||||||
destinationController.addDestinations(dest);
|
destinationController.addDestinations(dest);
|
||||||
},
|
},
|
||||||
),
|
):
|
||||||
),
|
Container(),
|
||||||
|
SizedBox(width: 20.0,) ,
|
||||||
|
Obx((() =>
|
||||||
|
|
||||||
|
indexController.rog_mode == 1 ?
|
||||||
|
ElevatedButton(
|
||||||
|
onPressed: () async {
|
||||||
|
Destination dest = indexController.currentDestinationFeature[0]!;
|
||||||
|
//print("------ curent destination is ${dest!.checkedIn}-------");
|
||||||
|
if(dest != null){
|
||||||
|
print("------ curent destination is ${dest!.checkedin}-------::::::::::");
|
||||||
|
destinationController.makeCheckin(dest, !dest.checkedin!);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
child: indexController.currentDestinationFeature[0].checkedin == false ?
|
||||||
|
Text("Check in")
|
||||||
|
:
|
||||||
|
Text("Check out")
|
||||||
|
):
|
||||||
|
Container()
|
||||||
|
|
||||||
|
)
|
||||||
|
)
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
@ -208,8 +366,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
Flexible(
|
Row(
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
indexController.currentAction[0][0]["checkin"] == false ?
|
indexController.currentAction[0][0]["checkin"] == false ?
|
||||||
@ -264,7 +421,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
,
|
,
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
@ -386,45 +542,36 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget getDetails(String label, String text, {bool isurl=false}){
|
|
||||||
|
Widget getDetails(BuildContext context, String label, String text, {bool isurl=false}){
|
||||||
return Row(
|
return Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
|
||||||
Flexible(
|
|
||||||
flex: 1,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
|
||||||
children: [
|
children: [
|
||||||
Text(label),
|
Text(label),
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(width: 10.0,),
|
SizedBox(width: 10.0,),
|
||||||
Flexible(
|
Flexible(
|
||||||
flex: 3,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: (){
|
onTap: (){
|
||||||
if(isurl){
|
if(isurl){
|
||||||
|
if(indexController.rog_mode == 0){
|
||||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
indexController.currentDestinationFeature[0].webcontents;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
},
|
},
|
||||||
child: Text(text,
|
child: Text(text,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
color: Colors.blue,
|
color: Colors.blue,
|
||||||
),
|
),
|
||||||
softWrap: true,
|
overflow: TextOverflow.ellipsis,
|
||||||
overflow: TextOverflow.fade,
|
maxLines: 5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -24,6 +24,7 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
return Image(image: AssetImage('assets/images/empty_image.png'));
|
return Image(image: AssetImage('assets/images/empty_image.png'));
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
print("------- image is ${destinationController.destinations[index].photos!}------");
|
||||||
return Image(image: NetworkImage(
|
return Image(image: NetworkImage(
|
||||||
destinationController.destinations[index].photos!),
|
destinationController.destinations[index].photos!),
|
||||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
@ -115,12 +116,11 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
{
|
{
|
||||||
double lat = destinationController.destinations[index].lat as double;
|
Destination? fs = destinationController.destinations[index];
|
||||||
double lon = destinationController.destinations[index].lon as double;
|
|
||||||
Destination? fs = await destinationController.getDEstinationForLatLong(lat, lon);
|
|
||||||
print("----fsf-----${fs}");
|
print("----fsf-----${fs}");
|
||||||
if(fs != null){
|
if(fs != null){
|
||||||
if(indexController.currentFeature.length > 0) {
|
|
||||||
|
if(indexController.currentDestinationFeature.length > 0) {
|
||||||
indexController.currentDestinationFeature.clear();
|
indexController.currentDestinationFeature.clear();
|
||||||
}
|
}
|
||||||
indexController.currentDestinationFeature.add(fs);
|
indexController.currentDestinationFeature.add(fs);
|
||||||
@ -153,7 +153,7 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
|
|
||||||
},
|
},
|
||||||
selectedTileColor: Colors.amberAccent,
|
selectedTileColor: Colors.amberAccent,
|
||||||
selected:destinationController.destinations[index].selected,
|
selected:destinationController.destinations[index].selected!,
|
||||||
leading: getImage(index),
|
leading: getImage(index),
|
||||||
title: Text(destinationController.destinations[index].name!),
|
title: Text(destinationController.destinations[index].name!),
|
||||||
subtitle: Text(destinationController.destinations[index].category!),
|
subtitle: Text(destinationController.destinations[index].category!),
|
||||||
@ -161,12 +161,12 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
startChild:
|
startChild:
|
||||||
destinationController.matrix["rows"] != null ?
|
destinationController.matrix["rows"][0]["elements"] != null ?
|
||||||
Column(
|
Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
children: [
|
children: [
|
||||||
Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
//Text(destinationController.matrix["rows"][0]["elements"][index]["distance"]["text"].toString()),
|
||||||
Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
//Text(destinationController.matrix["rows"][0]["elements"][index]["duration"]["text"].toString())
|
||||||
],
|
],
|
||||||
):
|
):
|
||||||
Container()
|
Container()
|
||||||
|
|||||||
@ -136,10 +136,9 @@ class MapWidget extends StatelessWidget {
|
|||||||
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
GeoJsonFeature? fs = indexController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
|
||||||
//print("------- fs ${fs}------");
|
//print("------- fs ${fs}------");
|
||||||
if(fs != null){
|
if(fs != null){
|
||||||
if(indexController.currentFeature.length > 0) {
|
|
||||||
indexController.currentFeature.clear();
|
indexController.currentFeature.clear();
|
||||||
}
|
|
||||||
indexController.currentFeature.add(fs);
|
indexController.currentFeature.add(fs);
|
||||||
|
//print("----- fs is ${fs.properties!['photos']}");
|
||||||
indexController.getAction();
|
indexController.getAction();
|
||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
|
|||||||
Reference in New Issue
Block a user