Added selected device provider, applied page_layout to account screens
This commit is contained in:
@@ -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: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';
|
||||
|
||||
@@ -5,7 +5,7 @@ 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: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 +21,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 +29,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(
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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: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';
|
||||
|
||||
@@ -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: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';
|
||||
|
||||
@@ -17,6 +17,8 @@ class AccountSettingsScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final selectedDevice = ref.watch(selectedDeviceProvider);
|
||||
|
||||
return PageLayout(
|
||||
title: context.translate(I18n.accountSettings),
|
||||
body: SingleChildScrollView(child: Container(
|
||||
@@ -66,7 +68,7 @@ class AccountSettingsScreen extends ConsumerWidget {
|
||||
onPressed: (){
|
||||
showDialog(context: context, builder: (context)=>Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: RegCodeDialog(regCode: 'regCode', deviceId: 'deviceId', name: 'name'),
|
||||
child: RegCodeDialog(regCode: selectedDevice?.id ?? '', deviceId: selectedDevice?.identificator ?? '', name: selectedDevice?.carrierName ?? ''),
|
||||
));
|
||||
},
|
||||
icon: Icons.qr_code,
|
||||
|
||||
@@ -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
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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
|
||||
@@ -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});
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
],
|
||||
))
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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),
|
||||
)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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';
|
||||
|
||||
|
||||
@@ -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)
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
116
modules/legacy/modules/account/pubspec.yaml
Normal file
116
modules/legacy/modules/account/pubspec.yaml
Normal file
@@ -0,0 +1,116 @@
|
||||
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
|
||||
|
||||
# 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
|
||||
117
modules/legacy/modules/customer_service/pubspec.yaml
Normal file
117
modules/legacy/modules/customer_service/pubspec.yaml
Normal 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
|
||||
@@ -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});
|
||||
|
||||
@@ -4,8 +4,8 @@ import 'package:dio/dio.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:legacy_shared/legacy_shared.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
|
||||
class HomeRemoteDatasourceImpl implements HomeRemoteDatasource {
|
||||
|
||||
@@ -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,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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});
|
||||
|
||||
@@ -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,
|
||||
});
|
||||
}
|
||||
@@ -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});
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -6,6 +6,7 @@ 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';
|
||||
@@ -49,7 +50,7 @@ class HubScreen extends ConsumerWidget {
|
||||
width: SizeUtils.getByScreen(small: 104, big: 100),
|
||||
height: 32,
|
||||
child: CustomDropdown(
|
||||
items: viewState.devices.map((device)=>
|
||||
items: viewState.devices.map((DeviceEntity device)=>
|
||||
Text(device.carrierName)
|
||||
).toList(),
|
||||
values: viewState.devices,
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
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/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:legacy_shared/legacy_shared.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
|
||||
@@ -20,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
|
||||
@@ -27,11 +29,17 @@ 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){
|
||||
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
|
||||
@@ -75,6 +83,8 @@ class HubViewModel extends Notifier<HubViewState> {
|
||||
selectedDevice: device,
|
||||
selectedPosition: selectedPosition,
|
||||
);
|
||||
|
||||
selectedDeviceNotifier.setSelectedDevice(device);
|
||||
}
|
||||
|
||||
void disposeControllers(){
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
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,
|
||||
DeviceEntity? selectedDevice,
|
||||
@Default([]) List<PositionEntity> positions,
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$HubViewState {
|
||||
|
||||
List<DeviceEntity> get devices; DeviceEntity? get selectedDevice; List<PositionEntity> get positions; PositionEntity? get selectedPosition;
|
||||
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)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.positions, positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition));
|
||||
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),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition);
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)';
|
||||
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, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
|
||||
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
|
||||
});
|
||||
|
||||
|
||||
$PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||
$UserEntityCopyWith<$Res>? get loggedUser;$DeviceEntityCopyWith<$Res>? get selectedDevice;$PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
@@ -62,9 +62,10 @@ 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? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) {
|
||||
@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
|
||||
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
|
||||
@@ -75,6 +76,30 @@ as PositionEntity?,
|
||||
/// 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;
|
||||
@@ -165,10 +190,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition)? $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.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -186,10 +211,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition) $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.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -206,10 +231,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition)? $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.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -221,9 +246,10 @@ return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selecte
|
||||
|
||||
|
||||
class _HubViewState implements HubViewState {
|
||||
const _HubViewState({final List<DeviceEntity> devices = const [], this.selectedDevice, final List<PositionEntity> positions = const [], this.selectedPosition}): _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;
|
||||
@@ -251,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)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition));
|
||||
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),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition);
|
||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'HubViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)';
|
||||
return 'HubViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition)';
|
||||
}
|
||||
|
||||
|
||||
@@ -271,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, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
|
||||
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition
|
||||
});
|
||||
|
||||
|
||||
@override $PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||
@override $UserEntityCopyWith<$Res>? get loggedUser;@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
@@ -288,9 +314,10 @@ 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? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,}) {
|
||||
@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
|
||||
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
|
||||
@@ -302,6 +329,30 @@ as PositionEntity?,
|
||||
/// 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;
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
|
||||
@@ -167,7 +167,6 @@
|
||||
"userNameLabel": "User name",
|
||||
"userPhoneLabel": "User phone number",
|
||||
"contactEmailLabel": "Contact email",
|
||||
"passwordLabel": "Password (6 to 12 digits)",
|
||||
"submit": "Submit",
|
||||
"save": "Save",
|
||||
"editDeviceTitle": "Edit Device",
|
||||
|
||||
@@ -164,9 +164,6 @@
|
||||
"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",
|
||||
|
||||
@@ -191,10 +191,6 @@ class I18n {
|
||||
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';
|
||||
|
||||
Reference in New Issue
Block a user