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;
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,

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';
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, '')}";
// }
}

View File

@ -138,7 +138,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
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,
),

View File

@ -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,))),
],
);
}