fixed messages

This commit is contained in:
Mohamed Nouffer
2023-09-15 16:50:59 +05:30
parent 14c8cb6f70
commit a2b055fe8b
2 changed files with 127 additions and 85 deletions

View File

@ -23,7 +23,12 @@ class CameraPage extends StatelessWidget {
bool? buyPointPhoto = false; bool? buyPointPhoto = false;
Destination destination; Destination destination;
Destination? dbDest; 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); : super(key: key);
DestinationController destinationController = DestinationController destinationController =
Get.find<DestinationController>(); Get.find<DestinationController>();
@ -37,28 +42,26 @@ class CameraPage extends StatelessWidget {
//print("----cccheckin is --- ${dbDest?.checkedin} ----"); //print("----cccheckin is --- ${dbDest?.checkedin} ----");
if (manulaCheckin == true) { if (manulaCheckin == true) {
return Row( return Row(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Obx(() => ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
destinationController.openCamera(context, destination); destinationController.openCamera(context, destination);
}, },
child: destinationController.photos.isNotEmpty child: const Text("撮影")),
? const Text("買い物なし")
: const Text("撮影"))),
Obx(() => destinationController.photos.isNotEmpty Obx(() => destinationController.photos.isNotEmpty
? ElevatedButton( ? ElevatedButton(
style: ElevatedButton.styleFrom(backgroundColor: Colors.red), style: ElevatedButton.styleFrom(backgroundColor: Colors.red),
onPressed: () async { onPressed: () async {
await destinationController.makeCheckin( await destinationController.makeCheckin(destination, true,
destination,
true,
destinationController.photos[0].path); destinationController.photos[0].path);
Get.back(); Get.back();
destinationController.rogaining_counted.value = true; destinationController.rogaining_counted.value = true;
destinationController.skip_gps = false; destinationController.skip_gps = false;
destinationController.is_photo_shoot.value = 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("チェックイン")) child: const Text("チェックイン"))
: Container()) : Container())
@ -167,7 +170,8 @@ class CameraPage extends StatelessWidget {
destinationController.rogaining_counted.value = true; destinationController.rogaining_counted.value = true;
destinationController.skip_gps = false; destinationController.skip_gps = false;
destinationController.is_photo_shoot.value = 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("レシートの写真を撮る")) child: const Text("レシートの写真を撮る"))
: Container()) : Container())
@ -215,14 +219,14 @@ class CameraPage extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
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);
} } else if (destinationController.is_in_rog.value) {
else if (destinationController.is_in_rog.value) {
print("--- in normal camera ${destination.toString()}"); print("--- in normal camera ${destination.toString()}");
return Scaffold( return Scaffold(
appBar: destinationController.is_in_rog.value && appBar: destinationController.is_in_rog.value &&
destinationController.rogaining_counted.value == true destinationController.rogaining_counted.value == true
? AppBar( ? AppBar(
automaticallyImplyLeading: false,
title: destination.cp == -1 title: destination.cp == -1
? Text("finishing_rogaining".tr) ? Text("finishing_rogaining".tr)
: Text("${destination.sub_loc_id} : ${destination.name}"), : Text("${destination.sub_loc_id} : ${destination.name}"),
@ -240,9 +244,11 @@ class CameraPage extends StatelessWidget {
centerTitle: true, centerTitle: true,
) )
: AppBar( : AppBar(
automaticallyImplyLeading: false,
title: Text("${destination.sub_loc_id} : ${destination.name}"), title: Text("${destination.sub_loc_id} : ${destination.name}"),
), ),
body: Column( body: SingleChildScrollView(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Padding( Padding(
@ -261,11 +267,14 @@ class CameraPage extends StatelessWidget {
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.symmetric(vertical: 8.0),
child: destinationController.photos.isEmpty == true ? Text("撮影してチェックインしてください。") : Text("チェックインをタップしてください。") , child: Obx(() => destinationController.photos.isEmpty == true
? const Text("撮影してチェックインしてください。")
: const Text("チェックインをタップしてください。")),
), ),
getAction(context), getAction(context),
], ],
), ),
),
); );
} else { } else {
return StartRogaining(); return StartRogaining();
@ -283,6 +292,7 @@ class StartRogaining extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
automaticallyImplyLeading: false,
title: Text( title: Text(
"Not started yet".tr, "Not started yet".tr,
), ),
@ -351,7 +361,6 @@ class StartRogaining extends StatelessWidget {
// } // }
// } // }
class BuyPointCamera extends StatelessWidget { class BuyPointCamera extends StatelessWidget {
BuyPointCamera({Key? key, required this.destination}) : super(key: key); BuyPointCamera({Key? key, required this.destination}) : super(key: key);
@ -364,6 +373,7 @@ class BuyPointCamera extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
automaticallyImplyLeading: false,
title: Text( title: Text(
"${destination.sub_loc_id} : ${destination.name}", "${destination.sub_loc_id} : ${destination.name}",
), ),
@ -387,31 +397,63 @@ class BuyPointCamera extends StatelessWidget {
), ),
const Padding( const Padding(
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
child: Text("チェックインをタップしてください"), child: Text("次にレシート撮影を行います"),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
mainAxisSize: MainAxisSize.min,
children: [ children: [
Obx(() => ElevatedButton( Obx(() => Row(
mainAxisSize: MainAxisSize.min,
children: [
ElevatedButton(
onPressed: () { onPressed: () {
destinationController.openCamera(context, destination); destinationController.openCamera(
context, destination);
}, },
child: destinationController.photos.isNotEmpty child: destinationController.photos.isNotEmpty
? const Text("再撮影") ? const Text("再撮影")
: const Text("撮影"))), : const Text("撮影")),
const SizedBox(width: 10,),
ElevatedButton(
onPressed: () {
destinationController.openCamera(
context, destination);
},
child: const Text("買い物なし"))
],
)),
Obx(() => destinationController.photos.isNotEmpty Obx(() => destinationController.photos.isNotEmpty
? ElevatedButton( ? Row(
style: ElevatedButton.styleFrom(backgroundColor: Colors.red), 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 { onPressed: () async {
await destinationController.makeBuyPoint( await destinationController.makeBuyPoint(
destination, destinationController.photos[0].path); destination,
destinationController.photos[0].path);
Get.back(); Get.back();
destinationController.rogaining_counted.value = true; destinationController.rogaining_counted.value =
true;
destinationController.skip_gps = false; destinationController.skip_gps = false;
destinationController.is_photo_shoot.value = false; destinationController.is_photo_shoot.value =
Get.snackbar("チェックインしました。", "${destination.sub_loc_id} : ${destination.name}"); false;
Get.snackbar("お買い物加点を行いました",
"${destination.sub_loc_id} : ${destination.name}");
}, },
child: const Text("チェックイン")) child: const Text("完了"))
],
)
: Container()) : Container())
], ],
), ),

View File

@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion. # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at # Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.18+18 version: 1.0.19+19
environment: environment:
sdk: '>=3.1.0 <4.0.0' sdk: '>=3.1.0 <4.0.0'