From 3465ac6e980f1473e4f42ba3eaafc7815423efec Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期六, 27 十一月 2021 17:10:45 +0800 Subject: [PATCH] 功能完善 --- lib/model/map/location_model.dart | 32 +++++++++++++++++++++++++++----- 1 files changed, 27 insertions(+), 5 deletions(-) diff --git a/lib/model/map/location_model.dart b/lib/model/map/location_model.dart index 77af0f5..887dae1 100644 --- a/lib/model/map/location_model.dart +++ b/lib/model/map/location_model.dart @@ -55,6 +55,7 @@ _locationDetail = json['locationDetail']; } + String? _locTime; double? _latitude; double? _longitude; @@ -115,21 +116,33 @@ double? latitude, double? longitude, String? address, + String? addressDetail }) { _latitude = latitude; _longitude = longitude; _address = address; + _addressDetail=addressDetail; } SimpleLocation.fromJson(dynamic json) { _latitude = json['latitude']; _longitude = json['longitude']; _address = json['address']; + _addressDetail = json['addressDetail']; + + } + + SimpleLocation.fromBaiDuLocation(BaiduLocation location) { + _latitude = location.latitude; + _longitude = location.longitude; + _address = location.address; + _addressDetail=location.locationDetail; } double? _latitude; double? _longitude; String? _address; + String? _addressDetail; double? get latitude => _latitude; @@ -137,35 +150,41 @@ String? get address => _address; + String? get addressDetail => _addressDetail; + Map<String, dynamic> toJson() { final map = <String, dynamic>{}; map['latitude'] = _latitude; map['longitude'] = _longitude; map['address'] = _address; + map['addressDetail'] = _addressDetail; return map; } } class UserLocationInfo { - UserLocationInfo({ - int? uid, - SimpleLocation? location, - String? updateTime, - }) { + UserLocationInfo( + {int? uid, + SimpleLocation? location, + String? updateTime, + int? locationCount}) { _uid = uid; _location = location; _updateTime = updateTime; + _locationCount=locationCount; } UserLocationInfo.fromJson(dynamic json) { _uid = json['uid']; _location = SimpleLocation.fromJson(json['location']); _updateTime = json['updateTime']; + _locationCount = json['locationCount']; } int? _uid; SimpleLocation? _location; String? _updateTime; + int? _locationCount; int? get uid => _uid; @@ -173,11 +192,14 @@ String? get updateTime => _updateTime; + int? get locationCount => _locationCount; + Map<String, dynamic> toJson() { final map = <String, dynamic>{}; map['uid'] = _uid; map['location'] = _location; map['updateTime'] = _updateTime; + map['locationCount'] = _locationCount; return map; } } -- Gitblit v1.8.0