fixed messages
This commit is contained in:
@ -11,19 +11,24 @@ import 'package:rogapp/services/external_service.dart';
|
||||
ImageProvider getFinishImage() {
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
if (destinationController.photos.isNotEmpty) {
|
||||
return FileImage(destinationController.photos[0]);
|
||||
} else {
|
||||
return const AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
if (destinationController.photos.isNotEmpty) {
|
||||
return FileImage(destinationController.photos[0]);
|
||||
} else {
|
||||
return const AssetImage('assets/images/empty_image.png');
|
||||
}
|
||||
}
|
||||
|
||||
class CameraPage extends StatelessWidget {
|
||||
bool? manulaCheckin = false;
|
||||
bool? buyPointPhoto = false;
|
||||
Destination destination;
|
||||
Destination? dbDest;
|
||||
CameraPage({Key? key,required this.destination, this.dbDest, this.manulaCheckin, this.buyPointPhoto})
|
||||
CameraPage(
|
||||
{Key? key,
|
||||
required this.destination,
|
||||
this.dbDest,
|
||||
this.manulaCheckin,
|
||||
this.buyPointPhoto})
|
||||
: super(key: key);
|
||||
DestinationController destinationController =
|
||||
Get.find<DestinationController>();
|
||||
@ -37,28 +42,26 @@ class CameraPage extends StatelessWidget {
|
||||
//print("----cccheckin is --- ${dbDest?.checkedin} ----");
|
||||
if (manulaCheckin == true) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("買い物なし")
|
||||
: const Text("撮影"))),
|
||||
child: const Text("撮影")),
|
||||
Obx(() => destinationController.photos.isNotEmpty
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
await destinationController.makeCheckin(
|
||||
destination,
|
||||
true,
|
||||
await destinationController.makeCheckin(destination, true,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
Get.snackbar("チェックインしました。", "${destination!.sub_loc_id} : ${destination!.name}");
|
||||
Get.snackbar("チェックインしました。",
|
||||
"${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
@ -167,7 +170,8 @@ class CameraPage extends StatelessWidget {
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
Get.snackbar("お買い物加点を行いました。", "${destination!.sub_loc_id} : ${destination!.name}");
|
||||
Get.snackbar("お買い物加点を行いました。",
|
||||
"${destination!.sub_loc_id} : ${destination!.name}");
|
||||
},
|
||||
child: const Text("レシートの写真を撮る"))
|
||||
: Container())
|
||||
@ -213,16 +217,16 @@ class CameraPage extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if(buyPointPhoto == true){
|
||||
if (buyPointPhoto == true) {
|
||||
print("--- buy point camera ${destination.toString()}");
|
||||
return BuyPointCamera(destination: destination!);
|
||||
}
|
||||
else if (destinationController.is_in_rog.value) {
|
||||
print("--- in normal camera ${destination.toString()}");
|
||||
return BuyPointCamera(destination: destination);
|
||||
} else if (destinationController.is_in_rog.value) {
|
||||
print("--- in normal camera ${destination.toString()}");
|
||||
return Scaffold(
|
||||
appBar: destinationController.is_in_rog.value &&
|
||||
destinationController.rogaining_counted.value == true
|
||||
? AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: destination.cp == -1
|
||||
? Text("finishing_rogaining".tr)
|
||||
: Text("${destination.sub_loc_id} : ${destination.name}"),
|
||||
@ -240,31 +244,36 @@ class CameraPage extends StatelessWidget {
|
||||
centerTitle: true,
|
||||
)
|
||||
: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text("${destination.sub_loc_id} : ${destination.name}"),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: getFinishImage(), fit: BoxFit.cover)),
|
||||
body: SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: getFinishImage(), fit: BoxFit.cover)),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding:const EdgeInsets.symmetric(vertical:8.0),
|
||||
child: destinationController.photos.isEmpty == true ? Text("撮影してチェックインしてください。") : Text("チェックインをタップしてください。") ,
|
||||
),
|
||||
getAction(context),
|
||||
],
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: Obx(() => destinationController.photos.isEmpty == true
|
||||
? const Text("撮影してチェックインしてください。")
|
||||
: const Text("チェックインをタップしてください。")),
|
||||
),
|
||||
getAction(context),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
@ -283,6 +292,7 @@ class StartRogaining extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
"Not started yet".tr,
|
||||
),
|
||||
@ -351,7 +361,6 @@ class StartRogaining extends StatelessWidget {
|
||||
// }
|
||||
// }
|
||||
|
||||
|
||||
class BuyPointCamera extends StatelessWidget {
|
||||
BuyPointCamera({Key? key, required this.destination}) : super(key: key);
|
||||
|
||||
@ -364,59 +373,92 @@ class BuyPointCamera extends StatelessWidget {
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
automaticallyImplyLeading: false,
|
||||
title: Text(
|
||||
"${destination.sub_loc_id} : ${destination.name}",
|
||||
),
|
||||
),
|
||||
body: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: getFinishImage(), fit: BoxFit.cover)),
|
||||
),
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Center(
|
||||
child: Obx(
|
||||
() => Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
height: 370,
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: getFinishImage(), fit: BoxFit.cover)),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text("チェックインをタップしてください。"),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
children: [
|
||||
Obx(() => ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
: const Text("撮影"))),
|
||||
Obx(() => destinationController.photos.isNotEmpty
|
||||
? ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
await destinationController.makeBuyPoint(
|
||||
destination, destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value = true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value = false;
|
||||
Get.snackbar("チェックインしました。", "${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
child: const Text("チェックイン"))
|
||||
: Container())
|
||||
),
|
||||
const Padding(
|
||||
padding: EdgeInsets.all(8.0),
|
||||
child: Text("次にレシート撮影を行います。"),
|
||||
),
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceAround,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Obx(() => Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(
|
||||
context, destination);
|
||||
},
|
||||
child: destinationController.photos.isNotEmpty
|
||||
? const Text("再撮影")
|
||||
: const Text("撮影")),
|
||||
const SizedBox(width: 10,),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
destinationController.openCamera(
|
||||
context, destination);
|
||||
},
|
||||
child: const Text("買い物なし"))
|
||||
],
|
||||
)),
|
||||
Obx(() => destinationController.photos.isNotEmpty
|
||||
? Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
// ElevatedButton(
|
||||
// style: ElevatedButton.styleFrom(
|
||||
// backgroundColor: Colors.red),
|
||||
// onPressed: () async {},
|
||||
// child: const Text("買物なし")),
|
||||
// const SizedBox(
|
||||
// width: 10,
|
||||
// ),
|
||||
ElevatedButton(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red),
|
||||
onPressed: () async {
|
||||
await destinationController.makeBuyPoint(
|
||||
destination,
|
||||
destinationController.photos[0].path);
|
||||
Get.back();
|
||||
destinationController.rogaining_counted.value =
|
||||
true;
|
||||
destinationController.skip_gps = false;
|
||||
destinationController.is_photo_shoot.value =
|
||||
false;
|
||||
Get.snackbar("お買い物加点を行いました",
|
||||
"${destination.sub_loc_id} : ${destination.name}");
|
||||
},
|
||||
child: const Text("完了"))
|
||||
],
|
||||
)
|
||||
: Container())
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user