44 lines
1.5 KiB
Dart
44 lines
1.5 KiB
Dart
import 'package:geojson_vi/geojson_vi.dart';
|
|
import 'package:gifunavi/model/destination.dart';
|
|
|
|
class TextUtils {
|
|
static String getDisplayTextFeture(GeoJSONFeature f) {
|
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
String txt = "";
|
|
if (f.properties!["sub_loc_id"] != null) {
|
|
txt = "${f.properties!["sub_loc_id"]}";
|
|
}
|
|
// 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"]}";
|
|
//}
|
|
//print("Text = ${txt}");
|
|
return txt;
|
|
}
|
|
|
|
static String getDisplayText(Destination dp) {
|
|
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
String txt = "";
|
|
if (dp.cp! > 0) {
|
|
txt = dp.cp.toString().replaceAll(regex, '');
|
|
if (dp.checkin_point != null && dp.checkin_point! > 0) {
|
|
txt = "$txt{${dp.checkin_point.toString().replaceAll(regex, '')}}";
|
|
}
|
|
if (dp.buy_point != null && dp.buy_point! > 0) {
|
|
//print("^^^^^^^^^ ${dp.sub_loc_id}^^^^^^^^^^");
|
|
txt =
|
|
"#${dp.cp.toString().replaceAll(regex, '')}(${dp.checkin_point.toString().replaceAll(regex, '')}+${dp.buy_point.toString().replaceAll(regex, '')})";
|
|
}
|
|
}
|
|
return txt;
|
|
}
|
|
|
|
// static String getDisplayText(String num){
|
|
// RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
|
|
// return "${num.replaceAll(regex, '')}";
|
|
// }
|
|
}
|