import 'package:geojson/geojson.dart'; import 'package:rogapp/model/destination.dart'; import 'package:rogapp/model/location_response.dart'; class TextUtils{ 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(Feature dp){ RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); String txt = ""; 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, '')}}"; } 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, '')})"; } } return txt; } static String getDisplayTextForFeature(Feature f){ return "${f.properties!.sub_loc_id}"; } // static String getDisplayText(String num){ // RegExp regex = RegExp(r'([.]*0)(?!.*\d)'); // return "${num.replaceAll(regex, '')}"; // } }