Complete refactoring SFM App Source Code

This commit is contained in:
anhtunz
2024-12-15 00:59:02 +07:00
parent caa73ca43c
commit 2e27d59278
247 changed files with 18390 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
class District {
String? code;
String? name;
String? nameEn;
String? fullName;
String? fullNameEn;
String? codeName;
String? provinceCode;
String? type;
District({
this.code,
this.name,
this.nameEn,
this.fullName,
this.fullNameEn,
this.codeName,
this.provinceCode,
this.type,
});
District.fromJson(Map<String, dynamic> json) {
code = json['code'];
name = json['name'];
nameEn = json['name_en'];
fullName = json['full_name'];
fullNameEn = json['full_name_en'];
codeName = json['code_name'];
provinceCode = json['parent'];
type = json['type'];
}
static List<District> fromJsonList(List list) {
return list.map((e) => District.fromJson(e)).toList();
}
static List<District> fromJsonDynamicList(List<dynamic> list) {
return list.map((e) => District.fromJson(e)).toList();
}
// @override
// String toString() => fullName!;
}

View File

@@ -0,0 +1,172 @@
class NearbySearch {
List<Result>? results;
String? status;
NearbySearch({
this.results,
this.status,
});
NearbySearch.fromJson(Map<String, dynamic> json) {
if (json['results'] != null) {
results = [];
json['results'].forEach((v) {
results!.add(Result.fromJson(v));
});
}
status = json['status'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (results != null) {
data['result'] = results!.map((v) => v.toJson()).toList();
}
data['status'] = status;
return data;
}
}
class PlaceDetails {
Result? result;
String? status;
PlaceDetails({this.result, this.status});
PlaceDetails.fromJson(Map<String, dynamic> json) {
result = json['result'] != null ? Result.fromJson(json['result']) : null;
status = json['status'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (result != null) {
data['result'] = result!.toJson();
}
data['status'] = status;
return data;
}
static List<PlaceDetails> fromJsonDynamicList(List<dynamic> list) {
return list.map((e) => PlaceDetails.fromJson(e)).toList();
}
}
class Result {
Geometry? geometry;
String? icon;
String? name;
String? placeId;
String? vicinity;
String? adress;
String? formattedAddress;
String? formattedPhoneNumber;
String? phoneNumber;
OpeningHours? openingHours;
Result({
this.geometry,
this.icon,
this.name,
this.placeId,
this.vicinity,
this.formattedPhoneNumber,
this.phoneNumber,
this.openingHours,
this.adress,
this.formattedAddress,
});
Result.fromJson(Map<String, dynamic> json) {
geometry =
json['geometry'] != null ? Geometry.fromJson(json['geometry']) : null;
icon = json['icon'];
name = json['name'];
placeId = json['place_id'];
vicinity = json['vicinity'];
adress = json['adr_address'];
formattedPhoneNumber = json['formatted_phone_number'] ?? "";
phoneNumber = json['international_phone_number'] ?? "";
formattedAddress = json['formatted_address'];
openingHours = json['opening_hours'] != null
? OpeningHours.fromJson(json['opening_hours'])
: null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (geometry != null) {
data['geometry'] = geometry!.toJson();
}
data['icon'] = icon;
data['name'] = name;
data['vicinity'] = vicinity;
data['adr_address'] = adress;
data['formatted_address'] = formattedAddress;
data['international_phone_number'] = phoneNumber;
data['formatted_phone_number'] = formattedPhoneNumber;
if (openingHours != null) {
data['opening_hours'] = openingHours!.toJson();
}
return data;
}
}
class Geometry {
Location? location;
Geometry({
this.location,
});
Geometry.fromJson(Map<String, dynamic> json) {
location =
json['location'] != null ? Location.fromJson(json['location']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
if (location != null) {
data['location'] = location!.toJson();
}
return data;
}
}
class Location {
double? lat;
double? lng;
Location({
this.lat,
this.lng,
});
Location.fromJson(Map<String, dynamic> json) {
lat = json['lat'];
lng = json['lng'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['lat'] = lat;
data['lng'] = lng;
return data;
}
}
class OpeningHours {
bool? openNow;
OpeningHours({
this.openNow,
});
OpeningHours.fromJson(Map<String, dynamic> json) {
openNow = json['open_now'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = <String, dynamic>{};
data['open_now'] = openNow;
return data;
}
}

View File

@@ -0,0 +1,42 @@
class Province {
String? code;
String? name;
String? nameEn;
String? fullName;
String? fullNameEn;
String? codeName;
String? parent;
String? type;
Province(
{this.code,
this.name,
this.nameEn,
this.fullName,
this.fullNameEn,
this.codeName,
this.parent,
this.type});
Province.fromJson(Map<String, dynamic> json) {
code = json['code'];
name = json['name'];
nameEn = json['name_en'];
fullName = json['full_name'];
fullNameEn = json['full_name_en'];
codeName = json['code_name'];
parent = json['parent'];
type = json['type'];
}
static List<Province> fromJsonList(List list) {
return list.map((e) => Province.fromJson(e)).toList();
}
static List<Province> fromJsonDynamicList(List<dynamic> list) {
return list.map((e) => Province.fromJson(e)).toList();
}
@override
String toString() => fullName!;
}

View File

@@ -0,0 +1,43 @@
class Ward {
String? code;
String? name;
String? nameEn;
String? fullName;
String? fullNameEn;
String? codeName;
String? districtCode;
String? type;
Ward({
this.code,
this.name,
this.nameEn,
this.fullName,
this.fullNameEn,
this.codeName,
this.districtCode,
this.type,
});
Ward.fromJson(Map<String, dynamic> json) {
code = json['code'];
name = json['name'];
nameEn = json['name_en'];
fullName = json['full_name'];
fullNameEn = json['full_name_en'];
codeName = json['code_name'];
districtCode = json['parent'];
type = json['type'];
}
static List<Ward> fromJsonList(List list) {
return list.map((e) => Ward.fromJson(e)).toList();
}
static List<Ward> fromJsonDynamicList(List<dynamic> list) {
return list.map((e) => Ward.fromJson(e)).toList();
}
@override
String toString() => fullName!;
}