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

@ -11,19 +11,24 @@ import 'package:rogapp/services/external_service.dart';
ImageProvider getFinishImage() { ImageProvider getFinishImage() {
DestinationController destinationController = DestinationController destinationController =
Get.find<DestinationController>(); Get.find<DestinationController>();
if (destinationController.photos.isNotEmpty) { if (destinationController.photos.isNotEmpty) {
return FileImage(destinationController.photos[0]); return FileImage(destinationController.photos[0]);
} else { } else {
return const AssetImage('assets/images/empty_image.png'); return const AssetImage('assets/images/empty_image.png');
}
} }
}
class CameraPage extends StatelessWidget { class CameraPage extends StatelessWidget {
bool? manulaCheckin = false; bool? manulaCheckin = false;
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())
@ -213,16 +217,16 @@ class CameraPage extends StatelessWidget {
@override @override
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,31 +244,36 @@ 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(
mainAxisAlignment: MainAxisAlignment.spaceAround, child: Column(
children: [ mainAxisAlignment: MainAxisAlignment.spaceAround,
Padding( children: [
padding: const EdgeInsets.all(8.0), Padding(
child: Center( padding: const EdgeInsets.all(8.0),
child: Obx( child: Center(
() => Container( child: Obx(
width: MediaQuery.of(context).size.width, () => Container(
height: 370, width: MediaQuery.of(context).size.width,
decoration: BoxDecoration( height: 370,
image: DecorationImage( decoration: BoxDecoration(
image: getFinishImage(), fit: BoxFit.cover)), image: DecorationImage(
image: getFinishImage(), fit: BoxFit.cover)),
),
), ),
), ),
), ),
), Padding(
Padding( padding: const EdgeInsets.symmetric(vertical: 8.0),
padding:const EdgeInsets.symmetric(vertical:8.0), child: Obx(() => destinationController.photos.isEmpty == true
child: destinationController.photos.isEmpty == true ? Text("撮影してチェックインしてください。") : Text("チェックインをタップしてください。") , ? const Text("撮影してチェックインしてください。")
), : const Text("チェックインをタップしてください。")),
getAction(context), ),
], getAction(context),
],
),
), ),
); );
} else { } else {
@ -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,59 +373,92 @@ 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}",
), ),
), ),
body: Column( body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Center( child: Center(
child: Obx( child: Obx(
() => Container( () => Container(
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
height: 370, height: 370,
decoration: BoxDecoration( decoration: BoxDecoration(
image: DecorationImage( image: DecorationImage(
image: getFinishImage(), fit: BoxFit.cover)), image: getFinishImage(), fit: BoxFit.cover)),
),
), ),
), ),
), ),
const Padding( ),
padding: EdgeInsets.all(8.0), const Padding(
child: Text("チェックインをタップしてください。"), padding: EdgeInsets.all(8.0),
), child: Text("次にレシート撮影を行います。"),
Row( ),
mainAxisAlignment: MainAxisAlignment.spaceAround, Row(
children: [ mainAxisAlignment: MainAxisAlignment.spaceAround,
Obx(() => ElevatedButton( mainAxisSize: MainAxisSize.min,
onPressed: () { children: [
destinationController.openCamera(context, destination); Obx(() => Row(
}, mainAxisSize: MainAxisSize.min,
child: destinationController.photos.isNotEmpty children: [
? const Text("再撮影") ElevatedButton(
: const Text("撮影"))), onPressed: () {
Obx(() => destinationController.photos.isNotEmpty destinationController.openCamera(
? ElevatedButton( context, destination);
style: ElevatedButton.styleFrom(backgroundColor: Colors.red), },
onPressed: () async { child: destinationController.photos.isNotEmpty
await destinationController.makeBuyPoint( ? const Text("再撮影")
destination, destinationController.photos[0].path); : const Text("撮影")),
Get.back(); const SizedBox(width: 10,),
destinationController.rogaining_counted.value = true; ElevatedButton(
destinationController.skip_gps = false; onPressed: () {
destinationController.is_photo_shoot.value = false; destinationController.openCamera(
Get.snackbar("チェックインしました。", "${destination.sub_loc_id} : ${destination.name}"); context, destination);
}, },
child: const Text("チェックイン")) child: const Text("買い物なし"))
: Container()) ],
)),
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())
],
),
], ],
), ),
],
),
); );
} }
} }

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'