Compare commits

...

1 Commits

Author SHA1 Message Date
48fd0c3cc8 Activity meter 2026-03-03 13:34:39 +01:00
42 changed files with 3123 additions and 68 deletions

View File

@@ -69,6 +69,12 @@ void configureAppRouter() {
name: 'locate_device',
pageBuilder: LocateDeviceBuilder().buildPage,
),
GoRoute(
path: AppRoutes.activityMeter,
name: 'activity_meter',
pageBuilder: ActivityMeterBuilder().buildPage,
),
GoRoute(
path: AppRoutes.accountSettings,
name: 'account_settings',

View File

@@ -1,4 +1,6 @@
import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
@@ -10,4 +12,8 @@ abstract class FunctionsRemoteDatasource {
Future<PictureEntity> takePicture({required String userId});
Future<void> locateDevice({required LocateDeviceRequestEntity request});
Future<void> setPedometer({required SetPedometerRequestEntity request});
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId});
}

View File

@@ -4,7 +4,10 @@ import 'package:dio/dio.dart';
// import 'package:flutter/material.dart';
import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart';
import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/core/data/models/get_device_steps_response_model.dart';
import 'package:functions/src/core/data/models/send_command_request_model.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
@@ -110,6 +113,99 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
);
}
}
@override
Future<void> setPedometer({required SetPedometerRequestEntity request}) async {
try {
/*final body = request.toModel().toJson();
await _repository.post<void>(
'/commands',
body: body,
);*/
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.response?.data ?? 'Error to set pedometer',
);
}
}
@override
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId}) async {
try {
/*final response = await _repository.get<Map<String, dynamic>>(
'/devices/identificator/$deviceId/steps',
);
final data = response.data;
if (data == null || data.isEmpty) {
throw Exception('Empty response from /devices/identificator/:deviceId/steps');
}
final model = GetDeviceStepsResponseModel.fromJson(data);*/
final model = GetDeviceStepsResponseModel(items: [
GetDeviceStepsItemResponseModel(
id: '1',
deviceIdentificator: '1111',
steps: 200,
totalSteps: 250,
occurredAt: 1771933790000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '2',
deviceIdentificator: '1111',
steps: 500,
totalSteps: 550,
occurredAt: 1772020190000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '3',
deviceIdentificator: '1111',
steps: 200,
totalSteps: 250,
occurredAt: 1772106590000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '4',
deviceIdentificator: '1111',
steps: 1000,
totalSteps: 1050,
occurredAt: 1772192990000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '5',
deviceIdentificator: '1111',
steps: 200,
totalSteps: 250,
occurredAt: 1772279390000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '6',
deviceIdentificator: '1111',
steps: 100,
totalSteps: 150,
occurredAt: 1772365790000,
createdAt: 0
),
GetDeviceStepsItemResponseModel(
id: '7',
deviceIdentificator: '1111',
steps: 300,
totalSteps: 350,
occurredAt: 1772455790000,
createdAt: 0
),
]);
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to get steps');
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {

View File

@@ -0,0 +1,11 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'set_pedometer_request_entity.freezed.dart';
@freezed
abstract class SetPedometerRequestEntity with _$SetPedometerRequestEntity {
const factory SetPedometerRequestEntity({
required String deviceName,
}) = _SetPedometerRequestEntity;
}

View File

@@ -0,0 +1,271 @@
// 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 'set_pedometer_request_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SetPedometerRequestEntity {
String get deviceName;
/// Create a copy of SetPedometerRequestEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SetPedometerRequestEntityCopyWith<SetPedometerRequestEntity> get copyWith => _$SetPedometerRequestEntityCopyWithImpl<SetPedometerRequestEntity>(this as SetPedometerRequestEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SetPedometerRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName));
}
@override
int get hashCode => Object.hash(runtimeType,deviceName);
@override
String toString() {
return 'SetPedometerRequestEntity(deviceName: $deviceName)';
}
}
/// @nodoc
abstract mixin class $SetPedometerRequestEntityCopyWith<$Res> {
factory $SetPedometerRequestEntityCopyWith(SetPedometerRequestEntity value, $Res Function(SetPedometerRequestEntity) _then) = _$SetPedometerRequestEntityCopyWithImpl;
@useResult
$Res call({
String deviceName
});
}
/// @nodoc
class _$SetPedometerRequestEntityCopyWithImpl<$Res>
implements $SetPedometerRequestEntityCopyWith<$Res> {
_$SetPedometerRequestEntityCopyWithImpl(this._self, this._then);
final SetPedometerRequestEntity _self;
final $Res Function(SetPedometerRequestEntity) _then;
/// Create a copy of SetPedometerRequestEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? deviceName = null,}) {
return _then(_self.copyWith(
deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [SetPedometerRequestEntity].
extension SetPedometerRequestEntityPatterns on SetPedometerRequestEntity {
/// 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( _SetPedometerRequestEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _SetPedometerRequestEntity() 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( _SetPedometerRequestEntity value) $default,){
final _that = this;
switch (_that) {
case _SetPedometerRequestEntity():
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( _SetPedometerRequestEntity value)? $default,){
final _that = this;
switch (_that) {
case _SetPedometerRequestEntity() 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 deviceName)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SetPedometerRequestEntity() when $default != null:
return $default(_that.deviceName);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 deviceName) $default,) {final _that = this;
switch (_that) {
case _SetPedometerRequestEntity():
return $default(_that.deviceName);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 deviceName)? $default,) {final _that = this;
switch (_that) {
case _SetPedometerRequestEntity() when $default != null:
return $default(_that.deviceName);case _:
return null;
}
}
}
/// @nodoc
class _SetPedometerRequestEntity implements SetPedometerRequestEntity {
const _SetPedometerRequestEntity({required this.deviceName});
@override final String deviceName;
/// Create a copy of SetPedometerRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SetPedometerRequestEntityCopyWith<_SetPedometerRequestEntity> get copyWith => __$SetPedometerRequestEntityCopyWithImpl<_SetPedometerRequestEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SetPedometerRequestEntity&&(identical(other.deviceName, deviceName) || other.deviceName == deviceName));
}
@override
int get hashCode => Object.hash(runtimeType,deviceName);
@override
String toString() {
return 'SetPedometerRequestEntity(deviceName: $deviceName)';
}
}
/// @nodoc
abstract mixin class _$SetPedometerRequestEntityCopyWith<$Res> implements $SetPedometerRequestEntityCopyWith<$Res> {
factory _$SetPedometerRequestEntityCopyWith(_SetPedometerRequestEntity value, $Res Function(_SetPedometerRequestEntity) _then) = __$SetPedometerRequestEntityCopyWithImpl;
@override @useResult
$Res call({
String deviceName
});
}
/// @nodoc
class __$SetPedometerRequestEntityCopyWithImpl<$Res>
implements _$SetPedometerRequestEntityCopyWith<$Res> {
__$SetPedometerRequestEntityCopyWithImpl(this._self, this._then);
final _SetPedometerRequestEntity _self;
final $Res Function(_SetPedometerRequestEntity) _then;
/// Create a copy of SetPedometerRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? deviceName = null,}) {
return _then(_SetPedometerRequestEntity(
deviceName: null == deviceName ? _self.deviceName : deviceName // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,44 @@
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_device_steps_response_model.freezed.dart';
part 'get_device_steps_response_model.g.dart';
@freezed
abstract class GetDeviceStepsResponseModel with _$GetDeviceStepsResponseModel {
const factory GetDeviceStepsResponseModel({
required List<GetDeviceStepsItemResponseModel> items,
}) = _GetDeviceStepsResponseModel;
factory GetDeviceStepsResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetDeviceStepsResponseModelFromJson(json);
}
@freezed
abstract class GetDeviceStepsItemResponseModel with _$GetDeviceStepsItemResponseModel {
const factory GetDeviceStepsItemResponseModel({
required String id,
required String deviceIdentificator,
required int steps,
required int totalSteps,
required int occurredAt,
required int createdAt,
}) =
_GetDeviceStepsItemResponseModel;
factory GetDeviceStepsItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetDeviceStepsItemResponseModelFromJson(json);
}
extension GetDeviceStepsResponseModelMapper on GetDeviceStepsResponseModel {
List<ActivityEntity> toEntity() {
return items.map((GetDeviceStepsItemResponseModel item) => ActivityEntity(
id: item.id,
deviceIdentificator: item.deviceIdentificator,
steps: item.steps,
totalSteps: item.totalSteps,
occurredAt: DateTime.fromMillisecondsSinceEpoch(item.occurredAt),
createdAt: item.createdAt,
)).toList();
}
}

View File

@@ -0,0 +1,561 @@
// 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 'get_device_steps_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetDeviceStepsResponseModel {
List<GetDeviceStepsItemResponseModel> get items;
/// Create a copy of GetDeviceStepsResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetDeviceStepsResponseModelCopyWith<GetDeviceStepsResponseModel> get copyWith => _$GetDeviceStepsResponseModelCopyWithImpl<GetDeviceStepsResponseModel>(this as GetDeviceStepsResponseModel, _$identity);
/// Serializes this GetDeviceStepsResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDeviceStepsResponseModel&&const DeepCollectionEquality().equals(other.items, items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(items));
@override
String toString() {
return 'GetDeviceStepsResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class $GetDeviceStepsResponseModelCopyWith<$Res> {
factory $GetDeviceStepsResponseModelCopyWith(GetDeviceStepsResponseModel value, $Res Function(GetDeviceStepsResponseModel) _then) = _$GetDeviceStepsResponseModelCopyWithImpl;
@useResult
$Res call({
List<GetDeviceStepsItemResponseModel> items
});
}
/// @nodoc
class _$GetDeviceStepsResponseModelCopyWithImpl<$Res>
implements $GetDeviceStepsResponseModelCopyWith<$Res> {
_$GetDeviceStepsResponseModelCopyWithImpl(this._self, this._then);
final GetDeviceStepsResponseModel _self;
final $Res Function(GetDeviceStepsResponseModel) _then;
/// Create a copy of GetDeviceStepsResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,}) {
return _then(_self.copyWith(
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
as List<GetDeviceStepsItemResponseModel>,
));
}
}
/// Adds pattern-matching-related methods to [GetDeviceStepsResponseModel].
extension GetDeviceStepsResponseModelPatterns on GetDeviceStepsResponseModel {
/// 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( _GetDeviceStepsResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel() 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( _GetDeviceStepsResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel():
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( _GetDeviceStepsResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel() 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( List<GetDeviceStepsItemResponseModel> items)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel() when $default != null:
return $default(_that.items);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( List<GetDeviceStepsItemResponseModel> items) $default,) {final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel():
return $default(_that.items);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( List<GetDeviceStepsItemResponseModel> items)? $default,) {final _that = this;
switch (_that) {
case _GetDeviceStepsResponseModel() when $default != null:
return $default(_that.items);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetDeviceStepsResponseModel implements GetDeviceStepsResponseModel {
const _GetDeviceStepsResponseModel({required final List<GetDeviceStepsItemResponseModel> items}): _items = items;
factory _GetDeviceStepsResponseModel.fromJson(Map<String, dynamic> json) => _$GetDeviceStepsResponseModelFromJson(json);
final List<GetDeviceStepsItemResponseModel> _items;
@override List<GetDeviceStepsItemResponseModel> get items {
if (_items is EqualUnmodifiableListView) return _items;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_items);
}
/// Create a copy of GetDeviceStepsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetDeviceStepsResponseModelCopyWith<_GetDeviceStepsResponseModel> get copyWith => __$GetDeviceStepsResponseModelCopyWithImpl<_GetDeviceStepsResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetDeviceStepsResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDeviceStepsResponseModel&&const DeepCollectionEquality().equals(other._items, _items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items));
@override
String toString() {
return 'GetDeviceStepsResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class _$GetDeviceStepsResponseModelCopyWith<$Res> implements $GetDeviceStepsResponseModelCopyWith<$Res> {
factory _$GetDeviceStepsResponseModelCopyWith(_GetDeviceStepsResponseModel value, $Res Function(_GetDeviceStepsResponseModel) _then) = __$GetDeviceStepsResponseModelCopyWithImpl;
@override @useResult
$Res call({
List<GetDeviceStepsItemResponseModel> items
});
}
/// @nodoc
class __$GetDeviceStepsResponseModelCopyWithImpl<$Res>
implements _$GetDeviceStepsResponseModelCopyWith<$Res> {
__$GetDeviceStepsResponseModelCopyWithImpl(this._self, this._then);
final _GetDeviceStepsResponseModel _self;
final $Res Function(_GetDeviceStepsResponseModel) _then;
/// Create a copy of GetDeviceStepsResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) {
return _then(_GetDeviceStepsResponseModel(
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
as List<GetDeviceStepsItemResponseModel>,
));
}
}
/// @nodoc
mixin _$GetDeviceStepsItemResponseModel {
String get id; String get deviceIdentificator; int get steps; int get totalSteps; int get occurredAt; int get createdAt;
/// Create a copy of GetDeviceStepsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetDeviceStepsItemResponseModelCopyWith<GetDeviceStepsItemResponseModel> get copyWith => _$GetDeviceStepsItemResponseModelCopyWithImpl<GetDeviceStepsItemResponseModel>(this as GetDeviceStepsItemResponseModel, _$identity);
/// Serializes this GetDeviceStepsItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetDeviceStepsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.totalSteps, totalSteps) || other.totalSteps == totalSteps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,totalSteps,occurredAt,createdAt);
@override
String toString() {
return 'GetDeviceStepsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, totalSteps: $totalSteps, occurredAt: $occurredAt, createdAt: $createdAt)';
}
}
/// @nodoc
abstract mixin class $GetDeviceStepsItemResponseModelCopyWith<$Res> {
factory $GetDeviceStepsItemResponseModelCopyWith(GetDeviceStepsItemResponseModel value, $Res Function(GetDeviceStepsItemResponseModel) _then) = _$GetDeviceStepsItemResponseModelCopyWithImpl;
@useResult
$Res call({
String id, String deviceIdentificator, int steps, int totalSteps, int occurredAt, int createdAt
});
}
/// @nodoc
class _$GetDeviceStepsItemResponseModelCopyWithImpl<$Res>
implements $GetDeviceStepsItemResponseModelCopyWith<$Res> {
_$GetDeviceStepsItemResponseModelCopyWithImpl(this._self, this._then);
final GetDeviceStepsItemResponseModel _self;
final $Res Function(GetDeviceStepsItemResponseModel) _then;
/// Create a copy of GetDeviceStepsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? steps = null,Object? totalSteps = null,Object? occurredAt = null,Object? createdAt = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,steps: null == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int,totalSteps: null == totalSteps ? _self.totalSteps : totalSteps // ignore: cast_nullable_to_non_nullable
as int,occurredAt: null == occurredAt ? _self.occurredAt : occurredAt // ignore: cast_nullable_to_non_nullable
as int,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// Adds pattern-matching-related methods to [GetDeviceStepsItemResponseModel].
extension GetDeviceStepsItemResponseModelPatterns on GetDeviceStepsItemResponseModel {
/// 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( _GetDeviceStepsItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel() 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( _GetDeviceStepsItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel():
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( _GetDeviceStepsItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, int steps, int totalSteps, int occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, int steps, int totalSteps, int occurredAt, int createdAt) $default,) {final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel():
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, int steps, int totalSteps, int occurredAt, int createdAt)? $default,) {final _that = this;
switch (_that) {
case _GetDeviceStepsItemResponseModel() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetDeviceStepsItemResponseModel implements GetDeviceStepsItemResponseModel {
const _GetDeviceStepsItemResponseModel({required this.id, required this.deviceIdentificator, required this.steps, required this.totalSteps, required this.occurredAt, required this.createdAt});
factory _GetDeviceStepsItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetDeviceStepsItemResponseModelFromJson(json);
@override final String id;
@override final String deviceIdentificator;
@override final int steps;
@override final int totalSteps;
@override final int occurredAt;
@override final int createdAt;
/// Create a copy of GetDeviceStepsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetDeviceStepsItemResponseModelCopyWith<_GetDeviceStepsItemResponseModel> get copyWith => __$GetDeviceStepsItemResponseModelCopyWithImpl<_GetDeviceStepsItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetDeviceStepsItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetDeviceStepsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.totalSteps, totalSteps) || other.totalSteps == totalSteps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,totalSteps,occurredAt,createdAt);
@override
String toString() {
return 'GetDeviceStepsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, totalSteps: $totalSteps, occurredAt: $occurredAt, createdAt: $createdAt)';
}
}
/// @nodoc
abstract mixin class _$GetDeviceStepsItemResponseModelCopyWith<$Res> implements $GetDeviceStepsItemResponseModelCopyWith<$Res> {
factory _$GetDeviceStepsItemResponseModelCopyWith(_GetDeviceStepsItemResponseModel value, $Res Function(_GetDeviceStepsItemResponseModel) _then) = __$GetDeviceStepsItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String id, String deviceIdentificator, int steps, int totalSteps, int occurredAt, int createdAt
});
}
/// @nodoc
class __$GetDeviceStepsItemResponseModelCopyWithImpl<$Res>
implements _$GetDeviceStepsItemResponseModelCopyWith<$Res> {
__$GetDeviceStepsItemResponseModelCopyWithImpl(this._self, this._then);
final _GetDeviceStepsItemResponseModel _self;
final $Res Function(_GetDeviceStepsItemResponseModel) _then;
/// Create a copy of GetDeviceStepsItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? steps = null,Object? totalSteps = null,Object? occurredAt = null,Object? createdAt = null,}) {
return _then(_GetDeviceStepsItemResponseModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,steps: null == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int,totalSteps: null == totalSteps ? _self.totalSteps : totalSteps // ignore: cast_nullable_to_non_nullable
as int,occurredAt: null == occurredAt ? _self.occurredAt : occurredAt // ignore: cast_nullable_to_non_nullable
as int,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
// dart format on

View File

@@ -0,0 +1,44 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_device_steps_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetDeviceStepsResponseModel _$GetDeviceStepsResponseModelFromJson(
Map<String, dynamic> json,
) => _GetDeviceStepsResponseModel(
items: (json['items'] as List<dynamic>)
.map(
(e) =>
GetDeviceStepsItemResponseModel.fromJson(e as Map<String, dynamic>),
)
.toList(),
);
Map<String, dynamic> _$GetDeviceStepsResponseModelToJson(
_GetDeviceStepsResponseModel instance,
) => <String, dynamic>{'items': instance.items};
_GetDeviceStepsItemResponseModel _$GetDeviceStepsItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetDeviceStepsItemResponseModel(
id: json['id'] as String,
deviceIdentificator: json['deviceIdentificator'] as String,
steps: (json['steps'] as num).toInt(),
totalSteps: (json['totalSteps'] as num).toInt(),
occurredAt: (json['occurredAt'] as num).toInt(),
createdAt: (json['createdAt'] as num).toInt(),
);
Map<String, dynamic> _$GetDeviceStepsItemResponseModelToJson(
_GetDeviceStepsItemResponseModel instance,
) => <String, dynamic>{
'id': instance.id,
'deviceIdentificator': instance.deviceIdentificator,
'steps': instance.steps,
'totalSteps': instance.totalSteps,
'occurredAt': instance.occurredAt,
'createdAt': instance.createdAt,
};

View File

@@ -1,5 +1,6 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
part 'send_command_request_model.freezed.dart';
part 'send_command_request_model.g.dart';
@@ -16,9 +17,16 @@ abstract class SendCommandRequestModel with _$SendCommandRequestModel {
}
extension SendCommandRequestModelMapper on LocateDeviceRequestEntity {
extension LocateDeviceRequestModelMapper on LocateDeviceRequestEntity {
SendCommandRequestModel toModel() => SendCommandRequestModel(
deviceName: deviceName,
command: 'FIND_DEVICE',
);
}
extension SetPedometerRequestModelMapper on SetPedometerRequestEntity {
SendCommandRequestModel toModel() => SendCommandRequestModel(
deviceName: deviceName,
command: 'SET_PEDOMETER',
);
}

View File

@@ -1,6 +1,8 @@
import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart';
import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
@@ -31,4 +33,16 @@ class FunctionsRepositoryImpl implements FunctionsRepository {
await Future<void>.delayed(const Duration(milliseconds: 2000));
return _remote.locateDevice(request: request);
}
@override
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId}) async {
await Future<void>.delayed(const Duration(milliseconds: 2000));
return _remote.getDeviceSteps(deviceId: deviceId);
}
@override
Future<void> setPedometer({required SetPedometerRequestEntity request}) async {
await Future<void>.delayed(const Duration(milliseconds: 2000));
return _remote.setPedometer(request: request);
}
}

View File

@@ -1,4 +1,6 @@
import 'package:functions/src/core/data/models/entities/locate_device_request_entity.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
@@ -10,4 +12,8 @@ abstract class FunctionsRepository {
Future<PictureEntity> takePicture({required String userId});
Future<void> locateDevice({required LocateDeviceRequestEntity request});
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId});
Future<void> setPedometer({required SetPedometerRequestEntity request}) async {}
}

View File

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

View File

@@ -0,0 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'activity_entity.freezed.dart';
@freezed
abstract class ActivityEntity with _$ActivityEntity {
const factory ActivityEntity({
required String id,
required String deviceIdentificator,
required int steps,
required int totalSteps,
required DateTime occurredAt,
required int createdAt,
}) = _ActivityEntity;
}

View File

@@ -0,0 +1,286 @@
// 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 'activity_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ActivityEntity {
String get id; String get deviceIdentificator; int get steps; int get totalSteps; DateTime get occurredAt; int get createdAt;
/// Create a copy of ActivityEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ActivityEntityCopyWith<ActivityEntity> get copyWith => _$ActivityEntityCopyWithImpl<ActivityEntity>(this as ActivityEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.totalSteps, totalSteps) || other.totalSteps == totalSteps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,totalSteps,occurredAt,createdAt);
@override
String toString() {
return 'ActivityEntity(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, totalSteps: $totalSteps, occurredAt: $occurredAt, createdAt: $createdAt)';
}
}
/// @nodoc
abstract mixin class $ActivityEntityCopyWith<$Res> {
factory $ActivityEntityCopyWith(ActivityEntity value, $Res Function(ActivityEntity) _then) = _$ActivityEntityCopyWithImpl;
@useResult
$Res call({
String id, String deviceIdentificator, int steps, int totalSteps, DateTime occurredAt, int createdAt
});
}
/// @nodoc
class _$ActivityEntityCopyWithImpl<$Res>
implements $ActivityEntityCopyWith<$Res> {
_$ActivityEntityCopyWithImpl(this._self, this._then);
final ActivityEntity _self;
final $Res Function(ActivityEntity) _then;
/// Create a copy of ActivityEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceIdentificator = null,Object? steps = null,Object? totalSteps = null,Object? occurredAt = null,Object? createdAt = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,steps: null == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int,totalSteps: null == totalSteps ? _self.totalSteps : totalSteps // ignore: cast_nullable_to_non_nullable
as int,occurredAt: null == occurredAt ? _self.occurredAt : occurredAt // ignore: cast_nullable_to_non_nullable
as DateTime,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
/// Adds pattern-matching-related methods to [ActivityEntity].
extension ActivityEntityPatterns on ActivityEntity {
/// 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( _ActivityEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ActivityEntity() 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( _ActivityEntity value) $default,){
final _that = this;
switch (_that) {
case _ActivityEntity():
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( _ActivityEntity value)? $default,){
final _that = this;
switch (_that) {
case _ActivityEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, int steps, int totalSteps, DateTime occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ActivityEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String deviceIdentificator, int steps, int totalSteps, DateTime occurredAt, int createdAt) $default,) {final _that = this;
switch (_that) {
case _ActivityEntity():
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String deviceIdentificator, int steps, int totalSteps, DateTime occurredAt, int createdAt)? $default,) {final _that = this;
switch (_that) {
case _ActivityEntity() when $default != null:
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.totalSteps,_that.occurredAt,_that.createdAt);case _:
return null;
}
}
}
/// @nodoc
class _ActivityEntity implements ActivityEntity {
const _ActivityEntity({required this.id, required this.deviceIdentificator, required this.steps, required this.totalSteps, required this.occurredAt, required this.createdAt});
@override final String id;
@override final String deviceIdentificator;
@override final int steps;
@override final int totalSteps;
@override final DateTime occurredAt;
@override final int createdAt;
/// Create a copy of ActivityEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ActivityEntityCopyWith<_ActivityEntity> get copyWith => __$ActivityEntityCopyWithImpl<_ActivityEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.totalSteps, totalSteps) || other.totalSteps == totalSteps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
}
@override
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,totalSteps,occurredAt,createdAt);
@override
String toString() {
return 'ActivityEntity(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, totalSteps: $totalSteps, occurredAt: $occurredAt, createdAt: $createdAt)';
}
}
/// @nodoc
abstract mixin class _$ActivityEntityCopyWith<$Res> implements $ActivityEntityCopyWith<$Res> {
factory _$ActivityEntityCopyWith(_ActivityEntity value, $Res Function(_ActivityEntity) _then) = __$ActivityEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String deviceIdentificator, int steps, int totalSteps, DateTime occurredAt, int createdAt
});
}
/// @nodoc
class __$ActivityEntityCopyWithImpl<$Res>
implements _$ActivityEntityCopyWith<$Res> {
__$ActivityEntityCopyWithImpl(this._self, this._then);
final _ActivityEntity _self;
final $Res Function(_ActivityEntity) _then;
/// Create a copy of ActivityEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceIdentificator = null,Object? steps = null,Object? totalSteps = null,Object? occurredAt = null,Object? createdAt = null,}) {
return _then(_ActivityEntity(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
as String,steps: null == steps ? _self.steps : steps // ignore: cast_nullable_to_non_nullable
as int,totalSteps: null == totalSteps ? _self.totalSteps : totalSteps // ignore: cast_nullable_to_non_nullable
as int,occurredAt: null == occurredAt ? _self.occurredAt : occurredAt // ignore: cast_nullable_to_non_nullable
as DateTime,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as int,
));
}
}
// dart format on

View File

@@ -0,0 +1,5 @@
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
abstract class GetDeviceStepsUseCase {
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId});
}

View File

@@ -0,0 +1,14 @@
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/activity_meter/domain/get_device_steps_use_case.dart';
class GetDeviceStepsUseCaseImpl implements GetDeviceStepsUseCase {
GetDeviceStepsUseCaseImpl(this._repository);
final FunctionsRepository _repository;
@override
Future<List<ActivityEntity>> getDeviceSteps({required String deviceId}) {
return _repository.getDeviceSteps(deviceId: deviceId);
}
}

View File

@@ -0,0 +1,5 @@
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
abstract class SetPedometerUseCase {
Future<void> setPedometer({required SetPedometerRequestEntity request});
}

View File

@@ -0,0 +1,14 @@
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
import 'package:functions/src/features/activity_meter/domain/set_pedometer_use_case.dart';
class SetPedometerUseCaseImpl implements SetPedometerUseCase {
SetPedometerUseCaseImpl(this._repository);
final FunctionsRepository _repository;
@override
Future<void> setPedometer({required SetPedometerRequestEntity request}) {
return _repository.setPedometer(request: request);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/core/providers/functions_repository_provider.dart';
import 'package:functions/src/features/activity_meter/domain/get_device_steps_use_case.dart';
import 'package:functions/src/features/activity_meter/domain/get_device_steps_use_case_impl.dart';
final getDeviceStepsUseCaseProvider = Provider.autoDispose<GetDeviceStepsUseCase>((ref) {
final functionsRepository = ref.read(functionsRepositoryProvider);
return GetDeviceStepsUseCaseImpl(functionsRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/core/providers/functions_repository_provider.dart';
import 'package:functions/src/features/activity_meter/domain/set_pedometer_use_case.dart';
import 'package:functions/src/features/activity_meter/domain/set_pedometer_use_case_impl.dart';
final setPedometerUseCaseProvider = Provider.autoDispose<SetPedometerUseCase>((ref) {
final functionsRepository = ref.read(functionsRepositoryProvider);
return SetPedometerUseCaseImpl(functionsRepository);
});

View File

@@ -0,0 +1,155 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/activity_meter/presentation/state/activity_meter_view_model.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:utils/utils.dart';
class ActivityChartScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
// final theme = ref.watch(themePortProvider);
final state = ref.watch(activityMeterViewModelProvider);
return PageLayout(
title: 'Ver tus datos semanales',
body: SingleChildScrollView(child: Padding(
padding: EdgeInsets.symmetric(horizontal: SizeUtils.getByScreen(small: 8, big: 6)),
child: Column(
children: [
ChartCard(title: 'Pasos', data: state.weekActivity),
SizedBox(height: SizeUtils.getByScreen(small: 10, big: 8)),
ChartCard(title: 'Vueltas al dormir', data: state.weekActivity),
Text('Los datos que se muestran en los gráficos se actualizan automáticamente cada semana',
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 13, big: 12),
fontWeight: FontWeight.w500
),
)
],
)
)),
);
}
}
class ChartCard extends StatelessWidget {
final String title;
final List<ActivityEntity> data;
const ChartCard({
required this.title,
required this.data,
});
@override
Widget build(BuildContext context) {
final weekDays = ["MO", "TU", "WE", "TH", "FR", "SA", "SU"];
final mean = data.fold(
0.0,
(s, activity) => s + activity.totalSteps/data.length
).round();
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 16, big: 15))),
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 14, vertical: 18),
big: EdgeInsets.symmetric(horizontal: 13, vertical: 16),
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(title,
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: SizeUtils.getByScreen(small: 18, big: 17)
),
),
Text(data.isNotEmpty ? data.last.totalSteps.toString() : '0',
style: TextStyle(
fontWeight: FontWeight.w500,
fontSize: SizeUtils.getByScreen(small: 18, big: 17)
),
),
],
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('promedio: $mean'),
Text('hoy'),
],
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
SizedBox(
height: SizeUtils.getByScreen(small: 270, big: 260),
child: BarChart(
BarChartData(
barGroups: data.map((activity) =>
BarChartGroupData(
x: activity.occurredAt.weekday - 1,
barRods: [BarChartRodData(
toY: activity.totalSteps.toDouble(),
color: Color(0xFF588EA5)
)]
)
).toList(),
titlesData: FlTitlesData(
bottomTitles: AxisTitles(
axisNameSize: 12,
sideTitles: SideTitles(
showTitles: true,
getTitlesWidget: (double value, TitleMeta meta){
String text = weekDays[value.toInt()];
return SideTitleWidget(
space: 0,
meta: meta,
child: Container(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
padding: EdgeInsets.all(4),
child: Center(child: Text(text,
style: TextStyle(
fontSize: 12,
color: Colors.white
)
))
),
);
},
),
),
leftTitles: AxisTitles(),
topTitles: AxisTitles(),
rightTitles: AxisTitles()
),
borderData: FlBorderData(
show: false,
),
gridData: FlGridData(
drawVerticalLine: false,
),
// maxY: data.fold(10, (s, x) => max(s!, x as double)),
// minY: 0,
),
),
),
],
),
);
}
}

View File

@@ -0,0 +1,258 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/features/activity_meter/presentation/screens/activity_chart_screen.dart';
import 'package:functions/src/features/activity_meter/presentation/screens/activity_settings_screen.dart';
import 'package:functions/src/features/activity_meter/presentation/state/activity_meter_view_model.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class ActivityMeterScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const ActivityMeterScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final viewModel = ref.read(activityMeterViewModelProvider.notifier);
final viewState = ref.watch(activityMeterViewModelProvider);
return PageLayout(
title: context.translate(I18n.activityMeter),
body: SingleChildScrollView(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22),
big: EdgeInsets.symmetric(horizontal: 21)
),
child: Column(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(SFIcons.functions, size: SizeUtils.getByScreen(small: 28, big: 26)),
SizedBox(width: SizeUtils.getByScreen(small: 14, big: 12)),
Text('Activar/desactivar'),
],
),
Switch(value: viewState.enabled, onChanged: viewModel.toggleEnabled)
],
),
SingleChildScrollView(child: Column(
children: [
GestureDetector(
onTap: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ActivityChartScreen(),
),
);
},
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 16),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 14)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: Color(0xFF588EA5),
),
child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
height: 68,
width: 68,
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
child: Icon(SFIcons.barChart,
size: SizeUtils.getByScreen(small: 36, big: 34),
color: Color(0xFF588EA5),
weight: 30,
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Text(context.translate('Ver tus datos semanales'),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500,
color: Colors.white
)
)
)
],
),
)
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
AppSectionButton(
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ActivitySettingsScreen(),
),
);
},
icon: SFIcons.steps,
iconSize: SizeUtils.getByScreen(small: 46, big: 44),
text: 'Movimiento',
amount: viewState.selectedActivity?.totalSteps ?? 0,
unit: 'Pasos'
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
AppSectionButton(
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ActivitySettingsScreen(),
),
);
},
icon: Icons.directions_run_rounded,
iconSize: SizeUtils.getByScreen(small: 46, big: 44),
text: 'Ejercicio',
amount: viewState.selectedActivity?.totalSteps ?? 0,
unit: 'Calorías'
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
AppSectionButton(
onPressed: (){
Navigator.push(
context,
MaterialPageRoute(
builder: (_) => ActivitySettingsScreen(),
),
);
},
icon: SFIcons.distance,
iconSize: SizeUtils.getByScreen(small: 46, big: 44),
text: 'Distancia',
amount: viewState.selectedActivity?.totalSteps ?? 0,
unit: 'Metros'
),
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 6)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.sleep,
iconSize: SizeUtils.getByScreen(small: 30, big: 28),
text: 'Movimiento dormido',
amount: viewState.selectedActivity?.totalSteps ?? 0,
unit: 'Veces'
),
],
))
],
),
)),
footer: IconButton(
onPressed: () async {
viewModel.pickDate(context);
},
icon: Icon(
SFIcons.calendarCircle,
size: SizeUtils.getByScreen(small: 66, big: 64),
color: Color(0xFF588EA5),
)
),
);
}
}
class AppSectionButton extends ConsumerWidget {
final GestureTapCallback onPressed;
final IconData icon;
final double iconSize;
final String text;
final int amount;
final String unit;
const AppSectionButton({
required this.onPressed,
required this.icon,
required this.iconSize,
required this.text,
required this.amount,
required this.unit,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
return GestureDetector(
onTap: onPressed,
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.only(left: 22, top: 16, bottom: 16),
big: EdgeInsets.only(left: 21, top: 14, bottom: 14)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
height: 68,
width: 68,
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 8, big: 12)),
child: Icon(icon,
size: iconSize,
color: Color(0xFF588EA5),
weight: 30,
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Text(context.translate(text),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 17),
fontWeight: FontWeight.w500
)
)
)
],
)),
Row(
children: [
Column(
children: [
Text(amount.toString(),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 26),
fontWeight: FontWeight.w500
)
),
Text(unit)
],
),
Icon(Icons.arrow_forward_ios_rounded,
size: SizeUtils.getByScreen(small: 48, big: 46),
)
],
)
],
)
)
);
}
}

View File

@@ -0,0 +1,436 @@
import 'package:design_system/design_system.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/features/activity_meter/presentation/state/activity_meter_view_model.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class ActivitySettingsScreen extends ConsumerWidget {
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
final state = ref.watch(activityMeterViewModelProvider);
final viewModel = ref.read(activityMeterViewModelProvider.notifier);
return PageLayout(
title: 'Ajustes de actividades',
body: Container(
color: theme.getColorFor(ThemeCode.backgroundSecondary),
padding: EdgeInsets.only(top: 12),
child: Column(
children: [
GestureDetector(
onTap: (){
showDialog(context: context, builder: (context)=>Dialog(
child: TimeEditDialog(
pickStartTime: (int index) async {
final time = await showTimePicker(
context: context,
initialTime: const TimeOfDay(hour: 00, minute: 00),
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
child: child!,
);
},
);
viewModel.setStartTime(index, time);
},
pickEndTime: (int index) async {
final time = await showTimePicker(
context: context,
initialTime: const TimeOfDay(hour: 00, minute: 00),
builder: (BuildContext context, Widget? child) {
return MediaQuery(
data: MediaQuery.of(context).copyWith(alwaysUse24HourFormat: true),
child: child!,
);
},
);
viewModel.setEndTime(index, time);
},
)
));
},
child: Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 22, vertical: 8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(Icons.access_time_filled_rounded),
SizedBox(width: 8),
Text('Ajustar Hora:')
],
),
Text('value')
],
),
),
),
GestureDetector(
onTap: (){
showDialog(context: context, builder: (context)=>Dialog(
child: NumberEditDialog(
title: 'Pasos (cm):',
controller: viewModel.stepLengthController,
errorMessage: state.errorMessage,
onSubmit: () async {
await viewModel.updateStepLength();
if (state.errorMessage.isEmpty){
Navigator.pop(context);
}
}
)
));
},
child: Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 22, vertical: 8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(SFIcons.foot, size: SizeUtils.getByScreen(small: 20, big: 18)),
SizedBox(width: 16),
Text('Pasos (cm):')
],
),
Text(state.selectedDevice?.carrierStepLength.toString() ?? '0')
],
),
),
),
GestureDetector(
onTap: (){
showDialog(context: context, builder: (context)=>Dialog(
child: NumberEditDialog(
title: 'Peso (kg):',
controller: viewModel.weightController,
errorMessage: state.errorMessage,
onSubmit: () async {
await viewModel.updateWeight();
if (state.errorMessage.isEmpty){
Navigator.pop(context);
}
}
)
));
},
child: Container(
color: theme.getColorFor(ThemeCode.backgroundPrimary),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 22, vertical: 8),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
Icon(SFIcons.scale),
SizedBox(width: 8),
Text('Peso (kg):')
],
),
Text(state.selectedDevice?.carrierWeight.toString() ?? '0')
],
),
),
),
],
),
)
);
}
}
class TimeEditDialog extends StatelessWidget {
final Function pickStartTime;
final Function pickEndTime;
const TimeEditDialog({
required this.pickStartTime,
required this.pickEndTime,
});
@override
Widget build(BuildContext context) {
return Container(
height: SizeUtils.getByScreen(small: 320, big: 300),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 24, vertical: 32),
big: EdgeInsets.symmetric(horizontal: 22, vertical: 30),
),
child: Stack(
children: [
Align(
alignment: Alignment.topRight,
child: IconButton(
padding: EdgeInsets.zero,
onPressed: (){Navigator.pop(context);},
icon: Icon(Icons.close, color: Color(0xFF588EA5))
),
),
Column(
children: [
Text(context.translate('Ajustar hora:').toUpperCase(),
style: TextStyle(color: Color(0xFF588EA5)),
),
SizedBox(height: 24),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tiempo 1',
style: TextStyle(
color: Color(0xFF588EA5),
)),
GestureDetector(
onTap: (){pickStartTime(0);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
GestureDetector(
onTap: (){pickEndTime(0);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
],
),
SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tiempo 2',
style: TextStyle(
color: Color(0xFF588EA5),
)),
GestureDetector(
onTap: (){pickStartTime(1);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
GestureDetector(
onTap: (){pickEndTime(1);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
],
),
SizedBox(height: 12),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Tiempo 3',
style: TextStyle(
color: Color(0xFF588EA5),
)),
GestureDetector(
onTap: (){pickStartTime(2);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
GestureDetector(
onTap: (){pickEndTime(2);},
child: Container(
decoration: BoxDecoration(
border: const BoxBorder.fromBorderSide(BorderSide(color: Color(0xFF588EA5))),
borderRadius: BorderRadius.all(Radius.circular(15))
),
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 6),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 4),
),
child: Text('00:00',
style: TextStyle(color: Color(0xFF588EA5)),
),
),
),
],
),
SizedBox(height: 12),
PrimaryButton(
onPressed: (){
},
height: SizeUtils.getByScreen(small: 36, big: 34),
text: 'Guardar',
color: Color(0xFF588EA5),
)
],
)
],
)
);
}
}
class NumberEditDialog extends StatelessWidget {
final String title;
final TextEditingController controller;
final VoidCallback onSubmit;
final String errorMessage;
const NumberEditDialog({
required this.title,
required this.controller,
required this.onSubmit,
required this.errorMessage,
});
@override
Widget build(BuildContext context) {
return Container(
height: SizeUtils.getByScreen(small: 20, big: 190),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(6))
),
padding: EdgeInsets.only(top: 24),
child: Stack(
children: [
Align(
alignment: Alignment.topRight,
child: IconButton(
padding: EdgeInsets.zero,
onPressed: (){Navigator.pop(context);},
icon: Icon(Icons.close)
),
),
Column(
children: [
Text(context.translate(title).toUpperCase()),
SizedBox(height: 14),
Padding(
padding: EdgeInsets.symmetric(horizontal: SizeUtils.getByScreen(small: 16, big: 14)),
child: TextField(
decoration: InputDecoration(
border: const OutlineInputBorder(
borderSide: BorderSide(color: Color(0xFF4B4B4B)),
),
),
keyboardType: TextInputType.number,
controller: controller,
),
),
if (errorMessage.isNotEmpty) ...[
const SizedBox(height: 8),
Text(
errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
SizedBox(height: 8),
Row(
children: [
Expanded(child: PrimaryButton(
height: 50,
onPressed: onSubmit,
text: 'OK',
color: Color(0xFF588EA5),
radius: 0,
)),
SizedBox(width: 8),
Expanded(child: PrimaryButton(
height: 50,
onPressed: (){
Navigator.pop(context);
},
text: context.translate(I18n.legacyCancel),
color: Color(0xFF588EA5),
radius: 0,
)),
],
),
],
)
],
)
);
}
}

View File

@@ -0,0 +1,178 @@
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:functions/src/core/data/models/entities/set_pedometer_request_entity.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:functions/src/features/activity_meter/domain/get_device_steps_use_case.dart';
import 'package:functions/src/features/activity_meter/domain/set_pedometer_use_case.dart';
import 'package:functions/src/features/activity_meter/presentation/providers/get_device_steps_use_case_provider.dart';
import 'package:functions/src/features/activity_meter/presentation/providers/set_pedometer_use_case_provider.dart';
import 'package:functions/src/features/activity_meter/presentation/state/activity_meter_view_state.dart';
import 'package:legacy_shared/legacy_shared.dart';
final activityMeterViewModelProvider =
NotifierProvider.autoDispose<ActivityMeterViewModel, ActivityMeterViewState>(
ActivityMeterViewModel.new,
);
class ActivityMeterViewModel extends Notifier<ActivityMeterViewState> {
late final GetDeviceStepsUseCase _getDeviceStepsUseCase;
late final SetPedometerUseCase _setPedometerUseCase;
late final TextEditingController stepLengthController;
late final TextEditingController weightController;
@override
ActivityMeterViewState build() {
_getDeviceStepsUseCase = ref.read(getDeviceStepsUseCaseProvider);
_setPedometerUseCase = ref.read(setPedometerUseCaseProvider);
final selectedDevice = ref.watch(selectedDeviceProvider);
_getDeviceStepsUseCase.getDeviceSteps(deviceId: selectedDevice!.identificator)
.then(setActivity);
stepLengthController = TextEditingController();
stepLengthController.text = selectedDevice.carrierStepLength.toString();
stepLengthController.addListener(_onStepLengthChanged);
weightController = TextEditingController();
weightController.text = selectedDevice.carrierWeight.toString();
weightController.addListener(_onWeightChanged);
return ActivityMeterViewState(
selectedDevice: selectedDevice,
selectedDate: DateTime.now(),
enabled: selectedDevice.capabilities?.podometer ?? false,
stepLength: selectedDevice.carrierStepLength ?? 0,
weight: selectedDevice.carrierWeight ?? 0,
);
}
void setActivity(List<ActivityEntity> activity) {
state = state.copyWith(
activityList: activity,
isLoading: false,
);
setSelectedActivity();
}
void _onStepLengthChanged(){
final value = double.tryParse(stepLengthController.text);
if (value == null || value <= 0){
state = state.copyWith(errorMessage: 'errorMessageStepLengthIsInvalid');
return;
}
if (value == state.stepLength) return;
state = state.copyWith(
stepLength: value,
);
}
void _onWeightChanged(){
final value = double.tryParse(weightController.text);
if (value == null || value <= 0){
state = state.copyWith(errorMessage: 'errorMessageWeightIsInvalid');
return;
}
if (value == state.weight) return;
state = state.copyWith(
weight: value,
);
}
bool isSameDate(DateTime a, DateTime b){
return a.year == b.year
&& a.month == b.month
&& a.day == b.day;
}
void setSelectedActivity() {
final currentDate = state.selectedDate!;
final weekAgo = DateTime(
currentDate.year,
currentDate.month,
currentDate.day - 6
);
final weekActivity = state.activityList.where(
(activity)=>activity.occurredAt.isAfter(weekAgo) && activity.occurredAt.isBefore(currentDate)
).toList();
final selectedDateActivity = state.activityList.where(
(activity)=>isSameDate(activity.occurredAt, currentDate)
);
final selectedActivity = selectedDateActivity.firstOrNull;
state = state.copyWith(
selectedActivity: selectedActivity,
weekActivity: weekActivity
);
}
Future<void> toggleEnabled(bool value) async {
try {
state = state.copyWith(isLoading: true);
SetPedometerRequestEntity request = SetPedometerRequestEntity(deviceName: state.selectedDevice!.identificator);
await _setPedometerUseCase.setPedometer(request: request);
state = state.copyWith(enabled: value, isLoading: false);
} catch (e) {
if (!ref.mounted) return;
state = state.copyWith(
isLoading: false,
errorMessage: e.toString(),
);
}
}
Future<void> pickDate(BuildContext context) async {
FocusManager.instance.primaryFocus?.unfocus();
final now = DateTime.now();
final DateTime initial = state.selectedDate ?? now;
final date = await showDatePicker(
context: context,
initialDate: initial,
firstDate: DateTime(1900, 1, 1),
lastDate: now,
);
if (!ref.mounted) return;
if (date == null) return;
state = state.copyWith(selectedDate: date, errorMessage: '');
setSelectedActivity();
}
Future<void> setStartTime(int index, TimeOfDay? value) async {
if (value == null) return;
}
Future<void> setEndTime(int index, TimeOfDay? value) async {
if (value == null) return;
}
Future<void> updateStepLength() async {
if (state.errorMessage.isNotEmpty) return;
print('FINO');
//_updateSettingsUseCase.updateSettings(request:request);
}
Future<void> updateWeight() async {
if (state.errorMessage.isNotEmpty) return;
print('FINO');
//_updateSettingsUseCase.updateSettings(request:request);
}
}

View File

@@ -0,0 +1,21 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:functions/src/features/activity_meter/domain/entities/activity_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'activity_meter_view_state.freezed.dart';
@freezed
abstract class ActivityMeterViewState with _$ActivityMeterViewState {
const factory ActivityMeterViewState({
DeviceEntity? selectedDevice,
DateTime? selectedDate,
@Default(false) bool enabled,
@Default([]) List<ActivityEntity> activityList,
@Default([]) List<ActivityEntity> weekActivity,
ActivityEntity? selectedActivity,
@Default(0) double stepLength,
@Default(0) double weight,
@Default(true) bool isLoading,
@Default('') String errorMessage,
}) = _ActivityMeterViewState;
}

View File

@@ -0,0 +1,358 @@
// 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 'activity_meter_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$ActivityMeterViewState {
DeviceEntity? get selectedDevice; DateTime? get selectedDate; bool get enabled; List<ActivityEntity> get activityList; List<ActivityEntity> get weekActivity; ActivityEntity? get selectedActivity; double get stepLength; double get weight; bool get isLoading; String get errorMessage;
/// Create a copy of ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$ActivityMeterViewStateCopyWith<ActivityMeterViewState> get copyWith => _$ActivityMeterViewStateCopyWithImpl<ActivityMeterViewState>(this as ActivityMeterViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityMeterViewState&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&(identical(other.selectedDate, selectedDate) || other.selectedDate == selectedDate)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other.activityList, activityList)&&const DeepCollectionEquality().equals(other.weekActivity, weekActivity)&&(identical(other.selectedActivity, selectedActivity) || other.selectedActivity == selectedActivity)&&(identical(other.stepLength, stepLength) || other.stepLength == stepLength)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,selectedDevice,selectedDate,enabled,const DeepCollectionEquality().hash(activityList),const DeepCollectionEquality().hash(weekActivity),selectedActivity,stepLength,weight,isLoading,errorMessage);
@override
String toString() {
return 'ActivityMeterViewState(selectedDevice: $selectedDevice, selectedDate: $selectedDate, enabled: $enabled, activityList: $activityList, weekActivity: $weekActivity, selectedActivity: $selectedActivity, stepLength: $stepLength, weight: $weight, isLoading: $isLoading, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $ActivityMeterViewStateCopyWith<$Res> {
factory $ActivityMeterViewStateCopyWith(ActivityMeterViewState value, $Res Function(ActivityMeterViewState) _then) = _$ActivityMeterViewStateCopyWithImpl;
@useResult
$Res call({
DeviceEntity? selectedDevice, DateTime? selectedDate, bool enabled, List<ActivityEntity> activityList, List<ActivityEntity> weekActivity, ActivityEntity? selectedActivity, double stepLength, double weight, bool isLoading, String errorMessage
});
$DeviceEntityCopyWith<$Res>? get selectedDevice;$ActivityEntityCopyWith<$Res>? get selectedActivity;
}
/// @nodoc
class _$ActivityMeterViewStateCopyWithImpl<$Res>
implements $ActivityMeterViewStateCopyWith<$Res> {
_$ActivityMeterViewStateCopyWithImpl(this._self, this._then);
final ActivityMeterViewState _self;
final $Res Function(ActivityMeterViewState) _then;
/// Create a copy of ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? selectedDevice = freezed,Object? selectedDate = freezed,Object? enabled = null,Object? activityList = null,Object? weekActivity = null,Object? selectedActivity = freezed,Object? stepLength = null,Object? weight = null,Object? isLoading = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,selectedDate: freezed == selectedDate ? _self.selectedDate : selectedDate // ignore: cast_nullable_to_non_nullable
as DateTime?,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable
as bool,activityList: null == activityList ? _self.activityList : activityList // ignore: cast_nullable_to_non_nullable
as List<ActivityEntity>,weekActivity: null == weekActivity ? _self.weekActivity : weekActivity // ignore: cast_nullable_to_non_nullable
as List<ActivityEntity>,selectedActivity: freezed == selectedActivity ? _self.selectedActivity : selectedActivity // ignore: cast_nullable_to_non_nullable
as ActivityEntity?,stepLength: null == stepLength ? _self.stepLength : stepLength // ignore: cast_nullable_to_non_nullable
as double,weight: null == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as double,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ActivityMeterViewState
/// 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 ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ActivityEntityCopyWith<$Res>? get selectedActivity {
if (_self.selectedActivity == null) {
return null;
}
return $ActivityEntityCopyWith<$Res>(_self.selectedActivity!, (value) {
return _then(_self.copyWith(selectedActivity: value));
});
}
}
/// Adds pattern-matching-related methods to [ActivityMeterViewState].
extension ActivityMeterViewStatePatterns on ActivityMeterViewState {
/// 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( _ActivityMeterViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _ActivityMeterViewState() 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( _ActivityMeterViewState value) $default,){
final _that = this;
switch (_that) {
case _ActivityMeterViewState():
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( _ActivityMeterViewState value)? $default,){
final _that = this;
switch (_that) {
case _ActivityMeterViewState() 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( DeviceEntity? selectedDevice, DateTime? selectedDate, bool enabled, List<ActivityEntity> activityList, List<ActivityEntity> weekActivity, ActivityEntity? selectedActivity, double stepLength, double weight, bool isLoading, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _ActivityMeterViewState() when $default != null:
return $default(_that.selectedDevice,_that.selectedDate,_that.enabled,_that.activityList,_that.weekActivity,_that.selectedActivity,_that.stepLength,_that.weight,_that.isLoading,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( DeviceEntity? selectedDevice, DateTime? selectedDate, bool enabled, List<ActivityEntity> activityList, List<ActivityEntity> weekActivity, ActivityEntity? selectedActivity, double stepLength, double weight, bool isLoading, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _ActivityMeterViewState():
return $default(_that.selectedDevice,_that.selectedDate,_that.enabled,_that.activityList,_that.weekActivity,_that.selectedActivity,_that.stepLength,_that.weight,_that.isLoading,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( DeviceEntity? selectedDevice, DateTime? selectedDate, bool enabled, List<ActivityEntity> activityList, List<ActivityEntity> weekActivity, ActivityEntity? selectedActivity, double stepLength, double weight, bool isLoading, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _ActivityMeterViewState() when $default != null:
return $default(_that.selectedDevice,_that.selectedDate,_that.enabled,_that.activityList,_that.weekActivity,_that.selectedActivity,_that.stepLength,_that.weight,_that.isLoading,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _ActivityMeterViewState implements ActivityMeterViewState {
const _ActivityMeterViewState({this.selectedDevice, this.selectedDate, this.enabled = false, final List<ActivityEntity> activityList = const [], final List<ActivityEntity> weekActivity = const [], this.selectedActivity, this.stepLength = 0, this.weight = 0, this.isLoading = true, this.errorMessage = ''}): _activityList = activityList,_weekActivity = weekActivity;
@override final DeviceEntity? selectedDevice;
@override final DateTime? selectedDate;
@override@JsonKey() final bool enabled;
final List<ActivityEntity> _activityList;
@override@JsonKey() List<ActivityEntity> get activityList {
if (_activityList is EqualUnmodifiableListView) return _activityList;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_activityList);
}
final List<ActivityEntity> _weekActivity;
@override@JsonKey() List<ActivityEntity> get weekActivity {
if (_weekActivity is EqualUnmodifiableListView) return _weekActivity;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_weekActivity);
}
@override final ActivityEntity? selectedActivity;
@override@JsonKey() final double stepLength;
@override@JsonKey() final double weight;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final String errorMessage;
/// Create a copy of ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$ActivityMeterViewStateCopyWith<_ActivityMeterViewState> get copyWith => __$ActivityMeterViewStateCopyWithImpl<_ActivityMeterViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityMeterViewState&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&(identical(other.selectedDate, selectedDate) || other.selectedDate == selectedDate)&&(identical(other.enabled, enabled) || other.enabled == enabled)&&const DeepCollectionEquality().equals(other._activityList, _activityList)&&const DeepCollectionEquality().equals(other._weekActivity, _weekActivity)&&(identical(other.selectedActivity, selectedActivity) || other.selectedActivity == selectedActivity)&&(identical(other.stepLength, stepLength) || other.stepLength == stepLength)&&(identical(other.weight, weight) || other.weight == weight)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,selectedDevice,selectedDate,enabled,const DeepCollectionEquality().hash(_activityList),const DeepCollectionEquality().hash(_weekActivity),selectedActivity,stepLength,weight,isLoading,errorMessage);
@override
String toString() {
return 'ActivityMeterViewState(selectedDevice: $selectedDevice, selectedDate: $selectedDate, enabled: $enabled, activityList: $activityList, weekActivity: $weekActivity, selectedActivity: $selectedActivity, stepLength: $stepLength, weight: $weight, isLoading: $isLoading, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$ActivityMeterViewStateCopyWith<$Res> implements $ActivityMeterViewStateCopyWith<$Res> {
factory _$ActivityMeterViewStateCopyWith(_ActivityMeterViewState value, $Res Function(_ActivityMeterViewState) _then) = __$ActivityMeterViewStateCopyWithImpl;
@override @useResult
$Res call({
DeviceEntity? selectedDevice, DateTime? selectedDate, bool enabled, List<ActivityEntity> activityList, List<ActivityEntity> weekActivity, ActivityEntity? selectedActivity, double stepLength, double weight, bool isLoading, String errorMessage
});
@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $ActivityEntityCopyWith<$Res>? get selectedActivity;
}
/// @nodoc
class __$ActivityMeterViewStateCopyWithImpl<$Res>
implements _$ActivityMeterViewStateCopyWith<$Res> {
__$ActivityMeterViewStateCopyWithImpl(this._self, this._then);
final _ActivityMeterViewState _self;
final $Res Function(_ActivityMeterViewState) _then;
/// Create a copy of ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? selectedDevice = freezed,Object? selectedDate = freezed,Object? enabled = null,Object? activityList = null,Object? weekActivity = null,Object? selectedActivity = freezed,Object? stepLength = null,Object? weight = null,Object? isLoading = null,Object? errorMessage = null,}) {
return _then(_ActivityMeterViewState(
selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
as DeviceEntity?,selectedDate: freezed == selectedDate ? _self.selectedDate : selectedDate // ignore: cast_nullable_to_non_nullable
as DateTime?,enabled: null == enabled ? _self.enabled : enabled // ignore: cast_nullable_to_non_nullable
as bool,activityList: null == activityList ? _self._activityList : activityList // ignore: cast_nullable_to_non_nullable
as List<ActivityEntity>,weekActivity: null == weekActivity ? _self._weekActivity : weekActivity // ignore: cast_nullable_to_non_nullable
as List<ActivityEntity>,selectedActivity: freezed == selectedActivity ? _self.selectedActivity : selectedActivity // ignore: cast_nullable_to_non_nullable
as ActivityEntity?,stepLength: null == stepLength ? _self.stepLength : stepLength // ignore: cast_nullable_to_non_nullable
as double,weight: null == weight ? _self.weight : weight // ignore: cast_nullable_to_non_nullable
as double,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of ActivityMeterViewState
/// 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 ActivityMeterViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$ActivityEntityCopyWith<$Res>? get selectedActivity {
if (_self.selectedActivity == null) {
return null;
}
return $ActivityEntityCopyWith<$Res>(_self.selectedActivity!, (value) {
return _then(_self.copyWith(selectedActivity: value));
});
}
}
// dart format on

View File

@@ -22,8 +22,8 @@ class FunctionsScreen extends ConsumerWidget {
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
@@ -42,57 +42,57 @@ class FunctionsScreen extends ConsumerWidget {
SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)),
Expanded(child: SingleChildScrollView(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Column(
children: [
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);},
icon: SFIcons.connection,
text: 'Remote connection'
onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);},
icon: SFIcons.connection,
text: context.translate(I18n.remoteConnection)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.calendarCircle,
text: 'Calendar'
onPressed: (){},
icon: SFIcons.calendarCircle,
text: context.translate(I18n.calendar)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.contacts);},
icon: SFIcons.contactsCircle,
text: 'Contacts'
onPressed: (){navigationContract.pushTo(AppRoutes.contacts);},
icon: SFIcons.contactsCircle,
text: context.translate(I18n.contacts)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.doNotDisturbCircle,
text: 'Do not disturb'
text: context.translate(I18n.doNotDisturb)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.videoCallCircle,
text: 'Video call'
text: context.translate(I18n.videoCall)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.healthCircle,
text: 'Health'
text: context.translate(I18n.health)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
onPressed: (){navigationContract.pushTo(AppRoutes.activityMeter);},
icon: SFIcons.healthCircle,
text: 'Activity meter'
text: context.translate(I18n.activityMeter)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.rewardsCircle,
text: 'Rewards'
text: context.translate(I18n.rewards)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
@@ -100,31 +100,31 @@ class FunctionsScreen extends ConsumerWidget {
child: CallWatchDialog()
));},
icon: Icons.call_outlined,
text: 'Call watch'
text: context.translate(I18n.callWatch)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.screenTime,
text: 'Apps use'
text: context.translate(I18n.appsUse)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: Icons.app_registration_sharp,
text: 'Apps surveillance'
text: context.translate(I18n.appsSurveillance)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.friendsCircle,
text: 'Make friends'
text: context.translate(I18n.makeFriends)
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.locateDevice);},
icon: SFIcons.locateSfCircle,
text: 'Locate your SaveFamily'
text: context.translate(I18n.locateWatch)
),
],
),

View File

@@ -51,6 +51,7 @@ dependencies:
json_annotation: ^4.9.0
json_serializable: ^6.11.2
url_launcher: ^6.3.2
fl_chart: ^1.1.1
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.

View File

@@ -16,7 +16,7 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource {
@override
Future<List<DeviceEntity>> getDevices({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'];
@@ -24,17 +24,65 @@ class HomeRemoteDatasourceImpl implements HomeRemoteDatasource {
throw Exception('Empty response from /:userId/devices');
}
final model = GetDevicesResponseModel.fromJson(data);
/*final model = GetDevicesResponseModel(items: [
final model = GetDevicesResponseModel.fromJson(data);*/
final model = GetDevicesResponseModel(items: [
GetDevicesItemResponseModel(
id: '1',
identificator: '1111',
carrierName: 'Carlos'),
carrierName: 'Carlos',
carrierGenre: null,
carrierBirthday: null,
carrierWeight: 25,
carrierStepLength: 35,
phone: '111111111',
settings: GetDevicesSettingsResponseModel(
frequency: 0,
frequencyHeartRate: 0,
timezone: 1,
pedometer: true,
language: 'es',
alerts: []
),
protocol: '',
type: '',
connectionServer: '',
createdAt: 0,
flags: GetDevicesFlagsResponseModel(
isInOrOut: 'in',
geofenceId: '',
isBatteryLow: false,
isDisconnect: false,
),
),
GetDevicesItemResponseModel(
id: '2',
identificator: '1112',
carrierName: 'Ana'),
]);*/
carrierName: 'Ana',
carrierGenre: null,
carrierBirthday: null,
carrierWeight: 26,
carrierStepLength: 36,
phone: '222222222',
settings: GetDevicesSettingsResponseModel(
frequency: 0,
frequencyHeartRate: 0,
timezone: 1,
pedometer: true,
language: 'es',
alerts: []
),
protocol: '',
type: '',
connectionServer: '',
createdAt: 0,
flags: GetDevicesFlagsResponseModel(
isInOrOut: 'in',
geofenceId: '',
isBatteryLow: false,
isDisconnect: false
)
),
]);
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(

View File

@@ -19,6 +19,10 @@ abstract class GetDevicesItemResponseModel with _$GetDevicesItemResponseModel {
const factory GetDevicesItemResponseModel({
required String identificator,
required String carrierName,
required String? carrierGenre,
required int? carrierBirthday,
required double? carrierWeight,
required double? carrierStepLength,
required String phone,
required String id,
required GetDevicesSettingsResponseModel settings,
@@ -39,6 +43,10 @@ extension GetDevicesResponseModelMapper on GetDevicesResponseModel {
return items.map((GetDevicesItemResponseModel item) => DeviceEntity(
identificator: item.identificator,
carrierName: item.carrierName,
carrierGenre: item.carrierGenre,
carrierBirthday: item.carrierBirthday,
carrierWeight: item.carrierWeight,
carrierStepLength: item.carrierStepLength,
phone: item.phone,
id: item.id,
settings: item.settings.toEntity(),

View File

@@ -284,7 +284,7 @@ as List<GetDevicesItemResponseModel>,
/// @nodoc
mixin _$GetDevicesItemResponseModel {
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;
String get identificator; String get carrierName; String? get carrierGenre; int? get carrierBirthday; double? get carrierWeight; double? get carrierStepLength; 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.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));
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.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(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,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -317,7 +317,7 @@ abstract mixin class $GetDevicesItemResponseModelCopyWith<$Res> {
factory $GetDevicesItemResponseModelCopyWith(GetDevicesItemResponseModel value, $Res Function(GetDevicesItemResponseModel) _then) = _$GetDevicesItemResponseModelCopyWithImpl;
@useResult
$Res call({
String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
String identificator, String carrierName, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
});
@@ -334,11 +334,15 @@ 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? 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,}) {
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? carrierName = null,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,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,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,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable
as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable
as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable
as double?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as double?,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
@@ -449,10 +453,10 @@ return $default(_that);case _:
/// }
/// ```
@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;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String carrierName, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, 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.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return $default(_that.identificator,_that.carrierName,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return orElse();
}
@@ -470,10 +474,10 @@ return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that
/// }
/// ```
@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;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String carrierName, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, 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.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return $default(_that.identificator,_that.carrierName,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
throw StateError('Unexpected subclass');
}
@@ -490,10 +494,10 @@ return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that
/// }
/// ```
@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;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String carrierName, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, 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.identificator,_that.carrierName,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return $default(_that.identificator,_that.carrierName,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.phone,_that.id,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.createdAt,_that.flags);case _:
return null;
}
@@ -505,11 +509,15 @@ return $default(_that.identificator,_that.carrierName,_that.phone,_that.id,_that
@JsonSerializable()
class _GetDevicesItemResponseModel implements GetDevicesItemResponseModel {
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});
const _GetDevicesItemResponseModel({required this.identificator, required this.carrierName, required this.carrierGenre, required this.carrierBirthday, required this.carrierWeight, required this.carrierStepLength, 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 identificator;
@override final String carrierName;
@override final String? carrierGenre;
@override final int? carrierBirthday;
@override final double? carrierWeight;
@override final double? carrierStepLength;
@override final String phone;
@override final String id;
@override final GetDevicesSettingsResponseModel settings;
@@ -532,16 +540,16 @@ Map<String, dynamic> toJson() {
@override
bool operator ==(Object other) {
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));
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.carrierGenre, carrierGenre) || other.carrierGenre == carrierGenre)&&(identical(other.carrierBirthday, carrierBirthday) || other.carrierBirthday == carrierBirthday)&&(identical(other.carrierWeight, carrierWeight) || other.carrierWeight == carrierWeight)&&(identical(other.carrierStepLength, carrierStepLength) || other.carrierStepLength == carrierStepLength)&&(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,carrierName,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
int get hashCode => Object.hash(runtimeType,identificator,carrierName,carrierGenre,carrierBirthday,carrierWeight,carrierStepLength,phone,id,settings,protocol,type,connectionServer,createdAt,flags);
@override
String toString() {
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
return 'GetDevicesItemResponseModel(identificator: $identificator, carrierName: $carrierName, carrierGenre: $carrierGenre, carrierBirthday: $carrierBirthday, carrierWeight: $carrierWeight, carrierStepLength: $carrierStepLength, phone: $phone, id: $id, settings: $settings, protocol: $protocol, type: $type, connectionServer: $connectionServer, createdAt: $createdAt, flags: $flags)';
}
@@ -552,7 +560,7 @@ abstract mixin class _$GetDevicesItemResponseModelCopyWith<$Res> implements $Get
factory _$GetDevicesItemResponseModelCopyWith(_GetDevicesItemResponseModel value, $Res Function(_GetDevicesItemResponseModel) _then) = __$GetDevicesItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String identificator, String carrierName, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
String identificator, String carrierName, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String phone, String id, GetDevicesSettingsResponseModel settings, String protocol, String type, String connectionServer, int createdAt, GetDevicesFlagsResponseModel flags
});
@@ -569,11 +577,15 @@ 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? 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,}) {
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? carrierName = null,Object? carrierGenre = freezed,Object? carrierBirthday = freezed,Object? carrierWeight = freezed,Object? carrierStepLength = freezed,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(
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,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable
as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable
as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable
as double?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as double?,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

View File

@@ -25,6 +25,10 @@ _GetDevicesItemResponseModel _$GetDevicesItemResponseModelFromJson(
) => _GetDevicesItemResponseModel(
identificator: json['identificator'] as String,
carrierName: json['carrierName'] as String,
carrierGenre: json['carrierGenre'] as String?,
carrierBirthday: (json['carrierBirthday'] as num?)?.toInt(),
carrierWeight: (json['carrierWeight'] as num?)?.toDouble(),
carrierStepLength: (json['carrierStepLength'] as num?)?.toDouble(),
phone: json['phone'] as String,
id: json['id'] as String,
settings: GetDevicesSettingsResponseModel.fromJson(
@@ -44,6 +48,10 @@ Map<String, dynamic> _$GetDevicesItemResponseModelToJson(
) => <String, dynamic>{
'identificator': instance.identificator,
'carrierName': instance.carrierName,
'carrierGenre': instance.carrierGenre,
'carrierBirthday': instance.carrierBirthday,
'carrierWeight': instance.carrierWeight,
'carrierStepLength': instance.carrierStepLength,
'phone': instance.phone,
'id': instance.id,
'settings': instance.settings,

View File

@@ -42,8 +42,8 @@ class HubViewModel extends Notifier<HubViewState> {
}).then((List<DeviceEntity> res){
state = state.copyWith(
devices: res,
selectedDevice: res.first
);
setSelectedDevice(res.first);
return Future.wait(res.map((device) =>
_getLatestPositionsUseCase.getLatestPositions(
deviceId: device.identificator

View File

@@ -17,8 +17,8 @@ abstract class DeviceEntity with _$DeviceEntity {
int? lastConnection,
String? carrierGenre,
int? carrierBirthday,
int? carrierWeight,
int? carrierStepLength,
double? carrierWeight,
double? carrierStepLength,
required String carrierName,
String? comment,
String? phone,

View File

@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
/// @nodoc
mixin _$DeviceEntity {
String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; DeviceFlagsEntity get flags; List<String>? get tags; int? get lastConnection; String? get carrierGenre; int? get carrierBirthday; int? get carrierWeight; int? get carrierStepLength; String get carrierName; String? get comment; String? get phone; String? get simId; String? get simStatus; DevicePaymentOptionsEntity? get paymentOptions; DeviceSettingsEntity get settings; String get protocol; String get type; String get connectionServer; DeviceCapabilitiesEntity? get capabilities; int get createdAt; int? get updatedAt;
String get id; String get identificator; int? get battery; String? get userId; String? get companyId; String? get delegationId; String? get groupId; DeviceFlagsEntity get flags; List<String>? get tags; int? get lastConnection; String? get carrierGenre; int? get carrierBirthday; double? get carrierWeight; double? get carrierStepLength; String get carrierName; String? get comment; String? get phone; String? get simId; String? get simStatus; DevicePaymentOptionsEntity? get paymentOptions; DeviceSettingsEntity get settings; String get protocol; String get type; String get connectionServer; DeviceCapabilitiesEntity? get capabilities; int get createdAt; int? get updatedAt;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@@ -45,7 +45,7 @@ abstract mixin class $DeviceEntityCopyWith<$Res> {
factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl;
@useResult
$Res call({
String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt
String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt
});
@@ -77,8 +77,8 @@ as List<String>?,lastConnection: freezed == lastConnection ? _self.lastConnectio
as int?,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable
as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable
as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable
as int?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as int?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as double?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as double?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,comment: freezed == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable
@@ -218,7 +218,7 @@ return $default(_that);case _:
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);case _:
@@ -239,7 +239,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt) $default,) {final _that = this;
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt) $default,) {final _that = this;
switch (_that) {
case _DeviceEntity():
return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);case _:
@@ -259,7 +259,7 @@ return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.co
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,) {final _that = this;
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt)? $default,) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.id,_that.identificator,_that.battery,_that.userId,_that.companyId,_that.delegationId,_that.groupId,_that.flags,_that.tags,_that.lastConnection,_that.carrierGenre,_that.carrierBirthday,_that.carrierWeight,_that.carrierStepLength,_that.carrierName,_that.comment,_that.phone,_that.simId,_that.simStatus,_that.paymentOptions,_that.settings,_that.protocol,_that.type,_that.connectionServer,_that.capabilities,_that.createdAt,_that.updatedAt);case _:
@@ -297,8 +297,8 @@ class _DeviceEntity implements DeviceEntity {
@override final int? lastConnection;
@override final String? carrierGenre;
@override final int? carrierBirthday;
@override final int? carrierWeight;
@override final int? carrierStepLength;
@override final double? carrierWeight;
@override final double? carrierStepLength;
@override final String carrierName;
@override final String? comment;
@override final String? phone;
@@ -343,7 +343,7 @@ abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWi
factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, int? carrierWeight, int? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt
String id, String identificator, int? battery, String? userId, String? companyId, String? delegationId, String? groupId, DeviceFlagsEntity flags, List<String>? tags, int? lastConnection, String? carrierGenre, int? carrierBirthday, double? carrierWeight, double? carrierStepLength, String carrierName, String? comment, String? phone, String? simId, String? simStatus, DevicePaymentOptionsEntity? paymentOptions, DeviceSettingsEntity settings, String protocol, String type, String connectionServer, DeviceCapabilitiesEntity? capabilities, int createdAt, int? updatedAt
});
@@ -375,8 +375,8 @@ as List<String>?,lastConnection: freezed == lastConnection ? _self.lastConnectio
as int?,carrierGenre: freezed == carrierGenre ? _self.carrierGenre : carrierGenre // ignore: cast_nullable_to_non_nullable
as String?,carrierBirthday: freezed == carrierBirthday ? _self.carrierBirthday : carrierBirthday // ignore: cast_nullable_to_non_nullable
as int?,carrierWeight: freezed == carrierWeight ? _self.carrierWeight : carrierWeight // ignore: cast_nullable_to_non_nullable
as int?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as int?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as double?,carrierStepLength: freezed == carrierStepLength ? _self.carrierStepLength : carrierStepLength // ignore: cast_nullable_to_non_nullable
as double?,carrierName: null == carrierName ? _self.carrierName : carrierName // ignore: cast_nullable_to_non_nullable
as String,comment: freezed == comment ? _self.comment : comment // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,simId: freezed == simId ? _self.simId : simId // ignore: cast_nullable_to_non_nullable

View File

@@ -1201,6 +1201,90 @@
"search": [
"icon"
]
},
{
"uid": "7e796781084c7b3862a412c8cf4a7dc0",
"css": "sleep",
"code": 59438,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M133.8 595.9V66.3C133.8 29.7 103.6 0 66.7 0 29.9 0 0 29.7 0 66.3V933.4C0 970 29.9 999.7 66.7 999.7 103.6 999.7 133.5 970 133.5 933.4V809L1502.6 805.7V930.1C1502.6 966.7 1532.5 996.4 1569.3 996.4 1606.2 996.4 1636.1 966.7 1636.1 930.1V592.9L133.8 595.9ZM1636.4 539.4H620.4V289.4C620.4 216.7 679.5 158 752.7 158H1369.4C1516.9 158 1636.4 276.6 1636.4 423.1V539.4ZM545.8 348.7C545.8 438.3 472.6 510.9 382.4 510.9 292.2 510.9 219.4 437.9 219.4 348.7 219.4 259.1 292.5 186.4 382.7 186.4 472.9 186.4 545.8 259.1 545.8 348.7Z",
"width": 1636
},
"search": [
"icon"
]
},
{
"uid": "916552f134e36a1b0efbeb7d297bf109",
"css": "distance",
"code": 59443,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M124.4 474.4C109.4 474.4 96.1 464.3 94 448.6 93.4 445 93.4 440.9 93.4 437.5 93.4 387.7 112.8 340.5 147.8 305 183.6 269.4 230.4 250 280.3 250H481.3C498.5 250 512.3 264.1 512.3 281.2 512.3 298.4 498.5 312.3 481.3 312.3H280.5C247.3 312.3 215.8 325.4 192.1 348.8 168.7 372.4 155.9 404 155.9 437.3 158.2 454.4 146.4 471.4 129.4 473.8 127.6 474.2 126 474.4 124.4 474.4ZM685.4 937.5H414.4C397.2 937.5 383.4 923.4 383.4 906.4 383.4 889.1 397.2 875.2 414.4 875.2H685.4C754 875.2 810 819 810 750.2 810 716.9 797 685.3 773.6 661.5 750.1 638.1 718.6 625.2 685.4 625.2H437.9C420.7 625.2 406.9 611.1 406.9 594 406.9 576.8 420.7 562.9 437.9 562.9H685.4C735.1 562.9 782.1 582.3 817.5 617.5 852.9 653.4 872.3 700.4 872.3 750.4 872.3 853.4 788.5 937.5 685.4 937.5ZM747.7 468.9C691.9 468.9 560.8 321.8 560.8 187.5 560.8 84.1 644.7 0 747.7 0 850.8 0 934.6 84.1 934.6 187.5 934.6 321.6 803.5 468.9 747.7 468.9ZM747.7 62.5C679.1 62.5 623.1 118.7 623.1 187.5 623.1 285.5 716.3 389.1 747.7 405.2 779.2 389.1 872.3 285.5 872.3 187.5 872.3 118.7 816.4 62.5 747.7 62.5ZM779 187.5C779 204.8 764.9 218.6 747.9 218.6 730.7 218.6 716.7 204.6 716.7 187.5 716.7 170.4 730.7 156.3 747.9 156.3 764.9 156.3 779 170.2 779 187.5ZM186.9 1000C131.1 1000 0 853 0 718.8 0 615.5 83.9 531.3 186.9 531.3 290 531.3 373.9 615.5 373.9 718.8 373.9 853 242.7 1000 186.9 1000ZM186.9 593.8C118.3 593.8 62.3 650 62.3 718.8 62.3 816.9 155.5 920.4 186.9 936.5 218.4 920.4 311.5 816.9 311.5 718.8 311.5 649.8 255.6 593.8 186.9 593.8ZM218.2 718.9C218.2 736.1 204.1 750 187.1 750 169.9 750 155.9 735.9 155.9 718.9 155.9 701.6 169.9 687.5 187.1 687.5 204.1 687.5 218.2 701.6 218.2 718.9Z",
"width": 944
},
"search": [
"icon"
]
},
{
"uid": "aa18e29bbff733ce0ec1402dfcc4bb41",
"css": "steps",
"code": 59479,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M611.5 246.5C666.2 246.5 708.2 278.6 733.4 319.4L738.3 327.7 738.3 327.8C762.4 372.6 771.4 426.9 771.4 477.2 771.4 551.6 755.4 670.9 719.6 775.3 701.7 827.5 678.8 876.5 648.4 914.2L648.4 914.3C617.7 952 576.6 980.3 527 980.3 470.2 980.3 410 935.8 410 864.5 410 822.7 422.7 792.8 433 765.9 443.2 739.2 452.3 712.9 452.3 665.7 452.3 660.6 451.2 651.9 449.3 640.7 448.4 635.1 447.3 629 446.1 622.6L442.3 602.3C437 574.2 430.9 541.9 430.9 508.8 430.9 433.7 445.8 372.6 473.8 327.5L479.5 318.7C511 272.6 559.1 246.5 611.5 246.5ZM510.3 731.5C505.7 754.3 499.4 772.9 493 789.1L493 789.1C482.1 818 474.1 836 474.1 865 474.1 882.9 481 895.7 490.7 904 500.6 912.4 513.8 916.5 526.5 916.5 551.7 916.5 574.2 903.3 597.5 874.5 619.9 846.5 640.4 805.3 656.7 758.8L510.3 731.5ZM165 5.4C217.2 5.4 265.2 31.4 297.2 77.5L297.2 77.5C328.8 123.4 345.8 187.5 345.8 267.6 345.8 300.7 339.7 333.3 334.4 361.2 331.8 375.3 329.3 388.5 327.4 399.7 325.5 410.9 324.4 419.6 324.4 424.8 324.4 466.1 331.4 491.4 340 515L343.8 525 343.8 525.1C353.8 551.9 366.8 581.5 366.8 623.6 366.8 695 306.6 739.5 249.7 739.5 200.1 739.4 159 711.2 128.4 673.4L128.3 673.4C97.9 635.6 75.1 586.6 57.2 534.4V534.4C21.3 429.8 5.4 310.8 5.4 236.3 5.4 186.2 14.3 131.7 38.5 86.9 62.5 41.9 106.4 5.4 165 5.4ZM611.5 310.8C579.7 310.8 553.9 323.7 532.7 354.8L532.6 354.9C510.8 386.2 495.6 437.4 495.6 508.8 495.6 527.9 498.2 548.9 501.8 569.6L505.6 590.3V590.3C510.5 617 517 642.5 517 665.7V667.2L674.9 696.8C695.9 615.4 706.3 530.2 706.3 477.4 706.3 435.4 697.7 389.7 680.9 358.2 672.5 342.3 663.2 330.6 652.1 322.7 641.1 314.9 628 310.8 611.5 310.8ZM119.5 517.9C135.6 564.2 156 605.2 178.6 633.1 201.9 661.9 224.3 675.1 249.5 675.2 262.4 675.2 275.5 671 285.4 662.6 295.1 654.3 301.9 641.6 301.9 623.6 301.9 594.4 293.9 576.4 283 547.5 276.9 531.6 270.6 513.2 266 490.4L119.5 517.9ZM165 69.6C148.5 69.6 135.4 73.8 124.4 81.6 113.4 89.4 104 101.2 95.6 117 78.8 148.6 70.2 194 70.2 236.3 70.2 288.8 80.6 374.2 101.6 455.7L259.5 426.1V424.8C259.5 401.6 265.7 376 270.9 349.1L274.8 328.4C278.3 307.6 281 286.8 281 267.6 281 196.5 265.4 145.1 243.9 113.7L243.8 113.7V113.7C222.7 82.6 196.6 69.7 165 69.6Z",
"width": 786
},
"search": [
"icon"
]
},
{
"uid": "9bb96350e77e15da942570519f383d92",
"css": "barChart",
"code": 59444,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M69.1 630.5C31 630.5 0 661.5 0 699.6V920.9C0 959.1 31 990.1 69.1 990.1 107.3 990.1 138.3 959.1 138.3 920.9V699.6C138.3 661.5 107.3 630.5 69.1 630.5ZM334.6 331.8C296.4 331.8 265.4 362.8 265.4 401V920.9C265.4 959.1 296.4 990.1 334.6 990.1 372.7 990.1 403.7 959.1 403.7 920.9V401C403.7 362.8 372.7 331.8 334.6 331.8ZM600 497.7C561.8 497.7 530.9 528.6 530.9 566.8V920.7C530.9 958.9 561.8 989.8 600 989.8 638.2 989.8 669.1 958.9 669.1 920.7V567C669.1 528.6 638.2 497.7 600 497.7ZM865.4 0C827.3 0 796.3 31 796.3 69.1V920.7C796.3 958.9 827.3 989.8 865.4 989.8 903.6 989.8 934.6 958.9 934.6 920.7V69.1C934.6 31 903.6 0 865.4 0ZM1130.9 298.6C1092.7 298.6 1061.7 329.6 1061.7 367.8V920.7C1061.7 958.9 1092.7 989.8 1130.9 989.8 1169 989.8 1200 958.9 1200 920.7V367.8C1200 329.6 1169.3 298.6 1130.9 298.6Z",
"width": 1200
},
"search": [
"icon"
]
},
{
"uid": "73fda456c6fc2c69d569fd1d3a109b1c",
"css": "foot",
"code": 59446,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M1447.8 689C1433.3 627.9 1409.6 569.3 1378 515.4 1366.9 496.5 1360.1 475.1 1358.6 453.4 1356.8 396.6 1358.9 339.9 1364.7 283.4 1371.2 205 1370 126.2 1361.7 47.8 1362.3 27.9 1348.1 10.9 1328.5 7.8 1313.1 4.4 1297.4 2.5 1281.7 2.2H1126.7V0.6C1068.9 0.6 1011.1-0.9 953.3 0.6 898.6 2.8 880.1 20.8 876.1 74.1 869.7 157.2 861.3 240.6 861 323.7 861 367.5 846.3 389.8 807.5 405 686.4 451.2 569.2 508.6 457.9 575.5 384.7 618.9 301.7 641.9 216.8 642.8 173.4 645.9 131 654.9 90.1 670.1 48.9 683.1 16.9 716.3 5.2 758.2-11.1 813.7 10.1 872.3 61.5 912.3 115.6 952.9 179.6 978.7 246.3 987 353.6 1003.5 461.3 994.5 568.9 992 676.8 989.5 781.1 991.4 887.2 991.4 985.6 991.4 1084 996 1182.4 995.1 1215 993.2 1247.3 987.3 1278.6 977.7 1412.1 942.4 1477 824.2 1447.8 689ZM1347.2 761.9C1347.8 785.2 1340.8 807.8 1327.2 826.7 1313.7 845.6 1294.3 859.3 1272.5 866.1 1235.6 878.8 1196.8 886.6 1157.8 888.4 1071.7 890 985.6 884.4 899.5 883.8 782 883.8 664.8 884.4 548 885.9 449.6 887.2 350.6 898.6 253.4 878.2 212.8 868.3 173.4 853.1 136.2 833.2 121.8 824.8 112.9 809.7 111.9 792.6 113.8 780.5 133.5 767.2 147.9 762.2 170.1 754.1 193.4 750.1 216.8 750.1 337.3 753.2 444 712.9 544 650.9 635.9 597.2 731.9 550.4 830.6 510.7 868.7 492.7 905 471.3 939.5 447.5 948.4 441 955.4 432.3 959.8 422 964.1 411.8 965.3 400.6 963.4 389.5 961.3 354.8 961.3 320 962.2 286.2 962.2 240.6 964.7 194.7 966.2 149.2 966.2 136.8 968.4 124.7 970.2 106.1L1261.7 98.6C1276.2 142 1270.6 183 1268.2 223.3 1264.2 294 1259 364.7 1253.1 435.4 1250.7 479.7 1261.1 523.7 1283 561.9 1304.5 603.8 1322.9 647.2 1338.3 691.5 1345.7 714.5 1348.8 738.3 1347.2 761.9Z",
"width": 1455
},
"search": [
"icon"
]
},
{
"uid": "21f28b255332bf33a8539cd95d9762e5",
"css": "scale",
"code": 59482,
"src": "custom_icons",
"selected": true,
"svg": {
"path": "M826.1 0H131.4C58.8 0 0 59.1 0 131.6V860.7C0 933.2 58.8 992.3 131.4 992.3H826.3C898.7 992.3 957.7 933.4 957.7 860.7V131.6C957.4 59.1 898.7 0 826.1 0ZM897.4 860.7C897.4 900 865.3 932.1 826.1 932.1H131.4C92.1 932.1 60.1 900 60.1 860.7V131.6C60.1 92.3 92.1 60.2 131.4 60.2H826.3C865.5 60.2 897.6 92.3 897.6 131.6V860.7H897.4ZM815.9 246.6C808.9 242.8 645.4 152.9 478 152.9 310.5 152.7 147.1 242.8 140.1 246.6 126.5 254.1 121 270.7 126.9 284.9L205.5 467.3C208.9 475.2 215.4 481.1 223.5 483.9 226.7 485 229.9 485.6 233 485.6 238.1 485.6 243.2 484.3 247.7 481.8 248.5 481.1 343.8 428.6 478 428.6 610.4 428.6 706.6 480.9 708.3 481.8 715.7 486 724.4 486.7 732.7 484.1 740.7 481.4 747.3 475.4 750.7 467.5L829.3 285.1C835 270.7 829.5 254.1 815.9 246.6ZM707.8 414.8C665.8 396.7 582.6 368.2 478.2 368.2 456.8 368.2 436.2 369.5 416.6 371.6L386.1 270.2C381.2 254.3 364.6 245.4 348.7 250 332.8 254.7 323.9 271.5 328.6 287.4L356.8 381.2C309.9 391.2 272.5 404.8 248.3 415L193.6 287C243 263.2 361.7 212.8 478 212.8 594.3 212.8 712.9 263 762.6 286.8L707.8 414.8Z",
"width": 957
},
"search": [
"icon"
]
}
]
}

View File

@@ -71,11 +71,15 @@ class SFIcons {
static const IconData startSelected = IconData(0xe82b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData infoCircle = IconData(0xe82c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData financeSelected = IconData(0xe82d, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData sleep = IconData(0xe82e, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData loginOutlined = IconData(0xe82f, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData bank1 = IconData(0xe830, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData gavel = IconData(0xe831, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData timer = IconData(0xe832, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rotateLeft = IconData(0xe835, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData distance = IconData(0xe833, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData barChart = IconData(0xe834, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData rotate_left = IconData(0xe835, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData foot = IconData(0xe836, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData home = IconData(0xe83a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData apartment = IconData(0xe83b, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData radioButtonUncheckedRounded = IconData(0xe83c, fontFamily: _kFontFam, fontPackage: _kFontPkg);
@@ -92,8 +96,10 @@ class SFIcons {
static const IconData temperature = IconData(0xe853, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData chat = IconData(0xe855, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData locationOutlined = IconData(0xe856, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData steps = IconData(0xe857, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData share = IconData(0xe858, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData favoriteOutlined = IconData(0xe859, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData scale = IconData(0xe85a, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData renovationSelected = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData renovation = IconData(0xe868, fontFamily: _kFontFam, fontPackage: _kFontPkg);
static const IconData options = IconData(0xe86f, fontFamily: _kFontFam, fontPackage: _kFontPkg);

View File

@@ -33,5 +33,6 @@ class AppRoutes {
static const contacts = '$dashboardFunctions/contacts';
static const remoteConnection = '$dashboardFunctions/remote_connection';
static const locateDevice = '$dashboardFunctions/locateDevice';
static const locateDevice = '$dashboardFunctions/locate_device';
static const activityMeter = '$dashboardFunctions/activity_meter';
}

View File

@@ -140,6 +140,19 @@
"home": "Home",
"location": "Location",
"chat": "Chat",
"remoteConnection": "Remote connection",
"calendar": "Calendar",
"contacts": "Contacts",
"doNotDisturb": "Do not Disturb",
"videoCall": "Video call",
"health": "Health",
"activityMeter": "Activity meter",
"rewards": "Rewards",
"callWatch": "Call watch",
"appsUse": "Apps use",
"appsSurveillance": "Apps surveillance",
"makeFriends": "Make friends",
"locateWatch": "Locate your SaveFamily",
"channelOnline": "SF online shop",
"channelAmazon": "Amazon",
"channelStore": "Physical store",

View File

@@ -140,6 +140,19 @@
"home": "Inicio",
"location": "Mapa",
"chat": "Chat",
"remoteConnection": "Conexión remota",
"calendar": "Horario de Actividades",
"contacts": "Agenda",
"doNotDisturb": "No Molestar",
"videoCall": "Video llamada",
"health": "Salud",
"activityMeter": "Medidor de Actividad",
"rewards": "Enviar recompensas",
"callWatch": "Llamar al reloj",
"appsUse": "Uso de las aplicaciones",
"appsSurveillance": "Supervisión de aplicaciones",
"makeFriends": "Hacer amigos",
"locateWatch": "Reproducir Sonido en Dispositivo",
"channelOnline": "Tienda online de SF",
"channelAmazon": "Amazon",
"channelStore": "Tienda física",

View File

@@ -170,6 +170,19 @@ class I18n {
static const String home = 'home';
static const String location = 'location';
static const String chat = 'chat';
static const String remoteConnection = 'remoteConnection';
static const String calendar = 'calendar';
static const String contacts = 'contacts';
static const String doNotDisturb = 'doNotDisturb';
static const String videoCall = 'videoCall';
static const String health = 'health';
static const String activityMeter = 'activityMeter';
static const String rewards = 'rewards';
static const String callWatch = 'callWatch';
static const String appsUse = 'appsUse';
static const String appsSurveillance = 'appsSurveillance';
static const String makeFriends = 'makeFriends';
static const String locateWatch = 'locateWatch';
static const String channelOnline = 'channelOnline';
static const String channelAmazon = 'channelAmazon';
static const String channelStore = 'channelStore';