Files
rog_app/lib/utils/text_util.dart

46 lines
1.6 KiB
Dart
Raw Normal View History

2022-10-12 21:46:17 +05:30
2023-01-22 18:05:15 +05:30
import 'package:geojson/geojson.dart';
2022-10-12 21:46:17 +05:30
import 'package:rogapp/model/destination.dart';
2023-06-09 15:55:59 +05:30
import 'package:rogapp/model/location_response.dart';
2022-10-12 21:46:17 +05:30
class TextUtils{
2023-01-22 18:05:15 +05:30
static String getDisplayTextFeture(GeoJsonFeature f){
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = "";
2023-01-22 18:43:08 +05:30
// 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){
2023-01-22 19:25:17 +05:30
txt = txt + "${f.properties!["sub_loc_id"]}";
2023-01-22 18:43:08 +05:30
//}
2023-01-22 18:05:15 +05:30
return txt;
}
2023-06-09 15:55:59 +05:30
static String getDisplayText(Feature dp){
2022-10-12 21:46:17 +05:30
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = "";
2023-06-09 15:55:59 +05:30
if(dp.properties!.cp! > 0){
txt = "${dp.properties!.cp.toString().replaceAll(regex, '')}";
if(dp.properties!.checkin_point != null && dp.properties!.checkin_point! > 0){
txt = txt + "{${dp.properties!.checkin_point.toString().replaceAll(regex, '')}}";
2022-10-12 21:46:17 +05:30
}
2023-06-09 15:55:59 +05:30
if(dp.properties!.buy_point != null && dp.properties!.buy_point! > 0){
txt = "#${dp.properties!.cp.toString().replaceAll(regex, '')}(${dp.properties!.checkin_point.toString().replaceAll(regex, '')}+${dp.properties!.buy_point.toString().replaceAll(regex, '')})";
2022-10-12 21:46:17 +05:30
}
}
return txt;
}
2023-06-09 15:55:59 +05:30
static String getDisplayTextForFeature(Feature f){
return "${f.properties!.sub_loc_id}";
}
2023-01-22 18:05:15 +05:30
// static String getDisplayText(String num){
// RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
// return "${num.replaceAll(regex, '')}";
// }
2022-10-12 21:46:17 +05:30
}