optimized
This commit is contained in:
@ -1,5 +1,3 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:geolocator/geolocator.dart';
|
||||
@ -28,15 +26,15 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
Image getImage() {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
if (indexController.rog_mode == 1) {
|
||||
if (indexController.rogMode == 1) {
|
||||
//print("----- rogaining mode 1");
|
||||
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} @@@@@@@@@@@");
|
||||
String _photo = indexController.currentDestinationFeature[0].photos!;
|
||||
if (_photo.contains('http')) {
|
||||
String photo = indexController.currentDestinationFeature[0].photos!;
|
||||
if (photo.contains('http')) {
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
indexController.currentDestinationFeature[0].photos!,
|
||||
@ -49,8 +47,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
} else {
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
'$serverUrl/media/compressed/' +
|
||||
indexController.currentDestinationFeature[0].photos!,
|
||||
'$serverUrl/media/compressed/${indexController.currentDestinationFeature[0].photos!}',
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
@ -64,8 +61,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
if (gf.properties!["photos"] == null || gf.properties!["photos"] == "") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
String _photo = gf.properties!["photos"];
|
||||
if (_photo.contains('http')) {
|
||||
String photo = gf.properties!["photos"];
|
||||
if (photo.contains('http')) {
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
gf.properties!["photos"],
|
||||
@ -78,7 +75,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
} else {
|
||||
return Image(
|
||||
image: NetworkImage(
|
||||
'$serverUrl/media/compressed/' + gf.properties!["photos"],
|
||||
'$serverUrl/media/compressed/${gf.properties!["photos"]}',
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception,
|
||||
StackTrace? stackTrace) {
|
||||
@ -91,7 +88,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
|
||||
void _launchURL(url) async {
|
||||
if (!await launch(url)) throw 'Could not launch $url';
|
||||
if (!await launchUrl(url)) throw 'Could not launch $url';
|
||||
}
|
||||
|
||||
bool isInDestination(String locationid) {
|
||||
@ -107,63 +104,60 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
destinationController.skip_gps = true;
|
||||
print('---- rog_mode ----- ${indexController.rog_mode} -----');
|
||||
return indexController.rog_mode == 0
|
||||
destinationController.skipGps = true;
|
||||
//print('---- rog_mode ----- ${indexController.rog_mode} -----');
|
||||
return indexController.rogMode.value == 0
|
||||
? detailsSheet(context)
|
||||
: destinationSheet(context);
|
||||
}
|
||||
|
||||
// Show destination detais
|
||||
SingleChildScrollView destinationSheet(BuildContext context) {
|
||||
print(
|
||||
'---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----');
|
||||
// print(
|
||||
// '---- currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} -----');
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
//destinationController.makePrevious(indexController.currentDestinationFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
//destinationController.makePrevious(indexController.currentDestinationFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() => 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: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() => 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: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
@ -180,8 +174,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
children: [
|
||||
Obx(
|
||||
() => indexController.currentDestinationFeature.isNotEmpty &&
|
||||
destinationController.is_in_checkin.value == true &&
|
||||
destinationController.is_at_start.value == false
|
||||
destinationController.isInCheckin.value == true &&
|
||||
destinationController.isAtStart.value == false
|
||||
? Row(
|
||||
children: [
|
||||
ElevatedButton(
|
||||
@ -196,8 +190,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
.currentDestinationFeature[0]
|
||||
.hidden_location ==
|
||||
0) {
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value =
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value =
|
||||
true;
|
||||
Get.back();
|
||||
} else {
|
||||
@ -210,7 +204,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
.currentDestinationFeature[0].cp !=
|
||||
-1) {
|
||||
destinationController
|
||||
.rogaining_counted.value = true;
|
||||
.rogainingCounted.value = true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -238,18 +232,18 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
: Container(),
|
||||
),
|
||||
Obx(
|
||||
() => destinationController.is_at_start.value == true
|
||||
() => destinationController.isAtStart.value == true
|
||||
? ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.is_in_rog.value = true;
|
||||
destinationController.isInRog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.current_lat,
|
||||
destinationController.current_lon,
|
||||
destinationController.currentLat,
|
||||
destinationController.currentLon,
|
||||
indexController
|
||||
.currentDestinationFeature[0].location_id!);
|
||||
saveGameState();
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.StartRogaining()
|
||||
.startRogaining()
|
||||
.then((value) => Get.back());
|
||||
},
|
||||
child: Text(
|
||||
@ -265,8 +259,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
: Container(),
|
||||
),
|
||||
Obx(
|
||||
() => destinationController.is_at_goal.value == true &&
|
||||
destinationController.rogaining_counted == true
|
||||
() => destinationController.isAtGoal.value == true &&
|
||||
destinationController.rogainingCounted.value == true
|
||||
? ElevatedButton(
|
||||
onPressed: () {
|
||||
Get.toNamed(AppPages.CAMERA_PAGE);
|
||||
@ -374,51 +368,51 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
|
||||
// show add location details
|
||||
SingleChildScrollView detailsSheet(BuildContext context) {
|
||||
|
||||
Destination _cdest = destinationController.festuretoDestination(
|
||||
indexController.currentFeature[0]);
|
||||
Destination cdest = destinationController
|
||||
.festuretoDestination(indexController.currentFeature[0]);
|
||||
var distance = const Distance();
|
||||
double _distance_to_dest = distance.as(LengthUnit.Meter, LatLng(destinationController.current_lat, destinationController.current_lon), LatLng(_cdest.lat!, _cdest.lon!));
|
||||
|
||||
double distanceToDest = distance.as(
|
||||
LengthUnit.Meter,
|
||||
LatLng(
|
||||
destinationController.currentLat, destinationController.currentLon),
|
||||
LatLng(cdest.lat!, cdest.lon!));
|
||||
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Container(
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
//indexController.makePrevious(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
//Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
child: Row(
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
Get.back();
|
||||
//indexController.makePrevious(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
padding: const EdgeInsets.all(16),
|
||||
shape: const CircleBorder(),
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
//Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() => Text(
|
||||
indexController
|
||||
.currentFeature[0].properties!["location_name"],
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() => Text(
|
||||
indexController
|
||||
.currentFeature[0].properties!["location_name"],
|
||||
style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Row(
|
||||
@ -446,26 +440,25 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
indexController.currentDestinationFeature[0]
|
||||
.checkedin ==
|
||||
false &&
|
||||
destinationController.is_at_start.value ==
|
||||
true
|
||||
destinationController.isAtStart.value == true
|
||||
? ElevatedButton(
|
||||
onPressed: () async {
|
||||
await destinationController.resetRogaining();
|
||||
print("~~~~ start button ~~~~");
|
||||
destinationController.is_in_rog.value =
|
||||
true;
|
||||
await destinationController
|
||||
.resetRogaining();
|
||||
//print("~~~~ start button ~~~~");
|
||||
destinationController.isInRog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.current_lat,
|
||||
destinationController.current_lon,
|
||||
destinationController.currentLat,
|
||||
destinationController.currentLon,
|
||||
indexController
|
||||
.currentDestinationFeature[0]
|
||||
.location_id!);
|
||||
saveGameState();
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.StartRogaining()
|
||||
.then((value){
|
||||
Get.back();
|
||||
});
|
||||
.startRogaining()
|
||||
.then((value) {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
// start
|
||||
@ -484,9 +477,9 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
: Container(),
|
||||
),
|
||||
Obx(
|
||||
() => destinationController.is_at_goal.value ==
|
||||
true &&
|
||||
destinationController.rogaining_counted ==
|
||||
() => destinationController.isAtGoal.value == true &&
|
||||
destinationController
|
||||
.rogainingCounted.value ==
|
||||
true
|
||||
? ElevatedButton(
|
||||
onPressed: () {
|
||||
@ -521,7 +514,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
.onPrimaryContainer),
|
||||
onPressed: () async {
|
||||
Get.back();
|
||||
print("---- go to ----");
|
||||
//print("---- go to ----");
|
||||
GeoJsonFeature<GeoJsonMultiPoint> mp =
|
||||
indexController.currentFeature[0]
|
||||
as GeoJsonFeature<GeoJsonMultiPoint>;
|
||||
@ -530,7 +523,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
desiredAccuracy:
|
||||
LocationAccuracy.bestForNavigation,
|
||||
forceAndroidLocationManager: true);
|
||||
print("------- position -------- $position");
|
||||
//print("------- position -------- $position");
|
||||
Destination ds = Destination(
|
||||
lat: position.latitude,
|
||||
lon: position.longitude);
|
||||
@ -550,49 +543,48 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
color:
|
||||
Theme.of(context).colorScheme.onPrimary),
|
||||
)),
|
||||
SizedBox(
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
|
||||
|
||||
// forced start / checkin
|
||||
_distance_to_dest <= 100 ?
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor:
|
||||
Theme.of(context).colorScheme.secondary),
|
||||
onPressed: () async {
|
||||
print("~~~~ manual checkin button ~~~~");
|
||||
if (destination.cp == -1) {
|
||||
destinationController.is_in_rog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.current_lat,
|
||||
destinationController.current_lon,
|
||||
destination.location_id!);
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.StartRogaining()
|
||||
.then((value) => Get.back());
|
||||
} else {
|
||||
await destinationController.CallforCheckin(destination);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
destinationController
|
||||
.festuretoDestination(
|
||||
indexController
|
||||
.currentFeature[0])
|
||||
.cp ==
|
||||
-1
|
||||
? "ロゲ開始"
|
||||
: "チェックイン",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
distanceToDest <= 100
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondary))):
|
||||
|
||||
Container()
|
||||
,
|
||||
.secondary),
|
||||
onPressed: () async {
|
||||
//print("~~~~ manual checkin button ~~~~");
|
||||
if (destination.cp == -1) {
|
||||
destinationController.isInRog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.currentLat,
|
||||
destinationController.currentLon,
|
||||
destination.location_id!);
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.startRogaining()
|
||||
.then((value) => Get.back());
|
||||
} else {
|
||||
await destinationController
|
||||
.callforCheckin(destination);
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
destinationController
|
||||
.festuretoDestination(
|
||||
indexController
|
||||
.currentFeature[0])
|
||||
.cp ==
|
||||
-1
|
||||
? "ロゲ開始"
|
||||
: "チェックイン",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context)
|
||||
.colorScheme
|
||||
.onSecondary)))
|
||||
: Container(),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
@ -603,8 +595,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
children: [
|
||||
indexController.currentDestinationFeature
|
||||
.isNotEmpty &&
|
||||
destinationController
|
||||
.is_in_checkin.value ==
|
||||
destinationController.isInCheckin.value ==
|
||||
true
|
||||
? Container()
|
||||
: FutureBuilder<Widget>(
|
||||
@ -787,14 +778,14 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
|
||||
Future<Widget> wantToGo(BuildContext context) async {
|
||||
bool _selected = false;
|
||||
print(
|
||||
'---target-- ${indexController.currentFeature[0].properties!["location_id"]}----');
|
||||
bool selected = false;
|
||||
// print(
|
||||
// '---target-- ${indexController.currentFeature[0].properties!["location_id"]}----');
|
||||
for (Destination d in destinationController.destinations) {
|
||||
print('---- ${d.location_id.toString()} ----');
|
||||
//print('---- ${d.location_id.toString()} ----');
|
||||
if (d.location_id ==
|
||||
indexController.currentFeature[0].properties!["location_id"]) {
|
||||
_selected = true;
|
||||
selected = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -905,12 +896,12 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
const SizedBox(
|
||||
width: 8.0,
|
||||
),
|
||||
Obx((() => indexController.rog_mode == 1
|
||||
Obx((() => indexController.rogMode.value == 1
|
||||
? ElevatedButton(
|
||||
onPressed: () async {
|
||||
Destination dest =
|
||||
indexController.currentDestinationFeature[0];
|
||||
print("~~~~ before checking button ~~~~");
|
||||
//print("~~~~ before checking button ~~~~");
|
||||
//print("------ curent destination is ${dest!.checkedIn}-------");
|
||||
destinationController.makeCheckin(
|
||||
dest, !dest.checkedin!, "");
|
||||
@ -945,8 +936,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
ElevatedButton(
|
||||
child: const Text("Image"),
|
||||
onPressed: () {
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
_picker
|
||||
final ImagePicker picker = ImagePicker();
|
||||
picker
|
||||
.pickImage(source: ImageSource.camera)
|
||||
.then((value) {
|
||||
//print("----- image---- ${value!.path}");
|
||||
@ -968,7 +959,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
//print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
child: Text("checkin".tr))
|
||||
],
|
||||
@ -984,7 +974,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
//print("---temp---${temp}");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
child: const Icon(Icons.favorite, color: Colors.red),
|
||||
)
|
||||
@ -1006,7 +995,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
InkWell(
|
||||
onTap: () {
|
||||
if (isurl) {
|
||||
if (indexController.rog_mode == 0) {
|
||||
if (indexController.rogMode.value == 0) {
|
||||
_launchURL(indexController
|
||||
.currentFeature[0].properties!["webcontents"]);
|
||||
} else {
|
||||
@ -1015,7 +1004,8 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
}
|
||||
},
|
||||
child: SizedBox(
|
||||
width: MediaQuery.of(context).size.width - (MediaQuery.of(context).size.width * 0.28),
|
||||
width: MediaQuery.of(context).size.width -
|
||||
(MediaQuery.of(context).size.width * 0.28),
|
||||
child: Text(
|
||||
text,
|
||||
textDirection: TextDirection.ltr,
|
||||
|
||||
@ -1,381 +0,0 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class BottomSheetWidget extends StatelessWidget {
|
||||
//const BottomSheetWidget({ Key? key }, GeoJsonFeature? pt) : super(key: key);
|
||||
|
||||
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 const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
}
|
||||
else{
|
||||
return Image(image: NetworkImage(
|
||||
gf.properties!["photos"],
|
||||
),
|
||||
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void _launchURL(url) async {
|
||||
if (!await launch(url)) throw 'Could not launch $url';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
const SizedBox(height: 5.0,),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makePrevious(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
Icons.arrow_back_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(14),
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.center,
|
||||
child: Obx(() =>
|
||||
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
|
||||
fontSize: 15.0,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
)
|
||||
),
|
||||
),
|
||||
),
|
||||
MaterialButton(
|
||||
onPressed: () {
|
||||
indexController.makeNext(indexController.currentFeature[0]);
|
||||
},
|
||||
color: Colors.blue,
|
||||
textColor: Colors.white,
|
||||
child: const Icon(
|
||||
Icons.arrow_forward_ios,
|
||||
size: 14,
|
||||
),
|
||||
padding: const EdgeInsets.all(14),
|
||||
shape: const CircleBorder(),
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SizedBox(
|
||||
height: 260.0,
|
||||
child: Obx(() => getImage(indexController.currentFeature[0])),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10.0),
|
||||
child: Column(
|
||||
children: [
|
||||
indexController.currentFeature[0].properties!["address"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text("address".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!["address"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
softWrap: true,
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): 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: 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: const TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): 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: 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: const TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0, height: 0,),
|
||||
indexController.currentFeature[0].properties!["webcontents"] != null ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Expanded(child: Container(
|
||||
alignment: Alignment.topRight,
|
||||
child: Text(
|
||||
"web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
|
||||
const SizedBox(width: 12.0,),
|
||||
Expanded(
|
||||
child: Container(
|
||||
alignment: Alignment.topLeft,
|
||||
child: Obx(() => InkWell(
|
||||
onTap: (){
|
||||
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
|
||||
},
|
||||
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
|
||||
style: const TextStyle(color: Colors.blue,),
|
||||
softWrap: false,
|
||||
overflow: TextOverflow.fade,),
|
||||
)),
|
||||
),
|
||||
)
|
||||
],
|
||||
): 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: 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: const TextStyle(color: Colors.blue,),
|
||||
overflow: TextOverflow.ellipsis,)
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
): const SizedBox(width: 0.0, height: 0.0,),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
const SizedBox(height: 20.0,),
|
||||
Obx(() =>
|
||||
indexController.currentAction.isNotEmpty ?
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
indexController.rog_mode.value == 0 ?
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
indexController.currentAction[0][0]["wanttogo"] == false ?
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["wanttogo"] = 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(context);
|
||||
},
|
||||
child: Text("want_to_go".tr)
|
||||
) :
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["wanttogo"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
|
||||
|
||||
},
|
||||
|
||||
)
|
||||
),
|
||||
indexController.currentAction[0][0]["like"] == false ?
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["like"] = 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(context);
|
||||
},
|
||||
child: Text("like".tr)
|
||||
) :
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["like"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
|
||||
child: IconButton(
|
||||
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
|
||||
|
||||
},
|
||||
|
||||
)
|
||||
),
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
:
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
indexController.rog_mode.value == 1 ?
|
||||
indexController.currentAction[0][0]["checkin"] == false ?
|
||||
Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
child: const Text("Image"), onPressed: (){
|
||||
final ImagePicker _picker = ImagePicker();
|
||||
_picker.pickImage(source: ImageSource.camera).then((value){
|
||||
print("----- image---- ${value!.path}");
|
||||
});
|
||||
},
|
||||
)
|
||||
],
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
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(context);
|
||||
},
|
||||
child: Text("checkin".tr)
|
||||
)
|
||||
],
|
||||
)
|
||||
:
|
||||
ElevatedButton(
|
||||
onPressed: (){
|
||||
if(indexController.currentAction.isNotEmpty){
|
||||
print(indexController.currentAction[0]);
|
||||
indexController.currentAction[0][0]["checkin"] = false;
|
||||
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
|
||||
indexController.currentAction.clear();
|
||||
print("---temp---$temp");
|
||||
indexController.currentAction.add([temp]);
|
||||
}
|
||||
indexController.makeAction(context);
|
||||
},
|
||||
|
||||
child: const Icon(
|
||||
Icons.favorite, color: Colors.red)
|
||||
|
||||
,
|
||||
):
|
||||
const SizedBox(width: 0, height: 0,),
|
||||
],
|
||||
): Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: (){
|
||||
Get.toNamed(AppPages.LOGIN);
|
||||
},
|
||||
child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
|
||||
],
|
||||
),
|
||||
),
|
||||
const Row(
|
||||
children: [
|
||||
SizedBox(height: 60.0,),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,34 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
import 'package:rogapp/widgets/perfecture_widget.dart';
|
||||
|
||||
class BreadCrumbWidget extends StatelessWidget {
|
||||
BreadCrumbWidget({Key? key, this.mapController}) : super(key: key);
|
||||
|
||||
final MapController? mapController;
|
||||
|
||||
final IndexController indexController = Get.find<IndexController>();
|
||||
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("------ map controller is $mapController------------");
|
||||
return
|
||||
Obx(()=>
|
||||
indexController.perfectures.isNotEmpty && mapController != null ?
|
||||
BreadCrumb.builder(
|
||||
itemCount: indexController.perfectures.length,
|
||||
builder: (index){
|
||||
return
|
||||
BreadCrumbItem(
|
||||
content: PerfectureWidget(indexController: indexController, mapController: mapController!) //Text('Item$index')
|
||||
);
|
||||
}
|
||||
):
|
||||
const Text("Empty")
|
||||
);
|
||||
}
|
||||
}
|
||||
56
lib/widgets/c_form_text_field.dart
Normal file
56
lib/widgets/c_form_text_field.dart
Normal file
@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CFormTextField extends StatelessWidget {
|
||||
const CFormTextField({
|
||||
super.key,
|
||||
required this.cFocus,
|
||||
required TextEditingController cController,
|
||||
}) : cTextEditingController = cController;
|
||||
|
||||
final FocusNode cFocus;
|
||||
final TextEditingController cTextEditingController;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
autocorrect: false,
|
||||
autofocus: true,
|
||||
focusNode: cFocus,
|
||||
controller: cTextEditingController,
|
||||
keyboardType: TextInputType.emailAddress,
|
||||
textInputAction: TextInputAction.done,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty) {
|
||||
return "Need a valied email address";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//filled: true,
|
||||
//fillColor: Theme.of(context).colorScheme.primaryContainer,
|
||||
hintText: "Enter email address",
|
||||
labelText: "Email",
|
||||
labelStyle: TextStyle(
|
||||
color: Theme.of(context).colorScheme.onPrimaryContainer,
|
||||
fontSize: 16),
|
||||
prefixIcon: const Icon(Icons.email_outlined),
|
||||
suffixIcon: cTextEditingController.text.isNotEmpty
|
||||
? IconButton(
|
||||
onPressed: () {
|
||||
cTextEditingController.clear();
|
||||
},
|
||||
icon: const Icon(Icons.clear))
|
||||
: Container(
|
||||
width: 0,
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
width: 1, color: Theme.of(context).colorScheme.secondary)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
width: 2, color: Theme.of(context).colorScheme.primary))),
|
||||
);
|
||||
}
|
||||
}
|
||||
54
lib/widgets/c_password_text_filed.dart
Normal file
54
lib/widgets/c_password_text_filed.dart
Normal file
@ -0,0 +1,54 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CPasswordTextField extends StatefulWidget {
|
||||
const CPasswordTextField(
|
||||
{super.key, required this.cFocusNode, required this.cController});
|
||||
|
||||
final FocusNode cFocusNode;
|
||||
final TextEditingController cController;
|
||||
|
||||
@override
|
||||
State<CPasswordTextField> createState() => _CPasswordTextFieldState();
|
||||
}
|
||||
|
||||
class _CPasswordTextFieldState extends State<CPasswordTextField> {
|
||||
var _isVisible = false;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
controller: widget.cController,
|
||||
textInputAction: TextInputAction.go,
|
||||
obscureText: !_isVisible,
|
||||
validator: (value) {
|
||||
if (value == null || value.isEmpty || value.length < 5) {
|
||||
return "Need a valied password with more than 4 charectors";
|
||||
}
|
||||
return null;
|
||||
},
|
||||
decoration: InputDecoration(
|
||||
//filled: true,
|
||||
//fillColor: Theme.of(context).colorScheme.tertiaryContainer,
|
||||
hintText: "Enter password",
|
||||
labelText: "Password",
|
||||
labelStyle: TextStyle(
|
||||
color: Theme.of(context).colorScheme.primary, fontSize: 16),
|
||||
suffixIcon: IconButton(
|
||||
onPressed: () {
|
||||
setState(() {
|
||||
_isVisible = !_isVisible;
|
||||
});
|
||||
},
|
||||
icon: _isVisible
|
||||
? const Icon(Icons.visibility)
|
||||
: const Icon(Icons.visibility_off)),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
width: 1, color: Theme.of(context).colorScheme.secondary)),
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
borderSide: BorderSide(
|
||||
width: 2, color: Theme.of(context).colorScheme.primary))));
|
||||
}
|
||||
}
|
||||
@ -1,49 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class CatWidget extends StatefulWidget {
|
||||
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
|
||||
|
||||
IndexController indexController;
|
||||
|
||||
@override
|
||||
State<CatWidget> createState() => _CatWidgetState();
|
||||
}
|
||||
|
||||
class _CatWidgetState extends State<CatWidget> {
|
||||
String defaultValue = "---";
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return
|
||||
PopupMenuButton(
|
||||
onSelected: (value) {
|
||||
widget.indexController.currentCat.clear();
|
||||
widget.indexController.currentCat.add(value.toString());
|
||||
widget.indexController.refreshLocationForCat();
|
||||
setState(() {
|
||||
print(value);
|
||||
//widget.indexController.is_loading.value = true;
|
||||
defaultValue = value.toString();
|
||||
});
|
||||
},
|
||||
itemBuilder: (BuildContext context){
|
||||
List<PopupMenuItem> itms = <PopupMenuItem>[];
|
||||
for(dynamic d in widget.indexController.cats[0]){
|
||||
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
itms.add(itm);
|
||||
}
|
||||
return itms;
|
||||
}
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// widget.indexController.cats.map((e) =>
|
||||
// PopupMenuItem(
|
||||
// value: defaultValue,
|
||||
// child: Text(e[0]['category'].toString()),
|
||||
// )
|
||||
// ).toList(),
|
||||
@ -23,10 +23,10 @@ class DestinationWidget extends StatelessWidget {
|
||||
destinationController.destinations[index].photos == "") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
print(
|
||||
"------- image is ${destinationController.destinations[index].photos!}------");
|
||||
String _photo = destinationController.destinations[index].photos!;
|
||||
if (_photo.contains('http')) {
|
||||
// print(
|
||||
// "------- image is ${destinationController.destinations[index].photos!}------");
|
||||
String photo = destinationController.destinations[index].photos!;
|
||||
if (photo.contains('http')) {
|
||||
return Image(
|
||||
image:
|
||||
NetworkImage(destinationController.destinations[index].photos!),
|
||||
@ -39,8 +39,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
String serverUrl = ConstValues.currentServer();
|
||||
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
|
||||
return Image(
|
||||
image: NetworkImage('$serverUrl/media/compressed/' +
|
||||
destinationController.destinations[index].photos!),
|
||||
image: NetworkImage(
|
||||
'$serverUrl/media/compressed/${destinationController.destinations[index].photos!}'),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
@ -84,7 +84,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
if (d != null) {
|
||||
print("--- selected destination is ${d.list_order}");
|
||||
//print("--- selected destination is ${d.list_order}");
|
||||
destinationController.makeOrder(d, -1);
|
||||
}
|
||||
}
|
||||
@ -98,7 +98,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
}
|
||||
}
|
||||
if (d != null) {
|
||||
print("--- selected destination is ${d.list_order}");
|
||||
//print("--- selected destination is ${d.list_order}");
|
||||
destinationController.makeOrder(d, 1);
|
||||
}
|
||||
}
|
||||
@ -145,8 +145,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(
|
||||
"------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
//print(
|
||||
// "------ destination widget------ ${destinationController.destinationCount.value} ----------");
|
||||
|
||||
return Obx(() => Stack(
|
||||
children: [
|
||||
@ -161,12 +161,12 @@ class DestinationWidget extends StatelessWidget {
|
||||
isFirst: index == 0 ? true : false,
|
||||
indicatorStyle: IndicatorStyle(
|
||||
indicator: CircleAvatar(
|
||||
backgroundColor: Colors.red,
|
||||
child: Text(
|
||||
destinationController.destinations[index].list_order
|
||||
.toString(),
|
||||
style: const TextStyle(color: Colors.white),
|
||||
),
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
),
|
||||
key: Key(index.toString()),
|
||||
@ -180,7 +180,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
{
|
||||
Destination? fs =
|
||||
destinationController.destinations[index];
|
||||
print("----fsf-----$index");
|
||||
//print("----fsf-----$index");
|
||||
if (indexController
|
||||
.currentDestinationFeature.isNotEmpty) {
|
||||
indexController.currentDestinationFeature
|
||||
@ -188,8 +188,8 @@ class DestinationWidget extends StatelessWidget {
|
||||
}
|
||||
indexController.currentDestinationFeature
|
||||
.add(fs);
|
||||
print(
|
||||
"--- ndexController.currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} ----");
|
||||
// print(
|
||||
// "--- ndexController.currentDestinationFeature ----- ${indexController.currentDestinationFeature[0].name} ----");
|
||||
//indexController.getAction();
|
||||
|
||||
showModalBottomSheet(
|
||||
@ -198,7 +198,9 @@ class DestinationWidget extends StatelessWidget {
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
builder: ((context) => BottomSheetNew(destination: fs,)));
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: fs,
|
||||
)));
|
||||
}
|
||||
},
|
||||
onLongPress: () {
|
||||
|
||||
@ -28,13 +28,13 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
"") {
|
||||
return const Image(image: AssetImage('assets/images/empty_image.png'));
|
||||
} else {
|
||||
print("==== photo index is $index ===");
|
||||
//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('$serverUrl/media/compressed/' + _photo),
|
||||
image: NetworkImage('$serverUrl/media/compressed/$photo'),
|
||||
errorBuilder:
|
||||
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||
return Image.asset("assets/images/empty_image.png");
|
||||
@ -57,19 +57,19 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
|
||||
Destination createDestination(GeoJsonFeature feature) {
|
||||
final props = feature.properties;
|
||||
GeoJsonMultiPoint _pt = feature.geometry;
|
||||
GeoJsonMultiPoint pt = feature.geometry;
|
||||
|
||||
return Destination(
|
||||
cp: props!['cp'],
|
||||
lat: _pt.geoSerie!.geoPoints.first.latitude,
|
||||
lon: _pt.geoSerie!.geoPoints.first.longitude,
|
||||
lat: pt.geoSerie!.geoPoints.first.latitude,
|
||||
lon: pt.geoSerie!.geoPoints.first.longitude,
|
||||
);
|
||||
}
|
||||
|
||||
Future<String> matrixDistance(int i) async {
|
||||
// Create two destinations directly from indexController.locations[0].collection
|
||||
Destination desCurr = Destination(
|
||||
lat: indexController.current_lat, lon: indexController.current_lon);
|
||||
lat: indexController.currentLat, lon: indexController.currentLon);
|
||||
//Destination dest1 = createDestination(indexController.locations[0].collection[0]);
|
||||
Destination dest2 =
|
||||
createDestination(indexController.locations[0].collection[i]);
|
||||
@ -82,7 +82,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
}
|
||||
|
||||
Future<void> _pullRefresh() async {
|
||||
print("pull to refesh");
|
||||
//print("pull to refesh");
|
||||
indexController.locations[0].collection.sort((a, b) =>
|
||||
(a.properties!['cp'] as Comparable)
|
||||
.compareTo(b.properties!['cp'] as Comparable));
|
||||
@ -99,23 +99,24 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
itemCount: indexController.locations[0].collection.length,
|
||||
shrinkWrap: true,
|
||||
itemBuilder: (_, index) {
|
||||
bool _is_found = false;
|
||||
bool isFound = false;
|
||||
for (Destination d in destinationController.destinations) {
|
||||
if (indexController.locations[0].collection[index]
|
||||
.properties!['location_id'] ==
|
||||
d.location_id) {
|
||||
_is_found = true;
|
||||
isFound = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return Card(
|
||||
child: ListTile(
|
||||
selected: _is_found,
|
||||
selected: isFound,
|
||||
selectedTileColor: Colors.yellow.shade200,
|
||||
onTap: () {
|
||||
GeoJsonFeature gf =
|
||||
indexController.locations[0].collection[index];
|
||||
Destination des = destinationController.festuretoDestination(gf);
|
||||
Destination des =
|
||||
destinationController.festuretoDestination(gf);
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
@ -123,7 +124,9 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
builder: ((context) => BottomSheetNew(destination: des,)));
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: des,
|
||||
)));
|
||||
},
|
||||
leading: getImage(index),
|
||||
title: indexController.locations[0].collection[index]
|
||||
|
||||
@ -26,7 +26,7 @@ class MapWidget extends StatelessWidget {
|
||||
Widget getMarkerShape(GeoJsonFeature i, BuildContext context) {
|
||||
GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
|
||||
//print("lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
//RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
return Row(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
@ -35,12 +35,11 @@ class MapWidget extends StatelessWidget {
|
||||
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);
|
||||
//print("----- fs is ${fs.properties!['photos']}");
|
||||
indexController.getAction();
|
||||
|
||||
Destination des = destinationController.festuretoDestination(fs);
|
||||
|
||||
@ -55,7 +54,7 @@ class MapWidget extends StatelessWidget {
|
||||
))
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
).whenComplete(() {
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.skipGps = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -107,7 +106,7 @@ class MapWidget extends StatelessWidget {
|
||||
}
|
||||
|
||||
List<LatLng>? getPoints() {
|
||||
print("##### --- route point ${indexController.routePoints.length}");
|
||||
//print("##### --- route point ${indexController.routePoints.length}");
|
||||
List<LatLng> pts = [];
|
||||
for (PointLatLng p in indexController.routePoints) {
|
||||
LatLng l = LatLng(p.latitude, p.longitude);
|
||||
@ -118,13 +117,13 @@ class MapWidget extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print(
|
||||
"---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
// print(
|
||||
// "---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
|
||||
|
||||
final PopupController _popupController = PopupController();
|
||||
final PopupController popupController = PopupController();
|
||||
return Stack(
|
||||
children: [
|
||||
Obx(() => indexController.is_loading == true
|
||||
Obx(() => indexController.isLoading.value == true
|
||||
? const Padding(
|
||||
padding: EdgeInsets.only(top: 60.0),
|
||||
child: CircularProgressIndicator(),
|
||||
@ -134,19 +133,13 @@ class MapWidget extends StatelessWidget {
|
||||
options: MapOptions(
|
||||
maxZoom: 18.4,
|
||||
onMapReady: () {
|
||||
indexController.is_mapController_loaded.value = true;
|
||||
subscription = indexController.mapController.mapEventStream
|
||||
.listen((MapEvent mapEvent) {
|
||||
if (mapEvent is MapEventMoveStart) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
|
||||
// do something
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd &&
|
||||
indexController.currentUser.isEmpty) {
|
||||
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
|
||||
indexController.loadLocationsBound();
|
||||
//indexController.rogMapController!.move(c.center, c.zoom);
|
||||
}
|
||||
if (mapEvent is MapEventMoveEnd) {}
|
||||
});
|
||||
},
|
||||
//center: LatLng(37.15319600454702, 139.58765950528198),
|
||||
@ -163,7 +156,7 @@ class MapWidget extends StatelessWidget {
|
||||
onPositionChanged: (MapPosition pos, isvalue) {
|
||||
indexController.currentBound = [pos.bounds!];
|
||||
},
|
||||
onTap: (_, __) => _popupController
|
||||
onTap: (_, __) => popupController
|
||||
.hideAllPopups(), // Hide popup when the map is tapped.
|
||||
),
|
||||
children: [
|
||||
@ -181,7 +174,7 @@ class MapWidget extends StatelessWidget {
|
||||
: Container(),
|
||||
),
|
||||
CurrentLocationLayer(
|
||||
followOnLocationUpdate: FollowOnLocationUpdate.once,
|
||||
followOnLocationUpdate: FollowOnLocationUpdate.never,
|
||||
turnOnHeadingUpdate: TurnOnHeadingUpdate.never,
|
||||
style: const LocationMarkerStyle(
|
||||
marker: DefaultLocationMarker(
|
||||
@ -199,13 +192,13 @@ class MapWidget extends StatelessWidget {
|
||||
? MarkerLayer(
|
||||
markers:
|
||||
indexController.locations[0].collection.map((i) {
|
||||
print("i si ${i.properties!['location_id']}");
|
||||
//print("i si ${i.properties!['location_id']}");
|
||||
|
||||
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
||||
GeoJsonMultiPoint p =
|
||||
i.geometry as GeoJsonMultiPoint;
|
||||
print(
|
||||
"lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
//print(
|
||||
// "lat is ${p.geoSerie!.geoPoints[0].latitude} and lon is ${p.geoSerie!.geoPoints[0].longitude}");
|
||||
return Marker(
|
||||
anchorPos: AnchorPos.exactly(Anchor(108.0, 18.0)),
|
||||
height: 32.0,
|
||||
|
||||
@ -1,237 +0,0 @@
|
||||
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';
|
||||
|
||||
|
||||
class PerfectureWidget extends StatefulWidget {
|
||||
|
||||
IndexController indexController;
|
||||
MapController mapController;
|
||||
|
||||
|
||||
PerfectureWidget({Key? key, required this.indexController, required this.mapController}) : super(key: key){
|
||||
//indexController.zoomtoMainPerf("9", mapController);
|
||||
}
|
||||
|
||||
@override
|
||||
State<PerfectureWidget> createState() => _PerfectureWidgetState();
|
||||
}
|
||||
|
||||
class _PerfectureWidgetState extends State<PerfectureWidget> {
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
}
|
||||
|
||||
|
||||
bool isNumeric(String s) {
|
||||
if (s == null) {
|
||||
return false;
|
||||
}
|
||||
return double.tryParse(s) != null;
|
||||
}
|
||||
|
||||
|
||||
List<DropdownMenuItem<String>> getDropdownItems() {
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
|
||||
//print(currency["id"].toString());
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["adm1_ja"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getSubDropdownItems() {
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
if(widget.indexController.subPerfs.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["adm2_ja"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
}
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getCustomArea(){
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
if(widget.indexController.areas.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["area_nm"].toString()),
|
||||
value: currency["id"].toString(),
|
||||
);
|
||||
dropDownItems.add(newDropdown);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if(widget.indexController.customAreas.isNotEmpty){
|
||||
|
||||
for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
|
||||
var newDropdown = DropdownMenuItem(
|
||||
child: Text(currency["event_name"].toString()),
|
||||
value: currency["event_name"].toString(),
|
||||
);
|
||||
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
List<DropdownMenuItem<String>> getCategory(){
|
||||
List<DropdownMenuItem<String>> dropDownItems = [];
|
||||
|
||||
dropDownItems.clear();
|
||||
|
||||
//print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
|
||||
for(dynamic d in widget.indexController.cats){
|
||||
//print("-------- ddd ------############### ${d} --------dddd-----");
|
||||
var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
|
||||
//print("--------cats ------############### ${d['category'].toString()} -------------");
|
||||
dropDownItems.add(newDropdown);
|
||||
}
|
||||
|
||||
//return [];
|
||||
|
||||
return dropDownItems;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
||||
return Obx(() =>
|
||||
Row(
|
||||
children: [
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.dropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
//setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.dropdownValue = newValue;
|
||||
widget.indexController.populateForPerf(newValue, widget.mapController);
|
||||
}
|
||||
//});
|
||||
},
|
||||
items: getDropdownItems()
|
||||
),
|
||||
|
||||
// Gifu areas
|
||||
widget.indexController.areas.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.areaDropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
if (isNumeric(newValue!)){
|
||||
widget.indexController.is_custom_area_selected.value = false;
|
||||
}
|
||||
else{
|
||||
widget.indexController.loadCustomLocation(newValue);
|
||||
widget.indexController.is_custom_area_selected.value = true;
|
||||
widget.indexController.subPerfs.clear();
|
||||
widget.indexController.cats.clear();
|
||||
}
|
||||
setState(() {
|
||||
widget.indexController.locations.clear();
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.areaDropdownValue = newValue;
|
||||
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
|
||||
});
|
||||
},
|
||||
items: getCustomArea(),
|
||||
): const Text(""),
|
||||
|
||||
widget.indexController.subPerfs.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.subDropdownValue,
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
//widget.indexController.is_loading.value = true;
|
||||
//widget.indexController.populateForSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
widget.indexController.subDropdownValue = newValue;
|
||||
widget.indexController.loadCatForCity(newValue);
|
||||
}
|
||||
});
|
||||
},
|
||||
items:
|
||||
getSubDropdownItems()
|
||||
) :
|
||||
const Text(""),
|
||||
//CatWidget(indexController: widget.indexController,),
|
||||
widget.indexController.cats.isNotEmpty ?
|
||||
DropdownButton<String>(
|
||||
value: widget.indexController.getCatText(),
|
||||
icon: const Icon(Icons.arrow_downward),
|
||||
elevation: 16,
|
||||
style: const TextStyle(color: Colors.deepPurple),
|
||||
hint: const Text("select"),
|
||||
underline: Container(
|
||||
height: 2,
|
||||
color: Colors.deepPurpleAccent,
|
||||
),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
if(newValue != null){
|
||||
widget.indexController.is_loading.value = true;
|
||||
widget.indexController.cateogory = newValue;
|
||||
widget.indexController.currentCat.clear();
|
||||
widget.indexController.currentCat.add(newValue);
|
||||
widget.indexController.populateForSubPerf(widget.indexController.subDropdownValue, widget.mapController);
|
||||
//widget.indexController.loadLocationforSubPerf(newValue, widget.mapController);
|
||||
//widget.indexController.subDropdownValue = newValue;
|
||||
}
|
||||
});
|
||||
},
|
||||
items:
|
||||
getCategory(),
|
||||
)
|
||||
:
|
||||
Container(),
|
||||
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user