update image on camera page
This commit is contained in:
@ -7,6 +7,38 @@ import 'package:rogapp/model/destination.dart';
|
|||||||
import 'package:rogapp/pages/destination/destination_controller.dart';
|
import 'package:rogapp/pages/destination/destination_controller.dart';
|
||||||
import 'package:rogapp/pages/index/index_controller.dart';
|
import 'package:rogapp/pages/index/index_controller.dart';
|
||||||
import 'package:rogapp/services/external_service.dart';
|
import 'package:rogapp/services/external_service.dart';
|
||||||
|
import 'package:rogapp/utils/const.dart';
|
||||||
|
|
||||||
|
Image getDisplayImage(Destination destination) {
|
||||||
|
String serverUrl = ConstValues.currentServer();
|
||||||
|
|
||||||
|
Image img = Image.asset("assets/images/empty_image.png");
|
||||||
|
if (destination.phone == null) {
|
||||||
|
return img;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (destination.photos!.contains('http')) {
|
||||||
|
return Image(
|
||||||
|
image: NetworkImage(
|
||||||
|
destination.phone!,
|
||||||
|
),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
|
return Image.asset("assets/images/empty_image.png");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return Image(
|
||||||
|
image: NetworkImage(
|
||||||
|
'$serverUrl/media/compressed/${destination.photos}',
|
||||||
|
),
|
||||||
|
errorBuilder:
|
||||||
|
(BuildContext context, Object exception, StackTrace? stackTrace) {
|
||||||
|
return Image.asset("assets/images/empty_image.png");
|
||||||
|
},
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
ImageProvider getFinishImage() {
|
ImageProvider getFinishImage() {
|
||||||
DestinationController destinationController =
|
DestinationController destinationController =
|
||||||
@ -23,12 +55,14 @@ class CameraPage extends StatelessWidget {
|
|||||||
bool? buyPointPhoto = false;
|
bool? buyPointPhoto = false;
|
||||||
Destination destination;
|
Destination destination;
|
||||||
Destination? dbDest;
|
Destination? dbDest;
|
||||||
|
String? initImage;
|
||||||
CameraPage(
|
CameraPage(
|
||||||
{Key? key,
|
{Key? key,
|
||||||
required this.destination,
|
required this.destination,
|
||||||
this.dbDest,
|
this.dbDest,
|
||||||
this.manulaCheckin,
|
this.manulaCheckin,
|
||||||
this.buyPointPhoto})
|
this.buyPointPhoto,
|
||||||
|
this.initImage})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
DestinationController destinationController =
|
DestinationController destinationController =
|
||||||
Get.find<DestinationController>();
|
Get.find<DestinationController>();
|
||||||
@ -200,7 +234,10 @@ class CameraPage extends StatelessWidget {
|
|||||||
destinationController.rogainingCounted.value = true;
|
destinationController.rogainingCounted.value = true;
|
||||||
destinationController.skipGps = false;
|
destinationController.skipGps = false;
|
||||||
destinationController.isPhotoShoot.value = false;
|
destinationController.isPhotoShoot.value = false;
|
||||||
Get.snackbar("チェックインした", "正常にチェックインしました");
|
Get.snackbar(
|
||||||
|
"チェックインしました",
|
||||||
|
indexController.currentDestinationFeature[0].name ??
|
||||||
|
"");
|
||||||
},
|
},
|
||||||
child: const Text("チェックイン"))
|
child: const Text("チェックイン"))
|
||||||
: Container())
|
: Container())
|
||||||
@ -215,6 +252,7 @@ class CameraPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
print("---- photos ${destination.photos} ----");
|
||||||
if (buyPointPhoto == true) {
|
if (buyPointPhoto == true) {
|
||||||
//print("--- buy point camera ${destination.toString()}");
|
//print("--- buy point camera ${destination.toString()}");
|
||||||
return BuyPointCamera(destination: destination);
|
return BuyPointCamera(destination: destination);
|
||||||
@ -258,7 +296,10 @@ class CameraPage extends StatelessWidget {
|
|||||||
height: 370,
|
height: 370,
|
||||||
decoration: BoxDecoration(
|
decoration: BoxDecoration(
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
image: getFinishImage(), fit: BoxFit.cover)),
|
image: destinationController.photos.isEmpty
|
||||||
|
? getDisplayImage(destination).image
|
||||||
|
: getFinishImage(),
|
||||||
|
fit: BoxFit.cover)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
@ -188,7 +188,7 @@ class DestinationController extends GetxController {
|
|||||||
isAtStart.value = true;
|
isAtStart.value = true;
|
||||||
await showModalBottomSheet(
|
await showModalBottomSheet(
|
||||||
constraints:
|
constraints:
|
||||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
|
||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
builder: ((context) => BottomSheetNew(
|
builder: ((context) => BottomSheetNew(
|
||||||
|
|||||||
@ -57,7 +57,7 @@ class DestinationMapPage extends StatelessWidget {
|
|||||||
context: Get.context!,
|
context: Get.context!,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
constraints: BoxConstraints.loose(
|
constraints: BoxConstraints.loose(
|
||||||
Size(Get.width, Get.height * 0.75)),
|
Size(Get.width, Get.height * 0.85)),
|
||||||
builder: ((context) => BottomSheetNew(
|
builder: ((context) => BottomSheetNew(
|
||||||
destination: d,
|
destination: d,
|
||||||
))).whenComplete(() {
|
))).whenComplete(() {
|
||||||
|
|||||||
@ -431,51 +431,51 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
|||||||
Row(
|
Row(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||||
children: [
|
children: [
|
||||||
Obx(
|
// Obx(
|
||||||
() => indexController
|
// () => indexController
|
||||||
.currentDestinationFeature.isNotEmpty &&
|
// .currentDestinationFeature.isNotEmpty &&
|
||||||
indexController
|
// indexController
|
||||||
.currentDestinationFeature[0].cp ==
|
// .currentDestinationFeature[0].cp ==
|
||||||
-1 &&
|
// -1 &&
|
||||||
indexController.currentDestinationFeature[0]
|
// indexController.currentDestinationFeature[0]
|
||||||
.checkedin ==
|
// .checkedin ==
|
||||||
false &&
|
// false &&
|
||||||
destinationController.isAtStart.value == true
|
// destinationController.isAtStart.value == true
|
||||||
? ElevatedButton(
|
// ? ElevatedButton(
|
||||||
onPressed: () async {
|
// onPressed: () async {
|
||||||
await destinationController
|
// await destinationController
|
||||||
.resetRogaining();
|
// .resetRogaining();
|
||||||
//print("~~~~ start button ~~~~");
|
// //print("~~~~ start button ~~~~");
|
||||||
destinationController.isInRog.value = true;
|
// destinationController.isInRog.value = true;
|
||||||
destinationController.addToRogaining(
|
// destinationController.addToRogaining(
|
||||||
destinationController.currentLat,
|
// destinationController.currentLat,
|
||||||
destinationController.currentLon,
|
// destinationController.currentLon,
|
||||||
indexController
|
// indexController
|
||||||
.currentDestinationFeature[0]
|
// .currentDestinationFeature[0]
|
||||||
.location_id!);
|
// .location_id!);
|
||||||
saveGameState();
|
// saveGameState();
|
||||||
ExternalService()
|
// ExternalService()
|
||||||
.startRogaining()
|
// .startRogaining()
|
||||||
.then((value) {
|
// .then((value) {
|
||||||
Get.back();
|
// Get.back();
|
||||||
});
|
// });
|
||||||
},
|
// },
|
||||||
child: Text(
|
// child: Text(
|
||||||
// start
|
// // start
|
||||||
indexController
|
// indexController
|
||||||
.currentDestinationFeature[
|
// .currentDestinationFeature[
|
||||||
0]
|
// 0]
|
||||||
.checkedin !=
|
// .checkedin !=
|
||||||
null ||
|
// null ||
|
||||||
indexController
|
// indexController
|
||||||
.currentDestinationFeature[
|
// .currentDestinationFeature[
|
||||||
0]
|
// 0]
|
||||||
.checkedin ==
|
// .checkedin ==
|
||||||
true
|
// true
|
||||||
? "ロゲイニングを開始"
|
// ? "ロゲイニングを開始"
|
||||||
: "間違った目的地..."))
|
// : "間違った目的地..."))
|
||||||
: Container(),
|
// : Container(),
|
||||||
),
|
// ),
|
||||||
Obx(
|
Obx(
|
||||||
() => destinationController.isAtGoal.value == true &&
|
() => destinationController.isAtGoal.value == true &&
|
||||||
destinationController
|
destinationController
|
||||||
|
|||||||
@ -194,7 +194,7 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
constraints: BoxConstraints.loose(
|
constraints: BoxConstraints.loose(
|
||||||
Size(Get.width, Get.height * 0.75)),
|
Size(Get.width, Get.height * 0.85)),
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
//builder:((context) => BottomSheetWidget())
|
//builder:((context) => BottomSheetWidget())
|
||||||
|
|||||||
@ -120,7 +120,7 @@ class _ListWidgetState extends State<ListWidget> {
|
|||||||
changeCurrentFeature(gf);
|
changeCurrentFeature(gf);
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
constraints: BoxConstraints.loose(
|
constraints: BoxConstraints.loose(
|
||||||
Size(Get.width, Get.height * 0.75)),
|
Size(Get.width, Get.height * 0.85)),
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
context: context,
|
context: context,
|
||||||
//builder: (context) => BottomSheetWidget(),
|
//builder: (context) => BottomSheetWidget(),
|
||||||
|
|||||||
@ -45,7 +45,7 @@ class MapWidget extends StatelessWidget {
|
|||||||
|
|
||||||
showModalBottomSheet(
|
showModalBottomSheet(
|
||||||
constraints:
|
constraints:
|
||||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
|
||||||
context: context,
|
context: context,
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
isDismissible: true,
|
isDismissible: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user