Compare commits

...

5 Commits

Author SHA1 Message Date
5a68dfb3df Delete account 2026-02-26 17:01:19 +01:00
8445af3f5a Change password 2026-02-23 09:46:41 +01:00
471aa1067c Added selected device provider, applied page_layout to account screens 2026-02-18 16:31:50 +01:00
d8afa49897 Added regcode qr dialog 2026-02-17 16:34:19 +01:00
5f1e125cff Added map data and device selection 2026-02-17 12:11:50 +01:00
86 changed files with 9273 additions and 1022 deletions

View File

@@ -79,6 +79,11 @@ void configureAppRouter() {
name: 'personal_data',
pageBuilder: PersonalDataBuilder().buildPage,
),
GoRoute(
path: AppRoutes.changePassword,
name: 'change_password',
pageBuilder: ChangePasswordBuilder().buildPage,
),
GoRoute(
path: AppRoutes.linkedDevices,
name: 'linked_devices',
@@ -89,6 +94,11 @@ void configureAppRouter() {
name: 'app_users',
pageBuilder: AppUsersBuilder().buildPage,
),
GoRoute(
path: AppRoutes.deleteAccount,
name: 'delete_account',
pageBuilder: DeleteAccountBuilder().buildPage,
),
GoRoute(
path: AppRoutes.customerService,

View File

@@ -1,4 +1,5 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
@@ -15,4 +16,6 @@ abstract class AccountRemoteDatasource {
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request});
}

View File

@@ -1,11 +1,13 @@
import 'dart:convert';
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/data/models/change_password_request_model.dart';
import 'package:account/src/core/data/models/get_app_users_response_model.dart';
import 'package:account/src/core/data/models/get_linked_devices_response_model.dart';
import 'package:account/src/core/data/models/update_device_request_model.dart';
import 'package:account/src/core/data/models/update_user_request_model.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
@@ -21,7 +23,7 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
/*final response = await _repository.get<Map<String, dynamic>>(
'/$userId/devices',
);
final data = response.data!['items'];
@@ -29,17 +31,57 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
throw Exception('Empty response from /:userId/devices');
}
final model = GetLinkedDevicesResponseModel.fromJson(data);
/*final model = GetLinkedDevicesResponseModel(items: [
final model = GetLinkedDevicesResponseModel.fromJson(data);*/
final model = GetLinkedDevicesResponseModel(items: [
GetLinkedDevicesItemResponseModel(
identificator: '1111',
name: 'Carlos',
number: '111111111'),
carrierName: 'Carlos',
phone: '111111111',
id: '',
settings: GetLinkedDevicesSettingsResponseModel(
frequency: 0,
frequencyHeartRate: 0,
timezone: 0,
pedometer: false,
language: 'language',
alerts: [],
),
protocol: '',
type: '',
connectionServer: '',
createdAt: 0,
flags: GetLinkedDevicesFlagsResponseModel(
isInOrOut: 'isInOrOut',
geofenceId: 'geofenceId',
isBatteryLow: false,
isDisconnect: false,
)
),
GetLinkedDevicesItemResponseModel(
identificator: '1112',
name: 'Ana',
number: '222222222'),
]);*/
carrierName: 'Ana',
phone: '222222222',
id: '',
settings: GetLinkedDevicesSettingsResponseModel(
frequency: 0,
frequencyHeartRate: 0,
timezone: 0,
pedometer: false,
language: 'language',
alerts: [],
),
protocol: '',
type: '',
connectionServer: '',
createdAt: 0,
flags: GetLinkedDevicesFlagsResponseModel(
isInOrOut: 'isInOrOut',
geofenceId: 'geofenceId',
isBatteryLow: false,
isDisconnect: false,
)
),
]);
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
@@ -151,6 +193,19 @@ class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
throw _mapDioError(error, defaultMessage: 'Error to delete device');
}
}
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/auth/change-password',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to change password');
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {

View File

@@ -0,0 +1,21 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'change_password_request_model.freezed.dart';
part 'change_password_request_model.g.dart';
@freezed
abstract class ChangePasswordRequestModel with _$ChangePasswordRequestModel {
const factory ChangePasswordRequestModel({
required String password,
}) = _ChangePasswordRequestModel;
factory ChangePasswordRequestModel.fromJson(Map<String, dynamic> json) =>
_$ChangePasswordRequestModelFromJson(json);
}
extension ChangePasswordRequestModelMapper on ChangePasswordRequestEntity {
ChangePasswordRequestModel toModel() => ChangePasswordRequestModel(
password: password,
);
}

View File

@@ -0,0 +1,277 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'change_password_request_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChangePasswordRequestModel {
String get password;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChangePasswordRequestModelCopyWith<ChangePasswordRequestModel> get copyWith => _$ChangePasswordRequestModelCopyWithImpl<ChangePasswordRequestModel>(this as ChangePasswordRequestModel, _$identity);
/// Serializes this ChangePasswordRequestModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordRequestModel&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,password);
@override
String toString() {
return 'ChangePasswordRequestModel(password: $password)';
}
}
/// @nodoc
abstract mixin class $ChangePasswordRequestModelCopyWith<$Res> {
factory $ChangePasswordRequestModelCopyWith(ChangePasswordRequestModel value, $Res Function(ChangePasswordRequestModel) _then) = _$ChangePasswordRequestModelCopyWithImpl;
@useResult
$Res call({
String password
});
}
/// @nodoc
class _$ChangePasswordRequestModelCopyWithImpl<$Res>
implements $ChangePasswordRequestModelCopyWith<$Res> {
_$ChangePasswordRequestModelCopyWithImpl(this._self, this._then);
final ChangePasswordRequestModel _self;
final $Res Function(ChangePasswordRequestModel) _then;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? password = null,}) {
return _then(_self.copyWith(
password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [ChangePasswordRequestModel].
extension ChangePasswordRequestModelPatterns on ChangePasswordRequestModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ChangePasswordRequestModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ChangePasswordRequestModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ChangePasswordRequestModel value) $default,){
final _that = this;
switch (_that) {
case _ChangePasswordRequestModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ChangePasswordRequestModel value)? $default,){
final _that = this;
switch (_that) {
case _ChangePasswordRequestModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String password)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChangePasswordRequestModel() when $default != null:
return $default(_that.password);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String password) $default,) {final _that = this;
switch (_that) {
case _ChangePasswordRequestModel():
return $default(_that.password);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String password)? $default,) {final _that = this;
switch (_that) {
case _ChangePasswordRequestModel() when $default != null:
return $default(_that.password);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _ChangePasswordRequestModel implements ChangePasswordRequestModel {
const _ChangePasswordRequestModel({required this.password});
factory _ChangePasswordRequestModel.fromJson(Map<String, dynamic> json) => _$ChangePasswordRequestModelFromJson(json);
@override final String password;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChangePasswordRequestModelCopyWith<_ChangePasswordRequestModel> get copyWith => __$ChangePasswordRequestModelCopyWithImpl<_ChangePasswordRequestModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$ChangePasswordRequestModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordRequestModel&&(identical(other.password, password) || other.password == password));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,password);
@override
String toString() {
return 'ChangePasswordRequestModel(password: $password)';
}
}
/// @nodoc
abstract mixin class _$ChangePasswordRequestModelCopyWith<$Res> implements $ChangePasswordRequestModelCopyWith<$Res> {
factory _$ChangePasswordRequestModelCopyWith(_ChangePasswordRequestModel value, $Res Function(_ChangePasswordRequestModel) _then) = __$ChangePasswordRequestModelCopyWithImpl;
@override @useResult
$Res call({
String password
});
}
/// @nodoc
class __$ChangePasswordRequestModelCopyWithImpl<$Res>
implements _$ChangePasswordRequestModelCopyWith<$Res> {
__$ChangePasswordRequestModelCopyWithImpl(this._self, this._then);
final _ChangePasswordRequestModel _self;
final $Res Function(_ChangePasswordRequestModel) _then;
/// Create a copy of ChangePasswordRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? password = null,}) {
return _then(_ChangePasswordRequestModel(
password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,15 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'change_password_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_ChangePasswordRequestModel _$ChangePasswordRequestModelFromJson(
Map<String, dynamic> json,
) => _ChangePasswordRequestModel(password: json['password'] as String);
Map<String, dynamic> _$ChangePasswordRequestModelToJson(
_ChangePasswordRequestModel instance,
) => <String, dynamic>{'password': instance.password};

View File

@@ -1,4 +1,4 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_linked_devices_response_model.freezed.dart';
@@ -18,8 +18,15 @@ abstract class GetLinkedDevicesResponseModel with _$GetLinkedDevicesResponseMode
abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResponseModel {
const factory GetLinkedDevicesItemResponseModel({
required String identificator,
required String name,
required String number,
required String carrierName,
required String phone,
required String id,
required GetLinkedDevicesSettingsResponseModel settings,
required String protocol,
required String type,
required String connectionServer,
required int createdAt,
required GetLinkedDevicesFlagsResponseModel flags,
}) =
_GetLinkedDevicesItemResponseModel;
@@ -30,9 +37,68 @@ abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResp
extension GetDevicesResponseModelMapper on GetLinkedDevicesResponseModel {
List<DeviceEntity> toEntity() {
return items.map((GetLinkedDevicesItemResponseModel item) => DeviceEntity(
identificator: item.identificator,
name: item.name,
number: item.number
identificator: item.identificator,
carrierName: item.carrierName,
phone: item.phone,
id: item.id,
settings: item.settings.toEntity(),
protocol: item.protocol,
type: item.type,
connectionServer: item.connectionServer,
createdAt: item.createdAt,
flags: item.flags.toEntity(),
)).toList();
}
}
@freezed
abstract class GetLinkedDevicesSettingsResponseModel with _$GetLinkedDevicesSettingsResponseModel {
const factory GetLinkedDevicesSettingsResponseModel({
required int frequency,
required int frequencyHeartRate,
required int timezone,
required bool pedometer,
required String language,
required List<String> alerts,
}) = _GetLinkedDevicesSettingsResponseModel;
factory GetLinkedDevicesSettingsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesSettingsResponseModelFromJson(json);
}
extension GetLinkedDevicesSettingsResponseModelMapper on GetLinkedDevicesSettingsResponseModel {
DeviceSettingsEntity toEntity() {
return DeviceSettingsEntity(
frequency: frequency,
frequencyHeartRate: frequencyHeartRate,
timezone: timezone,
pedometer: pedometer,
language: language,
alerts: alerts,
);
}
}
@freezed
abstract class GetLinkedDevicesFlagsResponseModel with _$GetLinkedDevicesFlagsResponseModel {
const factory GetLinkedDevicesFlagsResponseModel({
required String isInOrOut,
required String geofenceId,
required bool isBatteryLow,
required bool isDisconnect,
}) = _GetLinkedDevicesFlagsResponseModel;
factory GetLinkedDevicesFlagsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesFlagsResponseModelFromJson(json);
}
extension GetLinkedDevicesFlagsResponseModelMapper on GetLinkedDevicesFlagsResponseModel {
DeviceFlagsEntity toEntity() {
return DeviceFlagsEntity(
isInOrOut: isInOrOut,
geofenceId: geofenceId,
isBatteryLow: isBatteryLow,
isDisconnect: isDisconnect,
);
}
}

View File

@@ -284,7 +284,7 @@ as List<GetLinkedDevicesItemResponseModel>,
/// @nodoc
mixin _$GetLinkedDevicesItemResponseModel {
String get identificator; String get name; String get number;
String get identificator; String get carrierName; String get phone; String get id; GetLinkedDevicesSettingsResponseModel get settings; String get protocol; String get type; String get connectionServer; int get createdAt; GetLinkedDevicesFlagsResponseModel get flags;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -297,16 +297,16 @@ $GetLinkedDevicesItemResponseModelCopyWith<GetLinkedDevicesItemResponseModel> ge
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)';
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -317,11 +317,11 @@ abstract mixin class $GetLinkedDevicesItemResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesItemResponseModelCopyWith(GetLinkedDevicesItemResponseModel value, $Res Function(GetLinkedDevicesItemResponseModel) _then) = _$GetLinkedDevicesItemResponseModelCopyWithImpl;
@useResult
$Res call({
String identificator, String name, String number
String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags
});
$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings;$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags;
}
/// @nodoc
@@ -334,15 +334,40 @@ class _$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res>
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) {
return _then(_self.copyWith(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable
as GetLinkedDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable
as GetLinkedDevicesFlagsResponseModel,
));
}
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings {
return $GetLinkedDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) {
return _then(_self.copyWith(settings: value));
});
}/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags {
return $GetLinkedDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) {
return _then(_self.copyWith(flags: value));
});
}
}
@@ -424,10 +449,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return orElse();
}
@@ -445,10 +470,10 @@ return $default(_that.identificator,_that.name,_that.number);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String name, String number) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel():
return $default(_that.identificator,_that.name,_that.number);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
throw StateError('Unexpected subclass');
}
@@ -465,10 +490,10 @@ return $default(_that.identificator,_that.name,_that.number);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String name, String number)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return null;
}
@@ -480,12 +505,19 @@ return $default(_that.identificator,_that.name,_that.number);case _:
@JsonSerializable()
class _GetLinkedDevicesItemResponseModel implements GetLinkedDevicesItemResponseModel {
const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.name, required this.number});
const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.phone, required this.id, required this.settings, required this.protocol, required this.type, required this.connectionServer, required this.createdAt, required this.flags});
factory _GetLinkedDevicesItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesItemResponseModelFromJson(json);
@override final String identificator;
@override final String name;
@override final String number;
@override final String carrierName;
@override final String phone;
@override final String id;
@override final GetLinkedDevicesSettingsResponseModel settings;
@override final String protocol;
@override final String type;
@override final String connectionServer;
@override final int createdAt;
@override final GetLinkedDevicesFlagsResponseModel flags;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@@ -500,16 +532,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)';
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -520,11 +552,11 @@ abstract mixin class _$GetLinkedDevicesItemResponseModelCopyWith<$Res> implement
factory _$GetLinkedDevicesItemResponseModelCopyWith(_GetLinkedDevicesItemResponseModel value, $Res Function(_GetLinkedDevicesItemResponseModel) _then) = __$GetLinkedDevicesItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String identificator, String name, String number
String identificator, String carrierName, String phone, String id, GetLinkedDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetLinkedDevicesFlagsResponseModel flags
});
@override $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings;@override $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags;
}
/// @nodoc
@@ -537,12 +569,593 @@ class __$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res>
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) {
return _then(_GetLinkedDevicesItemResponseModel(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable
as GetLinkedDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable
as GetLinkedDevicesFlagsResponseModel,
));
}
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> get settings {
return $GetLinkedDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) {
return _then(_self.copyWith(settings: value));
});
}/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> get flags {
return $GetLinkedDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) {
return _then(_self.copyWith(flags: value));
});
}
}
/// @nodoc
mixin _$GetLinkedDevicesSettingsResponseModel {
int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List<String> get alerts;
/// Create a copy of GetLinkedDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLinkedDevicesSettingsResponseModelCopyWith<GetLinkedDevicesSettingsResponseModel> get copyWith => _$GetLinkedDevicesSettingsResponseModelCopyWithImpl<GetLinkedDevicesSettingsResponseModel>(this as GetLinkedDevicesSettingsResponseModel, _$identity);
/// Serializes this GetLinkedDevicesSettingsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts));
@override
String toString() {
return 'GetLinkedDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)';
}
}
/// @nodoc
abstract mixin class $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesSettingsResponseModelCopyWith(GetLinkedDevicesSettingsResponseModel value, $Res Function(GetLinkedDevicesSettingsResponseModel) _then) = _$GetLinkedDevicesSettingsResponseModelCopyWithImpl;
@useResult
$Res call({
int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts
});
}
/// @nodoc
class _$GetLinkedDevicesSettingsResponseModelCopyWithImpl<$Res>
implements $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> {
_$GetLinkedDevicesSettingsResponseModelCopyWithImpl(this._self, this._then);
final GetLinkedDevicesSettingsResponseModel _self;
final $Res Function(GetLinkedDevicesSettingsResponseModel) _then;
/// Create a copy of GetLinkedDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) {
return _then(_self.copyWith(
frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable
as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable
as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable
as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// Adds pattern-matching-related methods to [GetLinkedDevicesSettingsResponseModel].
extension GetLinkedDevicesSettingsResponseModelPatterns on GetLinkedDevicesSettingsResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GetLinkedDevicesSettingsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GetLinkedDevicesSettingsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GetLinkedDevicesSettingsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel() when $default != null:
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel():
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesSettingsResponseModel() when $default != null:
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLinkedDevicesSettingsResponseModel implements GetLinkedDevicesSettingsResponseModel {
const _GetLinkedDevicesSettingsResponseModel({required this.frequency, required this.frequencyHeartRate, required this.timezone, required this.pedometer, required this.language, required final List<String> alerts}): _alerts = alerts;
factory _GetLinkedDevicesSettingsResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesSettingsResponseModelFromJson(json);
@override final int frequency;
@override final int frequencyHeartRate;
@override final int timezone;
@override final bool pedometer;
@override final String language;
final List<String> _alerts;
@override List<String> get alerts {
if (_alerts is EqualUnmodifiableListView) return _alerts;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_alerts);
}
/// Create a copy of GetLinkedDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLinkedDevicesSettingsResponseModelCopyWith<_GetLinkedDevicesSettingsResponseModel> get copyWith => __$GetLinkedDevicesSettingsResponseModelCopyWithImpl<_GetLinkedDevicesSettingsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLinkedDevicesSettingsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts));
@override
String toString() {
return 'GetLinkedDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)';
}
}
/// @nodoc
abstract mixin class _$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> implements $GetLinkedDevicesSettingsResponseModelCopyWith<$Res> {
factory _$GetLinkedDevicesSettingsResponseModelCopyWith(_GetLinkedDevicesSettingsResponseModel value, $Res Function(_GetLinkedDevicesSettingsResponseModel) _then) = __$GetLinkedDevicesSettingsResponseModelCopyWithImpl;
@override @useResult
$Res call({
int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts
});
}
/// @nodoc
class __$GetLinkedDevicesSettingsResponseModelCopyWithImpl<$Res>
implements _$GetLinkedDevicesSettingsResponseModelCopyWith<$Res> {
__$GetLinkedDevicesSettingsResponseModelCopyWithImpl(this._self, this._then);
final _GetLinkedDevicesSettingsResponseModel _self;
final $Res Function(_GetLinkedDevicesSettingsResponseModel) _then;
/// Create a copy of GetLinkedDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) {
return _then(_GetLinkedDevicesSettingsResponseModel(
frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable
as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable
as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable
as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
mixin _$GetLinkedDevicesFlagsResponseModel {
String get isInOrOut; String get geofenceId; bool get isBatteryLow; bool get isDisconnect;
/// Create a copy of GetLinkedDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLinkedDevicesFlagsResponseModelCopyWith<GetLinkedDevicesFlagsResponseModel> get copyWith => _$GetLinkedDevicesFlagsResponseModelCopyWithImpl<GetLinkedDevicesFlagsResponseModel>(this as GetLinkedDevicesFlagsResponseModel, _$identity);
/// Serializes this GetLinkedDevicesFlagsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect);
@override
String toString() {
return 'GetLinkedDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)';
}
}
/// @nodoc
abstract mixin class $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesFlagsResponseModelCopyWith(GetLinkedDevicesFlagsResponseModel value, $Res Function(GetLinkedDevicesFlagsResponseModel) _then) = _$GetLinkedDevicesFlagsResponseModelCopyWithImpl;
@useResult
$Res call({
String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect
});
}
/// @nodoc
class _$GetLinkedDevicesFlagsResponseModelCopyWithImpl<$Res>
implements $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> {
_$GetLinkedDevicesFlagsResponseModelCopyWithImpl(this._self, this._then);
final GetLinkedDevicesFlagsResponseModel _self;
final $Res Function(GetLinkedDevicesFlagsResponseModel) _then;
/// Create a copy of GetLinkedDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) {
return _then(_self.copyWith(
isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable
as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable
as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable
as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [GetLinkedDevicesFlagsResponseModel].
extension GetLinkedDevicesFlagsResponseModelPatterns on GetLinkedDevicesFlagsResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GetLinkedDevicesFlagsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GetLinkedDevicesFlagsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GetLinkedDevicesFlagsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel() when $default != null:
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel():
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesFlagsResponseModel() when $default != null:
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLinkedDevicesFlagsResponseModel implements GetLinkedDevicesFlagsResponseModel {
const _GetLinkedDevicesFlagsResponseModel({required this.isInOrOut, required this.geofenceId, required this.isBatteryLow, required this.isDisconnect});
factory _GetLinkedDevicesFlagsResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesFlagsResponseModelFromJson(json);
@override final String isInOrOut;
@override final String geofenceId;
@override final bool isBatteryLow;
@override final bool isDisconnect;
/// Create a copy of GetLinkedDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLinkedDevicesFlagsResponseModelCopyWith<_GetLinkedDevicesFlagsResponseModel> get copyWith => __$GetLinkedDevicesFlagsResponseModelCopyWithImpl<_GetLinkedDevicesFlagsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLinkedDevicesFlagsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect);
@override
String toString() {
return 'GetLinkedDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)';
}
}
/// @nodoc
abstract mixin class _$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> implements $GetLinkedDevicesFlagsResponseModelCopyWith<$Res> {
factory _$GetLinkedDevicesFlagsResponseModelCopyWith(_GetLinkedDevicesFlagsResponseModel value, $Res Function(_GetLinkedDevicesFlagsResponseModel) _then) = __$GetLinkedDevicesFlagsResponseModelCopyWithImpl;
@override @useResult
$Res call({
String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect
});
}
/// @nodoc
class __$GetLinkedDevicesFlagsResponseModelCopyWithImpl<$Res>
implements _$GetLinkedDevicesFlagsResponseModelCopyWith<$Res> {
__$GetLinkedDevicesFlagsResponseModelCopyWithImpl(this._self, this._then);
final _GetLinkedDevicesFlagsResponseModel _self;
final $Res Function(_GetLinkedDevicesFlagsResponseModel) _then;
/// Create a copy of GetLinkedDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) {
return _then(_GetLinkedDevicesFlagsResponseModel(
isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable
as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable
as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable
as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -26,14 +26,74 @@ _GetLinkedDevicesItemResponseModel _$GetLinkedDevicesItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLinkedDevicesItemResponseModel(
identificator: json['identificator'] as String,
name: json['name'] as String,
number: json['number'] as String,
carrierName: json['carrierName'] as String,
phone: json['phone'] as String,
id: json['id'] as String,
settings: GetLinkedDevicesSettingsResponseModel.fromJson(
json['settings'] as Map<String, dynamic>,
),
protocol: json['protocol'] as String,
type: json['type'] as String,
connectionServer: json['connectionServer'] as String,
createdAt: (json['createdAt'] as num).toInt(),
flags: GetLinkedDevicesFlagsResponseModel.fromJson(
json['flags'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$GetLinkedDevicesItemResponseModelToJson(
_GetLinkedDevicesItemResponseModel instance,
) => <String, dynamic>{
'identificator': instance.identificator,
'name': instance.name,
'number': instance.number,
'carrierName': instance.carrierName,
'phone': instance.phone,
'id': instance.id,
'settings': instance.settings,
'protocol': instance.protocol,
'type': instance.type,
'connectionServer': instance.connectionServer,
'createdAt': instance.createdAt,
'flags': instance.flags,
};
_GetLinkedDevicesSettingsResponseModel
_$GetLinkedDevicesSettingsResponseModelFromJson(Map<String, dynamic> json) =>
_GetLinkedDevicesSettingsResponseModel(
frequency: (json['frequency'] as num).toInt(),
frequencyHeartRate: (json['frequencyHeartRate'] as num).toInt(),
timezone: (json['timezone'] as num).toInt(),
pedometer: json['pedometer'] as bool,
language: json['language'] as String,
alerts: (json['alerts'] as List<dynamic>)
.map((e) => e as String)
.toList(),
);
Map<String, dynamic> _$GetLinkedDevicesSettingsResponseModelToJson(
_GetLinkedDevicesSettingsResponseModel instance,
) => <String, dynamic>{
'frequency': instance.frequency,
'frequencyHeartRate': instance.frequencyHeartRate,
'timezone': instance.timezone,
'pedometer': instance.pedometer,
'language': instance.language,
'alerts': instance.alerts,
};
_GetLinkedDevicesFlagsResponseModel
_$GetLinkedDevicesFlagsResponseModelFromJson(Map<String, dynamic> json) =>
_GetLinkedDevicesFlagsResponseModel(
isInOrOut: json['isInOrOut'] as String,
geofenceId: json['geofenceId'] as String,
isBatteryLow: json['isBatteryLow'] as bool,
isDisconnect: json['isDisconnect'] as bool,
);
Map<String, dynamic> _$GetLinkedDevicesFlagsResponseModelToJson(
_GetLinkedDevicesFlagsResponseModel instance,
) => <String, dynamic>{
'isInOrOut': instance.isInOrOut,
'geofenceId': instance.geofenceId,
'isBatteryLow': instance.isBatteryLow,
'isDisconnect': instance.isDisconnect,
};

View File

@@ -1,6 +1,7 @@
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
@@ -39,4 +40,9 @@ class AccountRepositoryImpl implements AccountRepository {
Future<void> deleteAppUser({required String userId}) {
return _remote.deleteAppUser(userId: userId);
}
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) {
return _remote.changePassword(userId: userId, request: request);
}
}

View File

@@ -1,4 +1,5 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
@@ -8,11 +9,23 @@ abstract class AccountRepository {
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request});
Future<void> updateDevice({
required String userId,
required String deviceId,
required UpdateDeviceRequestEntity request
});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<void> updateUser({
required String userId,
required UpdateUserRequestEntity request
});
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
Future<void> changePassword({
required String userId,
required ChangePasswordRequestEntity request
});
}

View File

@@ -1,10 +1,13 @@
// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:utils/utils.dart';
import 'package:flutter/services.dart';
import 'package:qr_flutter/qr_flutter.dart';
class AccountSettingsScreen extends ConsumerWidget {
final NavigationContract navigationContract;
@@ -15,75 +18,88 @@ class AccountSettingsScreen extends ConsumerWidget {
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
final selectedDevice = ref.watch(selectedDeviceProvider);
return PageLayout(
title: context.translate(I18n.accountSettings),
body: SingleChildScrollView(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.accountSettings),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
icon: SFIcons.account,
text: I18n.legacyPersonalData
),
SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)),
SingleChildScrollView(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Column(
children: [
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
icon: SFIcons.account,
text: I18n.legacyPersonalData
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.changePassword);},
icon: Icons.lock,
text: I18n.legacyChangePassword
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: Icons.add_circle_outline,
text: I18n.legacyAddNewSF
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
icon: Icons.account_circle_outlined,
text: I18n.legacyLinkedDevices
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
icon: Icons.groups_outlined,
text: I18n.legacyAppUsers
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: () async {
final Uri url = Uri.parse('https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
icon: SFIcons.privacy,
text: I18n.legacyPrivacyPolicy
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){
showDialog(context: context, builder: (context)=>Dialog(
backgroundColor: Colors.transparent,
child: RegCodeDialog(
regCode: selectedDevice?.id ?? '',
deviceId: selectedDevice?.identificator ?? '',
name: selectedDevice?.carrierName ?? ''
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: Icons.add_circle_outline,
text: I18n.legacyAddNewSF
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
icon: Icons.account_circle_outlined,
text: I18n.legacyLinkedDevices
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
icon: Icons.groups_outlined,
text: I18n.legacyAppUsers
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.privacy,
text: I18n.legacyPrivacyPolicy
),
SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)),
PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5))
],
),
)),
));
},
icon: Icons.qr_code,
text: I18n.legacyRegCode
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.deleteAccount);},
icon: Icons.no_accounts,
text: I18n.legacyDeleteAccount
),
],
)
),
),
)),
footer: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(vertical: 12, horizontal: 30),
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28)
),
child: PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5)),
)
);
}
}
@@ -143,4 +159,103 @@ class AppSectionButton extends ConsumerWidget {
)
);
}
}
class RegCodeDialog extends StatelessWidget {
final String regCode;
final String deviceId;
final String name;
const RegCodeDialog({
super.key,
required this.regCode,
required this.deviceId,
required this.name,
});
@override
Widget build(BuildContext context) {
return Container(
height: SizeUtils.getByScreen(small: 330, big: 328),
color: Colors.transparent,
child: Stack(
children: [
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: SizeUtils.getByScreen(small: 300, big: 298),
width: SizeUtils.getByScreen(small: 350, big: 348),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(vertical: 14, horizontal: 18),
big: EdgeInsets.symmetric(vertical: 12, horizontal: 16)
),
color: Colors.white,
child: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Align(
alignment: Alignment.topRight,
child: IconButton(
onPressed: (){Navigator.pop(context);},
icon: Icon(Icons.close),
padding: EdgeInsets.zero,
),
),
Text(name, style: TextStyle()),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(context.translate(I18n.legacyDeviceIdLabel,
args: {'deviceId': deviceId})),
TextButton(
onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));},
child: Text(context.translate(I18n.legacyCopy)),
)
],
),
QrImageView(
data: regCode,
version: QrVersions.auto,
size: SizeUtils.getByScreen(small: 100, big: 98),
padding: EdgeInsets.zero,
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(context.translate(I18n.legacyRegCodeLabel,
args: {'regCode': regCode})),
TextButton(
onPressed: (){Clipboard.setData(ClipboardData(text: regCode));},
child: Text(context.translate(I18n.legacyCopy))
)
],
)
],
),
),
),
Align(
alignment: Alignment.topCenter,
child: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFF00A1C6),
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.all(12),
big: EdgeInsets.all(12)
),
child: Icon(
SFIcons.watch,
size: SizeUtils.getByScreen(small: 68, big: 66),
color: Colors.white,
),
)
),
],
),
);
}
}

View File

@@ -19,83 +19,33 @@ class AppUsersScreen extends ConsumerWidget {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
if (!state.isEditing) ...[
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
child: IconButton(onPressed: vm.toggleIsEditing,
icon: Icon(Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 30, big: 28),
)
),
)
]
],
),
Center(
child: Text(context.translate(I18n.legacyAppUsers),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
return PageLayout(
showEdit: true,
onEditChange: vm.toggleIsEditing,
title: context.translate(I18n.legacyAppUsers),
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>AppUserCard(
user: state.appUsers[index],
isEditing: state.isEditing,
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded( child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>AppUserCard(
user: state.appUsers[index],
isEditing: state.isEditing,
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.appUsers.length
),
)),
if (state.isEditing) ...[
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 26, vertical: 14),
big: EdgeInsets.symmetric(horizontal: 24, vertical: 12)
),
child: PrimaryButton(
onPressed: vm.toggleIsEditing,
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 44, big: 42),
),
),
]
],
)
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.appUsers.length
),
),
footer: state.isEditing ?
PrimaryButton(
onPressed: vm.toggleIsEditing,
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 44, big: 42),
) : null
);
}
}

View File

@@ -21,7 +21,7 @@ class AppUsersViewModel extends Notifier<AppUsersViewState> {
_getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider);
_deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider);
ref.watch(loggedUserProvider.future)
ref.read(loggedUserProvider.future)
.then((user){
setUser(user);
return _getAppUsersUseCase.getAppUsers(userId: user.id);

View File

@@ -0,0 +1,18 @@
import 'package:account/src/features/change_password/presentation/change_password_screen.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';
import 'package:navigation/navigation.dart';
class ChangePasswordBuilder {
const ChangePasswordBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: ChangePasswordScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -0,0 +1,8 @@
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
abstract class ChangePasswordUseCase {
Future<void> changePassword({
required String userId,
required ChangePasswordRequestEntity request,
});
}

View File

@@ -0,0 +1,14 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:account/src/features/change_password/domain/change_password_use_case.dart';
class ChangePasswordUseCaseImpl implements ChangePasswordUseCase {
ChangePasswordUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> changePassword({required String userId, required ChangePasswordRequestEntity request}) {
return _repository.changePassword(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,10 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'change_password_request_entity.freezed.dart';
@freezed
abstract class ChangePasswordRequestEntity with _$ChangePasswordRequestEntity {
const factory ChangePasswordRequestEntity({
required String password,
}) = _ChangePasswordRequestEntity;
}

View File

@@ -0,0 +1 @@
part of 'change_password_request_entity.dart';

View File

@@ -0,0 +1,75 @@
import 'package:account/src/features/change_password/presentation/state/change_password_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class ChangePasswordScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const ChangePasswordScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(changePasswordViewModelProvider.notifier);
final state = ref.watch(changePasswordViewModelProvider);
final theme = ref.watch(themePortProvider);
return PageLayout(
title: context.translate(I18n.legacyChangePassword),
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 28, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 27, vertical: 8)
),
child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
CustomTextField(
controller: vm.currentPasswordController,
hint: '********',
label: context.translate(I18n.password),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.newPasswordController,
hint: '********',
label: context.translate(I18n.newPassword),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.repeatPasswordController,
hint: '********',
label: context.translate(I18n.repeatPassword),
),
if (state.errorMessage.isNotEmpty) ...[
const SizedBox(height: 8),
Text(
state.errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
],
))
),
footer: PrimaryButton(
onPressed: () async {
final bool res = await vm.changePassword();
if (res){
Navigator.pop(context);
}
},
text: context.translate('OK'),
color: Color(0xFF588EA5)
),
);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/change_password/domain/change_password_use_case.dart';
import 'package:account/src/features/change_password/domain/change_password_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final changePasswordUseCaseProvider = Provider.autoDispose<ChangePasswordUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return ChangePasswordUseCaseImpl(accountRepository);
});

View File

@@ -0,0 +1,143 @@
import 'package:account/src/features/change_password/domain/change_password_use_case.dart';
import 'package:account/src/features/change_password/domain/models/entities/change_password_request_entity.dart';
import 'package:account/src/features/change_password/presentation/providers/change_password_use_case_provider.dart';
import 'package:account/src/features/change_password/presentation/state/change_password_view_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final changePasswordViewModelProvider =
NotifierProvider.autoDispose<ChangePasswordViewModel, ChangePasswordViewState>(
ChangePasswordViewModel.new,
);
class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
late final ChangePasswordUseCase _changePasswordUseCase;
late final TextEditingController currentPasswordController;
late final TextEditingController newPasswordController;
late final TextEditingController repeatPasswordController;
late final TextEditingController passwordController;
@override
ChangePasswordViewState build() {
_changePasswordUseCase = ref.read(changePasswordUseCaseProvider);
currentPasswordController = TextEditingController();
currentPasswordController.addListener(_onCurrentPasswordChanged);
newPasswordController = TextEditingController();
newPasswordController.addListener(_onNewPasswordChanged);
repeatPasswordController = TextEditingController();
repeatPasswordController.addListener(_onRepeatPasswordController);
ref.read(loggedUserProvider.future)
.then(setUser);
ref.onDispose(disposeControllers);
return const ChangePasswordViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(loggedUser: user);
}
void _onCurrentPasswordChanged() {
final value = currentPasswordController.text;
if (value == state.currentPassword) return;
state = state.copyWith(
currentPassword: value,
);
}
void _onNewPasswordChanged() {
final value = newPasswordController.text;
if (value == state.newPassword) return;
state = state.copyWith(
newPassword: value,
);
}
void _onRepeatPasswordController() {
final value = repeatPasswordController.text;
if (value == state.repeatPassword) return;
state = state.copyWith(
repeatPassword: value,
);
}
bool _validateForm() {
if (state.currentPassword.trim().isEmpty){
state = state.copyWith(errorMessage: 'errorMessageCurrentPasswordIsEmpty');
return false;
}
if (state.newPassword.trim().isEmpty){
state = state.copyWith(errorMessage: 'errorMessageNewPasswordIsEmpty');
return false;
}
if (state.repeatPassword.trim().isEmpty){
state = state.copyWith(errorMessage: 'errorMessageRepeatPasswordIsEmpty');
return false;
}
if (state.newPassword.trim() != state.repeatPassword.trim()){
state = state.copyWith(errorMessage: 'errorMessagePasswordsDontMatch');
return false;
}
return true;
}
ChangePasswordRequestEntity _toRequest() {
return ChangePasswordRequestEntity(
password: state.newPassword.trim(),
);
}
Future<bool> changePassword() async {
if (state.isLoading) return false;
if (!_validateForm()) return false;
try {
final request = _toRequest();
await _changePasswordUseCase.changePassword(userId: state.loggedUser!.id, request: request);
ref.invalidate(loggedUserProvider);
return true;
} catch (e) {
if (!ref.mounted) return false;
_finishWithError(message: e.toString());
return false;
}
}
void _finishWithError({required String message}) {
state = state.copyWith(
isLoading: false,
errorMessage: message,
);
}
void disposeControllers() {
currentPasswordController.removeListener(_onCurrentPasswordChanged);
currentPasswordController.dispose();
newPasswordController.removeListener(_onNewPasswordChanged);
newPasswordController.dispose();
repeatPasswordController.removeListener(_onRepeatPasswordController);
repeatPasswordController.dispose();
}
}

View File

@@ -0,0 +1,16 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'change_password_view_state.freezed.dart';
@freezed
abstract class ChangePasswordViewState with _$ChangePasswordViewState {
const factory ChangePasswordViewState({
UserEntity? loggedUser,
@Default(false) bool isLoading,
@Default('') String currentPassword,
@Default('') String newPassword,
@Default('') String repeatPassword,
@Default('') String errorMessage
}) = _ChangePasswordViewState;
}

View File

@@ -0,0 +1,310 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'change_password_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ChangePasswordViewState {
UserEntity? get loggedUser; bool get isLoading; String get currentPassword; String get newPassword; String get repeatPassword; String get errorMessage;
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ChangePasswordViewStateCopyWith<ChangePasswordViewState> get copyWith => _$ChangePasswordViewStateCopyWithImpl<ChangePasswordViewState>(this as ChangePasswordViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChangePasswordViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.currentPassword, currentPassword) || other.currentPassword == currentPassword)&&(identical(other.newPassword, newPassword) || other.newPassword == newPassword)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,loggedUser,isLoading,currentPassword,newPassword,repeatPassword,errorMessage);
@override
String toString() {
return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $ChangePasswordViewStateCopyWith<$Res> {
factory $ChangePasswordViewStateCopyWith(ChangePasswordViewState value, $Res Function(ChangePasswordViewState) _then) = _$ChangePasswordViewStateCopyWithImpl;
@useResult
$Res call({
UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage
});
$UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class _$ChangePasswordViewStateCopyWithImpl<$Res>
implements $ChangePasswordViewStateCopyWith<$Res> {
_$ChangePasswordViewStateCopyWithImpl(this._self, this._then);
final ChangePasswordViewState _self;
final $Res Function(ChangePasswordViewState) _then;
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? isLoading = null,Object? currentPassword = null,Object? newPassword = null,Object? repeatPassword = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,currentPassword: null == currentPassword ? _self.currentPassword : currentPassword // ignore: cast_nullable_to_non_nullable
as String,newPassword: null == newPassword ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
/// Adds pattern-matching-related methods to [ChangePasswordViewState].
extension ChangePasswordViewStatePatterns on ChangePasswordViewState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ChangePasswordViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ChangePasswordViewState() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ChangePasswordViewState value) $default,){
final _that = this;
switch (_that) {
case _ChangePasswordViewState():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ChangePasswordViewState value)? $default,){
final _that = this;
switch (_that) {
case _ChangePasswordViewState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ChangePasswordViewState() when $default != null:
return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _ChangePasswordViewState():
return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _ChangePasswordViewState() when $default != null:
return $default(_that.loggedUser,_that.isLoading,_that.currentPassword,_that.newPassword,_that.repeatPassword,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _ChangePasswordViewState implements ChangePasswordViewState {
const _ChangePasswordViewState({this.loggedUser, this.isLoading = false, this.currentPassword = '', this.newPassword = '', this.repeatPassword = '', this.errorMessage = ''});
@override final UserEntity? loggedUser;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final String currentPassword;
@override@JsonKey() final String newPassword;
@override@JsonKey() final String repeatPassword;
@override@JsonKey() final String errorMessage;
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ChangePasswordViewStateCopyWith<_ChangePasswordViewState> get copyWith => __$ChangePasswordViewStateCopyWithImpl<_ChangePasswordViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChangePasswordViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.currentPassword, currentPassword) || other.currentPassword == currentPassword)&&(identical(other.newPassword, newPassword) || other.newPassword == newPassword)&&(identical(other.repeatPassword, repeatPassword) || other.repeatPassword == repeatPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,loggedUser,isLoading,currentPassword,newPassword,repeatPassword,errorMessage);
@override
String toString() {
return 'ChangePasswordViewState(loggedUser: $loggedUser, isLoading: $isLoading, currentPassword: $currentPassword, newPassword: $newPassword, repeatPassword: $repeatPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$ChangePasswordViewStateCopyWith<$Res> implements $ChangePasswordViewStateCopyWith<$Res> {
factory _$ChangePasswordViewStateCopyWith(_ChangePasswordViewState value, $Res Function(_ChangePasswordViewState) _then) = __$ChangePasswordViewStateCopyWithImpl;
@override @useResult
$Res call({
UserEntity? loggedUser, bool isLoading, String currentPassword, String newPassword, String repeatPassword, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class __$ChangePasswordViewStateCopyWithImpl<$Res>
implements _$ChangePasswordViewStateCopyWith<$Res> {
__$ChangePasswordViewStateCopyWithImpl(this._self, this._then);
final _ChangePasswordViewState _self;
final $Res Function(_ChangePasswordViewState) _then;
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? isLoading = null,Object? currentPassword = null,Object? newPassword = null,Object? repeatPassword = null,Object? errorMessage = null,}) {
return _then(_ChangePasswordViewState(
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,currentPassword: null == currentPassword ? _self.currentPassword : currentPassword // ignore: cast_nullable_to_non_nullable
as String,newPassword: null == newPassword ? _self.newPassword : newPassword // ignore: cast_nullable_to_non_nullable
as String,repeatPassword: null == repeatPassword ? _self.repeatPassword : repeatPassword // ignore: cast_nullable_to_non_nullable
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ChangePasswordViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
// dart format on

View File

@@ -0,0 +1,18 @@
import 'package:account/src/features/delete_account/presentation/delete_account_screen.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart';
class DeleteAccountBuilder {
const DeleteAccountBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: DeleteAccountScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -0,0 +1,6 @@
abstract class DeleteAccountUseCase {
Future<void> deleteAccount({
required String userId,
});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart';
class DeleteAccountUseCaseImpl implements DeleteAccountUseCase {
DeleteAccountUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> deleteAccount({required String userId}) {
return _repository.deleteAppUser(userId: userId);
}
}

View File

@@ -0,0 +1,256 @@
import 'package:account/src/features/delete_account/presentation/state/delete_account_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class DeleteAccountScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const DeleteAccountScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final state = ref.watch(deleteAccountViewModelProvider);
final viewModel = ref.read(deleteAccountViewModelProvider.notifier);
return PageLayout(
title: context.translate(I18n.legacyDeleteAccount),
body: SingleChildScrollView(child: Container(
margin: EdgeInsets.symmetric(horizontal: 10),
child: Column(
children: [
Container(
color: theme.getColorFor(ThemeCode.backgroundSecondary),
width: double.infinity,
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(vertical: 20),
big: EdgeInsets.symmetric(vertical: 19),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Container(
decoration: BoxDecoration(
color: Color(0xFF00A1C6),
borderRadius: BorderRadius.circular(12)
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.all(7),
big: EdgeInsets.all(6),
),
child: Icon(Icons.power_settings_new_outlined,
size: SizeUtils.getByScreen(small: 48, big: 46),
color: Colors.white,
),
),
Text(context.translate(I18n.legacyDeleteAccount),
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 20, big: 19)),
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
Text(context.translate(I18n.legacyDeleteAccountBody1),
textAlign: TextAlign.start,
),
SizedBox(height: SizeUtils.getByScreen(small: 38, big: 36)),
Text(context.translate(I18n.legacyDeleteAccountBody2),
textAlign: TextAlign.start,
style: TextStyle(
fontSize: 12,
color: theme.getColorFor(ThemeCode.textPrimary)
),
),
],
)
)),
footer: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 14, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
),
child: PrimaryButton(
onPressed: (){
if (state.loggedUser != null) {
showDialog(context: context, builder: (context) =>
Dialog(
backgroundColor: Colors.transparent,
child: ConfirmDialog(navigationContract: navigationContract),
)
);
}
},
text: context.translate(I18n.legacyRequestCancelButton),
color: Color(0xFF588EA5)
),
),
);
}
}
class ConfirmDialog extends ConsumerWidget{
final NavigationContract navigationContract;
const ConfirmDialog({
super.key,
required this.navigationContract,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final state = ref.watch(deleteAccountViewModelProvider);
final viewModel = ref.read(deleteAccountViewModelProvider.notifier);
final steps = [
Container(
height: 210,
width: 500,
color: Colors.white,
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 11),
big: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(context.translate(I18n.legacyVerifyAccount),
style: TextStyle(
fontWeight: FontWeight.w500
),
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
Text('${context.translate(I18n.email)}: ${state.loggedUser!.email}'),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
Row(
children: [
Text('${context.translate(I18n.password)}: '),
SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)),
Expanded(child: TextField(
controller: viewModel.passwordController,
style: TextStyle(fontSize: 12),
decoration: InputDecoration(hintText: context.translate(I18n.password)),
obscureText: true,
enableSuggestions: false,
autocorrect: true,
))
],
),
if (state.errorMessage.isNotEmpty)
Text(
state.errorMessage,
textAlign: TextAlign.center,
style: TextStyle(
color: Theme.of(context).colorScheme.error,
fontSize: 13,
),
),
SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)),
Row(
children: [
Expanded(child: SecondaryButton(
onPressed: (){Navigator.pop(context);},
text: context.translate(I18n.legacyCancel),
color: Color(0xFF588EA5),
height: 40,
radius: 20,
)),
SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)),
Expanded(child: PrimaryButton(
onPressed: viewModel.nextStep,
text: context.translate(I18n.accept),
color: Color(0xFF588EA5),
height: 40,
radius: 20,
)),
],
)
],
),
),
Container(
height: 400,
width: 500,
color: Colors.white,
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 11),
big: EdgeInsets.symmetric(horizontal: 20, vertical: 10),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)),
Text(context.translate(I18n.legacyRequestCancelTitle),
style: TextStyle(
fontWeight: FontWeight.w500
),
),
SizedBox(height: SizeUtils.getByScreen(small: 14, big: 12)),
Expanded(child: SingleChildScrollView(child: Column(
children: [
Text(context.translate(I18n.legacyRequestCancelBody),
style: TextStyle(height: 1.5),
),
SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)),
...List<Widget>.generate(state.devices.length, (int index) =>
CheckboxListTile(
contentPadding: EdgeInsets.zero,
title: Text(context.translate(I18n.legacyDeleteDeviceData,
args: {'name': state.devices[index].carrierName}
),
style: TextStyle(height: 0),
),
controlAffinity: ListTileControlAffinity.leading,
value: false,
onChanged: (_){
viewModel.updateDeleteDevice(index);
}
)
),
]
))),
SizedBox(height: SizeUtils.getByScreen(small: 12, big: 10)),
Row(
children: [
Expanded(child: SecondaryButton(
onPressed: (){
viewModel.resetConfirmStep();
Navigator.pop(context);
},
text: context.translate(I18n.legacyCancel),
color: Color(0xFF588EA5),
height: 50,
radius: 25,
)),
SizedBox(width: SizeUtils.getByScreen(small: 12, big: 10)),
Expanded(child: PrimaryButton(
onPressed: () async {
viewModel.deleteAccount();
if (!context.mounted) return;
navigationContract.goTo(AppRoutes.login);
},
text: context.translate(I18n.legacyConfirm),
color: Color(0xFF588EA5),
height: 50,
radius: 25,
)),
],
)
],
),
)
];
return steps[state.confirmStep];
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart';
import 'package:account/src/features/delete_account/domain/delete_account_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final deleteAccountUseCaseProvider = Provider.autoDispose<DeleteAccountUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return DeleteAccountUseCaseImpl(accountRepository);
});

View File

@@ -0,0 +1,128 @@
import 'package:account/src/features/delete_account/domain/delete_account_use_case.dart';
import 'package:account/src/features/delete_account/presentation/providers/delete_account_use_case_provider.dart';
import 'package:account/src/features/delete_account/presentation/state/delete_account_view_state.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final deleteAccountViewModelProvider =
NotifierProvider.autoDispose<DeleteAccountViewModel, DeleteAccountViewState>(
DeleteAccountViewModel.new,
);
class DeleteAccountViewModel extends Notifier<DeleteAccountViewState> {
late final DeleteAccountUseCase _deleteAccountUseCase;
late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase;
late final TextEditingController passwordController;
@override
DeleteAccountViewState build() {
_deleteAccountUseCase = ref.read(deleteAccountUseCaseProvider);
_getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider);
passwordController = TextEditingController();
passwordController.addListener(_onPasswordChanged);
ref.read(loggedUserProvider.future)
.then((user){
setUser(user);
return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id);
}).then(setDevices);
ref.onDispose(disposeListeners);
return const DeleteAccountViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(loggedUser: user);
}
void setDevices(List<DeviceEntity> devices) {
state = state.copyWith(
devices: devices,
deleteDevices: List<bool>.generate(devices.length, (_)=>false),
);
}
void updateDeleteDevice(int index) {
List<bool> deleteDevices = state.deleteDevices;
deleteDevices[index] = !deleteDevices[index];
state = state.copyWith(
deleteDevices: deleteDevices,
);
}
void _onPasswordChanged() {
final value = passwordController.text;
if (value == state.password) return;
state = state.copyWith(
password: value,
errorMessage: ''
);
}
bool _validateForm() {
if (state.password.trim().isEmpty) {
state = state.copyWith(errorMessage: 'errorMessagePasswordIsEmpty');
return false;
}
/*if (state.password.trim() != state.loggedUser.password.trim()) {
state = state.copyWith(errorMessage: 'errorMessagePasswordsDontMatch');
return false;
}*/
return true;
}
void nextStep() {
final step = state.confirmStep;
if (step == 0 && !_validateForm()) return;
state = state.copyWith(confirmStep: step + 1);
}
void resetConfirmStep() {
state = state.copyWith(confirmStep: 0);
}
Future<bool> deleteAccount() async {
if (state.isLoading) return false;
try {
state = state.copyWith(isLoading: true);
await _deleteAccountUseCase.deleteAccount(userId: state.loggedUser!.id);
if (!ref.mounted) return false;
ref.invalidate(loggedUserProvider);
state = state.copyWith(isLoading: false, isDeleted: true);
return true;
} catch (e) {
state = state.copyWith(isLoading: false);
if (!ref.mounted) return false;
_finishWithError(message: e.toString());
return false;
}
}
void _finishWithError({required String message}) {
state = state.copyWith(
isLoading: false,
errorMessage: message,
);
}
void disposeListeners() {
passwordController.removeListener(_onPasswordChanged);
passwordController.dispose();
}
}

View File

@@ -0,0 +1,18 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'delete_account_view_state.freezed.dart';
@freezed
abstract class DeleteAccountViewState with _$DeleteAccountViewState {
const factory DeleteAccountViewState({
UserEntity? loggedUser,
@Default('') String password,
@Default(false) bool isLoading,
@Default(false) bool isDeleted,
@Default(0) int confirmStep,
@Default([]) List<DeviceEntity> devices,
@Default([]) List<bool> deleteDevices,
@Default('') String errorMessage,
}) = _DeleteAccountViewState;
}

View File

@@ -0,0 +1,328 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'delete_account_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$DeleteAccountViewState {
UserEntity? get loggedUser; String get password; bool get isLoading; bool get isDeleted; int get confirmStep; List<DeviceEntity> get devices; List<bool> get deleteDevices; String get errorMessage;
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$DeleteAccountViewStateCopyWith<DeleteAccountViewState> get copyWith => _$DeleteAccountViewStateCopyWithImpl<DeleteAccountViewState>(this as DeleteAccountViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other.devices, devices)&&const DeepCollectionEquality().equals(other.deleteDevices, deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(deleteDevices),errorMessage);
@override
String toString() {
return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $DeleteAccountViewStateCopyWith<$Res> {
factory $DeleteAccountViewStateCopyWith(DeleteAccountViewState value, $Res Function(DeleteAccountViewState) _then) = _$DeleteAccountViewStateCopyWithImpl;
@useResult
$Res call({
UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List<DeviceEntity> devices, List<bool> deleteDevices, String errorMessage
});
$UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class _$DeleteAccountViewStateCopyWithImpl<$Res>
implements $DeleteAccountViewStateCopyWith<$Res> {
_$DeleteAccountViewStateCopyWithImpl(this._self, this._then);
final DeleteAccountViewState _self;
final $Res Function(DeleteAccountViewState) _then;
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable
as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable
as int,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,deleteDevices: null == deleteDevices ? _self.deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable
as List<bool>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
/// Adds pattern-matching-related methods to [DeleteAccountViewState].
extension DeleteAccountViewStatePatterns on DeleteAccountViewState {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _DeleteAccountViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _DeleteAccountViewState() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _DeleteAccountViewState value) $default,){
final _that = this;
switch (_that) {
case _DeleteAccountViewState():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _DeleteAccountViewState value)? $default,){
final _that = this;
switch (_that) {
case _DeleteAccountViewState() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List<DeviceEntity> devices, List<bool> deleteDevices, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _DeleteAccountViewState() when $default != null:
return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List<DeviceEntity> devices, List<bool> deleteDevices, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _DeleteAccountViewState():
return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List<DeviceEntity> devices, List<bool> deleteDevices, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _DeleteAccountViewState() when $default != null:
return $default(_that.loggedUser,_that.password,_that.isLoading,_that.isDeleted,_that.confirmStep,_that.devices,_that.deleteDevices,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _DeleteAccountViewState implements DeleteAccountViewState {
const _DeleteAccountViewState({this.loggedUser, this.password = '', this.isLoading = false, this.isDeleted = false, this.confirmStep = 0, final List<DeviceEntity> devices = const [], final List<bool> deleteDevices = const [], this.errorMessage = ''}): _devices = devices,_deleteDevices = deleteDevices;
@override final UserEntity? loggedUser;
@override@JsonKey() final String password;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final bool isDeleted;
@override@JsonKey() final int confirmStep;
final List<DeviceEntity> _devices;
@override@JsonKey() List<DeviceEntity> get devices {
if (_devices is EqualUnmodifiableListView) return _devices;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_devices);
}
final List<bool> _deleteDevices;
@override@JsonKey() List<bool> get deleteDevices {
if (_deleteDevices is EqualUnmodifiableListView) return _deleteDevices;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_deleteDevices);
}
@override@JsonKey() final String errorMessage;
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$DeleteAccountViewStateCopyWith<_DeleteAccountViewState> get copyWith => __$DeleteAccountViewStateCopyWithImpl<_DeleteAccountViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeleteAccountViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&(identical(other.password, password) || other.password == password)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isDeleted, isDeleted) || other.isDeleted == isDeleted)&&(identical(other.confirmStep, confirmStep) || other.confirmStep == confirmStep)&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._deleteDevices, _deleteDevices)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,loggedUser,password,isLoading,isDeleted,confirmStep,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_deleteDevices),errorMessage);
@override
String toString() {
return 'DeleteAccountViewState(loggedUser: $loggedUser, password: $password, isLoading: $isLoading, isDeleted: $isDeleted, confirmStep: $confirmStep, devices: $devices, deleteDevices: $deleteDevices, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$DeleteAccountViewStateCopyWith<$Res> implements $DeleteAccountViewStateCopyWith<$Res> {
factory _$DeleteAccountViewStateCopyWith(_DeleteAccountViewState value, $Res Function(_DeleteAccountViewState) _then) = __$DeleteAccountViewStateCopyWithImpl;
@override @useResult
$Res call({
UserEntity? loggedUser, String password, bool isLoading, bool isDeleted, int confirmStep, List<DeviceEntity> devices, List<bool> deleteDevices, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class __$DeleteAccountViewStateCopyWithImpl<$Res>
implements _$DeleteAccountViewStateCopyWith<$Res> {
__$DeleteAccountViewStateCopyWithImpl(this._self, this._then);
final _DeleteAccountViewState _self;
final $Res Function(_DeleteAccountViewState) _then;
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? password = null,Object? isLoading = null,Object? isDeleted = null,Object? confirmStep = null,Object? devices = null,Object? deleteDevices = null,Object? errorMessage = null,}) {
return _then(_DeleteAccountViewState(
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,isDeleted: null == isDeleted ? _self.isDeleted : isDeleted // ignore: cast_nullable_to_non_nullable
as bool,confirmStep: null == confirmStep ? _self.confirmStep : confirmStep // ignore: cast_nullable_to_non_nullable
as int,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,deleteDevices: null == deleteDevices ? _self._deleteDevices : deleteDevices // ignore: cast_nullable_to_non_nullable
as List<bool>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of DeleteAccountViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
// dart format on

View File

@@ -1,12 +0,0 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'device_entity.freezed.dart';
@freezed
abstract class DeviceEntity with _$DeviceEntity {
const factory DeviceEntity({
required String identificator,
required String name,
required String number,
}) = _DeviceEntity;
}

View File

@@ -1,277 +0,0 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'device_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$DeviceEntity {
String get identificator; String get name; String get number;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$DeviceEntityCopyWith<DeviceEntity> get copyWith => _$DeviceEntityCopyWithImpl<DeviceEntity>(this as DeviceEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class $DeviceEntityCopyWith<$Res> {
factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl;
@useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class _$DeviceEntityCopyWithImpl<$Res>
implements $DeviceEntityCopyWith<$Res> {
_$DeviceEntityCopyWithImpl(this._self, this._then);
final DeviceEntity _self;
final $Res Function(DeviceEntity) _then;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_self.copyWith(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [DeviceEntity].
extension DeviceEntityPatterns on DeviceEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _DeviceEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _DeviceEntity value) $default,){
final _that = this;
switch (_that) {
case _DeviceEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _DeviceEntity value)? $default,){
final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String name, String number) $default,) {final _that = this;
switch (_that) {
case _DeviceEntity():
return $default(_that.identificator,_that.name,_that.number);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String name, String number)? $default,) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return null;
}
}
}
/// @nodoc
class _DeviceEntity implements DeviceEntity {
const _DeviceEntity({required this.identificator, required this.name, required this.number});
@override final String identificator;
@override final String name;
@override final String number;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImpl<_DeviceEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWith<$Res> {
factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl;
@override @useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class __$DeviceEntityCopyWithImpl<$Res>
implements _$DeviceEntityCopyWith<$Res> {
__$DeviceEntityCopyWithImpl(this._self, this._then);
final _DeviceEntity _self;
final $Res Function(_DeviceEntity) _then;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_DeviceEntity(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -1,4 +1,4 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
abstract class GetLinkedDevicesUseCase {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});

View File

@@ -1,5 +1,5 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
class GetLinkedDevicesUseCaseImpl implements GetLinkedDevicesUseCase {

View File

@@ -1,9 +1,10 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:legacy_shared/legacy_shared.dart';
// import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
@@ -21,86 +22,92 @@ class EditLinkedDeviceScreen extends ConsumerWidget {
final theme = ref.watch(themePortProvider);
return Scaffold(
return /*PageLayout(
title: context.translate(I18n.legacyEditDeviceTitle),
showEdit: true,
onEditChange: vm.toggleIsEditing,
body: body
);*/
Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.legacyEditDeviceTitle),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.legacyEditDeviceTitle),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
)
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.deviceNameController,
hint: device.name,
label: context.translate(I18n.legacyName),
)
],
),
PrimaryButton(
onPressed: (){vm.updateDevice(device);},
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5)
)
],
))
),
],
)
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.deviceNameController,
hint: device.carrierName,
label: context.translate(I18n.legacyName),
)
],
),
PrimaryButton(
onPressed: (){vm.updateDevice(device);},
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5)
)
],
))
),
],
)
),
);
}

View File

@@ -1,9 +1,10 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
@@ -20,67 +21,26 @@ class LinkedDevicesScreen extends ConsumerWidget {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
child: IconButton(onPressed: vm.toggleIsEditing,
icon: Icon(Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 30, big: 28),
)
),
)
],
),
Center(
child: Text(context.translate(I18n.legacyLinkedDevices),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded( child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard(
device: state.linkedDevices[index],
isEditing: state.isEditing,
onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]),
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.linkedDevices.length
),
)),
],
)
return PageLayout(
title: context.translate(I18n.legacyLinkedDevices),
showEdit: true,
onEditChange: vm.toggleIsEditing,
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard(
device: state.linkedDevices[index],
isEditing: state.isEditing,
onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]),
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.linkedDevices.length
),
),
);
}
@@ -130,13 +90,13 @@ class LinkedDeviceCard extends ConsumerWidget {
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(device.name,
Text(device.carrierName,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
),
Text(device.number,
Text(device.phone ?? '',
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 14, big: 13),
)

View File

@@ -1,5 +1,5 @@
import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
@@ -33,7 +33,7 @@ class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
deviceNameController = TextEditingController();
deviceNameController.addListener(_onDeviceNameChanged);
ref.watch(loggedUserProvider.future)
ref.read(loggedUserProvider.future)
.then((user){
setUser(user);
return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id);

View File

@@ -1,4 +1,4 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';

View File

@@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
@@ -19,113 +20,74 @@ class PersonalDataScreen extends ConsumerWidget {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.legacyPersonalData),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
return PageLayout(
title: context.translate(I18n.legacyPersonalData),
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
)
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
Text(context.translate(I18n.legacyLoginEmail),
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13))
),
Text(state.user?.email ?? '',
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17))
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.nameController,
hint: state.user?.firstName ?? '',
label: context.translate(I18n.legacyUserNameLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.phoneController,
hint: state.user?.phone ?? '',
label: context.translate(I18n.legacyUserPhoneLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.emailController,
hint: state.user?.email ?? '',
label: context.translate(I18n.legacyContactEmailLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.passwordController,
showPassword: state.showPassword,
hint: '********',
label: context.translate(I18n.passwordLabel),
),
],
))),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
PrimaryButton(
onPressed: vm.updateUser,
text: context.translate(I18n.legacySubmit),
color: Color(0xFF588EA5)
)
],
)
))
),
],
)
],
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
Text(context.translate(I18n.emailLabel),
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13))
),
Text(state.user?.email ?? '',
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17))
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.nameController,
hint: state.user?.firstName ?? '',
label: context.translate(I18n.firstNameLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.phoneController,
hint: state.user?.phone ?? '',
label: context.translate(I18n.phoneLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.emailController,
hint: state.user?.email ?? '',
label: context.translate(I18n.emailLabel),
),
],
))
),
footer: PrimaryButton(
onPressed: vm.updateUser,
text: context.translate(I18n.legacySubmit),
color: Color(0xFF588EA5)
),
);
}

View File

@@ -36,7 +36,7 @@ class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
passwordController = TextEditingController();
passwordController.addListener(_onPasswordChanged);
ref.watch(loggedUserProvider.future)
ref.read(loggedUserProvider.future)
.then(setUser);
ref.onDispose(disposeControllers);
@@ -117,6 +117,7 @@ class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
final request = _toRequest();
_updateUserUseCase.updateUser(userId: state.user!.id, request: request);
ref.invalidate(loggedUserProvider);
return true;
} catch (e) {

View File

@@ -0,0 +1,117 @@
name: account
description: "A new Flutter project."
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
#
# This version is used _only_ for the Runner app, which is used if you just do
# a `flutter run`. It has no impact on any other native host app that you embed
# your Flutter project into.
version: 1.0.0+1
environment:
sdk: ^3.9.2
dependencies:
flutter:
sdk: flutter
#modules dependencies go here
#packages dependencies go here
design_system:
path: ../../../../packages/design_system
navigation:
path: ../../../../packages/navigation
sf_localizations:
path: ../../../../packages/sf_localizations
sf_infrastructure:
path: ../../../../packages/sf_infrastructure
utils:
path: ../../../../packages/utils
fonts:
path: ../../../../packages/fonts
legacy_shared:
path: ../../packages/legacy_shared
#dependencies go here
flutter_svg: ^2.2.1
get_it: ^9.0.5
go_router: ^17.0.0
flutter_riverpod: ^3.0.3
freezed_annotation: ^3.1.0
freezed: ^3.2.3
dio: ^5.9.0
json_annotation: ^4.9.0
json_serializable: ^6.11.2
uuid: ^4.5.2
qr_flutter: ^4.1.0
url_launcher: ^6.3.2
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add Flutter specific assets to your application, add an assets section,
# like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# To add Flutter specific custom fonts to your application, add a fonts
# section here, in this "flutter" section. Each entry in this list should
# have a "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
# This section identifies your Flutter project as a module meant for
# embedding in a native host app. These identifiers should _not_ ordinarily
# be changed after generation - they are used to ensure that the tooling can
# maintain consistency when adding or modifying assets and plugins.
# They also do not have any bearing on your native host application's
# identifiers, which may be completely independent or the same as these.
module:
androidX: true
androidPackage: com.example.account
iosBundleIdentifier: com.example.account

View File

@@ -0,0 +1,117 @@
name: customer_service
description: "A new Flutter project."
# The following defines the version and build number for your application.
# A version number is three numbers separated by dots, like 1.2.43
# followed by an optional build number separated by a +.
# Both the version and the builder number may be overridden in flutter
# build by specifying --build-name and --build-number, respectively.
# In Android, build-name is used as versionName while build-number used as versionCode.
# Read more about Android versioning at https://developer.android.com/studio/publish/versioning
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
#
# This version is used _only_ for the Runner app, which is used if you just do
# a `flutter run`. It has no impact on any other native host app that you embed
# your Flutter project into.
version: 1.0.0+1
environment:
sdk: ^3.9.2
dependencies:
flutter:
sdk: flutter
#modules dependencies go here
#packages dependencies go here
design_system:
path: ../../../../packages/design_system
navigation:
path: ../../../../packages/navigation
sf_localizations:
path: ../../../../packages/sf_localizations
sf_infrastructure:
path: ../../../../packages/sf_infrastructure
utils:
path: ../../../../packages/utils
fonts:
path: ../../../../packages/fonts
legacy_shared:
path: ../../packages/legacy_shared
#dependencies go here
flutter_svg: ^2.2.1
get_it: ^9.0.5
go_router: ^17.0.0
flutter_riverpod: ^3.0.3
freezed_annotation: ^3.1.0
freezed: ^3.2.3
dio: ^5.9.0
json_annotation: ^4.9.0
json_serializable: ^6.11.2
url_launcher: ^6.3.2
qr_flutter: ^4.1.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^5.0.0
# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec
flutter:
# The following line ensures that the Material Icons font is
# included with your application, so that you can use the icons in
# the material Icons class.
uses-material-design: true
# To add Flutter specific assets to your application, add an assets section,
# like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/to/resolution-aware-images
# For details regarding adding assets from package dependencies, see
# https://flutter.dev/to/asset-from-package
# To add Flutter specific custom fonts to your application, add a fonts
# section here, in this "flutter" section. Each entry in this list should
# have a "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts from package dependencies,
# see https://flutter.dev/to/font-from-package
# This section identifies your Flutter project as a module meant for
# embedding in a native host app. These identifiers should _not_ ordinarily
# be changed after generation - they are used to ensure that the tooling can
# maintain consistency when adding or modifying assets and plugins.
# They also do not have any bearing on your native host application's
# identifiers, which may be completely independent or the same as these.
module:
androidX: true
androidPackage: com.example.customer_service
iosBundleIdentifier: com.example.customerService

View File

@@ -1,7 +1,5 @@
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
abstract class HomeRemoteDatasource {
Future<List<DeviceEntity>> getDevices({required String userId});

View File

@@ -1,13 +1,11 @@
import 'dart:convert';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart';
import 'package:hub/src/core/data/models/get_devices_response_model.dart';
import 'package:hub/src/core/data/models/latest_positions_response_model.dart';
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
class HomeRemoteDatasourceImpl implements HomeRemoteDatasource {
@@ -62,17 +60,53 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource {
LatestPositionsItemResponseModel(
latitude: 43.327116830678186,
longitude: -3.083269100434551,
address: 'Aparcamiento',
positionDate: DateTime.now(),
address: LatestPositionsAddressResponseModel(
street: 'street',
city: 'city',
province: 'province',
state: 'state',
country: 'country',
),
positionDate: DateTime.now().millisecondsSinceEpoch,
frequentPlace: false,
frequentPlaceName: ''),
frequentPlaceName: '',
id: '1',
deviceIdentificator: deviceId,
hpe: 0,
ncell: 65,
type: 0,
createdAt: DateTime.now().millisecondsSinceEpoch,
positionDateOriginal: null,
message: '',
networks: [LatestPositionsNetworkResponseModel(SSID: 'SSID', BSSID: 'BSSID', signal: 'signal')],
ignore: false,
suspect: false
),
LatestPositionsItemResponseModel(
latitude: 43.32729043118528,
longitude: -3.08320596406992,
address: 'Izekoren etxea',
positionDate: DateTime.now(),
address: LatestPositionsAddressResponseModel(
street: 'street',
city: 'city',
province: 'province',
state: 'state',
country: 'country',
),
positionDate: DateTime.now().millisecondsSinceEpoch,
frequentPlace: true,
frequentPlaceName: 'La cafetería'),
frequentPlaceName: 'La cafetería',
id: '2',
deviceIdentificator: deviceId,
hpe: 0,
ncell: 65,
type: 0,
createdAt: DateTime.now().millisecondsSinceEpoch,
positionDateOriginal: null,
message: '',
networks: [],
ignore: false,
suspect: false
),
]);*/
return model.toEntity();
} on DioException catch (error) {

View File

@@ -1,5 +1,5 @@
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
part 'get_devices_response_model.freezed.dart';
part 'get_devices_response_model.g.dart';
@@ -15,13 +15,20 @@ abstract class GetDevicesResponseModel with _$GetDevicesResponseModel {
}
@freezed
abstract class GetDevicesItemResponseModel
with _$GetDevicesItemResponseModel {
abstract class GetDevicesItemResponseModel with _$GetDevicesItemResponseModel {
const factory GetDevicesItemResponseModel({
required String id,
required String identificator,
required String carrierName,
}) = _GetDevicesItemResponseModel;
required String phone,
required String id,
required GetDevicesSettingsResponseModel settings,
required String protocol,
required String type,
required String connectionServer,
required int createdAt,
required GetDevicesFlagsResponseModel flags,
}) =
_GetDevicesItemResponseModel;
factory GetDevicesItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetDevicesItemResponseModelFromJson(json);
@@ -30,9 +37,68 @@ abstract class GetDevicesItemResponseModel
extension GetDevicesResponseModelMapper on GetDevicesResponseModel {
List<DeviceEntity> toEntity() {
return items.map((GetDevicesItemResponseModel item) => DeviceEntity(
id: item.id,
identificator: item.identificator,
carrierName: item.carrierName,
identificator: item.identificator,
carrierName: item.carrierName,
phone: item.phone,
id: item.id,
settings: item.settings.toEntity(),
protocol: item.protocol,
type: item.type,
connectionServer: item.connectionServer,
createdAt: item.createdAt,
flags: item.flags.toEntity(),
)).toList();
}
}
@freezed
abstract class GetDevicesSettingsResponseModel with _$GetDevicesSettingsResponseModel {
const factory GetDevicesSettingsResponseModel({
required int frequency,
required int frequencyHeartRate,
required int timezone,
required bool pedometer,
required String language,
required List<String> alerts,
}) = _GetDevicesSettingsResponseModel;
factory GetDevicesSettingsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetDevicesSettingsResponseModelFromJson(json);
}
extension GetDevicesSettingsResponseModelMapper on GetDevicesSettingsResponseModel {
DeviceSettingsEntity toEntity() {
return DeviceSettingsEntity(
frequency: frequency,
frequencyHeartRate: frequencyHeartRate,
timezone: timezone,
pedometer: pedometer,
language: language,
alerts: alerts,
);
}
}
@freezed
abstract class GetDevicesFlagsResponseModel with _$GetDevicesFlagsResponseModel {
const factory GetDevicesFlagsResponseModel({
required String isInOrOut,
required String geofenceId,
required bool isBatteryLow,
required bool isDisconnect,
}) = _GetDevicesFlagsResponseModel;
factory GetDevicesFlagsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetDevicesFlagsResponseModelFromJson(json);
}
extension GetDevicesFlagsResponseModelMapper on GetDevicesFlagsResponseModel {
DeviceFlagsEntity toEntity() {
return DeviceFlagsEntity(
isInOrOut: isInOrOut,
geofenceId: geofenceId,
isBatteryLow: isBatteryLow,
isDisconnect: isDisconnect,
);
}
}

View File

@@ -284,7 +284,7 @@ as List<GetDevicesItemResponseModel>,
/// @nodoc
mixin _$GetDevicesItemResponseModel {
String get id; String get identificator; String get carrierName;
String get identificator; String get carrierName; String get phone; String get id; GetDevicesSettingsResponseModel get settings; String get protocol; String get type; String get connectionServer; int get createdAt; GetDevicesFlagsResponseModel get flags;
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -297,16 +297,16 @@ $GetDevicesItemResponseModelCopyWith<GetDevicesItemResponseModel> get copyWith =
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,identificator,carrierName);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)';
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -317,11 +317,11 @@ abstract mixin class $GetDevicesItemResponseModelCopyWith<$Res> {
factory $GetDevicesItemResponseModelCopyWith(GetDevicesItemResponseModel value, $Res Function(GetDevicesItemResponseModel) _then) = _$GetDevicesItemResponseModelCopyWithImpl;
@useResult
$Res call({
String id, String identificator, String carrierName
String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
});
$GetDevicesSettingsResponseModelCopyWith<$Res> get settings;$GetDevicesFlagsResponseModelCopyWith<$Res> get flags;
}
/// @nodoc
@@ -334,15 +334,40 @@ class _$GetDevicesItemResponseModelCopyWithImpl<$Res>
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? identificator = null,Object? carrierName = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable
as GetDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable
as GetDevicesFlagsResponseModel,
));
}
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetDevicesSettingsResponseModelCopyWith<$Res> get settings {
return $GetDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) {
return _then(_self.copyWith(settings: value));
});
}/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetDevicesFlagsResponseModelCopyWith<$Res> get flags {
return $GetDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) {
return _then(_self.copyWith(flags: value));
});
}
}
@@ -424,10 +449,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String identificator, String carrierName)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetDevicesItemResponseModel() when $default != null:
return $default(_that.id,_that.identificator,_that.carrierName);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return orElse();
}
@@ -445,10 +470,10 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String identificator, String carrierName) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags) $default,) {final _that = this;
switch (_that) {
case _GetDevicesItemResponseModel():
return $default(_that.id,_that.identificator,_that.carrierName);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
throw StateError('Unexpected subclass');
}
@@ -465,10 +490,10 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String identificator, String carrierName)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags)? $default,) {final _that = this;
switch (_that) {
case _GetDevicesItemResponseModel() when $default != null:
return $default(_that.id,_that.identificator,_that.carrierName);case _:
return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return null;
}
@@ -480,12 +505,19 @@ return $default(_that.id,_that.identificator,_that.carrierName);case _:
@JsonSerializable()
class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel {
const _GetDevicesItemResponseModel({required this.id, required this.identificator, required this.carrierName});
const _GetDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.phone, required this.id, required this.settings, required this.protocol, required this.type, required this.connectionServer, required this.createdAt, required this.flags});
factory _GetDevicesItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetDevicesItemResponseModelFromJson(json);
@override final String id;
@override final String identificator;
@override final String carrierName;
@override final String phone;
@override final String id;
@override final GetDevicesSettingsResponseModel settings;
@override final String protocol;
@override final String type;
@override final String connectionServer;
@override final int createdAt;
@override final GetDevicesFlagsResponseModel flags;
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@@ -500,16 +532,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.carrierName, carrierName) || other.carrierName == carrierName)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.id, id) || other.id == id)&&(identical(other.settings, settings) || other.settings == settings)&&(identical(other.protocol, protocol) || other.protocol == protocol)&&(identical(other.type, type) || other.type == type)&&(identical(other.connectionServer, connectionServer) || other.connectionServer == connectionServer)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.flags, flags) || other.flags == flags));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,identificator,carrierName);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetDevicesItemResponseModel(id: $id, identificator: $identificator, carrierName: $carrierName)';
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -520,11 +552,11 @@ abstract mixin class _$GetDevicesItemResponseModelCopyWith<$Res> implements $Get
factory _$GetDevicesItemResponseModelCopyWith(_GetDevicesItemResponseModel value, $Res Function(_GetDevicesItemResponseModel) _then) = __$GetDevicesItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String id, String identificator, String carrierName
String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
});
@override $GetDevicesSettingsResponseModelCopyWith<$Res> get settings;@override $GetDevicesFlagsResponseModelCopyWith<$Res> get flags;
}
/// @nodoc
@@ -537,12 +569,593 @@ class __$GetDevicesItemResponseModelCopyWithImpl<$Res>
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? identificator = null,Object? carrierName = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = null,Object? phone = null,Object? id = null,Object? settings = null,Object? protocol = null,Object? type = null,Object? connectionServer = null,Object? createdAt = null,Object? flags = null,}) {
return _then(_GetDevicesItemResponseModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,settings: null == settings ? _self.settings : settings // ignore: cast_nullable_to_non_nullable
as GetDevicesSettingsResponseModel,protocol: null == protocol ? _self.protocol : protocol // ignore: cast_nullable_to_non_nullable
as String,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as String,connectionServer: null == connectionServer ? _self.connectionServer : connectionServer // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,flags: null == flags ? _self.flags : flags // ignore: cast_nullable_to_non_nullable
as GetDevicesFlagsResponseModel,
));
}
/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetDevicesSettingsResponseModelCopyWith<$Res> get settings {
return $GetDevicesSettingsResponseModelCopyWith<$Res>(_self.settings, (value) {
return _then(_self.copyWith(settings: value));
});
}/// Create a copy of GetDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetDevicesFlagsResponseModelCopyWith<$Res> get flags {
return $GetDevicesFlagsResponseModelCopyWith<$Res>(_self.flags, (value) {
return _then(_self.copyWith(flags: value));
});
}
}
/// @nodoc
mixin _$GetDevicesSettingsResponseModel {
int get frequency; int get frequencyHeartRate; int get timezone; bool get pedometer; String get language; List<String> get alerts;
/// Create a copy of GetDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetDevicesSettingsResponseModelCopyWith<GetDevicesSettingsResponseModel> get copyWith => _$GetDevicesSettingsResponseModelCopyWithImpl<GetDevicesSettingsResponseModel>(this as GetDevicesSettingsResponseModel, _$identity);
/// Serializes this GetDevicesSettingsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other.alerts, alerts));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(alerts));
@override
String toString() {
return 'GetDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)';
}
}
/// @nodoc
abstract mixin class $GetDevicesSettingsResponseModelCopyWith<$Res> {
factory $GetDevicesSettingsResponseModelCopyWith(GetDevicesSettingsResponseModel value, $Res Function(GetDevicesSettingsResponseModel) _then) = _$GetDevicesSettingsResponseModelCopyWithImpl;
@useResult
$Res call({
int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts
});
}
/// @nodoc
class _$GetDevicesSettingsResponseModelCopyWithImpl<$Res>
implements $GetDevicesSettingsResponseModelCopyWith<$Res> {
_$GetDevicesSettingsResponseModelCopyWithImpl(this._self, this._then);
final GetDevicesSettingsResponseModel _self;
final $Res Function(GetDevicesSettingsResponseModel) _then;
/// Create a copy of GetDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) {
return _then(_self.copyWith(
frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable
as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable
as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable
as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String,alerts: null == alerts ? _self.alerts : alerts // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// Adds pattern-matching-related methods to [GetDevicesSettingsResponseModel].
extension GetDevicesSettingsResponseModelPatterns on GetDevicesSettingsResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GetDevicesSettingsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GetDevicesSettingsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GetDevicesSettingsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel() when $default != null:
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts) $default,) {final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel():
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts)? $default,) {final _that = this;
switch (_that) {
case _GetDevicesSettingsResponseModel() when $default != null:
return $default(_that.frequency,_that.frequencyHeartRate,_that.timezone,_that.pedometer,_that.language,_that.alerts);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetDevicesSettingsResponseModel implements GetDevicesSettingsResponseModel {
const _GetDevicesSettingsResponseModel({required this.frequency, required this.frequencyHeartRate, required this.timezone, required this.pedometer, required this.language, required final List<String> alerts}): _alerts = alerts;
factory _GetDevicesSettingsResponseModel.fromJson(Map<String, dynamic> json) => _$GetDevicesSettingsResponseModelFromJson(json);
@override final int frequency;
@override final int frequencyHeartRate;
@override final int timezone;
@override final bool pedometer;
@override final String language;
final List<String> _alerts;
@override List<String> get alerts {
if (_alerts is EqualUnmodifiableListView) return _alerts;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_alerts);
}
/// Create a copy of GetDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetDevicesSettingsResponseModelCopyWith<_GetDevicesSettingsResponseModel> get copyWith => __$GetDevicesSettingsResponseModelCopyWithImpl<_GetDevicesSettingsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetDevicesSettingsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesSettingsResponseModel&&(identical(other.frequency, frequency) || other.frequency == frequency)&&(identical(other.frequencyHeartRate, frequencyHeartRate) || other.frequencyHeartRate == frequencyHeartRate)&&(identical(other.timezone, timezone) || other.timezone == timezone)&&(identical(other.pedometer, pedometer) || other.pedometer == pedometer)&&(identical(other.language, language) || other.language == language)&&const DeepCollectionEquality().equals(other._alerts, _alerts));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,frequency,frequencyHeartRate,timezone,pedometer,language,const DeepCollectionEquality().hash(_alerts));
@override
String toString() {
return 'GetDevicesSettingsResponseModel(frequency: $frequency, frequencyHeartRate: $frequencyHeartRate, timezone: $timezone, pedometer: $pedometer, language: $language, alerts: $alerts)';
}
}
/// @nodoc
abstract mixin class _$GetDevicesSettingsResponseModelCopyWith<$Res> implements $GetDevicesSettingsResponseModelCopyWith<$Res> {
factory _$GetDevicesSettingsResponseModelCopyWith(_GetDevicesSettingsResponseModel value, $Res Function(_GetDevicesSettingsResponseModel) _then) = __$GetDevicesSettingsResponseModelCopyWithImpl;
@override @useResult
$Res call({
int frequency, int frequencyHeartRate, int timezone, bool pedometer, String language, List<String> alerts
});
}
/// @nodoc
class __$GetDevicesSettingsResponseModelCopyWithImpl<$Res>
implements _$GetDevicesSettingsResponseModelCopyWith<$Res> {
__$GetDevicesSettingsResponseModelCopyWithImpl(this._self, this._then);
final _GetDevicesSettingsResponseModel _self;
final $Res Function(_GetDevicesSettingsResponseModel) _then;
/// Create a copy of GetDevicesSettingsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? frequency = null,Object? frequencyHeartRate = null,Object? timezone = null,Object? pedometer = null,Object? language = null,Object? alerts = null,}) {
return _then(_GetDevicesSettingsResponseModel(
frequency: null == frequency ? _self.frequency : frequency // ignore: cast_nullable_to_non_nullable
as int,frequencyHeartRate: null == frequencyHeartRate ? _self.frequencyHeartRate : frequencyHeartRate // ignore: cast_nullable_to_non_nullable
as int,timezone: null == timezone ? _self.timezone : timezone // ignore: cast_nullable_to_non_nullable
as int,pedometer: null == pedometer ? _self.pedometer : pedometer // ignore: cast_nullable_to_non_nullable
as bool,language: null == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String,alerts: null == alerts ? _self._alerts : alerts // ignore: cast_nullable_to_non_nullable
as List<String>,
));
}
}
/// @nodoc
mixin _$GetDevicesFlagsResponseModel {
String get isInOrOut; String get geofenceId; bool get isBatteryLow; bool get isDisconnect;
/// Create a copy of GetDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetDevicesFlagsResponseModelCopyWith<GetDevicesFlagsResponseModel> get copyWith => _$GetDevicesFlagsResponseModelCopyWithImpl<GetDevicesFlagsResponseModel>(this as GetDevicesFlagsResponseModel, _$identity);
/// Serializes this GetDevicesFlagsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect);
@override
String toString() {
return 'GetDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)';
}
}
/// @nodoc
abstract mixin class $GetDevicesFlagsResponseModelCopyWith<$Res> {
factory $GetDevicesFlagsResponseModelCopyWith(GetDevicesFlagsResponseModel value, $Res Function(GetDevicesFlagsResponseModel) _then) = _$GetDevicesFlagsResponseModelCopyWithImpl;
@useResult
$Res call({
String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect
});
}
/// @nodoc
class _$GetDevicesFlagsResponseModelCopyWithImpl<$Res>
implements $GetDevicesFlagsResponseModelCopyWith<$Res> {
_$GetDevicesFlagsResponseModelCopyWithImpl(this._self, this._then);
final GetDevicesFlagsResponseModel _self;
final $Res Function(GetDevicesFlagsResponseModel) _then;
/// Create a copy of GetDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) {
return _then(_self.copyWith(
isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable
as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable
as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable
as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable
as bool,
));
}
}
/// Adds pattern-matching-related methods to [GetDevicesFlagsResponseModel].
extension GetDevicesFlagsResponseModelPatterns on GetDevicesFlagsResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _GetDevicesFlagsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _GetDevicesFlagsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _GetDevicesFlagsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel() when $default != null:
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect) $default,) {final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel():
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect)? $default,) {final _that = this;
switch (_that) {
case _GetDevicesFlagsResponseModel() when $default != null:
return $default(_that.isInOrOut,_that.geofenceId,_that.isBatteryLow,_that.isDisconnect);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetDevicesFlagsResponseModel implements GetDevicesFlagsResponseModel {
const _GetDevicesFlagsResponseModel({required this.isInOrOut, required this.geofenceId, required this.isBatteryLow, required this.isDisconnect});
factory _GetDevicesFlagsResponseModel.fromJson(Map<String, dynamic> json) => _$GetDevicesFlagsResponseModelFromJson(json);
@override final String isInOrOut;
@override final String geofenceId;
@override final bool isBatteryLow;
@override final bool isDisconnect;
/// Create a copy of GetDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetDevicesFlagsResponseModelCopyWith<_GetDevicesFlagsResponseModel> get copyWith => __$GetDevicesFlagsResponseModelCopyWithImpl<_GetDevicesFlagsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetDevicesFlagsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDevicesFlagsResponseModel&&(identical(other.isInOrOut, isInOrOut) || other.isInOrOut == isInOrOut)&&(identical(other.geofenceId, geofenceId) || other.geofenceId == geofenceId)&&(identical(other.isBatteryLow, isBatteryLow) || other.isBatteryLow == isBatteryLow)&&(identical(other.isDisconnect, isDisconnect) || other.isDisconnect == isDisconnect));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,isInOrOut,geofenceId,isBatteryLow,isDisconnect);
@override
String toString() {
return 'GetDevicesFlagsResponseModel(isInOrOut: $isInOrOut, geofenceId: $geofenceId, isBatteryLow: $isBatteryLow, isDisconnect: $isDisconnect)';
}
}
/// @nodoc
abstract mixin class _$GetDevicesFlagsResponseModelCopyWith<$Res> implements $GetDevicesFlagsResponseModelCopyWith<$Res> {
factory _$GetDevicesFlagsResponseModelCopyWith(_GetDevicesFlagsResponseModel value, $Res Function(_GetDevicesFlagsResponseModel) _then) = __$GetDevicesFlagsResponseModelCopyWithImpl;
@override @useResult
$Res call({
String isInOrOut, String geofenceId, bool isBatteryLow, bool isDisconnect
});
}
/// @nodoc
class __$GetDevicesFlagsResponseModelCopyWithImpl<$Res>
implements _$GetDevicesFlagsResponseModelCopyWith<$Res> {
__$GetDevicesFlagsResponseModelCopyWithImpl(this._self, this._then);
final _GetDevicesFlagsResponseModel _self;
final $Res Function(_GetDevicesFlagsResponseModel) _then;
/// Create a copy of GetDevicesFlagsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isInOrOut = null,Object? geofenceId = null,Object? isBatteryLow = null,Object? isDisconnect = null,}) {
return _then(_GetDevicesFlagsResponseModel(
isInOrOut: null == isInOrOut ? _self.isInOrOut : isInOrOut // ignore: cast_nullable_to_non_nullable
as String,geofenceId: null == geofenceId ? _self.geofenceId : geofenceId // ignore: cast_nullable_to_non_nullable
as String,isBatteryLow: null == isBatteryLow ? _self.isBatteryLow : isBatteryLow // ignore: cast_nullable_to_non_nullable
as bool,isDisconnect: null == isDisconnect ? _self.isDisconnect : isDisconnect // ignore: cast_nullable_to_non_nullable
as bool,
));
}

View File

@@ -23,15 +23,73 @@ Map<String, dynamic> _$GetDevicesResponseModelToJson(
_GetDevicesItemResponseModel _$GetDevicesItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetDevicesItemResponseModel(
id: json['id'] as String,
identificator: json['identificator'] as String,
carrierName: json['carrierName'] as String,
phone: json['phone'] as String,
id: json['id'] as String,
settings: GetDevicesSettingsResponseModel.fromJson(
json['settings'] as Map<String, dynamic>,
),
protocol: json['protocol'] as String,
type: json['type'] as String,
connectionServer: json['connectionServer'] as String,
createdAt: (json['createdAt'] as num).toInt(),
flags: GetDevicesFlagsResponseModel.fromJson(
json['flags'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$GetDevicesItemResponseModelToJson(
_GetDevicesItemResponseModel instance,
) => <String, dynamic>{
'id': instance.id,
'identificator': instance.identificator,
'carrierName': instance.carrierName,
'phone': instance.phone,
'id': instance.id,
'settings': instance.settings,
'protocol': instance.protocol,
'type': instance.type,
'connectionServer': instance.connectionServer,
'createdAt': instance.createdAt,
'flags': instance.flags,
};
_GetDevicesSettingsResponseModel _$GetDevicesSettingsResponseModelFromJson(
Map<String, dynamic> json,
) => _GetDevicesSettingsResponseModel(
frequency: (json['frequency'] as num).toInt(),
frequencyHeartRate: (json['frequencyHeartRate'] as num).toInt(),
timezone: (json['timezone'] as num).toInt(),
pedometer: json['pedometer'] as bool,
language: json['language'] as String,
alerts: (json['alerts'] as List<dynamic>).map((e) => e as String).toList(),
);
Map<String, dynamic> _$GetDevicesSettingsResponseModelToJson(
_GetDevicesSettingsResponseModel instance,
) => <String, dynamic>{
'frequency': instance.frequency,
'frequencyHeartRate': instance.frequencyHeartRate,
'timezone': instance.timezone,
'pedometer': instance.pedometer,
'language': instance.language,
'alerts': instance.alerts,
};
_GetDevicesFlagsResponseModel _$GetDevicesFlagsResponseModelFromJson(
Map<String, dynamic> json,
) => _GetDevicesFlagsResponseModel(
isInOrOut: json['isInOrOut'] as String,
geofenceId: json['geofenceId'] as String,
isBatteryLow: json['isBatteryLow'] as bool,
isDisconnect: json['isDisconnect'] as bool,
);
Map<String, dynamic> _$GetDevicesFlagsResponseModelToJson(
_GetDevicesFlagsResponseModel instance,
) => <String, dynamic>{
'isInOrOut': instance.isInOrOut,
'geofenceId': instance.geofenceId,
'isBatteryLow': instance.isBatteryLow,
'isDisconnect': instance.isDisconnect,
};

View File

@@ -1,4 +1,6 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hub/src/features/hub/domain/entities/address_entity.dart';
import 'package:hub/src/features/hub/domain/entities/network_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
part 'latest_positions_response_model.freezed.dart';
@@ -18,27 +20,99 @@ abstract class LatestPositionsResponseModel with _$LatestPositionsResponseModel
abstract class LatestPositionsItemResponseModel
with _$LatestPositionsItemResponseModel {
const factory LatestPositionsItemResponseModel({
required String id,
required String deviceIdentificator,
required double latitude,
required double longitude,
required String? address,
required DateTime positionDate,
required int hpe,
int? ncell,
required int type,
int? steps,
LatestPositionsAddressResponseModel? address,
required int createdAt,
required int positionDate,
int? positionDateOriginal,
String? frequentPlaceName,
required String message,
required List<LatestPositionsNetworkResponseModel> networks,
required bool ignore,
required bool suspect,
required bool frequentPlace,
required String frequentPlaceName,
}) = _LatestPositionsItemResponseModel;
factory LatestPositionsItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$LatestPositionsItemResponseModelFromJson(json);
_$LatestPositionsItemResponseModelFromJson(json);
}
extension LatestPositionsResponseModelMapper on LatestPositionsResponseModel {
List<PositionEntity> toEntity() {
return items.map((LatestPositionsItemResponseModel item) => PositionEntity(
latitude: item.latitude,
longitude: item.longitude,
address: item.address,
positionDate: item.positionDate,
frequentPlace: item.frequentPlace,
frequentPlaceName: item.frequentPlaceName,
return items.map((LatestPositionsItemResponseModel item) => PositionEntity(
id: item.id,
deviceIdentificator: item.deviceIdentificator,
latitude: item.latitude,
longitude: item.longitude,
hpe: item.hpe,
ncell: item.ncell,
type: item.type,
steps: item.steps,
address: item.address?.toEntity(),
createdAt: item.createdAt,
positionDate: item.positionDate,
positionDateOriginal: item.positionDateOriginal,
frequentPlaceName: item.frequentPlaceName,
message: item.message,
networks: item.networks.map((n)=>n.toEntity()).toList(),
ignore: item.ignore,
suspect: item.suspect,
frequentPlace: item.frequentPlace,
)).toList();
}
}
@freezed
abstract class LatestPositionsAddressResponseModel with _$LatestPositionsAddressResponseModel {
const factory LatestPositionsAddressResponseModel({
required String street,
required String city,
required String province,
required String state,
required String country,
}) = _LatestPositionsAddressResponseModel;
factory LatestPositionsAddressResponseModel.fromJson(Map<String, dynamic> json) =>
_$LatestPositionsAddressResponseModelFromJson(json);
}
extension LatestPositionsAddressResponseModelMapper on LatestPositionsAddressResponseModel {
AddressEntity toEntity() {
return AddressEntity(
street: street,
city: city,
province: province,
state: state,
country: country,
);
}
}
@freezed
abstract class LatestPositionsNetworkResponseModel with _$LatestPositionsNetworkResponseModel {
const factory LatestPositionsNetworkResponseModel({
required String SSID,
required String BSSID,
required String signal,
}) = _LatestPositionsNetworkResponseModel;
factory LatestPositionsNetworkResponseModel.fromJson(Map<String, dynamic> json) =>
_$LatestPositionsNetworkResponseModelFromJson(json);
}
extension LatestPositionsNetworkResponseModelMapper on LatestPositionsNetworkResponseModel {
NetworkEntity toEntity() {
return NetworkEntity(
SSID: SSID,
BSSID: BSSID,
signal: signal,
);
}
}

View File

@@ -284,7 +284,7 @@ as List<LatestPositionsItemResponseModel>,
/// @nodoc
mixin _$LatestPositionsItemResponseModel {
double get latitude; double get longitude; String? get address; DateTime get positionDate; bool get frequentPlace; String get frequentPlaceName;
String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; LatestPositionsAddressResponseModel? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List<LatestPositionsNetworkResponseModel> get networks; bool get ignore; bool get suspect; bool get frequentPlace;
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -297,16 +297,16 @@ $LatestPositionsItemResponseModelCopyWith<LatestPositionsItemResponseModel> get
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace);
@override
String toString() {
return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)';
return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)';
}
@@ -317,11 +317,11 @@ abstract mixin class $LatestPositionsItemResponseModelCopyWith<$Res> {
factory $LatestPositionsItemResponseModelCopyWith(LatestPositionsItemResponseModel value, $Res Function(LatestPositionsItemResponseModel) _then) = _$LatestPositionsItemResponseModelCopyWithImpl;
@useResult
$Res call({
double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName
String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<LatestPositionsNetworkResponseModel> networks, bool ignore, bool suspect, bool frequentPlace
});
$LatestPositionsAddressResponseModelCopyWith<$Res>? get address;
}
/// @nodoc
@@ -334,18 +334,42 @@ class _$LatestPositionsItemResponseModelCopyWithImpl<$Res>
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) {
return _then(_self.copyWith(
latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as String,
as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable
as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable
as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable
as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable
as List<LatestPositionsNetworkResponseModel>,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable
as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable
as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LatestPositionsAddressResponseModelCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}
}
@@ -427,10 +451,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<LatestPositionsNetworkResponseModel> networks, bool ignore, bool suspect, bool frequentPlace)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LatestPositionsItemResponseModel() when $default != null:
return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _:
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
return orElse();
}
@@ -448,10 +472,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<LatestPositionsNetworkResponseModel> networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this;
switch (_that) {
case _LatestPositionsItemResponseModel():
return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _:
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
throw StateError('Unexpected subclass');
}
@@ -468,10 +492,10 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<LatestPositionsNetworkResponseModel> networks, bool ignore, bool suspect, bool frequentPlace)? $default,) {final _that = this;
switch (_that) {
case _LatestPositionsItemResponseModel() when $default != null:
return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,_that.frequentPlace,_that.frequentPlaceName);case _:
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
return null;
}
@@ -483,15 +507,33 @@ return $default(_that.latitude,_that.longitude,_that.address,_that.positionDate,
@JsonSerializable()
class _LatestPositionsItemResponseModel implements LatestPositionsItemResponseModel {
const _LatestPositionsItemResponseModel({required this.latitude, required this.longitude, required this.address, required this.positionDate, required this.frequentPlace, required this.frequentPlaceName});
const _LatestPositionsItemResponseModel({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List<LatestPositionsNetworkResponseModel> networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks;
factory _LatestPositionsItemResponseModel.fromJson(Map<String, dynamic> json) => _$LatestPositionsItemResponseModelFromJson(json);
@override final String id;
@override final String deviceIdentificator;
@override final double latitude;
@override final double longitude;
@override final String? address;
@override final DateTime positionDate;
@override final int hpe;
@override final int? ncell;
@override final int type;
@override final int? steps;
@override final LatestPositionsAddressResponseModel? address;
@override final int createdAt;
@override final int positionDate;
@override final int? positionDateOriginal;
@override final String? frequentPlaceName;
@override final String message;
final List<LatestPositionsNetworkResponseModel> _networks;
@override List<LatestPositionsNetworkResponseModel> get networks {
if (_networks is EqualUnmodifiableListView) return _networks;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_networks);
}
@override final bool ignore;
@override final bool suspect;
@override final bool frequentPlace;
@override final String frequentPlaceName;
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@@ -506,16 +548,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.address, address) || other.address == address)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,latitude,longitude,address,positionDate,frequentPlace,frequentPlaceName);
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace);
@override
String toString() {
return 'LatestPositionsItemResponseModel(latitude: $latitude, longitude: $longitude, address: $address, positionDate: $positionDate, frequentPlace: $frequentPlace, frequentPlaceName: $frequentPlaceName)';
return 'LatestPositionsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)';
}
@@ -526,11 +568,11 @@ abstract mixin class _$LatestPositionsItemResponseModelCopyWith<$Res> implements
factory _$LatestPositionsItemResponseModelCopyWith(_LatestPositionsItemResponseModel value, $Res Function(_LatestPositionsItemResponseModel) _then) = __$LatestPositionsItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
double latitude, double longitude, String? address, DateTime positionDate, bool frequentPlace, String frequentPlaceName
String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, LatestPositionsAddressResponseModel? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<LatestPositionsNetworkResponseModel> networks, bool ignore, bool suspect, bool frequentPlace
});
@override $LatestPositionsAddressResponseModelCopyWith<$Res>? get address;
}
/// @nodoc
@@ -543,14 +585,582 @@ class __$LatestPositionsItemResponseModelCopyWithImpl<$Res>
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? latitude = null,Object? longitude = null,Object? address = freezed,Object? positionDate = null,Object? frequentPlace = null,Object? frequentPlaceName = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) {
return _then(_LatestPositionsItemResponseModel(
latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as String?,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as DateTime,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,frequentPlaceName: null == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable
as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable
as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as LatestPositionsAddressResponseModel?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable
as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable
as List<LatestPositionsNetworkResponseModel>,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable
as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable
as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of LatestPositionsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$LatestPositionsAddressResponseModelCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $LatestPositionsAddressResponseModelCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}
}
/// @nodoc
mixin _$LatestPositionsAddressResponseModel {
String get street; String get city; String get province; String get state; String get country;
/// Create a copy of LatestPositionsAddressResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LatestPositionsAddressResponseModelCopyWith<LatestPositionsAddressResponseModel> get copyWith => _$LatestPositionsAddressResponseModelCopyWithImpl<LatestPositionsAddressResponseModel>(this as LatestPositionsAddressResponseModel, _$identity);
/// Serializes this LatestPositionsAddressResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,street,city,province,state,country);
@override
String toString() {
return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)';
}
}
/// @nodoc
abstract mixin class $LatestPositionsAddressResponseModelCopyWith<$Res> {
factory $LatestPositionsAddressResponseModelCopyWith(LatestPositionsAddressResponseModel value, $Res Function(LatestPositionsAddressResponseModel) _then) = _$LatestPositionsAddressResponseModelCopyWithImpl;
@useResult
$Res call({
String street, String city, String province, String state, String country
});
}
/// @nodoc
class _$LatestPositionsAddressResponseModelCopyWithImpl<$Res>
implements $LatestPositionsAddressResponseModelCopyWith<$Res> {
_$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then);
final LatestPositionsAddressResponseModel _self;
final $Res Function(LatestPositionsAddressResponseModel) _then;
/// Create a copy of LatestPositionsAddressResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) {
return _then(_self.copyWith(
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [LatestPositionsAddressResponseModel].
extension LatestPositionsAddressResponseModelPatterns on LatestPositionsAddressResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LatestPositionsAddressResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LatestPositionsAddressResponseModel value) $default,){
final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LatestPositionsAddressResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel() when $default != null:
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String street, String city, String province, String state, String country) $default,) {final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel():
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String street, String city, String province, String state, String country)? $default,) {final _that = this;
switch (_that) {
case _LatestPositionsAddressResponseModel() when $default != null:
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _LatestPositionsAddressResponseModel implements LatestPositionsAddressResponseModel {
const _LatestPositionsAddressResponseModel({required this.street, required this.city, required this.province, required this.state, required this.country});
factory _LatestPositionsAddressResponseModel.fromJson(Map<String, dynamic> json) => _$LatestPositionsAddressResponseModelFromJson(json);
@override final String street;
@override final String city;
@override final String province;
@override final String state;
@override final String country;
/// Create a copy of LatestPositionsAddressResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LatestPositionsAddressResponseModelCopyWith<_LatestPositionsAddressResponseModel> get copyWith => __$LatestPositionsAddressResponseModelCopyWithImpl<_LatestPositionsAddressResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LatestPositionsAddressResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsAddressResponseModel&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,street,city,province,state,country);
@override
String toString() {
return 'LatestPositionsAddressResponseModel(street: $street, city: $city, province: $province, state: $state, country: $country)';
}
}
/// @nodoc
abstract mixin class _$LatestPositionsAddressResponseModelCopyWith<$Res> implements $LatestPositionsAddressResponseModelCopyWith<$Res> {
factory _$LatestPositionsAddressResponseModelCopyWith(_LatestPositionsAddressResponseModel value, $Res Function(_LatestPositionsAddressResponseModel) _then) = __$LatestPositionsAddressResponseModelCopyWithImpl;
@override @useResult
$Res call({
String street, String city, String province, String state, String country
});
}
/// @nodoc
class __$LatestPositionsAddressResponseModelCopyWithImpl<$Res>
implements _$LatestPositionsAddressResponseModelCopyWith<$Res> {
__$LatestPositionsAddressResponseModelCopyWithImpl(this._self, this._then);
final _LatestPositionsAddressResponseModel _self;
final $Res Function(_LatestPositionsAddressResponseModel) _then;
/// Create a copy of LatestPositionsAddressResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? street = null,Object? city = null,Object? province = null,Object? state = null,Object? country = null,}) {
return _then(_LatestPositionsAddressResponseModel(
street: null == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String,city: null == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String,province: null == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String,state: null == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String,country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// @nodoc
mixin _$LatestPositionsNetworkResponseModel {
String get SSID; String get BSSID; String get signal;
/// Create a copy of LatestPositionsNetworkResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$LatestPositionsNetworkResponseModelCopyWith<LatestPositionsNetworkResponseModel> get copyWith => _$LatestPositionsNetworkResponseModelCopyWithImpl<LatestPositionsNetworkResponseModel>(this as LatestPositionsNetworkResponseModel, _$identity);
/// Serializes this LatestPositionsNetworkResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
@override
String toString() {
return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
}
}
/// @nodoc
abstract mixin class $LatestPositionsNetworkResponseModelCopyWith<$Res> {
factory $LatestPositionsNetworkResponseModelCopyWith(LatestPositionsNetworkResponseModel value, $Res Function(LatestPositionsNetworkResponseModel) _then) = _$LatestPositionsNetworkResponseModelCopyWithImpl;
@useResult
$Res call({
String SSID, String BSSID, String signal
});
}
/// @nodoc
class _$LatestPositionsNetworkResponseModelCopyWithImpl<$Res>
implements $LatestPositionsNetworkResponseModelCopyWith<$Res> {
_$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then);
final LatestPositionsNetworkResponseModel _self;
final $Res Function(LatestPositionsNetworkResponseModel) _then;
/// Create a copy of LatestPositionsNetworkResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
return _then(_self.copyWith(
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [LatestPositionsNetworkResponseModel].
extension LatestPositionsNetworkResponseModelPatterns on LatestPositionsNetworkResponseModel {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _LatestPositionsNetworkResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _LatestPositionsNetworkResponseModel value) $default,){
final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _LatestPositionsNetworkResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel() when $default != null:
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal) $default,) {final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel():
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String SSID, String BSSID, String signal)? $default,) {final _that = this;
switch (_that) {
case _LatestPositionsNetworkResponseModel() when $default != null:
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _LatestPositionsNetworkResponseModel implements LatestPositionsNetworkResponseModel {
const _LatestPositionsNetworkResponseModel({required this.SSID, required this.BSSID, required this.signal});
factory _LatestPositionsNetworkResponseModel.fromJson(Map<String, dynamic> json) => _$LatestPositionsNetworkResponseModelFromJson(json);
@override final String SSID;
@override final String BSSID;
@override final String signal;
/// Create a copy of LatestPositionsNetworkResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$LatestPositionsNetworkResponseModelCopyWith<_LatestPositionsNetworkResponseModel> get copyWith => __$LatestPositionsNetworkResponseModelCopyWithImpl<_LatestPositionsNetworkResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$LatestPositionsNetworkResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _LatestPositionsNetworkResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
@override
String toString() {
return 'LatestPositionsNetworkResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
}
}
/// @nodoc
abstract mixin class _$LatestPositionsNetworkResponseModelCopyWith<$Res> implements $LatestPositionsNetworkResponseModelCopyWith<$Res> {
factory _$LatestPositionsNetworkResponseModelCopyWith(_LatestPositionsNetworkResponseModel value, $Res Function(_LatestPositionsNetworkResponseModel) _then) = __$LatestPositionsNetworkResponseModelCopyWithImpl;
@override @useResult
$Res call({
String SSID, String BSSID, String signal
});
}
/// @nodoc
class __$LatestPositionsNetworkResponseModelCopyWithImpl<$Res>
implements _$LatestPositionsNetworkResponseModelCopyWith<$Res> {
__$LatestPositionsNetworkResponseModelCopyWithImpl(this._self, this._then);
final _LatestPositionsNetworkResponseModel _self;
final $Res Function(_LatestPositionsNetworkResponseModel) _then;
/// Create a copy of LatestPositionsNetworkResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
return _then(_LatestPositionsNetworkResponseModel(
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
as String,
));
}

View File

@@ -25,21 +25,91 @@ Map<String, dynamic> _$LatestPositionsResponseModelToJson(
_LatestPositionsItemResponseModel _$LatestPositionsItemResponseModelFromJson(
Map<String, dynamic> json,
) => _LatestPositionsItemResponseModel(
id: json['id'] as String,
deviceIdentificator: json['deviceIdentificator'] as String,
latitude: (json['latitude'] as num).toDouble(),
longitude: (json['longitude'] as num).toDouble(),
address: json['address'] as String?,
positionDate: DateTime.parse(json['positionDate'] as String),
hpe: (json['hpe'] as num).toInt(),
ncell: (json['ncell'] as num?)?.toInt(),
type: (json['type'] as num).toInt(),
steps: (json['steps'] as num?)?.toInt(),
address: json['address'] == null
? null
: LatestPositionsAddressResponseModel.fromJson(
json['address'] as Map<String, dynamic>,
),
createdAt: (json['createdAt'] as num).toInt(),
positionDate: (json['positionDate'] as num).toInt(),
positionDateOriginal: (json['positionDateOriginal'] as num?)?.toInt(),
frequentPlaceName: json['frequentPlaceName'] as String?,
message: json['message'] as String,
networks: (json['networks'] as List<dynamic>)
.map(
(e) => LatestPositionsNetworkResponseModel.fromJson(
e as Map<String, dynamic>,
),
)
.toList(),
ignore: json['ignore'] as bool,
suspect: json['suspect'] as bool,
frequentPlace: json['frequentPlace'] as bool,
frequentPlaceName: json['frequentPlaceName'] as String,
);
Map<String, dynamic> _$LatestPositionsItemResponseModelToJson(
_LatestPositionsItemResponseModel instance,
) => <String, dynamic>{
'id': instance.id,
'deviceIdentificator': instance.deviceIdentificator,
'latitude': instance.latitude,
'longitude': instance.longitude,
'hpe': instance.hpe,
'ncell': instance.ncell,
'type': instance.type,
'steps': instance.steps,
'address': instance.address,
'positionDate': instance.positionDate.toIso8601String(),
'frequentPlace': instance.frequentPlace,
'createdAt': instance.createdAt,
'positionDate': instance.positionDate,
'positionDateOriginal': instance.positionDateOriginal,
'frequentPlaceName': instance.frequentPlaceName,
'message': instance.message,
'networks': instance.networks,
'ignore': instance.ignore,
'suspect': instance.suspect,
'frequentPlace': instance.frequentPlace,
};
_LatestPositionsAddressResponseModel
_$LatestPositionsAddressResponseModelFromJson(Map<String, dynamic> json) =>
_LatestPositionsAddressResponseModel(
street: json['street'] as String,
city: json['city'] as String,
province: json['province'] as String,
state: json['state'] as String,
country: json['country'] as String,
);
Map<String, dynamic> _$LatestPositionsAddressResponseModelToJson(
_LatestPositionsAddressResponseModel instance,
) => <String, dynamic>{
'street': instance.street,
'city': instance.city,
'province': instance.province,
'state': instance.state,
'country': instance.country,
};
_LatestPositionsNetworkResponseModel
_$LatestPositionsNetworkResponseModelFromJson(Map<String, dynamic> json) =>
_LatestPositionsNetworkResponseModel(
SSID: json['SSID'] as String,
BSSID: json['BSSID'] as String,
signal: json['signal'] as String,
);
Map<String, dynamic> _$LatestPositionsNetworkResponseModelToJson(
_LatestPositionsNetworkResponseModel instance,
) => <String, dynamic>{
'SSID': instance.SSID,
'BSSID': instance.BSSID,
'signal': instance.signal,
};

View File

@@ -1,8 +1,7 @@
import 'package:hub/src/core/data/datasource/hub_remote_datasource.dart';
import 'package:hub/src/core/domain/repositories/hub_repository.dart';
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
class HomeRepositoryImpl implements HomeRepository {
const HomeRepositoryImpl(this._remote);

View File

@@ -1,6 +1,5 @@
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
abstract class HomeRepository {
Future<List<DeviceEntity>> getDevices({required String userId});

View File

@@ -0,0 +1,14 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'address_entity.freezed.dart';
@freezed
abstract class AddressEntity with _$AddressEntity {
const factory AddressEntity({
required String? street,
required String? city,
required String? province,
required String? state,
required String? country,
}) = _AddressEntity;
}

View File

@@ -0,0 +1,283 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'address_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AddressEntity {
String? get street; String? get city; String? get province; String? get state; String? get country;
/// Create a copy of AddressEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AddressEntityCopyWith<AddressEntity> get copyWith => _$AddressEntityCopyWithImpl<AddressEntity>(this as AddressEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country));
}
@override
int get hashCode => Object.hash(runtimeType,street,city,province,state,country);
@override
String toString() {
return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)';
}
}
/// @nodoc
abstract mixin class $AddressEntityCopyWith<$Res> {
factory $AddressEntityCopyWith(AddressEntity value, $Res Function(AddressEntity) _then) = _$AddressEntityCopyWithImpl;
@useResult
$Res call({
String? street, String? city, String? province, String? state, String? country
});
}
/// @nodoc
class _$AddressEntityCopyWithImpl<$Res>
implements $AddressEntityCopyWith<$Res> {
_$AddressEntityCopyWithImpl(this._self, this._then);
final AddressEntity _self;
final $Res Function(AddressEntity) _then;
/// Create a copy of AddressEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) {
return _then(_self.copyWith(
street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [AddressEntity].
extension AddressEntityPatterns on AddressEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _AddressEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AddressEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _AddressEntity value) $default,){
final _that = this;
switch (_that) {
case _AddressEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _AddressEntity value)? $default,){
final _that = this;
switch (_that) {
case _AddressEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? street, String? city, String? province, String? state, String? country)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AddressEntity() when $default != null:
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? street, String? city, String? province, String? state, String? country) $default,) {final _that = this;
switch (_that) {
case _AddressEntity():
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? street, String? city, String? province, String? state, String? country)? $default,) {final _that = this;
switch (_that) {
case _AddressEntity() when $default != null:
return $default(_that.street,_that.city,_that.province,_that.state,_that.country);case _:
return null;
}
}
}
/// @nodoc
class _AddressEntity implements AddressEntity {
const _AddressEntity({required this.street, required this.city, required this.province, required this.state, required this.country});
@override final String? street;
@override final String? city;
@override final String? province;
@override final String? state;
@override final String? country;
/// Create a copy of AddressEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AddressEntityCopyWith<_AddressEntity> get copyWith => __$AddressEntityCopyWithImpl<_AddressEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AddressEntity&&(identical(other.street, street) || other.street == street)&&(identical(other.city, city) || other.city == city)&&(identical(other.province, province) || other.province == province)&&(identical(other.state, state) || other.state == state)&&(identical(other.country, country) || other.country == country));
}
@override
int get hashCode => Object.hash(runtimeType,street,city,province,state,country);
@override
String toString() {
return 'AddressEntity(street: $street, city: $city, province: $province, state: $state, country: $country)';
}
}
/// @nodoc
abstract mixin class _$AddressEntityCopyWith<$Res> implements $AddressEntityCopyWith<$Res> {
factory _$AddressEntityCopyWith(_AddressEntity value, $Res Function(_AddressEntity) _then) = __$AddressEntityCopyWithImpl;
@override @useResult
$Res call({
String? street, String? city, String? province, String? state, String? country
});
}
/// @nodoc
class __$AddressEntityCopyWithImpl<$Res>
implements _$AddressEntityCopyWith<$Res> {
__$AddressEntityCopyWithImpl(this._self, this._then);
final _AddressEntity _self;
final $Res Function(_AddressEntity) _then;
/// Create a copy of AddressEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? street = freezed,Object? city = freezed,Object? province = freezed,Object? state = freezed,Object? country = freezed,}) {
return _then(_AddressEntity(
street: freezed == street ? _self.street : street // ignore: cast_nullable_to_non_nullable
as String?,city: freezed == city ? _self.city : city // ignore: cast_nullable_to_non_nullable
as String?,province: freezed == province ? _self.province : province // ignore: cast_nullable_to_non_nullable
as String?,state: freezed == state ? _self.state : state // ignore: cast_nullable_to_non_nullable
as String?,country: freezed == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -1,11 +0,0 @@
class DeviceEntity {
final String id;
final String identificator;
final String carrierName;
const DeviceEntity({
required this.id,
required this.identificator,
required this.carrierName,
});
}

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'network_entity.freezed.dart';
@freezed
abstract class NetworkEntity with _$NetworkEntity {
const factory NetworkEntity({
required String SSID,
required String BSSID,
required String signal,
}) = _NetworkEntity;
}

View File

@@ -0,0 +1,277 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'network_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$NetworkEntity {
String get SSID; String get BSSID; String get signal;
/// Create a copy of NetworkEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$NetworkEntityCopyWith<NetworkEntity> get copyWith => _$NetworkEntityCopyWithImpl<NetworkEntity>(this as NetworkEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
}
@override
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
@override
String toString() {
return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
}
}
/// @nodoc
abstract mixin class $NetworkEntityCopyWith<$Res> {
factory $NetworkEntityCopyWith(NetworkEntity value, $Res Function(NetworkEntity) _then) = _$NetworkEntityCopyWithImpl;
@useResult
$Res call({
String SSID, String BSSID, String signal
});
}
/// @nodoc
class _$NetworkEntityCopyWithImpl<$Res>
implements $NetworkEntityCopyWith<$Res> {
_$NetworkEntityCopyWithImpl(this._self, this._then);
final NetworkEntity _self;
final $Res Function(NetworkEntity) _then;
/// Create a copy of NetworkEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
return _then(_self.copyWith(
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [NetworkEntity].
extension NetworkEntityPatterns on NetworkEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _NetworkEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _NetworkEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _NetworkEntity value) $default,){
final _that = this;
switch (_that) {
case _NetworkEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _NetworkEntity value)? $default,){
final _that = this;
switch (_that) {
case _NetworkEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _NetworkEntity() when $default != null:
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal) $default,) {final _that = this;
switch (_that) {
case _NetworkEntity():
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String SSID, String BSSID, String signal)? $default,) {final _that = this;
switch (_that) {
case _NetworkEntity() when $default != null:
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
return null;
}
}
}
/// @nodoc
class _NetworkEntity implements NetworkEntity {
const _NetworkEntity({required this.SSID, required this.BSSID, required this.signal});
@override final String SSID;
@override final String BSSID;
@override final String signal;
/// Create a copy of NetworkEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$NetworkEntityCopyWith<_NetworkEntity> get copyWith => __$NetworkEntityCopyWithImpl<_NetworkEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _NetworkEntity&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
}
@override
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
@override
String toString() {
return 'NetworkEntity(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
}
}
/// @nodoc
abstract mixin class _$NetworkEntityCopyWith<$Res> implements $NetworkEntityCopyWith<$Res> {
factory _$NetworkEntityCopyWith(_NetworkEntity value, $Res Function(_NetworkEntity) _then) = __$NetworkEntityCopyWithImpl;
@override @useResult
$Res call({
String SSID, String BSSID, String signal
});
}
/// @nodoc
class __$NetworkEntityCopyWithImpl<$Res>
implements _$NetworkEntityCopyWith<$Res> {
__$NetworkEntityCopyWithImpl(this._self, this._then);
final _NetworkEntity _self;
final $Res Function(_NetworkEntity) _then;
/// Create a copy of NetworkEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
return _then(_NetworkEntity(
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -1,17 +1,29 @@
class PositionEntity {
final double latitude;
final double longitude;
final String? address;
final bool frequentPlace;
final String frequentPlaceName;
final DateTime positionDate;
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:hub/src/features/hub/domain/entities/address_entity.dart';
import 'package:hub/src/features/hub/domain/entities/network_entity.dart';
const PositionEntity({
required this.latitude,
required this.longitude,
required this.address,
required this.positionDate,
required this.frequentPlace,
required this.frequentPlaceName,
});
}
part 'position_entity.freezed.dart';
@freezed
abstract class PositionEntity with _$PositionEntity {
const factory PositionEntity({
required String id,
required String deviceIdentificator,
required double latitude,
required double longitude,
required int hpe,
int? ncell,
required int type,
int? steps,
AddressEntity? address,
required int createdAt,
required int positionDate,
int? positionDateOriginal,
String? frequentPlaceName,
required String message,
required List<NetworkEntity> networks,
required bool ignore,
required bool suspect,
required bool frequentPlace,
}) = _PositionEntity;
}

View File

@@ -0,0 +1,352 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// 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 'position_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$PositionEntity {
String get id; String get deviceIdentificator; double get latitude; double get longitude; int get hpe; int? get ncell; int get type; int? get steps; AddressEntity? get address; int get createdAt; int get positionDate; int? get positionDateOriginal; String? get frequentPlaceName; String get message; List<NetworkEntity> get networks; bool get ignore; bool get suspect; bool get frequentPlace;
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PositionEntityCopyWith<PositionEntity> get copyWith => _$PositionEntityCopyWithImpl<PositionEntity>(this as PositionEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other.networks, networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(networks),ignore,suspect,frequentPlace);
@override
String toString() {
return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)';
}
}
/// @nodoc
abstract mixin class $PositionEntityCopyWith<$Res> {
factory $PositionEntityCopyWith(PositionEntity value, $Res Function(PositionEntity) _then) = _$PositionEntityCopyWithImpl;
@useResult
$Res call({
String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<NetworkEntity> networks, bool ignore, bool suspect, bool frequentPlace
});
$AddressEntityCopyWith<$Res>? get address;
}
/// @nodoc
class _$PositionEntityCopyWithImpl<$Res>
implements $PositionEntityCopyWith<$Res> {
_$PositionEntityCopyWithImpl(this._self, this._then);
final PositionEntity _self;
final $Res Function(PositionEntity) _then;
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable
as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable
as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable
as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,networks: null == networks ? _self.networks : networks // ignore: cast_nullable_to_non_nullable
as List<NetworkEntity>,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable
as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable
as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AddressEntityCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $AddressEntityCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}
}
/// Adds pattern-matching-related methods to [PositionEntity].
extension PositionEntityPatterns on PositionEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _PositionEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _PositionEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _PositionEntity value) $default,){
final _that = this;
switch (_that) {
case _PositionEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _PositionEntity value)? $default,){
final _that = this;
switch (_that) {
case _PositionEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<NetworkEntity> networks, bool ignore, bool suspect, bool frequentPlace)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PositionEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<NetworkEntity> networks, bool ignore, bool suspect, bool frequentPlace) $default,) {final _that = this;
switch (_that) {
case _PositionEntity():
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<NetworkEntity> networks, bool ignore, bool suspect, bool frequentPlace)? $default,) {final _that = this;
switch (_that) {
case _PositionEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.latitude,_that.longitude,_that.hpe,_that.ncell,_that.type,_that.steps,_that.address,_that.createdAt,_that.positionDate,_that.positionDateOriginal,_that.frequentPlaceName,_that.message,_that.networks,_that.ignore,_that.suspect,_that.frequentPlace);case _:
return null;
}
}
}
/// @nodoc
class _PositionEntity implements PositionEntity {
const _PositionEntity({required this.id, required this.deviceIdentificator, required this.latitude, required this.longitude, required this.hpe, this.ncell, required this.type, this.steps, this.address, required this.createdAt, required this.positionDate, this.positionDateOriginal, this.frequentPlaceName, required this.message, required final List<NetworkEntity> networks, required this.ignore, required this.suspect, required this.frequentPlace}): _networks = networks;
@override final String id;
@override final String deviceIdentificator;
@override final double latitude;
@override final double longitude;
@override final int hpe;
@override final int? ncell;
@override final int type;
@override final int? steps;
@override final AddressEntity? address;
@override final int createdAt;
@override final int positionDate;
@override final int? positionDateOriginal;
@override final String? frequentPlaceName;
@override final String message;
final List<NetworkEntity> _networks;
@override List<NetworkEntity> get networks {
if (_networks is EqualUnmodifiableListView) return _networks;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_networks);
}
@override final bool ignore;
@override final bool suspect;
@override final bool frequentPlace;
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$PositionEntityCopyWith<_PositionEntity> get copyWith => __$PositionEntityCopyWithImpl<_PositionEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PositionEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.hpe, hpe) || other.hpe == hpe)&&(identical(other.ncell, ncell) || other.ncell == ncell)&&(identical(other.type, type) || other.type == type)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.address, address) || other.address == address)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.positionDate, positionDate) || other.positionDate == positionDate)&&(identical(other.positionDateOriginal, positionDateOriginal) || other.positionDateOriginal == positionDateOriginal)&&(identical(other.frequentPlaceName, frequentPlaceName) || other.frequentPlaceName == frequentPlaceName)&&(identical(other.message, message) || other.message == message)&&const DeepCollectionEquality().equals(other._networks, _networks)&&(identical(other.ignore, ignore) || other.ignore == ignore)&&(identical(other.suspect, suspect) || other.suspect == suspect)&&(identical(other.frequentPlace, frequentPlace) || other.frequentPlace == frequentPlace));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,latitude,longitude,hpe,ncell,type,steps,address,createdAt,positionDate,positionDateOriginal,frequentPlaceName,message,const DeepCollectionEquality().hash(_networks),ignore,suspect,frequentPlace);
@override
String toString() {
return 'PositionEntity(id: $id, deviceIdentificator: $deviceIdentificator, latitude: $latitude, longitude: $longitude, hpe: $hpe, ncell: $ncell, type: $type, steps: $steps, address: $address, createdAt: $createdAt, positionDate: $positionDate, positionDateOriginal: $positionDateOriginal, frequentPlaceName: $frequentPlaceName, message: $message, networks: $networks, ignore: $ignore, suspect: $suspect, frequentPlace: $frequentPlace)';
}
}
/// @nodoc
abstract mixin class _$PositionEntityCopyWith<$Res> implements $PositionEntityCopyWith<$Res> {
factory _$PositionEntityCopyWith(_PositionEntity value, $Res Function(_PositionEntity) _then) = __$PositionEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String deviceIdentificator, double latitude, double longitude, int hpe, int? ncell, int type, int? steps, AddressEntity? address, int createdAt, int positionDate, int? positionDateOriginal, String? frequentPlaceName, String message, List<NetworkEntity> networks, bool ignore, bool suspect, bool frequentPlace
});
@override $AddressEntityCopyWith<$Res>? get address;
}
/// @nodoc
class __$PositionEntityCopyWithImpl<$Res>
implements _$PositionEntityCopyWith<$Res> {
__$PositionEntityCopyWithImpl(this._self, this._then);
final _PositionEntity _self;
final $Res Function(_PositionEntity) _then;
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? latitude = null,Object? longitude = null,Object? hpe = null,Object? ncell = freezed,Object? type = null,Object? steps = freezed,Object? address = freezed,Object? createdAt = null,Object? positionDate = null,Object? positionDateOriginal = freezed,Object? frequentPlaceName = freezed,Object? message = null,Object? networks = null,Object? ignore = null,Object? suspect = null,Object? frequentPlace = null,}) {
return _then(_PositionEntity(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
as double,hpe: null == hpe ? _self.hpe : hpe // ignore: cast_nullable_to_non_nullable
as int,ncell: freezed == ncell ? _self.ncell : ncell // ignore: cast_nullable_to_non_nullable
as int?,type: null == type ? _self.type : type // ignore: cast_nullable_to_non_nullable
as int,steps: freezed == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int?,address: freezed == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
as AddressEntity?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,positionDate: null == positionDate ? _self.positionDate : positionDate // ignore: cast_nullable_to_non_nullable
as int,positionDateOriginal: freezed == positionDateOriginal ? _self.positionDateOriginal : positionDateOriginal // ignore: cast_nullable_to_non_nullable
as int?,frequentPlaceName: freezed == frequentPlaceName ? _self.frequentPlaceName : frequentPlaceName // ignore: cast_nullable_to_non_nullable
as String?,message: null == message ? _self.message : message // ignore: cast_nullable_to_non_nullable
as String,networks: null == networks ? _self._networks : networks // ignore: cast_nullable_to_non_nullable
as List<NetworkEntity>,ignore: null == ignore ? _self.ignore : ignore // ignore: cast_nullable_to_non_nullable
as bool,suspect: null == suspect ? _self.suspect : suspect // ignore: cast_nullable_to_non_nullable
as bool,frequentPlace: null == frequentPlace ? _self.frequentPlace : frequentPlace // ignore: cast_nullable_to_non_nullable
as bool,
));
}
/// Create a copy of PositionEntity
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$AddressEntityCopyWith<$Res>? get address {
if (_self.address == null) {
return null;
}
return $AddressEntityCopyWith<$Res>(_self.address!, (value) {
return _then(_self.copyWith(address: value));
});
}
}
// dart format on

View File

@@ -1,4 +1,4 @@
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
abstract class GetDevicesUseCase {
Future<List<DeviceEntity>> getDevices({required String userId});

View File

@@ -1,7 +1,6 @@
import 'package:hub/src/core/domain/repositories/hub_repository.dart';
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart';
import 'package:hub/src/features/hub/domain/get_devices_use_case.dart';
import 'package:legacy_shared/legacy_shared.dart';
class GetDevicesUseCaseImpl implements GetDevicesUseCase {
GetDevicesUseCaseImpl(this._repository);

View File

@@ -12,7 +12,7 @@ class HubBuilder {
return MaterialPage<void>(
key: state.pageKey,
child: HubScreen(navigationContract: navigationContract),
child: HubScreen(navigationContract: navigationContract, routerState: state),
);
}
}

View File

@@ -1,18 +1,25 @@
import 'package:flutter_svg/svg.dart';
import 'package:go_router/go_router.dart';
import 'package:hub/src/features/hub/presentation/state/hub_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:latlong2/latlong.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class HubScreen extends ConsumerWidget {
final NavigationContract navigationContract;
final GoRouterState routerState;
const HubScreen({super.key, required this.navigationContract});
const HubScreen({
super.key,
required this.navigationContract,
required this.routerState
});
@override
Widget build(BuildContext context, WidgetRef ref) {
@@ -24,8 +31,8 @@ class HubScreen extends ConsumerWidget {
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14),
child: Container(
padding: EdgeInsets.symmetric(horizontal: 14),
child: Column(
children: [
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 4)),
@@ -33,10 +40,28 @@ class HubScreen extends ConsumerWidget {
children: [
SizedBox(
height: SizeUtils.getByScreen(small: 36, big: 36),
child: Align(
alignment: Alignment.centerLeft,
child: Image.asset('assets/images/ui/iso_sf.png',
height: SizeUtils.getByScreen(small: 18, big: 18)),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Image.asset('assets/images/ui/iso_sf.png',
height: SizeUtils.getByScreen(small: 18, big: 18)),
SizedBox(width: SizeUtils.getByScreen(small: 8, big: 4)),
SizedBox(
width: SizeUtils.getByScreen(small: 104, big: 100),
height: 32,
child: CustomDropdown(
items: viewState.devices.map((DeviceEntity device)=>
Text(device.carrierName)
).toList(),
values: viewState.devices,
value: viewState.selectedDevice,
onChanged: (device){viewModel.setSelectedDevice(device);},
height: 32,
color: Colors.transparent,
padding: EdgeInsets.zero,
),
),
]
)
),
Center(
@@ -51,29 +76,29 @@ class HubScreen extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.customerService);},
icon: SFIcons.customerService,
text: I18n.customerService),
onPressed: (){navigationContract.pushTo(AppRoutes.customerService);},
icon: SFIcons.customerService,
text: I18n.customerService),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);},
icon: SFIcons.payments,
text: I18n.sfPay),
onPressed: (){navigationContract.pushTo(AppRoutes.dashboardHome);},
icon: SFIcons.payments,
text: I18n.sfPay),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);},
icon: SFIcons.functions,
text: I18n.functions),
onPressed: (){navigationContract.pushTo(AppRoutes.dashboardFunctions);},
icon: SFIcons.functions,
text: I18n.functions),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);},
icon: Icons.manage_accounts_outlined,
text: I18n.accountSettings),
onPressed: (){navigationContract.pushTo(AppRoutes.accountSettings);},
icon: Icons.manage_accounts_outlined,
text: I18n.accountSettings),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
AppSectionButton(
onPressed: (){},
icon: Icons.settings_outlined,
text: I18n.deviceSettings),
onPressed: (){},
icon: Icons.settings_outlined,
text: I18n.deviceSettings),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 22)),
Text(context.translate(I18n.watchesOnMap),
@@ -86,32 +111,7 @@ class HubScreen extends ConsumerWidget {
SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)),
SizedBox(
height: SizeUtils.getByScreen(small: 200, big: 300),
child: FlutterMap(
mapController: viewModel.mapController,
options: MapOptions(
initialCenter: LatLng(45.32833189648895, -3.0830872665435085), // Center the map over London, UK
initialZoom: 15,
keepAlive: true,
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.savefamily.sf_platform',
),
MarkerLayer(markers: viewState.positions.map((position)=>
Marker(
point: LatLng(position.latitude, position.longitude),
width: 200,
height: 145,
child: Align(
alignment: Alignment.topCenter,
child: SvgPicture.asset('assets/images/ui/location.svg',
height: 80)),
rotate: true,
)
).toList())
],
)
child: Minimap(),
),
SizedBox(height: SizeUtils.getByScreen(small: 14, big: 13)),
],
@@ -181,4 +181,118 @@ class AppSectionButton extends ConsumerWidget {
);
}
}
class Minimap extends ConsumerWidget {
IconData batteryToIcon(int battery) {
if (battery < 15) return Icons.battery_0_bar;
if (battery < 30) return Icons.battery_1_bar;
if (battery < 45) return Icons.battery_2_bar;
if (battery < 60) return Icons.battery_3_bar;
if (battery < 75) return Icons.battery_4_bar;
if (battery < 90) return Icons.battery_5_bar;
return Icons.battery_6_bar;
}
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final viewState = ref.watch(hubViewModelProvider);
final viewModel = ref.read(hubViewModelProvider.notifier);
final battery = viewState.selectedPosition?.ncell ?? 0;
final IconData batteryIcon = batteryToIcon(battery);
final positionDate = DateTime.fromMillisecondsSinceEpoch(viewState.selectedPosition?.positionDate ?? 0);
return FlutterMap(
mapController: viewModel.mapController,
options: MapOptions(
initialCenter: LatLng(45.32833189648895, -3.0830872665435085),
initialZoom: 15,
keepAlive: true,
),
children: [
TileLayer(
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png',
userAgentPackageName: 'com.savefamily.sf_platform',
),
MarkerLayer(markers: [if (viewState.selectedPosition != null)
Marker(
point: LatLng(viewState.selectedPosition!.latitude, viewState.selectedPosition!.longitude),
width: 200,
height: 145,
child: Align(
alignment: Alignment.topCenter,
child: SvgPicture.asset('assets/images/ui/location.svg',
height: 80)
),
rotate: true,
)
]),
if (viewState.selectedPosition != null)
Align(
alignment: Alignment.bottomCenter,
child: Container(
height: SizeUtils.getByScreen(small: 60, big: 58),
width: SizeUtils.getByScreen(small: 300, big: 298),
margin: EdgeInsets.only(bottom: SizeUtils.getByScreen(small: 20, big: 16)),
decoration: BoxDecoration(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 9, big: 8)))
),
child: Row(
children: [
Icon(SFIcons.location,
size: SizeUtils.getByScreen(small: 40, big: 38),
color: Color(0xFF588EA5),
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.center,
children: [
SizedBox(
width: SizeUtils.getByScreen(small: 250, big: 248),
child: Text('${viewState.selectedPosition!.address?.street}, '
'${viewState.selectedPosition!.address?.province}, '
'${viewState.selectedPosition!.address?.country}',
overflow: TextOverflow.ellipsis,
)
),
Row(
children: [
Text('${positionDate.month.toString().padLeft(2, '0')}-'
'${positionDate.day.toString().padLeft(2, '0')} '
'${positionDate.hour.toString().padLeft(2, '0')}:'
'${positionDate.minute.toString().padLeft(2, '0')}:'
'${positionDate.second.toString().padLeft(2, '0')}',
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 12, big: 11)
),
),
if (viewState.selectedPosition!.networks.isNotEmpty)
Text(' | ${viewState.selectedPosition!.networks.first.signal}',
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 12, big: 11)
),
),
Icon(batteryIcon),
Text('${viewState.selectedPosition!.ncell ?? 0}%',
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 12, big: 11)
),
)
],
)
],
)
],
),
),
)
],
);
}
}

View File

@@ -1,19 +1,15 @@
import 'dart:async';
import 'package:flutter_map/flutter_map.dart';
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/get_devices_request_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:hub/src/features/hub/domain/get_devices_use_case.dart';
import 'package:hub/src/features/hub/domain/get_latest_positions_use_case.dart';
import 'package:hub/src/features/hub/presentation/providers/get_devices_use_case_provider.dart';
import 'package:hub/src/features/hub/presentation/providers/get_latest_positions_use_case_provider.dart';
import 'package:hub/src/features/hub/presentation/state/hub_view_state.dart';
import 'package:flutter/material.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:latlong2/latlong.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:uuid/uuid.dart';
final hubViewModelProvider =
NotifierProvider.autoDispose<HubViewModel, HubViewState>(
@@ -24,6 +20,8 @@ class HubViewModel extends Notifier<HubViewState> {
late final GetDevicesUseCase _getDevicesUseCase;
late final GetLatestPositionsUseCase _getLatestPositionsUseCase;
late final SelectedDeviceNotifier selectedDeviceNotifier;
late final MapController mapController;
@override
@@ -31,16 +29,25 @@ class HubViewModel extends Notifier<HubViewState> {
_getDevicesUseCase = ref.read(getDevicesUseCaseProvider);
_getLatestPositionsUseCase = ref.read(getLatestPositionsUseCaseProvider);
selectedDeviceNotifier = ref.read(selectedDeviceProvider.notifier);
mapController = MapControllerImpl();
_getDevicesUseCase.getDevices(
userId: ''
).then((List<DeviceEntity> res){
state = state.copyWith(devices: res);
ref.read(loggedUserProvider.future)
.then((loggedUser) {
state = state.copyWith(loggedUser: loggedUser);
return _getDevicesUseCase.getDevices(
userId: loggedUser.id
);
}).then((List<DeviceEntity> res){
state = state.copyWith(
devices: res,
selectedDevice: res.first
);
return Future.wait(res.map((device) =>
_getLatestPositionsUseCase.getLatestPositions(
deviceId: device.identificator
)
_getLatestPositionsUseCase.getLatestPositions(
deviceId: device.identificator
)
));
}).then(
(List<List<PositionEntity>> res) {
@@ -55,31 +62,30 @@ class HubViewModel extends Notifier<HubViewState> {
void setPositions(List<List<PositionEntity>> positions) {
final devicePositions = positions.map((List<PositionEntity> devicePositions)=>devicePositions[0]).toList();
final selectedPosition = devicePositions.where((p)=>
p.deviceIdentificator == state.selectedDevice!.identificator).firstOrNull;
state = state.copyWith(
positions: devicePositions,
selectedPosition: selectedPosition,
);
mapController.move(LatLng(
devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.latitude)/positions.length,
devicePositions.fold(0.0, (double x, PositionEntity position)=>x+position.longitude)/positions.length,
), 15);
if (selectedPosition != null) {
mapController.move(LatLng(
selectedPosition.latitude,
selectedPosition.longitude,
), 15);
}
}
GetDevicesRequestEntity _toDevicesRequest() {
final userId = '';
if (userId == null) throw Exception('userId is required');
return GetDevicesRequestEntity(userId: userId);
}
/*void _startLoadingForSignUp() {
void setSelectedDevice(DeviceEntity device) {
final selectedPosition = state.positions.where((p)=>
p.deviceIdentificator == device.identificator).firstOrNull;
state = state.copyWith(
isLoading: true,
errorMessage: '',
twoFASecret: null,
showSecretCode: false,
showAccountCreated: false,
selectedDevice: device,
selectedPosition: selectedPosition,
);
}*/
selectedDeviceNotifier.setSelectedDevice(device);
}
void disposeControllers(){
mapController.dispose();

View File

@@ -1,13 +1,16 @@
import 'package:hub/src/features/hub/domain/entities/device_entity.dart';
import 'package:hub/src/features/hub/domain/entities/position_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'hub_view_state.freezed.dart';
@freezed
abstract class HubViewState with _$HubViewState {
const factory HubViewState({
UserEntity? loggedUser,
@Default([]) List<DeviceEntity> devices,
@Default([]) List<PositionEntity> positions
DeviceEntity? selectedDevice,
@Default([]) List<PositionEntity> positions,
PositionEntity? selectedPosition
}) = _HubViewState;
}

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$HubViewState {
List<DeviceEntity> get devices; List<PositionEntity> get positions;
UserEntity? get loggedUser; List<DeviceEntity> get devices; DeviceEntity? get selectedDevice; List<PositionEntity> get positions; PositionEntity? get selectedPosition;
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -25,16 +25,16 @@ $HubViewStateCopyWith<HubViewState> get copyWith => _$HubViewStateCopyWithImpl<H
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is HubViewState&&const DeepCollectionEquality().equals(other.devices, devices)&&const DeepCollectionEquality().equals(other.positions, positions));
return identical(this, other) || (other.runtimeType == runtimeType&&other is HubViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.devices, devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.positions, positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition));
}
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),const DeepCollectionEquality().hash(positions));
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition);
@override
String toString() {
return 'HubViewState(devices: $devices, positions: $positions)';
return 'HubViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)';
}
@@ -45,11 +45,11 @@ abstract mixin class $HubViewStateCopyWith<$Res> {
factory $HubViewStateCopyWith(HubViewState value, $Res Function(HubViewState) _then) = _$HubViewStateCopyWithImpl;
@useResult
$Res call({
List<DeviceEntity> devices, List<PositionEntity> positions
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
});
$UserEntityCopyWith<$Res>? get loggedUser;$DeviceEntityCopyWith<$Res>? get selectedDevice;$PositionEntityCopyWith<$Res>? get selectedPosition;
}
/// @nodoc
@@ -62,14 +62,53 @@ class _$HubViewStateCopyWithImpl<$Res>
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? positions = null,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) {
return _then(_self.copyWith(
devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable
as List<PositionEntity>,
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
as PositionEntity?,
));
}
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DeviceEntityCopyWith<$Res>? get selectedDevice {
if (_self.selectedDevice == null) {
return null;
}
return $DeviceEntityCopyWith<$Res>(_self.selectedDevice!, (value) {
return _then(_self.copyWith(selectedDevice: value));
});
}/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PositionEntityCopyWith<$Res>? get selectedPosition {
if (_self.selectedPosition == null) {
return null;
}
return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) {
return _then(_self.copyWith(selectedPosition: value));
});
}
}
@@ -151,10 +190,10 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, List<PositionEntity> positions)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _HubViewState() when $default != null:
return $default(_that.devices,_that.positions);case _:
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
return orElse();
}
@@ -172,10 +211,10 @@ return $default(_that.devices,_that.positions);case _:
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, List<PositionEntity> positions) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition) $default,) {final _that = this;
switch (_that) {
case _HubViewState():
return $default(_that.devices,_that.positions);case _:
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
throw StateError('Unexpected subclass');
}
@@ -192,10 +231,10 @@ return $default(_that.devices,_that.positions);case _:
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<DeviceEntity> devices, List<PositionEntity> positions)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition)? $default,) {final _that = this;
switch (_that) {
case _HubViewState() when $default != null:
return $default(_that.devices,_that.positions);case _:
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
return null;
}
@@ -207,9 +246,10 @@ return $default(_that.devices,_that.positions);case _:
class _HubViewState implements HubViewState {
const _HubViewState({final List<DeviceEntity> devices = const [], final List<PositionEntity> positions = const []}): _devices = devices,_positions = positions;
const _HubViewState({this.loggedUser, final List<DeviceEntity> devices = const [], this.selectedDevice, final List<PositionEntity> positions = const [], this.selectedPosition}): _devices = devices,_positions = positions;
@override final UserEntity? loggedUser;
final List<DeviceEntity> _devices;
@override@JsonKey() List<DeviceEntity> get devices {
if (_devices is EqualUnmodifiableListView) return _devices;
@@ -217,6 +257,7 @@ class _HubViewState implements HubViewState {
return EqualUnmodifiableListView(_devices);
}
@override final DeviceEntity? selectedDevice;
final List<PositionEntity> _positions;
@override@JsonKey() List<PositionEntity> get positions {
if (_positions is EqualUnmodifiableListView) return _positions;
@@ -224,6 +265,7 @@ class _HubViewState implements HubViewState {
return EqualUnmodifiableListView(_positions);
}
@override final PositionEntity? selectedPosition;
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@@ -235,16 +277,16 @@ _$HubViewStateCopyWith<_HubViewState> get copyWith => __$HubViewStateCopyWithImp
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&const DeepCollectionEquality().equals(other._positions, _positions));
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HubViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition));
}
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),const DeepCollectionEquality().hash(_positions));
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition);
@override
String toString() {
return 'HubViewState(devices: $devices, positions: $positions)';
return 'HubViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)';
}
@@ -255,11 +297,11 @@ abstract mixin class _$HubViewStateCopyWith<$Res> implements $HubViewStateCopyWi
factory _$HubViewStateCopyWith(_HubViewState value, $Res Function(_HubViewState) _then) = __$HubViewStateCopyWithImpl;
@override @useResult
$Res call({
List<DeviceEntity> devices, List<PositionEntity> positions
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
});
@override $UserEntityCopyWith<$Res>? get loggedUser;@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $PositionEntityCopyWith<$Res>? get selectedPosition;
}
/// @nodoc
@@ -272,15 +314,54 @@ class __$HubViewStateCopyWithImpl<$Res>
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? positions = null,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) {
return _then(_HubViewState(
devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable
as List<PositionEntity>,
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
as PositionEntity?,
));
}
/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$DeviceEntityCopyWith<$Res>? get selectedDevice {
if (_self.selectedDevice == null) {
return null;
}
return $DeviceEntityCopyWith<$Res>(_self.selectedDevice!, (value) {
return _then(_self.copyWith(selectedDevice: value));
});
}/// Create a copy of HubViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$PositionEntityCopyWith<$Res>? get selectedPosition {
if (_self.selectedPosition == null) {
return null;
}
return $PositionEntityCopyWith<$Res>(_self.selectedPosition!, (value) {
return _then(_self.copyWith(selectedPosition: value));
});
}
}
// dart format on

View File

@@ -422,7 +422,7 @@ packages:
source: sdk
version: "0.0.0"
fonts:
dependency: "direct main"
dependency: "direct overridden"
description:
path: "../../../../packages/fonts"
relative: true
@@ -595,6 +595,13 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.2"
legacy_shared:
dependency: "direct main"
description:
path: "../../packages/legacy_shared"
relative: true
source: path
version: "0.0.1"
lints:
dependency: transitive
description:

View File

@@ -45,8 +45,8 @@ dependencies:
path: ../../../../packages/sf_infrastructure
utils:
path: ../../../../packages/utils
fonts:
path: ../../../../packages/fonts
legacy_shared:
path: ../../packages/legacy_shared
#dependencies go here
flutter_svg: ^2.2.1
get_it: ^9.0.5

View File

@@ -1,3 +1,4 @@
# melos_managed_dependency_overrides: legacy_shared
# melos_managed_dependency_overrides: design_system,fonts,navigation,sf_infrastructure,sf_localizations,utils,auth,dashboard_shell,home,notifications,sf_shared,profile
dependency_overrides:
auth:
@@ -10,6 +11,8 @@ dependency_overrides:
path: ..\\..\\..\\..\\packages\\fonts
home:
path: ..\\..\\..\\home
legacy_shared:
path: ..\\..\\packages\\legacy_shared
navigation:
path: ..\\..\\..\\..\\packages\\navigation
notifications:

View File

@@ -1,3 +1,4 @@
# melos_managed_dependency_overrides: legacy_shared
# melos_managed_dependency_overrides: auth,design_system,fonts,home,navigation,notifications,sf_infrastructure,sf_localizations,sf_shared,utils,dashboard_shell,hub,profile
dependency_overrides:
auth:
@@ -12,6 +13,8 @@ dependency_overrides:
path: ..\\..\\..\\home
hub:
path: ..\\hub
legacy_shared:
path: ..\\..\\packages\\legacy_shared
navigation:
path: ..\\..\\..\\..\\packages\\navigation
notifications:

View File

@@ -14,7 +14,7 @@ class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource {
@override
Future<UserEntity> getLoggedUser({required String token}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
/*final response = await _repository.get<Map<String, dynamic>>(
'/users/api/auth/me',
);
final data = response.data!['item'];
@@ -22,13 +22,13 @@ class LegacySharedRemoteDatasourceImpl implements LegacySharedRemoteDatasource {
throw Exception('Empty response from /auth/me');
}
final model = GetLoggedUserResponseModel.fromJson(data);
/*final model = GetLoggedUserResponseModel(item:
final model = GetLoggedUserResponseModel.fromJson(data);*/
final model = GetLoggedUserResponseModel(item:
GetLoggedUserItemResponseModel(
id: '1111',
firstName: 'Juan',
email: 'juan@test.com',
phone: '111111111'));*/
phone: '111111111'));
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(

View File

@@ -0,0 +1,123 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'device_entity.freezed.dart';
@freezed
abstract class DeviceEntity with _$DeviceEntity {
const factory DeviceEntity({
required String id,
required String identificator,
int? battery,
String? userId,
String? companyId,
String? delegationId,
String? groupId,
required DeviceFlagsEntity flags,
List<String>? tags,
int? lastConnection,
String? carrierGenre,
int? carrierBirthday,
int? carrierWeight,
int? carrierStepLength,
required String carrierName,
String? comment,
String? phone,
String? simId,
String? simStatus,
DevicePaymentOptionsEntity? paymentOptions,
required DeviceSettingsEntity settings,
required String protocol,
required String type,
required String connectionServer,
DeviceCapabilitiesEntity? capabilities,
required int createdAt,
int? updatedAt,
}) = _DeviceEntity;
}
@freezed
abstract class DeviceFlagsEntity with _$DeviceFlagsEntity{
const factory DeviceFlagsEntity({
required String isInOrOut,
String? geofenceId,
required bool isBatteryLow,
required bool isDisconnect,
}) = _DeviceFlagsEntity;
}
@freezed
abstract class DevicePaymentOptionsEntity with _$DevicePaymentOptionsEntity{
const factory DevicePaymentOptionsEntity({
int? nextPayDate,
required bool usePayment,
required String typeSubscription,
required bool hasSubscription,
required bool hasToPay,
}) = _DevicePaymentOptionsEntity;
}
@freezed
abstract class DeviceSettingsEntity with _$DeviceSettingsEntity{
const factory DeviceSettingsEntity({
required int frequency,
required int frequencyHeartRate,
required int timezone,
required bool pedometer,
required String language,
required List<String> alerts,
}) = _DeviceSettingsEntity;
}
@freezed
abstract class DeviceCapabilitiesEntity with _$DeviceCapabilitiesEntity{
const factory DeviceCapabilitiesEntity({
required bool heartbeats,
required bool bloodPressure,
required DeviceCapabilitiesAlertEntity alerts,
required bool podometer,
required DeviceCapabilitiesContactsEntity contacts,
required DeviceCapabilitiesCommandsEntity commands,
required DeviceCapabilitiesSettingsEntity settings,
}) = _DeviceCapabilitiesEntity;
}
@freezed
abstract class DeviceCapabilitiesAlertEntity with _$DeviceCapabilitiesAlertEntity{
const factory DeviceCapabilitiesAlertEntity({
required bool enabled,
required List<String> types,
}) = _DeviceCapabilitiesAlertEntity;
}
@freezed
abstract class DeviceCapabilitiesContactsEntity with _$DeviceCapabilitiesContactsEntity{
const factory DeviceCapabilitiesContactsEntity({
required bool enabled,
required List<DeviceCapabilitiesContactTypeEntity> types,
}) = _DeviceCapabilitiesContactsEntity;
}
@freezed
abstract class DeviceCapabilitiesContactTypeEntity with _$DeviceCapabilitiesContactTypeEntity{
const factory DeviceCapabilitiesContactTypeEntity({
required String type,
required int amount,
}) = _DeviceCapabilitiesContactTypeEntity;
}
@freezed
abstract class DeviceCapabilitiesCommandsEntity with _$DeviceCapabilitiesCommandsEntity{
const factory DeviceCapabilitiesCommandsEntity({
required bool enabled,
required List<String> types,
}) = _DeviceCapabilitiesCommandsEntity;
}
@freezed
abstract class DeviceCapabilitiesSettingsEntity with _$DeviceCapabilitiesSettingsEntity{
const factory DeviceCapabilitiesSettingsEntity({
required bool locationFrequency,
required bool timezone,
required bool language,
}) = _DeviceCapabilitiesSettingsEntity;
}

View File

@@ -2,6 +2,7 @@ import 'dart:async';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
import 'package:legacy_shared/src/data/repositories/legacy_shared_repository.dart';
import 'legacy_shared_repository_provider.dart';
@@ -10,11 +11,11 @@ final loggedUserProvider = AsyncNotifierProvider<LoggedUserNotifier, UserEntity>
);
class LoggedUserNotifier extends AsyncNotifier<UserEntity> {
late final legacySharedRepository;
late final LegacySharedRepository _legacySharedRepository;
@override
Future<UserEntity> build() {
legacySharedRepository = ref.read(legacySharedRepositoryProvider);
return legacySharedRepository.getLoggedUser(token: '');
_legacySharedRepository = ref.read(legacySharedRepositoryProvider);
return _legacySharedRepository.getLoggedUser(token: '');
}
}

View File

@@ -0,0 +1,18 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/src/data/models/entities/device_entity.dart';
final selectedDeviceProvider = NotifierProvider<SelectedDeviceNotifier, DeviceEntity?>(
SelectedDeviceNotifier.new,
);
class SelectedDeviceNotifier extends Notifier<DeviceEntity?> {
@override
DeviceEntity? build() {
return null;
}
void setSelectedDevice(DeviceEntity device) {
state = device;
}
}

View File

@@ -6,12 +6,16 @@ class PageLayout extends StatelessWidget{
final String title;
final Widget body;
final Widget? footer;
final bool showEdit;
final VoidCallback? onEditChange;
const PageLayout({
super.key,
required this.title,
required this.body,
this.footer
this.footer,
this.showEdit = false,
this.onEditChange
});
@override
@@ -28,12 +32,30 @@ class PageLayout extends StatelessWidget{
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back,
color: Color(0xFF588EA5),
size: 32,
),
padding: EdgeInsets.zero,
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back,
color: Color(0xFF588EA5),
size: 32,
),
padding: EdgeInsets.zero,
),
if (showEdit)
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
child: IconButton(onPressed: onEditChange,
icon: Icon(Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 30, big: 28),
)
),
)
],
),
SizedBox(
height: 50,

View File

@@ -1104,20 +1104,6 @@
"icon"
]
},
{
"uid": "aca7aa7439ff0bf2ee30da8c7e056628",
"css": "chat",
"code": 59530,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M320.5 450C330.4 450 339.8 453.9 346.8 460.9 353.8 467.9 357.7 477.3 357.7 487.2 357.7 494.5 355.5 501.7 351.4 507.8 347.3 514 341.5 518.7 334.7 521.5 327.9 524.3 320.5 525.1 313.2 523.6 306 522.2 299.4 518.7 294.2 513.5 289 508.3 285.5 501.6 284 494.4 282.6 487.2 283.4 479.7 286.2 472.9 289 466.2 293.8 460.3 299.9 456.3 306 452.2 313.2 450 320.5 450ZM479.9 30.4C543.4 27.7 606.8 37.9 666.3 60.4 725.8 82.9 780.2 117.2 826 161.4 871.8 205.5 908.2 258.4 933 317H933C970.9 406.7 979.9 505.9 959 601 938 696.1 888 782.3 816 847.8 743.9 913.3 653.3 954.8 556.6 966.5 460.4 978.3 362.9 959.9 277.5 914.1L93.1 949.9C90.3 950.6 87.5 951 84.7 951V951C79.6 951 74.7 949.9 70.1 947.7 65.6 945.4 61.7 942.2 58.6 938.2 55.6 934.2 53.4 929.6 52.4 924.6 51.5 919.7 51.6 914.7 52.9 909.9L85.9 722.5C56 666.8 37.7 605.7 31.9 542.7 26.2 479.4 33.3 415.5 53 355 72.6 294.5 104.3 238.6 146.2 190.7 188.1 142.8 239.3 103.9 296.6 76.3 354 48.8 416.3 33.2 479.9 30.4ZM500 95.6C277.1 95.6 95.7 277.1 95.7 500 95.7 570.8 114.2 640.3 149.4 701.7 153.8 709.2 155 718.1 152.7 726.5L152.8 726.5 115 868.8C112.4 878.7 121.4 887.7 131.3 885.1L273.5 847.3C276.3 846.6 279.1 846.2 282 846.2 287.7 846.2 293.4 847.7 298.3 850.6 359.7 885.9 429.2 904.4 500 904.4 722.9 904.4 904.3 723 904.3 500 904.3 277.1 722.9 95.6 500 95.6ZM559 487.2C559 497.8 555.8 508.2 549.9 517.1 544 526 535.6 532.9 525.7 536.9 515.9 541 505.1 542.1 494.6 540 484.2 537.9 474.6 532.8 467.1 525.3 459.5 517.7 454.4 508.1 452.3 497.7 450.2 487.2 451.3 476.4 455.4 466.6 459.5 456.7 466.4 448.3 475.2 442.4 484.1 436.5 494.5 433.3 505.1 433.3 519.4 433.3 533.1 439 543.2 449.1 553.3 459.2 559 472.9 559 487.2ZM525.6 487.2C525.6 491.2 524.4 495.2 522.2 498.6L577.6 535.6C587.2 521.3 592.3 504.4 592.3 487.2H525.6ZM522.2 498.6C519.9 502 516.7 504.6 513 506.1L538.5 567.7C554.4 561.1 568 550 577.6 535.6L522.2 498.6ZM513 506.1C509.2 507.7 505.1 508.1 501.1 507.3L488.1 572.7C505 576 522.6 574.3 538.5 567.7L513 506.1ZM501.1 507.3C497.1 506.5 493.5 504.6 490.6 501.7L443.5 548.8C455.7 561 471.2 569.3 488.1 572.7L501.1 507.3ZM490.6 501.7C487.8 498.8 485.8 495.2 485 491.2L419.6 504.2C423 521.1 431.3 536.6 443.5 548.8L490.6 501.7ZM485 491.2C484.2 487.2 484.6 483.1 486.2 479.3L424.6 453.8C418 469.7 416.3 487.3 419.6 504.2L485 491.2ZM486.2 479.3C487.7 475.6 490.4 472.4 493.7 470.1L456.7 414.7C442.4 424.3 431.2 437.9 424.6 453.8L486.2 479.3ZM493.7 470.1C497.1 467.9 501.1 466.7 505.1 466.7V400C487.9 400 471 405.1 456.7 414.7L493.7 470.1ZM505.1 466.7C510.6 466.7 515.8 468.8 519.6 472.7L566.8 425.5C550.4 409.2 528.3 400 505.1 400V466.7ZM519.6 472.7C523.5 476.5 525.6 481.7 525.6 487.2H592.3C592.3 464.1 583.1 441.9 566.8 425.5L519.6 472.7ZM759 487.2C759 497.8 755.8 508.2 749.9 517.1 744 526 735.6 532.9 725.7 536.9 715.9 541 705.1 542.1 694.6 540 684.2 537.9 674.6 532.8 667.1 525.3 659.5 517.7 654.4 508.1 652.3 497.7 650.2 487.2 651.3 476.4 655.4 466.6 659.5 456.7 666.4 448.3 675.2 442.4 684.1 436.5 694.5 433.3 705.1 433.3 719.4 433.3 733.1 439 743.2 449.1 753.3 459.2 759 472.9 759 487.2ZM725.6 487.2C725.6 491.2 724.4 495.2 722.2 498.6L777.6 535.6C787.2 521.3 792.3 504.4 792.3 487.2H725.6ZM722.2 498.6C719.9 502 716.7 504.6 713 506.1L738.5 567.7C754.4 561.1 768 550 777.6 535.6L722.2 498.6ZM713 506.1C709.2 507.7 705.1 508.1 701.1 507.3L688.1 572.7C705 576 722.6 574.3 738.5 567.7L713 506.1ZM701.1 507.3C697.1 506.5 693.5 504.6 690.6 501.7L643.5 548.8C655.7 561 671.2 569.3 688.1 572.7L701.1 507.3ZM690.6 501.7C687.8 498.8 685.8 495.2 685 491.2L619.6 504.2C623 521.1 631.3 536.6 643.5 548.8L690.6 501.7ZM685 491.2C684.2 487.2 684.6 483.1 686.2 479.3L624.6 453.8C618 469.7 616.3 487.3 619.6 504.2L685 491.2ZM686.2 479.3C687.7 475.6 690.4 472.4 693.7 470.1L656.7 414.7C642.4 424.3 631.2 437.9 624.6 453.8L686.2 479.3ZM693.7 470.1C697.1 467.9 701.1 466.7 705.1 466.7V400C687.9 400 671 405.1 656.7 414.7L693.7 470.1ZM705.1 466.7C710.6 466.7 715.8 468.8 719.6 472.7L766.8 425.5C750.4 409.2 728.3 400 705.1 400V466.7ZM719.6 472.7C723.5 476.5 725.6 481.7 725.6 487.2H792.3C792.3 464.1 783.1 441.9 766.8 425.5L719.6 472.7Z",
"width": 1000
},
"search": [
"icon"
]
},
{
"uid": "c2dafca4f49d11a68d647573fb4b3c0c",
"css": "listen",
@@ -1201,6 +1187,20 @@
"search": [
"icon"
]
},
{
"uid": "ec2a0c653e4ea9982cbdf60ea596704c",
"css": "chat",
"code": 59477,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M320.5 450C330.4 450 339.8 453.9 346.8 460.9 353.8 467.9 357.7 477.3 357.7 487.2 357.7 494.5 355.5 501.7 351.4 507.8 347.3 514 341.5 518.7 334.7 521.5 327.9 524.3 320.5 525.1 313.2 523.6 306 522.2 299.4 518.7 294.2 513.5 289 508.3 285.5 501.6 284 494.4 282.6 487.2 283.4 479.7 286.2 472.9 289 466.2 293.8 460.3 299.9 456.3 306 452.2 313.2 450 320.5 450ZM479.9 30.4C543.4 27.7 606.8 37.9 666.3 60.4 725.8 82.9 780.2 117.2 826 161.4 871.8 205.5 908.2 258.4 933 317H933C970.9 406.7 979.9 505.9 959 601 938 696.1 888 782.3 816 847.8 743.9 913.3 653.3 954.8 556.6 966.5 460.4 978.3 362.9 959.9 277.5 914.1L93.1 949.9C90.3 950.6 87.5 951 84.7 951V951C79.6 951 74.7 949.9 70.1 947.7 65.6 945.4 61.7 942.2 58.6 938.2 55.6 934.2 53.4 929.6 52.4 924.6 51.5 919.7 51.6 914.7 52.9 909.9L85.9 722.5C56 666.8 37.7 605.7 31.9 542.7 26.2 479.4 33.3 415.5 53 355 72.6 294.5 104.3 238.6 146.2 190.7 188.1 142.8 239.3 103.9 296.6 76.3 354 48.8 416.3 33.2 479.9 30.4ZM500 95.6C277.1 95.6 95.7 277.1 95.7 500 95.7 570.8 114.2 640.3 149.4 701.7 153.8 709.2 155 718.1 152.7 726.5L152.8 726.5 115 868.8C112.4 878.7 121.4 887.7 131.3 885.1L273.5 847.3C276.3 846.6 279.1 846.2 282 846.2 287.7 846.2 293.4 847.7 298.3 850.6 359.7 885.9 429.2 904.4 500 904.4 722.9 904.4 904.3 723 904.3 500 904.3 277.1 722.9 95.6 500 95.6ZM559 487.2C559 497.8 555.8 508.2 549.9 517.1 544 526 535.6 532.9 525.7 536.9 515.9 541 505.1 542.1 494.6 540 484.2 537.9 474.6 532.8 467.1 525.3 459.5 517.7 454.4 508.1 452.3 497.7 450.2 487.2 451.3 476.4 455.4 466.6 459.5 456.7 466.4 448.3 475.2 442.4 484.1 436.5 494.5 433.3 505.1 433.3 519.4 433.3 533.1 439 543.2 449.1 553.3 459.2 559 472.9 559 487.2ZM759 487.2C759 497.8 755.8 508.2 749.9 517.1 744 526 735.6 532.9 725.7 536.9 715.9 541 705.1 542.1 694.6 540 684.2 537.9 674.6 532.8 667.1 525.3 659.5 517.7 654.4 508.1 652.3 497.7 650.2 487.2 651.3 476.4 655.4 466.6 659.5 456.7 666.4 448.3 675.2 442.4 684.1 436.5 694.5 433.3 705.1 433.3 719.4 433.3 733.1 439 743.2 449.1 753.3 459.2 759 472.9 759 487.2Z",
"width": 1000
},
"search": [
"icon"
]
}
]
}

View File

@@ -13,6 +13,7 @@ class CustomDropdown extends StatelessWidget {
final double height;
final double width;
final Color? color;
final EdgeInsets? padding;
const CustomDropdown({
super.key,
@@ -26,6 +27,7 @@ class CustomDropdown extends StatelessWidget {
this.width = double.infinity,
this.height = 70,
this.color,
this.padding,
});
@override
@@ -60,7 +62,7 @@ class CustomDropdown extends StatelessWidget {
disabledBorder: border(borderColor),
errorBorder: border(borderColor),
focusedErrorBorder: border(borderColor),
contentPadding: const EdgeInsets.symmetric(
contentPadding: padding ?? const EdgeInsets.symmetric(
horizontal: 12,
vertical: 16,
),

View File

@@ -90,6 +90,7 @@ class SFIcons {
static const IconData screenTime = IconData(0xe851, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData friendsCircle = IconData(0xe852, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData temperature = IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData chat = IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData locationOutlined = IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData share = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData favoriteOutlined = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg);
@@ -109,6 +110,5 @@ class SFIcons {
static const IconData healthCircle = IconData(0xe887, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rewardsCircle = IconData(0xe888, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData locateSfCircle = IconData(0xe889, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData chat = IconData(0xe88a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData lightbulbOutline = IconData(0xe8a8, fontFamily: _kFontFam, fontPackage: _kFontPkg);
}

View File

@@ -21,8 +21,10 @@ class AppRoutes {
static const accountSettings = '$legacy/account_settings';
static const personalData = '$accountSettings/personal_data';
static const changePassword = '$accountSettings/change_password';
static const linkedDevices = '$accountSettings/linked_devices';
static const appUsers = '$accountSettings/app_users';
static const deleteAccount = '$accountSettings/delete_account';
static const legacyDashboard = '$legacy/dashboard';

View File

@@ -136,7 +136,7 @@
"functions": "Functions",
"accountSettings": "Account Settings",
"deviceSettings": "Device Settings",
"watchesOnMap": "Smartwatch on the map",
"watchesOnMap": "Smartwatch on the map:",
"home": "Home",
"location": "Location",
"chat": "Chat",
@@ -155,16 +155,18 @@
"enterMessage": "Your message",
"sendEmail": "Send!",
"personalData": "Personal Data",
"changePassword": "Change password",
"addNewSF": "Add a new SaveFamily",
"linkedDevices": "Linked Devices",
"appUsers": "App Users",
"privacyPolicy": "User privacy policy",
"regCode": "Device registration code",
"deleteAccount": "Delete account",
"logOut": "Log out",
"loginEmail": "(Login email)",
"userNameLabel": "User name",
"userPhoneLabel": "User phone number",
"contactEmailLabel": "Contact email",
"passwordLabel": "Password (6 to 12 digits)",
"submit": "Submit",
"save": "Save",
"editDeviceTitle": "Edit Device",
@@ -173,5 +175,8 @@
"cancel": "Cancel",
"delete": "Delete",
"userAccount": "Account: {email}",
"userRole": "Role: {role}"
"userRole": "Role: {role}",
"copy": "copy",
"deviceIdLabel": "ID: {deviceId}",
"regCodeLabel": "Registration code: {regCode}"
}

View File

@@ -136,7 +136,7 @@
"functions": "Funciones",
"accountSettings": "Perfil de cuenta",
"deviceSettings": "Ajustes",
"watchesOnMap": "Reloj inteligente en el mapa",
"watchesOnMap": "Reloj inteligente en el mapa:",
"home": "Inicio",
"location": "Mapa",
"chat": "Chat",
@@ -155,15 +155,15 @@
"enterMessage": "Tu mensaje",
"sendEmail": "Enviar",
"personalData": "Datos Personales",
"addNewSF": "Añadir un nuevo SaveFamily",
"changePassword": "Cambiar contraseña",
"addNewSF": "Agregar un nuevo SaveFamily",
"linkedDevices": "Dispositivos vinculados",
"appUsers": "Usuarios de la App",
"privacyPolicy": "Política de privacidad",
"appUsers": "Usuarios de la aplicación",
"privacyPolicy": "Política de privacidad del usuario",
"regCode": "Código de registro del dispositivo",
"deleteAccount": "Eliminar cuenta",
"logOut": "Cerrar sesión",
"loginEmail": "(Correo electrónico)",
"userNameLabel": "Nombre del usuario",
"userPhoneLabel": "Número de teléfono del usuario",
"contactEmailLabel": "Correo de contacto",
"passwordLabel": "Contraseña (de 6 a 12 caracteres)",
"submit": "Enviar",
"save": "Guardar",
@@ -173,5 +173,16 @@
"cancel": "Cancelar",
"delete": "Eliminar",
"userAccount": "Cuenta: {email}",
"userRole": "Rol: {role}"
"userRole": "Rol: {role}",
"copy": "copiar",
"deviceIdLabel": "ID: {deviceId}",
"regCodeLabel": "Código de registro: {regCode}",
"deleteAccountBody1": "Cancelar una cuenta es una operación irreversible. Confirma que todos los servicios relacionados con la cuenta se hayan gestionado correctamente.\n\nDespués de cancelar tu cuenta, ya no podrás usar esta cuenta ni recuperar ningún contenido o información que hayas agregado o vinculado (incluso si usas la misma cuenta para registrarse y volver a usar), incluídos, entre otros:\n1. No podrás iniciar sesión y usar esta cuenta.\n2. La información personal y la información histórica de tu cuenta no se recuperarán.\n3. No se pueden recuperar todos los registros de servicios de terceros que utiliza a través de la vinculación de cuenta o la vinculación de cuenta. Ya no podrás iniciar sesión y utilizar los servicios mencionados anteriormente. El amor, las monedas de oro, los puntos de terceros, los pedidos, los boletos y otros cupones que hayas recibido se considerarán abandonados y no se utilizarán.\n\nTen en cuenta que cancelar tu cuenta no significa que el comportamiento de la cuenta y las responsabilidades relacionadas antes de la cancelación de esta cuenta estén exentas o reducidas.",
"deleteAccountBody2": "Hacer clic en \"Solicitar la cancelación de mi cuenta\" significa que has leído y estás de acuerdo con la descripción anterior.",
"requestCancelButton": "Solicitar la cancelación de mi cuenta",
"verifyAccount": "Verificación de la cuenta,",
"requestCancelTitle": "Solicitud de cancelación de la cuenta",
"requestCancelBody": "1. La cancelación de la cuenta no es la recuperación operacional, asegúrate de que antes de operar la cuenta ya no se utiliza.\n2. Enviado correctamente una cancelación de la cuenta de la aplicación, la plataforma se eliminará toda la información relacionada con tu cuenta dentro de 1 hora.",
"deleteDeviceData": "Borrar toda la información relacionada con el dispositivo de {name}",
"confirm": "Confirmar"
}

View File

@@ -185,15 +185,12 @@ class I18n {
static const String enterMessage = 'enterMessage';
static const String sendEmail = 'sendEmail';
static const String legacyPersonalData = 'personalData';
static const String legacyChangePassword = 'changePassword';
static const String legacyAddNewSF = 'addNewSF';
static const String legacyLinkedDevices = 'linkedDevices';
static const String legacyAppUsers = 'appUsers';
static const String legacyPrivacyPolicy = 'privacyPolicy';
static const String legacyLogOut = 'logOut';
static const String legacyLoginEmail = 'loginEmail';
static const String legacyUserNameLabel = 'userNameLabel';
static const String legacyUserPhoneLabel = 'userPhoneLabel';
static const String legacyContactEmailLabel = 'contactEmailLabel';
static const String passwordLabel = 'passwordLabel';
static const String legacySubmit = 'submit';
static const String legacySave = 'save';
@@ -205,4 +202,17 @@ class I18n {
static const String legacyDelete = 'delete';
static const String legacyUserAccount = 'userAccount';
static const String legacyUserRole = 'userRole';
static const String legacyCopy = 'copy';
static const String legacyDeviceIdLabel = 'deviceIdLabel';
static const String legacyRegCodeLabel = 'regCodeLabel';
static const String legacyRegCode = 'regCode';
static const String legacyDeleteAccount = 'deleteAccount';
static const String legacyDeleteAccountBody1 = 'deleteAccountBody1';
static const String legacyDeleteAccountBody2 = 'deleteAccountBody2';
static const String legacyRequestCancelButton = 'requestCancelButton';
static const String legacyVerifyAccount = 'verifyAccount';
static const String legacyRequestCancelTitle = 'requestCancelTitle';
static const String legacyRequestCancelBody = 'requestCancelBody';
static const String legacyDeleteDeviceData = 'deleteDeviceData';
static const String legacyConfirm = 'confirm';
}