update to add resume app from sleep

This commit is contained in:
Mohamed Nouffer
2023-08-16 14:53:32 +05:30
parent 68bf3e9ab3
commit 2ab96cc3d0
51 changed files with 748 additions and 789 deletions

View File

@ -13,7 +13,7 @@ class BaseLayer extends StatelessWidget {
FMTCTileProviderSettings(
behavior: CacheBehavior.values
.byName('cacheFirst'),
cachedValidDuration: Duration(
cachedValidDuration: const Duration(
days: 14
),
),

View File

@ -1,15 +1,9 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:geojson/geojson.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:image_picker/image_picker.dart';
import 'package:latlong2/latlong.dart';
import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
@ -28,11 +22,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Image getImage(){
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
if(indexController.rog_mode == 1){
//print("----- rogaining mode 1");
if(indexController.currentDestinationFeature.length <= 0 || indexController.currentDestinationFeature[0].photos! == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
if(indexController.currentDestinationFeature.isEmpty || indexController.currentDestinationFeature[0].photos! == ""){
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
//print("@@@@@@@@@@@@@ rog mode -------------------- ${indexController.currentDestinationFeature[0].photos} @@@@@@@@@@@");
@ -48,7 +42,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
else {
return Image(image: NetworkImage(
'${server_url}/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
'$serverUrl/media/compressed/' + indexController.currentDestinationFeature[0].photos!,
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
@ -59,11 +53,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
else{
GeoJsonFeature<dynamic> gf = indexController.currentFeature[0];
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
if(gf.properties!["photos"] == null || gf.properties!["photos"] == ""){
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
String _photo = gf!.properties!["photos"];
String _photo = gf.properties!["photos"];
if(_photo.contains('http')){
return Image(image: NetworkImage(
gf.properties!["photos"],
@ -75,7 +69,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
else {
return Image(image: NetworkImage(
'${server_url}/media/compressed/' + gf.properties!["photos"],
'$serverUrl/media/compressed/' + gf.properties!["photos"],
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
@ -94,7 +88,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
bool isInDestination(String locationid){
int lid = int.parse(locationid);
if(destinationController.destinations.where((element) => element.location_id == lid).length > 0){
if(destinationController.destinations.where((element) => element.location_id == lid).isNotEmpty){
return true;
}
else{
@ -130,25 +124,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
child: const Icon(
Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(16),
shape: CircleBorder(),
padding: const EdgeInsets.all(16),
shape: const CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
indexController.currentUser.length > 0 ?
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
indexController.currentUser.isNotEmpty ?
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: const TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
:
Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
Text(indexController.currentDestinationFeature[0].name!, style: const TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
@ -257,33 +251,33 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.currentDestinationFeature[0].address != null && indexController.currentDestinationFeature[0].address!.isNotEmpty ?
getDetails(context, "address".tr, indexController.currentDestinationFeature[0].address! ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
),
Obx(() =>
indexController.currentDestinationFeature[0].phone != null && indexController.currentDestinationFeature[0].phone!.isNotEmpty ?
getDetails(context, "telephone".tr, indexController.currentDestinationFeature[0].phone! ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
),
Obx(() =>
indexController.currentDestinationFeature[0].email != null && indexController.currentDestinationFeature[0].email!.isNotEmpty ?
getDetails(context, "email".tr, indexController.currentDestinationFeature[0].email! ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
),
Obx(() =>
indexController.currentDestinationFeature[0].webcontents != null && indexController.currentDestinationFeature[0].webcontents!.isNotEmpty ?
getDetails(context, "web".tr, indexController.currentDestinationFeature[0].webcontents! ?? '', isurl: true)
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
),
Obx(() =>
indexController.currentDestinationFeature[0].videos != null && indexController.currentDestinationFeature[0].videos!.isNotEmpty ?
getDetails(context, "video".tr, indexController.currentDestinationFeature[0].videos! ?? '', isurl: true)
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
),
SizedBox(height: 20.0,),
const SizedBox(height: 20.0,),
// Obx(() =>
// //wantToGo(context),
@ -297,7 +291,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
// ),
// ),
SizedBox(height: 60.0,)
const SizedBox(height: 60.0,)
],
),
);
@ -321,19 +315,19 @@ class BottomSheetNew extends GetView<BottomSheetController> {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
child: const Icon(
Icons.arrow_back_ios,
//Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(16),
shape: CircleBorder(),
padding: const EdgeInsets.all(16),
shape: const CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
@ -423,7 +417,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.currentFeature[0].properties!["location_name"] != null && (indexController.currentFeature[0].properties!["location_name"] as String).isNotEmpty ?
Flexible(child: Text(indexController.currentFeature[0].properties!["location_name"]))
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -432,8 +426,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
Get.back();
print("---- go to ----");
GeoJsonFeature<GeoJsonMultiPoint> mp = indexController.currentFeature[0] as GeoJsonFeature<GeoJsonMultiPoint>;
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest);
print("------- position -------- ${position}");
Position position = await Geolocator.getCurrentPosition(desiredAccuracy: LocationAccuracy.lowest, forceAndroidLocationManager: true);
print("------- position -------- $position");
Destination ds = Destination(
lat: position.latitude,
lon: position.longitude
@ -447,20 +441,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
destinationController.destinationMatrixFromCurrentPoint([ds, tp]);
},
child:Text("ここへ行く")),
child:const Text("ここへ行く")),
],
),
SizedBox(height: 8.0,),
const SizedBox(height: 8.0,),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.roundabout_left),
SizedBox(width: 8.0,),
const Icon(Icons.roundabout_left),
const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["address"] != null && (indexController.currentFeature[0].properties!["address"] as String).isNotEmpty ?
getDetails(context, "address".tr, indexController.currentFeature[0].properties!["address"] ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -468,12 +462,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.phone),
SizedBox(width: 8.0,),
const Icon(Icons.phone),
const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["phone"] != null && (indexController.currentFeature[0].properties!["phone"] as String).isNotEmpty ?
getDetails(context, "telephone".tr, indexController.currentFeature[0].properties!["phone"] ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -481,12 +475,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.email),
SizedBox(width: 8.0,),
const Icon(Icons.email),
const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["email"] != null && (indexController.currentFeature[0].properties!["email"] as String).isNotEmpty ?
getDetails(context, "email".tr, indexController.currentFeature[0].properties!["email"] ?? '')
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -494,12 +488,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Icon(Icons.language),
SizedBox(width: 8.0,),
const Icon(Icons.language),
const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["webcontents"] != null && (indexController.currentFeature[0].properties!["webcontents"] as String).isNotEmpty ?
getDetails(context, "web".tr, indexController.currentFeature[0].properties!["webcontents"] ?? '', isurl: true)
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -507,11 +501,11 @@ class BottomSheetNew extends GetView<BottomSheetController> {
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
SizedBox(width: 8.0,),
const SizedBox(width: 8.0,),
indexController.currentFeature[0].properties!["remark"] != null && (indexController.currentFeature[0].properties!["remark"] as String).isNotEmpty ?
getDetails(context, "remarks".tr, indexController.currentFeature[0].properties!["remark"] ?? '', isurl: false)
:
Container(width: 0.0, height: 0,),
const SizedBox(width: 0.0, height: 0,),
],
),
),
@ -520,7 +514,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
),
)
),
SizedBox(height: 60.0,)
const SizedBox(height: 60.0,)
],
),
);
@ -645,23 +639,20 @@ class BottomSheetNew extends GetView<BottomSheetController> {
// // },
// // ):
// // Container(),
SizedBox(width: 8.0,) ,
const SizedBox(width: 8.0,) ,
Obx((() =>
indexController.rog_mode == 1 ?
ElevatedButton(
onPressed: () async {
Destination dest = indexController.currentDestinationFeature[0]!;
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!, "");
}
destinationController.makeCheckin(dest, !dest.checkedin!, "");
},
child: indexController.currentDestinationFeature[0].checkedin == false ?
Text("チェックイン")
const Text("チェックイン")
:
Text("チェックアウト")
const Text("チェックアウト")
):
Container()
@ -690,7 +681,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
mainAxisSize: MainAxisSize.max,
children: [
ElevatedButton(
child: Text("Image"), onPressed: (){
child: const Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){
//print("----- image---- ${value!.path}");
@ -729,7 +720,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
indexController.makeAction(context);
},
child: Icon(
child: const Icon(
Icons.favorite, color: Colors.red)
,
@ -747,7 +738,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(label),
SizedBox(width: 10.0,),
const SizedBox(width: 10.0,),
InkWell(
onTap: (){
if(isurl){
@ -760,7 +751,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
},
child: Container(
child: SizedBox(
width: MediaQuery.of(context).size.width - 160,
child: Text(text,
style: TextStyle(

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
@ -13,9 +12,11 @@ class BottomSheetWidget extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
BottomSheetWidget({Key? key}) : super(key: key);
Image getImage(GeoJsonFeature? gf){
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(image: NetworkImage(
@ -37,7 +38,7 @@ class BottomSheetWidget extends StatelessWidget {
return SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 5.0,),
const SizedBox(height: 5.0,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -47,18 +48,18 @@ class BottomSheetWidget extends StatelessWidget {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
child: const Icon(
Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
padding: const EdgeInsets.all(14),
shape: const CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
@ -72,12 +73,12 @@ class BottomSheetWidget extends StatelessWidget {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
child: const Icon(
Icons.arrow_forward_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
padding: const EdgeInsets.all(14),
shape: const CircleBorder(),
),
],
),
@ -105,59 +106,59 @@ class BottomSheetWidget extends StatelessWidget {
Expanded(
child: Container(
alignment: Alignment.topRight,
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)),
),
SizedBox(width: 12.0,),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
softWrap: true,
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0,),
): const SizedBox(width: 0.0, height: 0,),
indexController.currentFeature[0].properties!["phone"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["email"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["webcontents"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -165,8 +166,8 @@ class BottomSheetWidget extends StatelessWidget {
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text(
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
"web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
@ -175,40 +176,40 @@ class BottomSheetWidget extends StatelessWidget {
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
},
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
softWrap: false,
overflow: TextOverflow.fade,),
)),
),
)
],
): Container(width: 0.0, height: 0.0,),
): const SizedBox(width: 0.0, height: 0.0,),
indexController.currentFeature[0].properties!["videos"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0.0,),
): const SizedBox(width: 0.0, height: 0.0,),
],
),
),
),
],
),
SizedBox(height: 20.0,),
const SizedBox(height: 20.0,),
Obx(() =>
indexController.currentAction.isNotEmpty ?
Row(
@ -232,7 +233,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -246,7 +247,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -267,7 +268,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -281,7 +282,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -302,7 +303,7 @@ class BottomSheetWidget extends StatelessWidget {
:
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
indexController.rog_mode.value == 1 ?
indexController.currentAction[0][0]["checkin"] == false ?
Column(
@ -311,7 +312,7 @@ class BottomSheetWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.max,
children: [
ElevatedButton(
child: Text("Image"), onPressed: (){
child: const Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){
print("----- image---- ${value!.path}");
@ -327,7 +328,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -344,18 +345,18 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Icon(
child: const Icon(
Icons.favorite, color: Colors.red)
,
):
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
],
): Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -364,7 +365,7 @@ class BottomSheetWidget extends StatelessWidget {
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
],
),
),

View File

@ -15,7 +15,7 @@ class BreadCrumbWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
print("------ map controller is ${mapController}------------");
print("------ map controller is $mapController------------");
return
Obx(()=>
indexController.perfectures.isNotEmpty && mapController != null ?

View File

@ -1,6 +1,5 @@
import 'package:flutter/material.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/location_service.dart';
class CatWidget extends StatefulWidget {
CatWidget({ Key? key, required this.indexController, }) : super(key: key);

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
@ -7,8 +6,6 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:timeline_tile/timeline_tile.dart';
class DestinationWidget extends StatelessWidget {
@ -22,7 +19,7 @@ class DestinationWidget extends StatelessWidget {
Image getImage(int index){
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("------- image is ${destinationController.destinations[index].photos!}------");
@ -36,10 +33,10 @@ class DestinationWidget extends StatelessWidget {
);
}
else {
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
return Image(image: NetworkImage(
'${server_url}/media/compressed/' + destinationController.destinations[index].photos!),
'$serverUrl/media/compressed/' + destinationController.destinations[index].photos!),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
@ -63,10 +60,10 @@ class DestinationWidget extends StatelessWidget {
// }
void doDelete() {
destinationController.currentSelectedDestinations.forEach((element) {
for (var element in destinationController.currentSelectedDestinations) {
destinationController.deleteDestination(element);
destinationController.resetRogaining();
});
}
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// destinationController.deleteDestination(element["index"]);
@ -75,7 +72,7 @@ class DestinationWidget extends StatelessWidget {
}
void moveUp() {
Destination? d = null;
Destination? d;
for(Destination ad in destinationController.destinations){
if(ad.selected == true){
d = ad;
@ -89,7 +86,7 @@ class DestinationWidget extends StatelessWidget {
}
void moveDown() {
Destination? d = null;
Destination? d;
for(Destination ad in destinationController.destinations){
if(ad.selected == true){
d = ad;
@ -107,8 +104,8 @@ class DestinationWidget extends StatelessWidget {
title: "are_you_sure_want_to_delete_all".tr,
middleText: "all_added_destination_will_be_deleted".tr,
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
titleStyle: const TextStyle(color: Colors.white),
middleTextStyle: const TextStyle(color: Colors.white),
textConfirm: "confirm".tr,
textCancel: "cancel".tr,
cancelTextColor: Colors.white,
@ -138,9 +135,9 @@ class DestinationWidget extends StatelessWidget {
// });
}
Future getIsLocationAvilable(int location_id) async {
Future getIsLocationAvilable(int locationId) async {
DatabaseHelper db = DatabaseHelper.instance;
return await db.isAlreadyAvailable(location_id);
return await db.isAlreadyAvailable(locationId);
}
@override
@ -164,7 +161,7 @@ class DestinationWidget extends StatelessWidget {
isFirst: index == 0 ? true : false,
indicatorStyle: IndicatorStyle(
indicator: CircleAvatar(
child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),),
child: Text(destinationController.destinations[index].list_order.toString(), style: const TextStyle(color: Colors.white),),
backgroundColor: Colors.red,
),
),
@ -178,22 +175,19 @@ class DestinationWidget extends StatelessWidget {
onTap: () async {
{
Destination? fs = destinationController.destinations[index];
print("----fsf-----${index}");
if(fs != null){
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(fs);
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
//indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
print("----fsf-----$index");
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
};
indexController.currentDestinationFeature.add(fs);
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
//indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
}
},
onLongPress: (){
destinationController.toggleSelection(destinationController.destinations[index]);
@ -229,7 +223,7 @@ class DestinationWidget extends StatelessWidget {
color: Colors.grey.withOpacity(0.3),
spreadRadius: 5,
blurRadius: 3,
offset: Offset(0, 7), // changes position of shadow
offset: const Offset(0, 7), // changes position of shadow
),
],
),
@ -239,22 +233,22 @@ class DestinationWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon:Icon(Icons.delete_forever),
icon:const Icon(Icons.delete_forever),
//onPressed: (){doDelete();},
onPressed: clearall,
),
IconButton(
icon:Icon(Icons.cancel),
icon:const Icon(Icons.cancel),
//onPressed: (){doDelete();},
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? doDelete : null,
),
IconButton(
icon:Icon(Icons.move_up),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveUp : null,
icon:const Icon(Icons.move_up),
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveUp : null,
),
IconButton(
icon:Icon(Icons.move_down),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveDown : null,
icon:const Icon(Icons.move_down),
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveDown : null,
),
// IconButton(
// icon:Icon(Icons.sync),

View File

@ -7,10 +7,9 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/maxtrix_service.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatefulWidget {
ListWidget({ Key? key }) : super(key: key);
const ListWidget({ Key? key }) : super(key: key);
@override
State<ListWidget> createState() => _ListWidgetState();
@ -23,16 +22,16 @@ class _ListWidgetState extends State<ListWidget> {
Image getImage(int index){
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("==== photo index is ${index} ===");
String server_url = ConstValues.currentServer();
print("==== photo index is $index ===");
String serverUrl = ConstValues.currentServer();
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
String _photo = gf!.properties!["photos"];
String _photo = gf.properties!["photos"];
return Image(
image: NetworkImage(
'${server_url}/media/compressed/' + _photo
'$serverUrl/media/compressed/' + _photo
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
@ -42,7 +41,7 @@ class _ListWidgetState extends State<ListWidget> {
}
void changeCurrentFeature(GeoJsonFeature fs){
if(indexController.currentFeature.length > 0){
if(indexController.currentFeature.isNotEmpty){
indexController.currentFeature.clear();
}
indexController.currentFeature.add(fs);
@ -89,7 +88,7 @@ class _ListWidgetState extends State<ListWidget> {
@override
Widget build(BuildContext context) {
return Obx(() =>
indexController.locations.length > 0 ?
indexController.locations.isNotEmpty ?
RefreshIndicator(
onRefresh: _pullRefresh,
child: ListView.builder(
@ -119,13 +118,13 @@ class _ListWidgetState extends State<ListWidget> {
);
},
leading: getImage(index),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""),
trailing: Column(
crossAxisAlignment: CrossAxisAlignment.end,
children: [
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""),
Container(
indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
SizedBox(
width: 100,
child: FutureBuilder<String>(
future: matrixDistance(index),
@ -134,10 +133,10 @@ class _ListWidgetState extends State<ListWidget> {
return const Center(child: CircularProgressIndicator(),);
}
if(snapshot.hasError){
return Text("-");
return const Text("-");
}
else{
return Text(snapshot.data ?? '', style: TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
return Text(snapshot.data ?? '', style: const TextStyle(color: Colors.red, fontWeight: FontWeight.bold),);
}
},
),
@ -148,7 +147,7 @@ class _ListWidgetState extends State<ListWidget> {
);
},
),
) : Container(width: 0, height: 0,),
) : const SizedBox(width: 0, height: 0,),
);
}
}

View File

@ -6,14 +6,12 @@ import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class MapWidget extends StatelessWidget {
@ -34,7 +32,7 @@ class MapWidget extends StatelessWidget {
InkWell(
onTap: () {
GeoJsonFeature? fs = indexController.getFeatureForLatLong(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude);
print("------- fs ${fs}------");
print("------- fs $fs------");
if(fs != null){
indexController.currentFeature.clear();
indexController.currentFeature.add(fs);
@ -71,19 +69,19 @@ class MapWidget extends StatelessWidget {
child: Stack(
alignment: Alignment.center,
children: [
Icon(Icons.circle,size: 6.0,),
const Icon(Icons.circle,size: 6.0,),
i.properties!['cp'] == -1 ?
Transform.rotate(
alignment: Alignment.centerLeft,
origin: Offset.fromDirection(1, 26),
angle: 270 * pi / 180,
child: Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
child: const Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
Container(color: Colors.transparent,),
],
)
),
),
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
],
);
}
@ -107,8 +105,8 @@ class MapWidget extends StatelessWidget {
return Stack(
children: [
Obx(() =>
indexController.is_loading == true ? Padding(
padding: const EdgeInsets.only(top: 60.0),
indexController.is_loading == true ? const Padding(
padding: EdgeInsets.only(top: 60.0),
child: CircularProgressIndicator(),
):
FlutterMap(
@ -122,7 +120,7 @@ class MapWidget extends StatelessWidget {
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// do something
}
if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) {
if (mapEvent is MapEventMoveEnd && indexController.currentUser.isEmpty) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
indexController.loadLocationsBound();
//indexController.rogMapController!.move(c.center, c.zoom);
@ -131,7 +129,7 @@ class MapWidget extends StatelessWidget {
},
//center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
@ -143,7 +141,7 @@ class MapWidget extends StatelessWidget {
.hideAllPopups(), // Hide popup when the map is tapped.
),
children: [
BaseLayer(),
const BaseLayer(),
Obx(() =>
indexController.routePointLenght > 0 ?
PolylineLayer(
@ -180,7 +178,7 @@ class MapWidget extends StatelessWidget {
}).toList(),
)
:
Center(child: CircularProgressIndicator())
const Center(child: CircularProgressIndicator())
,
],
)

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/cat_widget.dart';
class PerfectureWidget extends StatefulWidget {
@ -166,11 +165,9 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
}
setState(() {
widget.indexController.locations.clear();
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
}
widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
});
},
items: getCustomArea(),
@ -203,7 +200,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
) :
const Text(""),
//CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ?
widget.indexController.cats.isNotEmpty ?
DropdownButton<String>(
value: widget.indexController.getCatText(),
icon: const Icon(Icons.arrow_downward),