added remote_connection screens and state
This commit is contained in:
@@ -57,6 +57,11 @@ void configureAppRouter() {
|
||||
name: 'contacts',
|
||||
pageBuilder: ContactsBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: AppRoutes.remoteConnection,
|
||||
name: 'remote_connection',
|
||||
pageBuilder: RemoteConnectionBuilder().buildPage,
|
||||
),
|
||||
|
||||
GoRoute(
|
||||
path: AppRoutes.login,
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_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';
|
||||
|
||||
abstract class FunctionsRemoteDatasource {
|
||||
Future<ContactListEntity> getContacts({required String deviceId});
|
||||
Future<List<ContactEntity>> getContacts({required String userId});
|
||||
|
||||
Future<List<PictureEntity>> getPictures({required String userId});
|
||||
|
||||
Future<PictureEntity> takePicture({required String userId});
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import 'dart:convert';
|
||||
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/features/contacts/domain/entities/contact_list_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/list_contact_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';
|
||||
|
||||
class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
|
||||
@@ -13,15 +13,15 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
|
||||
final QuestiaRepository _repository;
|
||||
|
||||
@override
|
||||
Future<ContactListEntity> getContacts({required String deviceId}) async {
|
||||
Future<List<ContactEntity>> getContacts({required String userId}) async {
|
||||
/*try {
|
||||
final response = await _repository.post<Map<String, dynamic>>(
|
||||
'/devices/$deviceId/contact-lists',
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/users/$userId/contacts',
|
||||
);
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) {
|
||||
throw Exception('Empty response from /devices/:deviceId/contact-lists');
|
||||
throw Exception('Empty response from /users/:userId/contacts');
|
||||
}
|
||||
|
||||
final model = GetContactsResponseModel.fromJson(data);
|
||||
@@ -29,20 +29,68 @@ class FunctionsRemoteDatasourceImpl implements FunctionsRemoteDatasource {
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(error, defaultMessage: 'Error to get contacts');
|
||||
}*/
|
||||
return ContactListEntity(
|
||||
id: 'id',
|
||||
delegationId: 'delegationId',
|
||||
userId: 'userId',
|
||||
groupId: 'groupId',
|
||||
deviceId: 'deviceId',
|
||||
type: 'type',
|
||||
contacts: [
|
||||
ListContactEntity(name: 'Ana', phone: '111111111'),
|
||||
ListContactEntity(name: 'Carlos', phone: '222222222'),
|
||||
],
|
||||
createdAt: 'createdAt',
|
||||
updatedAt: 'updatedAt'
|
||||
);
|
||||
return [
|
||||
ContactEntity(
|
||||
id: '1111',
|
||||
name: 'Ana',
|
||||
phone: '111111111',
|
||||
createdAt: 1,
|
||||
delegationId: null,
|
||||
groupId: null,
|
||||
userId: null,
|
||||
updatedAt: null,
|
||||
),
|
||||
ContactEntity(
|
||||
id: '1112',
|
||||
name: 'Carlos',
|
||||
phone: '222222222',
|
||||
createdAt: 2,
|
||||
delegationId: null,
|
||||
groupId: null,
|
||||
userId: null,
|
||||
updatedAt: null,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<PictureEntity>> getPictures({required String userId}) async {
|
||||
/*try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'',
|
||||
);
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) {
|
||||
throw Exception('Empty response from /users/:userId/contacts');
|
||||
}
|
||||
|
||||
final model = GetContactsResponseModel.fromJson(data);
|
||||
return model.toEntity();
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(error, defaultMessage: 'Error to get contacts');
|
||||
}*/
|
||||
return [];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PictureEntity> takePicture({required String userId}) async {
|
||||
/*try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'',
|
||||
);
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) {
|
||||
throw Exception('Empty response from /users/:userId/contacts');
|
||||
}
|
||||
|
||||
final model = GetContactsResponseModel.fromJson(data);
|
||||
return model.toEntity();
|
||||
} on DioException catch (error) {
|
||||
throw _mapDioError(error, defaultMessage: 'Error to get contacts');
|
||||
}*/
|
||||
return PictureEntity(id: '1', userId: '1111', createdAt: 1111);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:functions/src/core/data/datasources/functions_remote_datasource.dart';
|
||||
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_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';
|
||||
|
||||
class FunctionsRepositoryImpl implements FunctionsRepository {
|
||||
const FunctionsRepositoryImpl(this._remote);
|
||||
@@ -8,7 +9,17 @@ class FunctionsRepositoryImpl implements FunctionsRepository {
|
||||
final FunctionsRemoteDatasource _remote;
|
||||
|
||||
@override
|
||||
Future<ContactListEntity> getContacts({required String deviceId}) {
|
||||
return _remote.getContacts(deviceId: deviceId);
|
||||
Future<List<ContactEntity>> getContacts({required String userId}) {
|
||||
return _remote.getContacts(userId: userId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<PictureEntity>> getPictures({required String userId}) {
|
||||
return _remote.getPictures(userId: userId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<PictureEntity> takePicture({required String userId}) {
|
||||
return _remote.takePicture(userId: userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,10 @@
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_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';
|
||||
|
||||
abstract class FunctionsRepository {
|
||||
Future<ContactListEntity> getContacts({required String deviceId});
|
||||
Future<List<ContactEntity>> getContacts({required String userId});
|
||||
|
||||
Future<List<PictureEntity>> getPictures({required String userId});
|
||||
|
||||
Future<PictureEntity> takePicture({required String userId});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
|
||||
|
||||
abstract class GetContactsUseCase {
|
||||
Future<ContactListEntity> getContacts({required String deviceId});
|
||||
Future<List<ContactEntity>> getContacts({required String userId});
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_list_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/entities/contact_entity.dart';
|
||||
import 'package:functions/src/features/contacts/domain/get_contacts_use_case.dart';
|
||||
|
||||
class GetContactsUseCaseImpl implements GetContactsUseCase {
|
||||
@@ -8,7 +8,7 @@ class GetContactsUseCaseImpl implements GetContactsUseCase {
|
||||
final FunctionsRepository _repository;
|
||||
|
||||
@override
|
||||
Future<ContactListEntity> getContacts({required String deviceId}) {
|
||||
return _repository.getContacts(deviceId: deviceId);
|
||||
Future<List<ContactEntity>> getContacts({required String userId}) {
|
||||
return _repository.getContacts(userId: userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ class FunctionsScreen extends ConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
onPressed: (){navigationContract.pushTo(AppRoutes.remoteConnection);},
|
||||
icon: SFIcons.connection,
|
||||
text: 'Remote connection'
|
||||
),
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'picture_entity.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PictureEntity with _$PictureEntity {
|
||||
const factory PictureEntity({
|
||||
required String id,
|
||||
required String? userId,
|
||||
required int createdAt,
|
||||
}) = _PictureEntity;
|
||||
}
|
||||
@@ -0,0 +1,277 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'picture_entity.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PictureEntity {
|
||||
|
||||
String get id; String? get userId; int get createdAt;
|
||||
/// Create a copy of PictureEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PictureEntityCopyWith<PictureEntity> get copyWith => _$PictureEntityCopyWithImpl<PictureEntity>(this as PictureEntity, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PictureEntityCopyWith<$Res> {
|
||||
factory $PictureEntityCopyWith(PictureEntity value, $Res Function(PictureEntity) _then) = _$PictureEntityCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String? userId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PictureEntityCopyWithImpl<$Res>
|
||||
implements $PictureEntityCopyWith<$Res> {
|
||||
_$PictureEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PictureEntity _self;
|
||||
final $Res Function(PictureEntity) _then;
|
||||
|
||||
/// Create a copy of PictureEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [PictureEntity].
|
||||
extension PictureEntityPatterns on PictureEntity {
|
||||
/// 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( _PictureEntity value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity() 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( _PictureEntity value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity():
|
||||
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( _PictureEntity value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity() 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? userId, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity() when $default != null:
|
||||
return $default(_that.id,_that.userId,_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? userId, int createdAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity():
|
||||
return $default(_that.id,_that.userId,_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? userId, int createdAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PictureEntity() when $default != null:
|
||||
return $default(_that.id,_that.userId,_that.createdAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _PictureEntity implements PictureEntity {
|
||||
const _PictureEntity({required this.id, required this.userId, required this.createdAt});
|
||||
|
||||
|
||||
@override final String id;
|
||||
@override final String? userId;
|
||||
@override final int createdAt;
|
||||
|
||||
/// Create a copy of PictureEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PictureEntityCopyWith<_PictureEntity> get copyWith => __$PictureEntityCopyWithImpl<_PictureEntity>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PictureEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,userId,createdAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PictureEntity(id: $id, userId: $userId, createdAt: $createdAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PictureEntityCopyWith<$Res> implements $PictureEntityCopyWith<$Res> {
|
||||
factory _$PictureEntityCopyWith(_PictureEntity value, $Res Function(_PictureEntity) _then) = __$PictureEntityCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String? userId, int createdAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PictureEntityCopyWithImpl<$Res>
|
||||
implements _$PictureEntityCopyWith<$Res> {
|
||||
__$PictureEntityCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PictureEntity _self;
|
||||
final $Res Function(_PictureEntity) _then;
|
||||
|
||||
/// Create a copy of PictureEntity
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? userId = freezed,Object? createdAt = null,}) {
|
||||
return _then(_PictureEntity(
|
||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,5 @@
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
|
||||
abstract class GetPicturesUseCase {
|
||||
Future<List<PictureEntity>> getPictures({required String userId});
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case.dart';
|
||||
|
||||
class GetPicturesUseCaseImpl implements GetPicturesUseCase {
|
||||
GetPicturesUseCaseImpl(this._repository);
|
||||
|
||||
final FunctionsRepository _repository;
|
||||
|
||||
@override
|
||||
Future<List<PictureEntity>> getPictures({required String userId}) {
|
||||
return _repository.getPictures(userId: userId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
|
||||
abstract class TakePictureUseCase {
|
||||
Future<PictureEntity> takePicture({required String userId});
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
import 'package:functions/src/core/domain/repositories/functions_repository.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/take_picture_use_case.dart';
|
||||
|
||||
class TakePictureUseCaseImpl implements TakePictureUseCase {
|
||||
TakePictureUseCaseImpl(this._repository);
|
||||
|
||||
final FunctionsRepository _repository;
|
||||
|
||||
@override
|
||||
Future<PictureEntity> takePicture({required String userId}) {
|
||||
return _repository.takePicture(userId: userId);
|
||||
}
|
||||
}
|
||||
@@ -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/remote_connection/domain/get_pictures_use_case.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case_impl.dart';
|
||||
|
||||
final getPicturesUseCaseProvider = Provider.autoDispose<GetPicturesUseCase>((ref) {
|
||||
final functionsRepository = ref.read(functionsRepositoryProvider);
|
||||
return GetPicturesUseCaseImpl(functionsRepository);
|
||||
});
|
||||
@@ -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/remote_connection/domain/take_picture_use_case.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/take_picture_use_case_impl.dart';
|
||||
|
||||
final takePictureUseCaseProvider = Provider.autoDispose<TakePictureUseCase>((ref) {
|
||||
final functionsRepository = ref.read(functionsRepositoryProvider);
|
||||
return TakePictureUseCaseImpl(functionsRepository);
|
||||
});
|
||||
@@ -0,0 +1,76 @@
|
||||
// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_model.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
|
||||
class RemoteCameraScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const RemoteCameraScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final viewModel = ref.read(remoteConnectionViewModelProvider.notifier);
|
||||
final viewState = ref.watch(remoteConnectionViewModelProvider);
|
||||
|
||||
return PageLayout(
|
||||
title: context.translate('Remote camera'),
|
||||
body: Expanded(child: GridView.count(
|
||||
primary: false,
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 24, vertical: 12),
|
||||
big: EdgeInsets.symmetric(horizontal: 23, vertical: 11)
|
||||
),
|
||||
crossAxisSpacing: 11,
|
||||
mainAxisSpacing: 11,
|
||||
crossAxisCount: 3,
|
||||
childAspectRatio: 0.8,
|
||||
children: List<Widget>.generate(12, (int index)=>
|
||||
Container(
|
||||
height: SizeUtils.getByScreen(small: 110, big: 105),
|
||||
width: SizeUtils.getByScreen(small: 60, big: 58),
|
||||
color: Colors.grey[200],
|
||||
child: SvgPicture.asset('assets/images/ui/face.svg'),
|
||||
)
|
||||
),
|
||||
)),
|
||||
footer: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(vertical: 12, horizontal: 26),
|
||||
big: EdgeInsets.symmetric(vertical: 10, horizontal: 25)
|
||||
),
|
||||
child: PrimaryButton(
|
||||
onPressed: () {
|
||||
showDialog(context: context, builder: (context)=>Dialog(
|
||||
child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 32, vertical: 30),
|
||||
big: EdgeInsets.symmetric(horizontal: 30, vertical: 28)
|
||||
),
|
||||
width: SizeUtils.getByScreen(small: 360, big: 350),
|
||||
height: SizeUtils.getByScreen(small: 195, big: 185),
|
||||
child: Text(context.translate('Loading photo...'),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)),
|
||||
),
|
||||
),
|
||||
));
|
||||
viewModel.takePicture();
|
||||
Navigator.pop(context);
|
||||
},
|
||||
text: context.translate('Take a picture'),
|
||||
color: Color(0xFF588EA5),
|
||||
height: SizeUtils.getByScreen(small: 36, big: 35),
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/remote_camera_screen.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 RemoteConnectionScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const RemoteConnectionScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
// final theme = ref.watch(themePortProvider);
|
||||
|
||||
return PageLayout(
|
||||
title: 'Remote Connection',
|
||||
body: SingleChildScrollView(child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
AppSectionButton(
|
||||
onPressed: (){Navigator.push(context, MaterialPageRoute(
|
||||
builder: (_)=>RemoteCameraScreen(navigationContract: navigationContract)
|
||||
));},
|
||||
icon: Icons.photo_camera_outlined,
|
||||
text: 'Remote camera'
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
AppSectionButton(
|
||||
onPressed: (){},
|
||||
icon: SFIcons.listen,
|
||||
text: 'Remote listening'
|
||||
),
|
||||
],
|
||||
),
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class AppSectionButton extends ConsumerWidget {
|
||||
|
||||
final GestureTapCallback onPressed;
|
||||
final IconData icon;
|
||||
final String text;
|
||||
|
||||
const AppSectionButton({
|
||||
required this.onPressed,
|
||||
required this.icon,
|
||||
required this.text,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.read(themePortProvider);
|
||||
|
||||
return GestureDetector(
|
||||
onTap: onPressed,
|
||||
child: Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 20),
|
||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 18)
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
|
||||
color: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.circle,
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
|
||||
child: Icon(icon,
|
||||
size: SizeUtils.getByScreen(small: 40, big: 44),
|
||||
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: 19),
|
||||
fontWeight: FontWeight.w500
|
||||
)
|
||||
)
|
||||
)
|
||||
],
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/get_pictures_use_case.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/take_picture_use_case.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/providers/get_pictures_use_case_provider.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/providers/take_picture_use_case_provider.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/state/remote_connection_view_state.dart';
|
||||
// import 'package:legacy_shared/src/providers/logged_user_provider.dart';
|
||||
// import 'package:legacy_shared/src/data/models/entities/user_entity.dart';
|
||||
// import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
final remoteConnectionViewModelProvider =
|
||||
NotifierProvider.autoDispose<RemoteConnectionViewModel, RemoteConnectionViewState>(
|
||||
RemoteConnectionViewModel.new,
|
||||
);
|
||||
|
||||
class RemoteConnectionViewModel extends Notifier<RemoteConnectionViewState> {
|
||||
late final GetPicturesUseCase _getPicturesUseCase;
|
||||
late final TakePictureUseCase _takePictureUseCase;
|
||||
|
||||
late final TextEditingController nameController;
|
||||
late final TextEditingController phoneController;
|
||||
|
||||
// late final UserEntity loggedUser;
|
||||
|
||||
@override
|
||||
RemoteConnectionViewState build() {
|
||||
_getPicturesUseCase = ref.read(getPicturesUseCaseProvider);
|
||||
_takePictureUseCase = ref.read(takePictureUseCaseProvider);
|
||||
|
||||
// loggedUser = ref.read(loggedUserProvider);
|
||||
|
||||
phoneController = TextEditingController();
|
||||
|
||||
phoneController.addListener(_onPhoneChanged);
|
||||
|
||||
// _getPicturesUseCase.getImages(userId: '').then(setImages);
|
||||
|
||||
ref.onDispose(disposeControllers);
|
||||
|
||||
return const RemoteConnectionViewState();
|
||||
}
|
||||
|
||||
void setImages(List<PictureEntity> pictures) {
|
||||
state = state.copyWith(
|
||||
pictures: pictures
|
||||
);
|
||||
}
|
||||
|
||||
void _onPhoneChanged() {
|
||||
final text = phoneController.text;
|
||||
if (text == state.phone) return;
|
||||
|
||||
state = state.copyWith(phone: text, errorMessage: '');
|
||||
}
|
||||
|
||||
void takePicture() {
|
||||
try {
|
||||
state = state.copyWith(isTakingPicture: true);
|
||||
|
||||
_takePictureUseCase.takePicture(userId: '')
|
||||
.then((picture) {
|
||||
List<PictureEntity> pictures = state.pictures;
|
||||
pictures.add(picture);
|
||||
state = state.copyWith(
|
||||
isTakingPicture: true,
|
||||
|
||||
);
|
||||
});
|
||||
} catch (e){
|
||||
state = state.copyWith(
|
||||
isTakingPicture: false,
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void disposeControllers() {
|
||||
phoneController.removeListener(_onPhoneChanged);
|
||||
|
||||
phoneController.dispose();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:functions/src/features/remote_connection/domain/entities/picture_entity.dart';
|
||||
|
||||
part 'remote_connection_view_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class RemoteConnectionViewState with _$RemoteConnectionViewState {
|
||||
const factory RemoteConnectionViewState({
|
||||
@Default('') String phone,
|
||||
@Default([]) List<PictureEntity> pictures,
|
||||
@Default(true) bool isLoadingImages,
|
||||
@Default(false) bool isTakingPicture,
|
||||
@Default(false) bool isCalling,
|
||||
@Default('') String errorMessage
|
||||
}) = _RemoteConnectionViewState;
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
// 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 'remote_connection_view_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$RemoteConnectionViewState {
|
||||
|
||||
String get phone; List<PictureEntity> get pictures; bool get isLoadingImages; bool get isTakingPicture; bool get isCalling; String get errorMessage;
|
||||
/// Create a copy of RemoteConnectionViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$RemoteConnectionViewStateCopyWith<RemoteConnectionViewState> get copyWith => _$RemoteConnectionViewStateCopyWithImpl<RemoteConnectionViewState>(this as RemoteConnectionViewState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other.pictures, pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $RemoteConnectionViewStateCopyWith<$Res> {
|
||||
factory $RemoteConnectionViewStateCopyWith(RemoteConnectionViewState value, $Res Function(RemoteConnectionViewState) _then) = _$RemoteConnectionViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String phone, List<PictureEntity> pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$RemoteConnectionViewStateCopyWithImpl<$Res>
|
||||
implements $RemoteConnectionViewStateCopyWith<$Res> {
|
||||
_$RemoteConnectionViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final RemoteConnectionViewState _self;
|
||||
final $Res Function(RemoteConnectionViewState) _then;
|
||||
|
||||
/// Create a copy of RemoteConnectionViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,pictures: null == pictures ? _self.pictures : pictures // ignore: cast_nullable_to_non_nullable
|
||||
as List<PictureEntity>,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [RemoteConnectionViewState].
|
||||
extension RemoteConnectionViewStatePatterns on RemoteConnectionViewState {
|
||||
/// 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( _RemoteConnectionViewState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState() 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( _RemoteConnectionViewState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState():
|
||||
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( _RemoteConnectionViewState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState() 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 phone, List<PictureEntity> pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState() when $default != null:
|
||||
return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_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( String phone, List<PictureEntity> pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState():
|
||||
return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_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( String phone, List<PictureEntity> pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _RemoteConnectionViewState() when $default != null:
|
||||
return $default(_that.phone,_that.pictures,_that.isLoadingImages,_that.isTakingPicture,_that.isCalling,_that.errorMessage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _RemoteConnectionViewState implements RemoteConnectionViewState {
|
||||
const _RemoteConnectionViewState({this.phone = '', final List<PictureEntity> pictures = const [], this.isLoadingImages = true, this.isTakingPicture = false, this.isCalling = false, this.errorMessage = ''}): _pictures = pictures;
|
||||
|
||||
|
||||
@override@JsonKey() final String phone;
|
||||
final List<PictureEntity> _pictures;
|
||||
@override@JsonKey() List<PictureEntity> get pictures {
|
||||
if (_pictures is EqualUnmodifiableListView) return _pictures;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_pictures);
|
||||
}
|
||||
|
||||
@override@JsonKey() final bool isLoadingImages;
|
||||
@override@JsonKey() final bool isTakingPicture;
|
||||
@override@JsonKey() final bool isCalling;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
|
||||
/// Create a copy of RemoteConnectionViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$RemoteConnectionViewStateCopyWith<_RemoteConnectionViewState> get copyWith => __$RemoteConnectionViewStateCopyWithImpl<_RemoteConnectionViewState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _RemoteConnectionViewState&&(identical(other.phone, phone) || other.phone == phone)&&const DeepCollectionEquality().equals(other._pictures, _pictures)&&(identical(other.isLoadingImages, isLoadingImages) || other.isLoadingImages == isLoadingImages)&&(identical(other.isTakingPicture, isTakingPicture) || other.isTakingPicture == isTakingPicture)&&(identical(other.isCalling, isCalling) || other.isCalling == isCalling)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,phone,const DeepCollectionEquality().hash(_pictures),isLoadingImages,isTakingPicture,isCalling,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'RemoteConnectionViewState(phone: $phone, pictures: $pictures, isLoadingImages: $isLoadingImages, isTakingPicture: $isTakingPicture, isCalling: $isCalling, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$RemoteConnectionViewStateCopyWith<$Res> implements $RemoteConnectionViewStateCopyWith<$Res> {
|
||||
factory _$RemoteConnectionViewStateCopyWith(_RemoteConnectionViewState value, $Res Function(_RemoteConnectionViewState) _then) = __$RemoteConnectionViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String phone, List<PictureEntity> pictures, bool isLoadingImages, bool isTakingPicture, bool isCalling, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$RemoteConnectionViewStateCopyWithImpl<$Res>
|
||||
implements _$RemoteConnectionViewStateCopyWith<$Res> {
|
||||
__$RemoteConnectionViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _RemoteConnectionViewState _self;
|
||||
final $Res Function(_RemoteConnectionViewState) _then;
|
||||
|
||||
/// Create a copy of RemoteConnectionViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? phone = null,Object? pictures = null,Object? isLoadingImages = null,Object? isTakingPicture = null,Object? isCalling = null,Object? errorMessage = null,}) {
|
||||
return _then(_RemoteConnectionViewState(
|
||||
phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||
as String,pictures: null == pictures ? _self._pictures : pictures // ignore: cast_nullable_to_non_nullable
|
||||
as List<PictureEntity>,isLoadingImages: null == isLoadingImages ? _self.isLoadingImages : isLoadingImages // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isTakingPicture: null == isTakingPicture ? _self.isTakingPicture : isTakingPicture // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isCalling: null == isCalling ? _self.isCalling : isCalling // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,18 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:functions/src/features/remote_connection/presentation/remote_connection_screen.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
class RemoteConnectionBuilder {
|
||||
const RemoteConnectionBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
|
||||
|
||||
return MaterialPage<void>(
|
||||
key: state.pageKey,
|
||||
child: RemoteConnectionScreen(navigationContract: navigationContract),
|
||||
);
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -1131,6 +1131,20 @@
|
||||
"search": [
|
||||
"icon"
|
||||
]
|
||||
},
|
||||
{
|
||||
"uid": "c2dafca4f49d11a68d647573fb4b3c0c",
|
||||
"css": "listen",
|
||||
"code": 59472,
|
||||
"src": "custom_icons",
|
||||
"selected": true,
|
||||
"svg": {
|
||||
"path": "M332.2 16C503.5 15.9 643.6 151.4 643.6 319.4 643.6 454.3 578.7 524 520.1 583.3 461.9 642.2 412.3 689.1 412.3 790.5 412.3 897.9 323 984 214 984 104.9 984 16 897.8 16 790.5V703.7C15.9 696.6 18.8 689.7 23.8 684.7L23.8 684.6C28.9 679.6 35.8 676.7 42.9 676.7 49.2 676.7 55.3 678.9 60.1 682.9L62.1 684.7 63.9 686.7C67.8 691.5 70 697.5 69.9 703.7V790.5C69.9 867.6 133.4 930.3 214 930.3 294.5 930.3 358.3 867.6 358.3 790.5 358.3 667.3 424.3 603.8 481.9 545.6L503.1 523.8C523.7 502.1 542.4 480 557.2 454 576.6 419.6 589.6 377.6 589.6 319.4 589.6 181.8 475 69.7 332.2 69.6 189.4 69.6 74.8 181.8 74.8 319.4 74.8 326.6 72 333.4 66.9 338.4L66.9 338.5C61.8 343.5 54.9 346.4 47.8 346.4 40.6 346.4 33.7 343.5 28.6 338.4L28.6 338.4C23.5 333.3 20.7 326.3 20.8 319.1 20.9 151.2 160.9 16 332.2 16ZM331.5 133C437.6 133 524.6 217.1 524.7 321.5 524.8 328.8 521.9 335.7 516.9 340.8L516.8 340.8C511.7 345.9 504.9 348.7 497.7 348.7 490.6 348.7 483.6 345.9 478.5 340.8 473.5 335.7 470.6 328.8 470.7 321.5 470.6 247.4 409 186.7 331.5 186.7 253.9 186.7 192 247.6 192 321.7V322.5L192 322.9 186.1 435.1C247.9 450.3 290.9 512.6 290.9 583 290.9 663.4 234.7 735.2 158 735.4 157.9 735.4 157.9 735.4 157.9 735.4 157.8 735.4 157.8 735.4 157.8 735.4V735.4C150.7 735.4 143.9 732.7 138.8 727.7 134.2 723.3 131.4 717.5 130.8 711.2L130.6 708.5 130.8 705.8C131.4 699.6 134.2 693.7 138.8 689.3 143.9 684.3 150.7 681.6 157.8 681.7L161.5 681.6C200.3 679.1 237 639.4 237 583 236.9 524.8 198 484.6 157.8 484.6V484.6C150.3 484.6 143.2 481.6 138.1 476.3 133 470.9 130.3 463.6 130.8 456.1L138 321 138.3 311.3C143.9 211.7 229 133 331.5 133Z",
|
||||
"width": 660
|
||||
},
|
||||
"search": [
|
||||
"icon"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -86,6 +86,7 @@ class SFIcons {
|
||||
static const IconData privacy = IconData(0xe841, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData watch = IconData(0xe843, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData handshake = IconData(0xe844, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
static const IconData listen = IconData(0xe850, 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 renovationSelected = IconData(0xe862, fontFamily: _kFontFam, fontPackage: _kFontPkg);
|
||||
|
||||
@@ -23,4 +23,5 @@ class AppRoutes {
|
||||
static const dashboardFunctions = '$legacyDashboard/functions';
|
||||
|
||||
static const contacts = '$dashboardFunctions/contacts';
|
||||
static const remoteConnection = '$dashboardFunctions/remote_connection';
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user