Used freezed package in location and locationTag models
This commit is contained in:
parent
2ff51d10f8
commit
3de5696b04
18 changed files with 631 additions and 39 deletions
|
@ -9,7 +9,7 @@ import 'package:photos/models/backup_status.dart';
|
|||
import 'package:photos/models/file.dart';
|
||||
import 'package:photos/models/file_load_result.dart';
|
||||
import 'package:photos/models/file_type.dart';
|
||||
import 'package:photos/models/location.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/models/magic_metadata.dart';
|
||||
import 'package:photos/utils/file_uploader_util.dart';
|
||||
import 'package:sqflite/sqflite.dart';
|
||||
|
@ -1489,7 +1489,10 @@ class FilesDB {
|
|||
file.title = row[columnTitle];
|
||||
file.deviceFolder = row[columnDeviceFolder];
|
||||
if (row[columnLatitude] != null && row[columnLongitude] != null) {
|
||||
file.location = Location(row[columnLatitude], row[columnLongitude]);
|
||||
file.location = Location(
|
||||
latitude: row[columnLatitude],
|
||||
longitude: row[columnLongitude],
|
||||
);
|
||||
}
|
||||
file.fileType = getFileType(row[columnFileType]);
|
||||
file.creationTime = row[columnCreationTime];
|
||||
|
|
|
@ -8,7 +8,7 @@ import 'package:photos/core/configuration.dart';
|
|||
import 'package:photos/core/constants.dart';
|
||||
import 'package:photos/models/ente_file.dart';
|
||||
import 'package:photos/models/file_type.dart';
|
||||
import 'package:photos/models/location.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/models/magic_metadata.dart';
|
||||
import 'package:photos/services/feature_flag_service.dart';
|
||||
import 'package:photos/utils/date_time_util.dart';
|
||||
|
@ -72,7 +72,8 @@ class File extends EnteFile {
|
|||
file.localID = asset.id;
|
||||
file.title = asset.title;
|
||||
file.deviceFolder = pathName;
|
||||
file.location = Location(asset.latitude, asset.longitude);
|
||||
file.location =
|
||||
Location(latitude: asset.latitude, longitude: asset.longitude);
|
||||
file.fileType = _fileTypeFromAsset(asset);
|
||||
file.creationTime = parseFileCreationTime(file.title, asset);
|
||||
file.modificationTime = asset.modifiedDateTime.microsecondsSinceEpoch;
|
||||
|
@ -147,7 +148,7 @@ class File extends EnteFile {
|
|||
if (latitude == null || longitude == null) {
|
||||
location = null;
|
||||
} else {
|
||||
location = Location(latitude, longitude);
|
||||
location = Location(latitude: latitude, longitude: longitude);
|
||||
}
|
||||
fileType = getFileType(metadata["fileType"] ?? -1);
|
||||
fileSubType = metadata["subType"] ?? -1;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
class Location {
|
||||
final double? latitude;
|
||||
final double? longitude;
|
||||
|
||||
Location(this.latitude, this.longitude);
|
||||
|
||||
@override
|
||||
String toString() => 'Location(latitude: $latitude, longitude: $longitude)';
|
||||
}
|
16
lib/models/location/location.dart
Normal file
16
lib/models/location/location.dart
Normal file
|
@ -0,0 +1,16 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'location.freezed.dart';
|
||||
|
||||
part 'location.g.dart';
|
||||
|
||||
@freezed
|
||||
class Location with _$Location {
|
||||
const factory Location({
|
||||
required double? latitude,
|
||||
required double? longitude,
|
||||
}) = _Location;
|
||||
|
||||
factory Location.fromJson(Map<String, Object?> json) =>
|
||||
_$LocationFromJson(json);
|
||||
}
|
168
lib/models/location/location.freezed.dart
Normal file
168
lib/models/location/location.freezed.dart
Normal file
|
@ -0,0 +1,168 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'location.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||
|
||||
Location _$LocationFromJson(Map<String, dynamic> json) {
|
||||
return _Location.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$Location {
|
||||
double? get latitude => throw _privateConstructorUsedError;
|
||||
double? get longitude => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$LocationCopyWith<Location> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LocationCopyWith<$Res> {
|
||||
factory $LocationCopyWith(Location value, $Res Function(Location) then) =
|
||||
_$LocationCopyWithImpl<$Res, Location>;
|
||||
@useResult
|
||||
$Res call({double? latitude, double? longitude});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LocationCopyWithImpl<$Res, $Val extends Location>
|
||||
implements $LocationCopyWith<$Res> {
|
||||
_$LocationCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? latitude = freezed,
|
||||
Object? longitude = freezed,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
latitude: freezed == latitude
|
||||
? _value.latitude
|
||||
: latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
longitude: freezed == longitude
|
||||
? _value.longitude
|
||||
: longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
) as $Val);
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$_LocationCopyWith<$Res> implements $LocationCopyWith<$Res> {
|
||||
factory _$$_LocationCopyWith(
|
||||
_$_Location value, $Res Function(_$_Location) then) =
|
||||
__$$_LocationCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({double? latitude, double? longitude});
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$_LocationCopyWithImpl<$Res>
|
||||
extends _$LocationCopyWithImpl<$Res, _$_Location>
|
||||
implements _$$_LocationCopyWith<$Res> {
|
||||
__$$_LocationCopyWithImpl(
|
||||
_$_Location _value, $Res Function(_$_Location) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? latitude = freezed,
|
||||
Object? longitude = freezed,
|
||||
}) {
|
||||
return _then(_$_Location(
|
||||
latitude: freezed == latitude
|
||||
? _value.latitude
|
||||
: latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
longitude: freezed == longitude
|
||||
? _value.longitude
|
||||
: longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double?,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$_Location implements _Location {
|
||||
const _$_Location({required this.latitude, required this.longitude});
|
||||
|
||||
factory _$_Location.fromJson(Map<String, dynamic> json) =>
|
||||
_$$_LocationFromJson(json);
|
||||
|
||||
@override
|
||||
final double? latitude;
|
||||
@override
|
||||
final double? longitude;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'Location(latitude: $latitude, longitude: $longitude)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$_Location &&
|
||||
(identical(other.latitude, latitude) ||
|
||||
other.latitude == latitude) &&
|
||||
(identical(other.longitude, longitude) ||
|
||||
other.longitude == longitude));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, latitude, longitude);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$_LocationCopyWith<_$_Location> get copyWith =>
|
||||
__$$_LocationCopyWithImpl<_$_Location>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$_LocationToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _Location implements Location {
|
||||
const factory _Location(
|
||||
{required final double? latitude,
|
||||
required final double? longitude}) = _$_Location;
|
||||
|
||||
factory _Location.fromJson(Map<String, dynamic> json) = _$_Location.fromJson;
|
||||
|
||||
@override
|
||||
double? get latitude;
|
||||
@override
|
||||
double? get longitude;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$_LocationCopyWith<_$_Location> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
18
lib/models/location/location.g.dart
Normal file
18
lib/models/location/location.g.dart
Normal file
|
@ -0,0 +1,18 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'location.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$_Location _$$_LocationFromJson(Map<String, dynamic> json) => _$_Location(
|
||||
latitude: (json['latitude'] as num?)?.toDouble(),
|
||||
longitude: (json['longitude'] as num?)?.toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_LocationToJson(_$_Location instance) =>
|
||||
<String, dynamic>{
|
||||
'latitude': instance.latitude,
|
||||
'longitude': instance.longitude,
|
||||
};
|
|
@ -1,13 +0,0 @@
|
|||
import "package:photos/models/location.dart";
|
||||
|
||||
class LocationTag {
|
||||
String name;
|
||||
int radius;
|
||||
Location centerPoint;
|
||||
|
||||
LocationTag({
|
||||
required this.name,
|
||||
required this.radius,
|
||||
required this.centerPoint,
|
||||
});
|
||||
}
|
17
lib/models/location_tag/location_tag.dart
Normal file
17
lib/models/location_tag/location_tag.dart
Normal file
|
@ -0,0 +1,17 @@
|
|||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
|
||||
part 'location_tag.freezed.dart';
|
||||
part 'location_tag.g.dart';
|
||||
|
||||
@freezed
|
||||
class LocationTag with _$LocationTag {
|
||||
const factory LocationTag({
|
||||
required String name,
|
||||
required int radius,
|
||||
required Location centerPoint,
|
||||
}) = _LocationTag;
|
||||
|
||||
factory LocationTag.fromJson(Map<String, Object?> json) =>
|
||||
_$LocationTagFromJson(json);
|
||||
}
|
201
lib/models/location_tag/location_tag.freezed.dart
Normal file
201
lib/models/location_tag/location_tag.freezed.dart
Normal file
|
@ -0,0 +1,201 @@
|
|||
// coverage:ignore-file
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'location_tag.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
final _privateConstructorUsedError = UnsupportedError(
|
||||
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#custom-getters-and-methods');
|
||||
|
||||
LocationTag _$LocationTagFromJson(Map<String, dynamic> json) {
|
||||
return _LocationTag.fromJson(json);
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
mixin _$LocationTag {
|
||||
String get name => throw _privateConstructorUsedError;
|
||||
int get radius => throw _privateConstructorUsedError;
|
||||
Location get centerPoint => throw _privateConstructorUsedError;
|
||||
|
||||
Map<String, dynamic> toJson() => throw _privateConstructorUsedError;
|
||||
@JsonKey(ignore: true)
|
||||
$LocationTagCopyWith<LocationTag> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class $LocationTagCopyWith<$Res> {
|
||||
factory $LocationTagCopyWith(
|
||||
LocationTag value, $Res Function(LocationTag) then) =
|
||||
_$LocationTagCopyWithImpl<$Res, LocationTag>;
|
||||
@useResult
|
||||
$Res call({String name, int radius, Location centerPoint});
|
||||
|
||||
$LocationCopyWith<$Res> get centerPoint;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class _$LocationTagCopyWithImpl<$Res, $Val extends LocationTag>
|
||||
implements $LocationTagCopyWith<$Res> {
|
||||
_$LocationTagCopyWithImpl(this._value, this._then);
|
||||
|
||||
// ignore: unused_field
|
||||
final $Val _value;
|
||||
// ignore: unused_field
|
||||
final $Res Function($Val) _then;
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? radius = null,
|
||||
Object? centerPoint = null,
|
||||
}) {
|
||||
return _then(_value.copyWith(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
radius: null == radius
|
||||
? _value.radius
|
||||
: radius // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
centerPoint: null == centerPoint
|
||||
? _value.centerPoint
|
||||
: centerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as Location,
|
||||
) as $Val);
|
||||
}
|
||||
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$LocationCopyWith<$Res> get centerPoint {
|
||||
return $LocationCopyWith<$Res>(_value.centerPoint, (value) {
|
||||
return _then(_value.copyWith(centerPoint: value) as $Val);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract class _$$_LocationTagCopyWith<$Res>
|
||||
implements $LocationTagCopyWith<$Res> {
|
||||
factory _$$_LocationTagCopyWith(
|
||||
_$_LocationTag value, $Res Function(_$_LocationTag) then) =
|
||||
__$$_LocationTagCopyWithImpl<$Res>;
|
||||
@override
|
||||
@useResult
|
||||
$Res call({String name, int radius, Location centerPoint});
|
||||
|
||||
@override
|
||||
$LocationCopyWith<$Res> get centerPoint;
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
class __$$_LocationTagCopyWithImpl<$Res>
|
||||
extends _$LocationTagCopyWithImpl<$Res, _$_LocationTag>
|
||||
implements _$$_LocationTagCopyWith<$Res> {
|
||||
__$$_LocationTagCopyWithImpl(
|
||||
_$_LocationTag _value, $Res Function(_$_LocationTag) _then)
|
||||
: super(_value, _then);
|
||||
|
||||
@pragma('vm:prefer-inline')
|
||||
@override
|
||||
$Res call({
|
||||
Object? name = null,
|
||||
Object? radius = null,
|
||||
Object? centerPoint = null,
|
||||
}) {
|
||||
return _then(_$_LocationTag(
|
||||
name: null == name
|
||||
? _value.name
|
||||
: name // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
radius: null == radius
|
||||
? _value.radius
|
||||
: radius // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
centerPoint: null == centerPoint
|
||||
? _value.centerPoint
|
||||
: centerPoint // ignore: cast_nullable_to_non_nullable
|
||||
as Location,
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
class _$_LocationTag implements _LocationTag {
|
||||
const _$_LocationTag(
|
||||
{required this.name, required this.radius, required this.centerPoint});
|
||||
|
||||
factory _$_LocationTag.fromJson(Map<String, dynamic> json) =>
|
||||
_$$_LocationTagFromJson(json);
|
||||
|
||||
@override
|
||||
final String name;
|
||||
@override
|
||||
final int radius;
|
||||
@override
|
||||
final Location centerPoint;
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'LocationTag(name: $name, radius: $radius, centerPoint: $centerPoint)';
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(dynamic other) {
|
||||
return identical(this, other) ||
|
||||
(other.runtimeType == runtimeType &&
|
||||
other is _$_LocationTag &&
|
||||
(identical(other.name, name) || other.name == name) &&
|
||||
(identical(other.radius, radius) || other.radius == radius) &&
|
||||
(identical(other.centerPoint, centerPoint) ||
|
||||
other.centerPoint == centerPoint));
|
||||
}
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType, name, radius, centerPoint);
|
||||
|
||||
@JsonKey(ignore: true)
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
_$$_LocationTagCopyWith<_$_LocationTag> get copyWith =>
|
||||
__$$_LocationTagCopyWithImpl<_$_LocationTag>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$$_LocationTagToJson(
|
||||
this,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
abstract class _LocationTag implements LocationTag {
|
||||
const factory _LocationTag(
|
||||
{required final String name,
|
||||
required final int radius,
|
||||
required final Location centerPoint}) = _$_LocationTag;
|
||||
|
||||
factory _LocationTag.fromJson(Map<String, dynamic> json) =
|
||||
_$_LocationTag.fromJson;
|
||||
|
||||
@override
|
||||
String get name;
|
||||
@override
|
||||
int get radius;
|
||||
@override
|
||||
Location get centerPoint;
|
||||
@override
|
||||
@JsonKey(ignore: true)
|
||||
_$$_LocationTagCopyWith<_$_LocationTag> get copyWith =>
|
||||
throw _privateConstructorUsedError;
|
||||
}
|
22
lib/models/location_tag/location_tag.g.dart
Normal file
22
lib/models/location_tag/location_tag.g.dart
Normal file
|
@ -0,0 +1,22 @@
|
|||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'location_tag.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_$_LocationTag _$$_LocationTagFromJson(Map<String, dynamic> json) =>
|
||||
_$_LocationTag(
|
||||
name: json['name'] as String,
|
||||
radius: json['radius'] as int,
|
||||
centerPoint:
|
||||
Location.fromJson(json['centerPoint'] as Map<String, dynamic>),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$$_LocationTagToJson(_$_LocationTag instance) =>
|
||||
<String, dynamic>{
|
||||
'name': instance.name,
|
||||
'radius': instance.radius,
|
||||
'centerPoint': instance.centerPoint,
|
||||
};
|
|
@ -3,8 +3,8 @@ import "dart:convert";
|
|||
import "dart:math";
|
||||
|
||||
import "package:photos/core/constants.dart";
|
||||
import "package:photos/models/location.dart";
|
||||
import "package:photos/models/location_tag.dart";
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/models/location_tag/location_tag.dart';
|
||||
import "package:shared_preferences/shared_preferences.dart";
|
||||
|
||||
class LocationService {
|
||||
|
@ -74,8 +74,8 @@ class LocationService {
|
|||
name: locationJson["name"],
|
||||
radius: locationJson["radius"],
|
||||
centerPoint: Location(
|
||||
locationJson["center"][0],
|
||||
locationJson["center"][1],
|
||||
latitude: locationJson["center"][0],
|
||||
longitude: locationJson["center"][1],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
@ -11,7 +11,7 @@ import 'package:photos/models/collection.dart';
|
|||
import 'package:photos/models/collection_items.dart';
|
||||
import 'package:photos/models/file.dart';
|
||||
import 'package:photos/models/file_type.dart';
|
||||
import 'package:photos/models/location.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/models/search/album_search_result.dart';
|
||||
import 'package:photos/models/search/generic_search_result.dart';
|
||||
import 'package:photos/models/search/location_api_response.dart';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import "package:flutter/material.dart";
|
||||
import "package:photos/models/location_tag.dart";
|
||||
import 'package:photos/models/location_tag/location_tag.dart';
|
||||
|
||||
class InheritedLocationScreenState extends InheritedWidget {
|
||||
final LocationTag locationTag;
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'package:photos/core/event_bus.dart';
|
|||
import 'package:photos/db/files_db.dart';
|
||||
import 'package:photos/events/local_photos_updated_event.dart';
|
||||
import 'package:photos/models/file.dart' as ente;
|
||||
import 'package:photos/models/location.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/services/sync_service.dart';
|
||||
import 'package:photos/ui/common/loading_widget.dart';
|
||||
import 'package:photos/ui/components/action_sheet_widget.dart';
|
||||
|
@ -359,7 +359,10 @@ class _ImageEditorPageState extends State<ImageEditorPage> {
|
|||
final assetEntity = await widget.originalFile.getAsset;
|
||||
if (assetEntity != null) {
|
||||
final latLong = await assetEntity.latlngAsync();
|
||||
newFile.location = Location(latLong.latitude, latLong.longitude);
|
||||
newFile.location = Location(
|
||||
latitude: latLong.latitude,
|
||||
longitude: latLong.longitude,
|
||||
);
|
||||
}
|
||||
}
|
||||
newFile.generatedID = await FilesDB.instance.insert(newFile);
|
||||
|
|
|
@ -160,7 +160,6 @@ class GalleryHeaderWidget extends StatefulWidget {
|
|||
class _GalleryHeaderWidgetState extends State<GalleryHeaderWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
debugPrint("Building GalleryHeaderWidget --------------");
|
||||
final locationName =
|
||||
InheritedLocationScreenState.of(context).locationTag.name;
|
||||
return Padding(
|
||||
|
|
|
@ -13,7 +13,7 @@ import 'package:photos/core/constants.dart';
|
|||
import 'package:photos/core/errors.dart';
|
||||
import 'package:photos/models/file.dart' as ente;
|
||||
import 'package:photos/models/file_type.dart';
|
||||
import 'package:photos/models/location.dart';
|
||||
import 'package:photos/models/location/location.dart';
|
||||
import 'package:photos/utils/crypto_util.dart';
|
||||
import 'package:photos/utils/file_util.dart';
|
||||
import 'package:video_thumbnail/video_thumbnail.dart';
|
||||
|
@ -155,7 +155,8 @@ Future<void> _decorateEnteFileData(ente.File file, AssetEntity asset) async {
|
|||
if (file.location == null ||
|
||||
(file.location!.latitude == 0 && file.location!.longitude == 0)) {
|
||||
final latLong = await asset.latlngAsync();
|
||||
file.location = Location(latLong.latitude, latLong.longitude);
|
||||
file.location =
|
||||
Location(latitude: latLong.latitude, longitude: latLong.longitude);
|
||||
}
|
||||
|
||||
if (file.title == null || file.title!.isEmpty) {
|
||||
|
|
162
pubspec.lock
162
pubspec.lock
|
@ -97,6 +97,70 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
build:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build
|
||||
sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.1"
|
||||
build_config:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_config
|
||||
sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
build_daemon:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_daemon
|
||||
sha256: "757153e5d9cd88253cb13f28c2fb55a537dc31fefd98137549895b5beb7c6169"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
build_resolvers:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_resolvers
|
||||
sha256: db49b8609ef8c81cca2b310618c3017c00f03a92af44c04d310b907b2d692d95
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
build_runner:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: b0a8a7b8a76c493e85f1b84bffa0588859a06197863dba8c9036b15581fd9727
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.3"
|
||||
build_runner_core:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: build_runner_core
|
||||
sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "7.2.7"
|
||||
built_collection:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_collection
|
||||
sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.1.1"
|
||||
built_value:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: built_value
|
||||
sha256: "31b7c748fd4b9adf8d25d72a4c4a59ef119f12876cf414f94f8af5131d5fa2b0"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.4.4"
|
||||
cached_network_image:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -169,6 +233,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.1"
|
||||
checked_yaml:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: checked_yaml
|
||||
sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.0.2"
|
||||
chewie:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -184,6 +256,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
code_builder:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: code_builder
|
||||
sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.4.0"
|
||||
collection:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -272,6 +352,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.5"
|
||||
dart_style:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: dart_style
|
||||
sha256: "5be16bf1707658e4c03078d4a9b90208ded217fb02c163e207d334082412f2fb"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.5"
|
||||
dbus:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -472,6 +560,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.12"
|
||||
fixnum:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fixnum
|
||||
sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.0"
|
||||
fk_user_agent:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -716,6 +812,22 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "8.1.3"
|
||||
freezed:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: freezed
|
||||
sha256: e819441678f1679b719008ff2ff0ef045d66eed9f9ec81166ca0d9b02a187454
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.3.2"
|
||||
freezed_annotation:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: freezed_annotation
|
||||
sha256: aeac15850ef1b38ee368d4c53ba9a847e900bb2c53a4db3f6881cbb3cb684338
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
frontend_server_client:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -740,6 +852,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "5.0.6"
|
||||
graphs:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: graphs
|
||||
sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.0"
|
||||
hex:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -877,13 +997,21 @@ packages:
|
|||
source: hosted
|
||||
version: "0.6.5"
|
||||
json_annotation:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: json_annotation
|
||||
sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "4.8.0"
|
||||
json_serializable:
|
||||
dependency: "direct dev"
|
||||
description:
|
||||
name: json_serializable
|
||||
sha256: dadc08bd61f72559f938dd08ec20dbfec6c709bba83515085ea943d2078d187a
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "6.6.1"
|
||||
like_button:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1309,6 +1437,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.1.3"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: pubspec_parse
|
||||
sha256: ec85d7d55339d85f44ec2b682a82fea340071e8978257e5a43e69f79e98ef50c
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.2"
|
||||
quiver:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
@ -1498,6 +1634,22 @@ packages:
|
|||
description: flutter
|
||||
source: sdk
|
||||
version: "0.0.99"
|
||||
source_gen:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_gen
|
||||
sha256: c2bea18c95cfa0276a366270afaa2850b09b4a76db95d546f3d003dcc7011298
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.2.7"
|
||||
source_helper:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: source_helper
|
||||
sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.3.3"
|
||||
source_map_stack_trace:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
@ -1675,6 +1827,14 @@ packages:
|
|||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "0.8.0"
|
||||
timing:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: timing
|
||||
sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.0.1"
|
||||
tuple:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
|
|
|
@ -68,12 +68,14 @@ dependencies:
|
|||
flutter_sodium: ^0.2.0
|
||||
flutter_typeahead: ^4.0.0
|
||||
fluttertoast: ^8.0.6
|
||||
freezed_annotation: ^2.2.0
|
||||
google_nav_bar: ^5.0.5
|
||||
http: ^0.13.4
|
||||
image: ^3.0.2
|
||||
image_editor: ^1.0.0
|
||||
in_app_purchase: ^3.0.7
|
||||
intl: ^0.17.0
|
||||
json_annotation: ^4.8.0
|
||||
like_button: ^2.0.2
|
||||
loading_animations: ^2.1.0
|
||||
local_auth: ^2.1.5
|
||||
|
@ -130,9 +132,12 @@ dependency_overrides:
|
|||
wakelock: ^0.6.1+2
|
||||
|
||||
dev_dependencies:
|
||||
build_runner: ^2.3.3
|
||||
flutter_lints: ^2.0.1
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
freezed: ^2.3.2
|
||||
json_serializable: ^6.6.1
|
||||
test:
|
||||
|
||||
flutter_icons:
|
||||
|
|
Loading…
Add table
Reference in a new issue