before
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
import '../entities/entities.dart';
|
||||
|
||||
class City extends Equatable {
|
||||
final String name;
|
||||
final String coords;
|
||||
|
||||
const City({
|
||||
required this.name,
|
||||
required this.coords,
|
||||
});
|
||||
|
||||
static const empty = City(name: '', coords: '');
|
||||
|
||||
City copyWith({
|
||||
String? name,
|
||||
String? coords,
|
||||
}) {
|
||||
return City(
|
||||
name: name ?? this.name,
|
||||
coords: coords ?? this.coords,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isEmpty => this == City.empty;
|
||||
|
||||
bool get isNotEmpty => this != City.empty;
|
||||
|
||||
City toEntity() {
|
||||
return City(
|
||||
name: name,
|
||||
coords: coords,
|
||||
);
|
||||
}
|
||||
|
||||
static City fromEntity(CityEntity entity) {
|
||||
return City(
|
||||
name: entity.name,
|
||||
coords: entity.coords,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name, coords];
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
|
||||
class Country extends Equatable {
|
||||
final String name;
|
||||
final List<Region> regions;
|
||||
|
||||
const Country({
|
||||
required this.name,
|
||||
required this.regions,
|
||||
});
|
||||
|
||||
static const empty = Country(name: '', regions: []);
|
||||
Country copyWith({
|
||||
String? name,
|
||||
List<Region>? regions,
|
||||
}) {
|
||||
return Country(
|
||||
name: name ?? this.name,
|
||||
regions: regions ?? this.regions,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isEmpty => this == Country.empty;
|
||||
|
||||
bool get isNotEmpty => this != Country.empty;
|
||||
|
||||
Country toEntity() {
|
||||
return Country(name: name, regions: regions);
|
||||
}
|
||||
|
||||
static Country fromEntity(CountryEntity entity) {
|
||||
return Country(
|
||||
name: entity.name,
|
||||
regions:
|
||||
entity.regions.map((region) => Region.fromEntity(region)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name, regions];
|
||||
}
|
||||
@@ -1 +1,4 @@
|
||||
export 'my_user.dart';
|
||||
export 'country.dart';
|
||||
export 'region.dart';
|
||||
export 'city.dart';
|
||||
|
||||
@@ -60,11 +60,3 @@ class MyUser extends Equatable {
|
||||
@override
|
||||
List<Object?> get props => [id, email, name, picture];
|
||||
}
|
||||
// final String name;
|
||||
// final String city;
|
||||
// final String? profession;
|
||||
// final String? state;
|
||||
// final Reference? photo;
|
||||
// final int? tarifa;
|
||||
// final String? phoneNumber;
|
||||
// final String? token;
|
||||
@@ -0,0 +1,41 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
import 'package:user_repository/user_repository.dart';
|
||||
|
||||
class Region extends Equatable {
|
||||
final String name;
|
||||
final List<City> cities;
|
||||
|
||||
const Region({
|
||||
required this.name,
|
||||
required this.cities,
|
||||
});
|
||||
|
||||
static const empty = Region(name: '', cities: []);
|
||||
Region copyWith({
|
||||
String? name,
|
||||
List<City>? cities,
|
||||
}) {
|
||||
return Region(
|
||||
name: name ?? this.name,
|
||||
cities: cities ?? this.cities,
|
||||
);
|
||||
}
|
||||
|
||||
bool get isEmpty => this == Region.empty;
|
||||
|
||||
bool get isNotEmpty => this != Region.empty;
|
||||
|
||||
Region toEntity() {
|
||||
return Region(name: name, cities: cities);
|
||||
}
|
||||
|
||||
static Region fromEntity(RegionEntity entity) {
|
||||
return Region(
|
||||
name: entity.name,
|
||||
cities: entity.cities.map((city) => City.fromEntity(city)).toList(),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
List<Object?> get props => [name, cities];
|
||||
}
|
||||
Reference in New Issue
Block a user