From 0d5be265ff6f1002a8c4b7924c239011e615e638 Mon Sep 17 00:00:00 2001 From: Mohamed Nouffer Date: Sun, 22 Jan 2023 18:05:15 +0530 Subject: [PATCH] update for display text --- lib/model/destination.dart | 4 +++ .../destination_map/destination_map_page.dart | 2 +- lib/utils/text_util.dart | 28 +++++++++++++++---- lib/widgets/bottom_sheet_new.dart | 2 +- lib/widgets/map_widget.dart | 3 +- pubspec.yaml | 2 +- 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/lib/model/destination.dart b/lib/model/destination.dart index ae8347f..7730066 100644 --- a/lib/model/destination.dart +++ b/lib/model/destination.dart @@ -11,6 +11,7 @@ class Destination { int? series; double? lat; double? lon; + String? sub_loc_id; int? location_id; int? list_order; String? photos; @@ -34,6 +35,7 @@ class Destination { this.series, this.lat, this.lon, + this.sub_loc_id, this.location_id, this.list_order, this.photos, @@ -63,6 +65,7 @@ class Destination { series: json['series'], lat: json['lat'], lon: json['lon'], + sub_loc_id : json['sub_loc_id'], location_id: json['location_id'], list_order: json['list_order'], photos: json['photos'], @@ -91,6 +94,7 @@ class Destination { 'series':series, 'lat':lat, 'lon':lon, + 'sub_loc_id': sub_loc_id, 'location_id':location_id, 'list_order':list_order, 'photos':photos, diff --git a/lib/pages/destination_map/destination_map_page.dart b/lib/pages/destination_map/destination_map_page.dart index 6357f6e..963a772 100644 --- a/lib/pages/destination_map/destination_map_page.dart +++ b/lib/pages/destination_map/destination_map_page.dart @@ -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),)), ], ), ); diff --git a/lib/utils/text_util.dart b/lib/utils/text_util.dart index c067798..e20963f 100644 --- a/lib/utils/text_util.dart +++ b/lib/utils/text_util.dart @@ -1,8 +1,24 @@ +import 'package:geojson/geojson.dart'; import 'package:rogapp/model/destination.dart'; 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)'); String txt = ""; if(dp.cp! > 0){ @@ -11,15 +27,15 @@ class TextUtils{ txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}"; } 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; } - static String getDisplayText(String num){ - RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); - return "${num.replaceAll(regex, '')}"; - } + // static String getDisplayText(String num){ + // RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); + // return "${num.replaceAll(regex, '')}"; + // } } \ No newline at end of file diff --git a/lib/widgets/bottom_sheet_new.dart b/lib/widgets/bottom_sheet_new.dart index 0310ee9..64c9691 100644 --- a/lib/widgets/bottom_sheet_new.dart +++ b/lib/widgets/bottom_sheet_new.dart @@ -138,7 +138,7 @@ class BottomSheetNew extends GetView { alignment: Alignment.center, child: Obx(() => 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, fontWeight: FontWeight.bold, ), diff --git a/lib/widgets/map_widget.dart b/lib/widgets/map_widget.dart index 8dd9791..1ba3872 100644 --- a/lib/widgets/map_widget.dart +++ b/lib/widgets/map_widget.dart @@ -8,6 +8,7 @@ import 'package:get/get.dart'; import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:latlong2/latlong.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/bottom_sheet_new.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,))), ], ); } diff --git a/pubspec.yaml b/pubspec.yaml index 087c8f4..cd7ca87 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -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. # Read more about iOS versioning at # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html -version: 1.0.4+4 +version: 1.0.5+5 environment: sdk: ">=2.16.0 <3.0.0"