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/index/index_controller.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() {
|
||||
DestinationController destinationController =
|
||||
@ -23,12 +55,14 @@ class CameraPage extends StatelessWidget {
|
||||
bool? buyPointPhoto = false;
|
||||
Destination destination;
|
||||
Destination? dbDest;
|
||||
String? initImage;
|
||||
CameraPage(
|
||||
{Key? key,
|
||||
required this.destination,
|
||||
this.dbDest,
|
||||
this.manulaCheckin,
|
||||
this.buyPointPhoto})
|
||||
this.buyPointPhoto,
|
||||
this.initImage})
|
||||
: super(key: key);
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
@ -200,7 +234,10 @@ class CameraPage extends StatelessWidget {
|
||||
destinationController.rogainingCounted.value = true;
|
||||
destinationController.skipGps = false;
|
||||
destinationController.isPhotoShoot.value = false;
|
||||
Get.snackbar("チェックインした", "正常にチェックインしました");
|
||||
Get.snackbar(
|
||||
"チェックインしました",
|
||||
indexController.currentDestinationFeature[0].name ??
|
||||
"");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
@ -215,6 +252,7 @@ class CameraPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
print("---- photos ${destination.photos} ----");
|
||||
if (buyPointPhoto == true) {
|
||||
//print("--- buy point camera ${destination.toString()}");
|
||||
return BuyPointCamera(destination: destination);
|
||||
@ -258,7 +296,10 @@ class CameraPage extends StatelessWidget {
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
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;
|
||||
await showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
builder: ((context) => BottomSheetNew(
|
||||
|
||||
@ -57,7 +57,7 @@ class DestinationMapPage extends StatelessWidget {
|
||||
context: Get.context!,
|
||||
isScrollControlled: true,
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
Size(Get.width, Get.height * 0.85)),
|
||||
builder: ((context) => BottomSheetNew(
|
||||
destination: d,
|
||||
))).whenComplete(() {
|
||||
|
||||
@ -431,51 +431,51 @@ class BottomSheetNew extends GetView<BottomSheetController> {
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Obx(
|
||||
() => indexController
|
||||
.currentDestinationFeature.isNotEmpty &&
|
||||
indexController
|
||||
.currentDestinationFeature[0].cp ==
|
||||
-1 &&
|
||||
indexController.currentDestinationFeature[0]
|
||||
.checkedin ==
|
||||
false &&
|
||||
destinationController.isAtStart.value == true
|
||||
? ElevatedButton(
|
||||
onPressed: () async {
|
||||
await destinationController
|
||||
.resetRogaining();
|
||||
//print("~~~~ start button ~~~~");
|
||||
destinationController.isInRog.value = true;
|
||||
destinationController.addToRogaining(
|
||||
destinationController.currentLat,
|
||||
destinationController.currentLon,
|
||||
indexController
|
||||
.currentDestinationFeature[0]
|
||||
.location_id!);
|
||||
saveGameState();
|
||||
ExternalService()
|
||||
.startRogaining()
|
||||
.then((value) {
|
||||
Get.back();
|
||||
});
|
||||
},
|
||||
child: Text(
|
||||
// start
|
||||
indexController
|
||||
.currentDestinationFeature[
|
||||
0]
|
||||
.checkedin !=
|
||||
null ||
|
||||
indexController
|
||||
.currentDestinationFeature[
|
||||
0]
|
||||
.checkedin ==
|
||||
true
|
||||
? "ロゲイニングを開始"
|
||||
: "間違った目的地..."))
|
||||
: Container(),
|
||||
),
|
||||
// Obx(
|
||||
// () => indexController
|
||||
// .currentDestinationFeature.isNotEmpty &&
|
||||
// indexController
|
||||
// .currentDestinationFeature[0].cp ==
|
||||
// -1 &&
|
||||
// indexController.currentDestinationFeature[0]
|
||||
// .checkedin ==
|
||||
// false &&
|
||||
// destinationController.isAtStart.value == true
|
||||
// ? ElevatedButton(
|
||||
// onPressed: () async {
|
||||
// await destinationController
|
||||
// .resetRogaining();
|
||||
// //print("~~~~ start button ~~~~");
|
||||
// destinationController.isInRog.value = true;
|
||||
// destinationController.addToRogaining(
|
||||
// destinationController.currentLat,
|
||||
// destinationController.currentLon,
|
||||
// indexController
|
||||
// .currentDestinationFeature[0]
|
||||
// .location_id!);
|
||||
// saveGameState();
|
||||
// ExternalService()
|
||||
// .startRogaining()
|
||||
// .then((value) {
|
||||
// Get.back();
|
||||
// });
|
||||
// },
|
||||
// child: Text(
|
||||
// // start
|
||||
// indexController
|
||||
// .currentDestinationFeature[
|
||||
// 0]
|
||||
// .checkedin !=
|
||||
// null ||
|
||||
// indexController
|
||||
// .currentDestinationFeature[
|
||||
// 0]
|
||||
// .checkedin ==
|
||||
// true
|
||||
// ? "ロゲイニングを開始"
|
||||
// : "間違った目的地..."))
|
||||
// : Container(),
|
||||
// ),
|
||||
Obx(
|
||||
() => destinationController.isAtGoal.value == true &&
|
||||
destinationController
|
||||
|
||||
@ -194,7 +194,7 @@ class DestinationWidget extends StatelessWidget {
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
Size(Get.width, Get.height * 0.85)),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
//builder:((context) => BottomSheetWidget())
|
||||
|
||||
@ -120,7 +120,7 @@ class _ListWidgetState extends State<ListWidget> {
|
||||
changeCurrentFeature(gf);
|
||||
showModalBottomSheet(
|
||||
constraints: BoxConstraints.loose(
|
||||
Size(Get.width, Get.height * 0.75)),
|
||||
Size(Get.width, Get.height * 0.85)),
|
||||
isScrollControlled: true,
|
||||
context: context,
|
||||
//builder: (context) => BottomSheetWidget(),
|
||||
|
||||
@ -45,7 +45,7 @@ class MapWidget extends StatelessWidget {
|
||||
|
||||
showModalBottomSheet(
|
||||
constraints:
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.75)),
|
||||
BoxConstraints.loose(Size(Get.width, Get.height * 0.85)),
|
||||
context: context,
|
||||
isScrollControlled: true,
|
||||
isDismissible: true,
|
||||
|
||||
Reference in New Issue
Block a user