update for display text

This commit is contained in:
Mohamed Nouffer
2023-01-22 18:05:15 +05:30
parent adf8d59777
commit 0d5be265ff
6 changed files with 31 additions and 10 deletions

View File

@ -11,6 +11,7 @@ class Destination {
int? series; int? series;
double? lat; double? lat;
double? lon; double? lon;
String? sub_loc_id;
int? location_id; int? location_id;
int? list_order; int? list_order;
String? photos; String? photos;
@ -34,6 +35,7 @@ class Destination {
this.series, this.series,
this.lat, this.lat,
this.lon, this.lon,
this.sub_loc_id,
this.location_id, this.location_id,
this.list_order, this.list_order,
this.photos, this.photos,
@ -63,6 +65,7 @@ class Destination {
series: json['series'], series: json['series'],
lat: json['lat'], lat: json['lat'],
lon: json['lon'], lon: json['lon'],
sub_loc_id : json['sub_loc_id'],
location_id: json['location_id'], location_id: json['location_id'],
list_order: json['list_order'], list_order: json['list_order'],
photos: json['photos'], photos: json['photos'],
@ -91,6 +94,7 @@ class Destination {
'series':series, 'series':series,
'lat':lat, 'lat':lat,
'lon':lon, 'lon':lon,
'sub_loc_id': sub_loc_id,
'location_id':location_id, 'location_id':location_id,
'list_order':list_order, 'list_order':list_order,
'photos':photos, 'photos':photos,

View File

@ -85,7 +85,7 @@ class DestinationMapPage extends StatelessWidget {
), ),
), ),
), ),
Container( color: Colors.yellow, child: Text(TextUtils.getDisplaytext(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)), Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
], ],
), ),
); );

View File

@ -1,8 +1,24 @@
import 'package:geojson/geojson.dart';
import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/destination.dart';
class TextUtils{ class TextUtils{
static String getDisplaytext(Destination dp){
static String getDisplayTextFeture(GeoJsonFeature f){
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = "";
if(f.properties!["cp"] > 0){
//print("-- sub-- ${f.properties!["cp"]} ----");
txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
}
if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){
txt = txt + "[${f.properties!["sub_loc_id"]}]";
}
return txt;
}
static String getDisplayText(Destination dp){
RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = ""; String txt = "";
if(dp.cp! > 0){ if(dp.cp! > 0){
@ -11,15 +27,15 @@ class TextUtils{
txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}"; txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}";
} }
if(dp.buy_point != null && dp.buy_point! > 0){ if(dp.buy_point != null && dp.buy_point! > 0){
txt = txt + "[${dp.buy_point.toString().replaceAll(regex, '')}]"; txt = txt + "[${dp.sub_loc_id}]";
} }
} }
return txt; return txt;
} }
static String getDisplayText(String num){ // static String getDisplayText(String num){
RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); // RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
return "${num.replaceAll(regex, '')}"; // return "${num.replaceAll(regex, '')}";
} // }
} }

View File

@ -138,7 +138,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
alignment: Alignment.center, alignment: Alignment.center,
child: Obx(() => child: Obx(() =>
indexController.currentUser.length > 0 ? indexController.currentUser.length > 0 ?
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0].cp.toString())} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0].checkin_point.toString())} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle( Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0])} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
fontSize: 15.0, fontSize: 15.0,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),

View File

@ -8,6 +8,7 @@ import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart'; import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_widget.dart';
@ -51,7 +52,7 @@ class MapWidget extends StatelessWidget {
], ],
) )
), ),
Container(color: Colors.white, child: Text(i.properties!['cp'] > 0 ? "${i.properties!['cp'].toString().replaceAll(regex, '')}{${i.properties!['checkin_point'].toString()}}" : "", style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))), Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
], ],
); );
} }

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.4+4 version: 1.0.5+5
environment: environment:
sdk: ">=2.16.0 <3.0.0" sdk: ">=2.16.0 <3.0.0"