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)),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user