updated for tag text

This commit is contained in:
2023-11-20 14:01:28 +05:30
parent b04985b71f
commit 4648b0424d
4 changed files with 48 additions and 13 deletions

View File

@ -25,6 +25,7 @@ class Destination {
String? buypoint_image; String? buypoint_image;
bool forced_checkin = false; bool forced_checkin = false;
int recipt_times = 0; int recipt_times = 0;
String? tags;
Destination( Destination(
{this.name, {this.name,
@ -52,13 +53,16 @@ class Destination {
this.checkin_image, this.checkin_image,
this.buypoint_image, this.buypoint_image,
this.forced_checkin = false, this.forced_checkin = false,
this.recipt_times = 0}); this.recipt_times = 0,
this.tags});
factory Destination.fromMap(Map<String, dynamic> json) { factory Destination.fromMap(Map<String, dynamic> json) {
bool selec = json['selected'] == 0 ? false : true; bool selec = json['selected'] == 0 ? false : true;
bool checkin = json['checkedin'] == 0 ? false : true; bool checkin = json['checkedin'] == 0 ? false : true;
bool forcedCheckin = json['forced_checkin'] == 0 ? false : true; bool forcedCheckin = json['forced_checkin'] == 0 ? false : true;
print("-----tags model----- ${json}");
return Destination( return Destination(
name: json['name'], name: json['name'],
address: json['address'], address: json['address'],
@ -85,7 +89,8 @@ class Destination {
checkin_image: json['checkin_image'], checkin_image: json['checkin_image'],
buypoint_image: json["buypoint_image"], buypoint_image: json["buypoint_image"],
forced_checkin: forcedCheckin, forced_checkin: forcedCheckin,
recipt_times: json["recipt_times"]); recipt_times: json["recipt_times"],
tags: json["tags"]);
} }
Map<String, dynamic> toMap() { Map<String, dynamic> toMap() {
@ -118,7 +123,8 @@ class Destination {
'checkin_image': checkin_image, 'checkin_image': checkin_image,
'buypoint_image': buypoint_image, 'buypoint_image': buypoint_image,
'forced_checkin': forcedCheckin, 'forced_checkin': forcedCheckin,
'recipt_times': recipt_times 'recipt_times': recipt_times,
'tags': tags
}; };
} }
} }

View File

@ -9,6 +9,28 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/external_service.dart'; import 'package:rogapp/services/external_service.dart';
import 'package:rogapp/utils/const.dart'; import 'package:rogapp/utils/const.dart';
String getTagText(bool isRecept, String? tags) {
if (tags == null || tags.isEmpty) {
return "";
}
List<String> tts = tags.split(" ");
List<String> ttt = tags.split(" ");
if (isRecept) {
if (ttt.length > tts.length && ttt.length > 1) {
return ttt[1];
}
}
if (!isRecept) {
if (ttt.length > tts.length && ttt.length > 1) {
return ttt[0];
}
}
if (!isRecept) {
return tts[0];
}
return "";
}
Image getDisplayImage(Destination destination) { Image getDisplayImage(Destination destination) {
String serverUrl = ConstValues.currentServer(); String serverUrl = ConstValues.currentServer();
@ -257,6 +279,7 @@ class CameraPage extends StatelessWidget {
//print("--- buy point camera ${destination.toString()}"); //print("--- buy point camera ${destination.toString()}");
return BuyPointCamera(destination: destination); return BuyPointCamera(destination: destination);
} else if (destinationController.isInRog.value) { } else if (destinationController.isInRog.value) {
//print("-----tags camera page----- ${destination.tags}");
//print("--- in normal camera ${destination.toString()}"); //print("--- in normal camera ${destination.toString()}");
return Scaffold( return Scaffold(
appBar: destinationController.isInRog.value && appBar: destinationController.isInRog.value &&
@ -305,11 +328,15 @@ class CameraPage extends StatelessWidget {
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0), padding: const EdgeInsets.symmetric(vertical: 8.0),
child: Obx(() => destinationController.photos.isEmpty == true child: Text(getTagText(
? const Text("撮影してチェックインしてください。") false,
: const Text("チェックインをタップしてください。")), destination.tags,
), ))
// child: Obx(() => destinationController.photos.isEmpty == true
// ? const Text("撮影してチェックインしてください。")
// : const Text("チェックインをタップしてください。")),
),
getAction(context), getAction(context),
], ],
), ),
@ -432,9 +459,9 @@ class BuyPointCamera extends StatelessWidget {
), ),
), ),
), ),
const Padding( Padding(
padding: EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text("次にレシート撮影を行います。"), child: Text(getTagText(true, destination.tags)),
), ),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,

View File

@ -103,7 +103,8 @@ class DestinationController extends GetxController {
buy_point: fs.properties!["buy_point"], buy_point: fs.properties!["buy_point"],
selected: false, selected: false,
checkedin: false, checkedin: false,
hidden_location: fs.properties!["hidden_location"] == true ? 1 : 0); hidden_location: fs.properties!["hidden_location"] == true ? 1 : 0,
tags: fs.properties!["tags"]);
} }
Future<void> startTimerLocation(GeoJsonFeature fs, double distance) async { Future<void> startTimerLocation(GeoJsonFeature fs, double distance) async {

View File

@ -58,7 +58,8 @@ class DatabaseHelper {
checkin_image TEXT, checkin_image TEXT,
buypoint_image TEXT, buypoint_image TEXT,
forced_checkin INTEGER, forced_checkin INTEGER,
recipt_times INTEGER recipt_times INTEGER,
tags TEXT
) )
'''); ''');