Merge branch 'feature/remote-management' into legacy
# Conflicts: # apps/mobile_app/lib/save_family_app.dart # packages/sf_localizations/assets/l10n/de.json # packages/sf_localizations/assets/l10n/en.json # packages/sf_localizations/assets/l10n/es.json # packages/sf_localizations/assets/l10n/fr.json # packages/sf_localizations/assets/l10n/it.json # packages/sf_localizations/assets/l10n/pt.json # packages/sf_localizations/lib/src/generated/i18n.dart
This commit is contained in:
1
.dart_tool/extension_discovery/devtools.json
Normal file
1
.dart_tool/extension_discovery/devtools.json
Normal file
@@ -0,0 +1 @@
|
|||||||
|
{"version":2,"entries":[{"package":"sf_app_platform_mono_repo","rootUri":"../","packageUri":"lib/"}]}
|
||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2026-02-27 12:35:56.235180","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_secure_storage","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"flutter_secure_storage_macos","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3/","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"flutter_secure_storage_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_linux","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false}],"windows":[{"name":"flutter_secure_storage_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_windows","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false}],"web":[{"name":"flutter_secure_storage_web","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1/","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_secure_storage","dependencies":["flutter_secure_storage_linux","flutter_secure_storage_macos","flutter_secure_storage_web","flutter_secure_storage_windows"]},{"name":"flutter_secure_storage_linux","dependencies":[]},{"name":"flutter_secure_storage_macos","dependencies":[]},{"name":"flutter_secure_storage_web","dependencies":[]},{"name":"flutter_secure_storage_windows","dependencies":["path_provider"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2026-03-13 09:52:54.635963","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
<uses-permission android:name="android.permission.CAMERA" />
|
<uses-permission android:name="android.permission.CAMERA" />
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||||
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
<uses-permission android:name="android.permission.USE_BIOMETRIC" />
|
||||||
|
<uses-permission android:name="android.permission.READ_CONTACTS" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -1,3 +1,6 @@
|
|||||||
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
org.gradle.jvmargs=-Xmx8G -XX:MaxMetaspaceSize=4G -XX:ReservedCodeCacheSize=512m -XX:+HeapDumpOnOutOfMemoryError
|
||||||
android.useAndroidX=true
|
android.useAndroidX=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
|
|
||||||
|
# permission_handler: enable contacts permission
|
||||||
|
PERMISSION_CONTACTS=1
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
<true/>
|
<true/>
|
||||||
<key>UIStatusBarHidden</key>
|
<key>UIStatusBarHidden</key>
|
||||||
<true/>
|
<true/>
|
||||||
|
<key>NSContactsUsageDescription</key>
|
||||||
|
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
|
||||||
<key>NSCameraUsageDescription</key>
|
<key>NSCameraUsageDescription</key>
|
||||||
<string>Necesitamos la cámara para escanear códigos QR</string>
|
<string>Necesitamos la cámara para escanear códigos QR</string>
|
||||||
<key>NSLocationWhenInUseUsageDescription</key>
|
<key>NSLocationWhenInUseUsageDescription</key>
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import 'package:navigation/navigation.dart';
|
|||||||
import 'package:notifications/notifications.dart';
|
import 'package:notifications/notifications.dart';
|
||||||
import 'package:payments/payments.dart';
|
import 'package:payments/payments.dart';
|
||||||
import 'package:profile/profile.dart';
|
import 'package:profile/profile.dart';
|
||||||
|
import 'package:settings/settings.dart';
|
||||||
import 'package:splash/splash.dart';
|
import 'package:splash/splash.dart';
|
||||||
|
|
||||||
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>();
|
final GlobalKey<NavigatorState> rootNavigatorKey = GlobalKey<NavigatorState>();
|
||||||
@@ -93,10 +94,27 @@ void configureAppRouter() {
|
|||||||
name: 'device_management',
|
name: 'device_management',
|
||||||
pageBuilder: DeviceManagementBuilder().buildPage,
|
pageBuilder: DeviceManagementBuilder().buildPage,
|
||||||
routes: [
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: 'scheduled_activities',
|
||||||
|
name: 'scheduled_activities',
|
||||||
|
pageBuilder: const ScheduledActivitiesBuilder().buildPage,
|
||||||
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'contacts',
|
path: 'contacts',
|
||||||
name: 'contacts',
|
name: 'contacts',
|
||||||
pageBuilder: ContactsBuilder().buildPage,
|
pageBuilder: const ContactsBuilder().buildPage,
|
||||||
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: 'edit/:contactId',
|
||||||
|
name: 'edit_contact',
|
||||||
|
pageBuilder: const EditContactBuilder().buildPage,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'health',
|
||||||
|
name: 'health',
|
||||||
|
pageBuilder: const HealthBuilder().buildPage,
|
||||||
),
|
),
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: 'remote_connection',
|
path: 'remote_connection',
|
||||||
@@ -113,6 +131,16 @@ void configureAppRouter() {
|
|||||||
name: 'rewards',
|
name: 'rewards',
|
||||||
pageBuilder: RewardsBuilder().buildPage,
|
pageBuilder: RewardsBuilder().buildPage,
|
||||||
),
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'activity_meter',
|
||||||
|
name: 'activity_meter',
|
||||||
|
pageBuilder: const ActivityMeterBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'apps_use',
|
||||||
|
name: 'apps_use',
|
||||||
|
pageBuilder: const AppsUseBuilder().buildPage,
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -141,8 +169,95 @@ void configureAppRouter() {
|
|||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
StatefulShellBranch(
|
||||||
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: AppRoutes.settings,
|
||||||
|
name: 'settings',
|
||||||
|
pageBuilder: SettingsBuilder().buildPage,
|
||||||
|
routes: [
|
||||||
|
GoRoute(
|
||||||
|
path: 'alarm',
|
||||||
|
name: 'alarm',
|
||||||
|
pageBuilder: AlarmBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'remote_management',
|
||||||
|
name: 'remote_management',
|
||||||
|
pageBuilder: RemoteManagementBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'sos_agenda',
|
||||||
|
name: 'sos_agenda',
|
||||||
|
pageBuilder: SosContactsBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'sound',
|
||||||
|
name: 'sound',
|
||||||
|
pageBuilder: SoundBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'sync_clock',
|
||||||
|
name: 'sync_clock',
|
||||||
|
pageBuilder: SyncClockBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'app_store',
|
||||||
|
name: 'app_store',
|
||||||
|
pageBuilder: AppStoreBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'battery',
|
||||||
|
name: 'battery',
|
||||||
|
pageBuilder: BatteryBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'block_phone',
|
||||||
|
name: 'block_phone',
|
||||||
|
pageBuilder: BlockPhoneBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'disable_functions',
|
||||||
|
name: 'disable_functions',
|
||||||
|
pageBuilder: DisableFunctionsBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'language',
|
||||||
|
name: 'language',
|
||||||
|
pageBuilder: LanguageBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'legacy_notifications',
|
||||||
|
name: 'legacy_notifications',
|
||||||
|
pageBuilder: LegacyNotificationsBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'remote_on_off',
|
||||||
|
name: 'remote_on_off',
|
||||||
|
pageBuilder: RemoteOnOffBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'sms_alert',
|
||||||
|
name: 'sms_alert',
|
||||||
|
pageBuilder: SmsAlertBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'timezone',
|
||||||
|
name: 'timezone',
|
||||||
|
pageBuilder: TimezoneBuilder().buildPage,
|
||||||
|
),
|
||||||
|
GoRoute(
|
||||||
|
path: 'wifi_settings',
|
||||||
|
name: 'wifi_settings',
|
||||||
|
pageBuilder: WifiSettingsBuilder().buildPage,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: AppRoutes.login,
|
path: AppRoutes.login,
|
||||||
name: 'login',
|
name: 'login',
|
||||||
|
|||||||
42
apps/mobile_app/lib/providers/legacy_heartbeat_service.dart
Normal file
42
apps/mobile_app/lib/providers/legacy_heartbeat_service.dart
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import 'dart:async';
|
||||||
|
|
||||||
|
import 'package:flutter/foundation.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
class LegacyHeartbeatService {
|
||||||
|
LegacyHeartbeatService({
|
||||||
|
required QuestiaRepository repository,
|
||||||
|
required void Function() onUnauthorized,
|
||||||
|
}) : _repository = repository,
|
||||||
|
_onUnauthorized = onUnauthorized;
|
||||||
|
|
||||||
|
final QuestiaRepository _repository;
|
||||||
|
final void Function() _onUnauthorized;
|
||||||
|
Timer? _timer;
|
||||||
|
|
||||||
|
static const _interval = Duration(minutes: 3);
|
||||||
|
|
||||||
|
void start() {
|
||||||
|
if (_timer != null) return;
|
||||||
|
_beat();
|
||||||
|
_timer = Timer.periodic(_interval, (_) => _beat());
|
||||||
|
debugPrint('[LegacyHeartbeat] started');
|
||||||
|
}
|
||||||
|
|
||||||
|
void stop() {
|
||||||
|
_timer?.cancel();
|
||||||
|
_timer = null;
|
||||||
|
debugPrint('[LegacyHeartbeat] stopped');
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> _beat() async {
|
||||||
|
try {
|
||||||
|
await _repository.get<dynamic>('/auth/me');
|
||||||
|
debugPrint('[LegacyHeartbeat] /auth/me => OK');
|
||||||
|
} catch (e) {
|
||||||
|
debugPrint('[LegacyHeartbeat] error: $e');
|
||||||
|
stop();
|
||||||
|
_onUnauthorized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,9 @@ import 'package:sf_app_platform/navigation/app_router.dart';
|
|||||||
import 'package:navigation/navigation.dart';
|
import 'package:navigation/navigation.dart';
|
||||||
import 'package:sf_app_platform/providers/app_state_provider.dart';
|
import 'package:sf_app_platform/providers/app_state_provider.dart';
|
||||||
import 'package:sf_app_platform/providers/permissions/permissions_provider.dart';
|
import 'package:sf_app_platform/providers/permissions/permissions_provider.dart';
|
||||||
|
import 'package:sf_app_platform/providers/legacy_heartbeat_service.dart';
|
||||||
import 'package:sf_app_platform/providers/wallet_heartbeat_service.dart';
|
import 'package:sf_app_platform/providers/wallet_heartbeat_service.dart';
|
||||||
|
import 'package:get_it/get_it.dart';
|
||||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
import 'package:sf_shared/sf_shared.dart';
|
import 'package:sf_shared/sf_shared.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
@@ -23,6 +25,7 @@ class SaveFamilyApp extends ConsumerStatefulWidget {
|
|||||||
class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||||
with WidgetsBindingObserver {
|
with WidgetsBindingObserver {
|
||||||
late final WalletHeartbeatService walletHeartbeat;
|
late final WalletHeartbeatService walletHeartbeat;
|
||||||
|
late final LegacyHeartbeatService legacyHeartbeat;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
@@ -33,13 +36,25 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
|||||||
sessionLocal: SessionLocalDatasourceImpl(),
|
sessionLocal: SessionLocalDatasourceImpl(),
|
||||||
onError: () => appRouter.go(AppRoutes.scaTreezor),
|
onError: () => appRouter.go(AppRoutes.scaTreezor),
|
||||||
);
|
);
|
||||||
onBeforeSessionCleared = walletHeartbeat.stop;
|
legacyHeartbeat = LegacyHeartbeatService(
|
||||||
walletHeartbeat.start();
|
repository: GetIt.I<QuestiaRepository>(),
|
||||||
|
onUnauthorized: () {
|
||||||
|
clearSessionData();
|
||||||
|
appRouter.go(AppRoutes.legacyLogin);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
onBeforeSessionCleared = () {
|
||||||
|
walletHeartbeat.stop();
|
||||||
|
legacyHeartbeat.stop();
|
||||||
|
};
|
||||||
|
// walletHeartbeat.start();
|
||||||
|
legacyHeartbeat.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
walletHeartbeat.stop();
|
walletHeartbeat.stop();
|
||||||
|
legacyHeartbeat.stop();
|
||||||
WidgetsBinding.instance.removeObserver(this);
|
WidgetsBinding.instance.removeObserver(this);
|
||||||
super.dispose();
|
super.dispose();
|
||||||
}
|
}
|
||||||
@@ -49,10 +64,12 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
|||||||
debugPrint('State: $state');
|
debugPrint('State: $state');
|
||||||
ref.read(appLifecycleStateProvider.notifier).setState(state);
|
ref.read(appLifecycleStateProvider.notifier).setState(state);
|
||||||
if (state == AppLifecycleState.resumed) {
|
if (state == AppLifecycleState.resumed) {
|
||||||
walletHeartbeat.start();
|
// walletHeartbeat.start();
|
||||||
|
legacyHeartbeat.start();
|
||||||
ref.read(permissionsProvider.notifier).checkPermissions();
|
ref.read(permissionsProvider.notifier).checkPermissions();
|
||||||
} else if (state == AppLifecycleState.paused) {
|
} else if (state == AppLifecycleState.paused) {
|
||||||
walletHeartbeat.stop();
|
// walletHeartbeat.stop();
|
||||||
|
legacyHeartbeat.stop();
|
||||||
}
|
}
|
||||||
super.didChangeAppLifecycleState(state);
|
super.didChangeAppLifecycleState(state);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1/
|
||||||
@@ -1 +1 @@
|
|||||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
|
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/shared_preferences_linux-2.4.1/
|
||||||
@@ -1 +1 @@
|
|||||||
/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/url_launcher_linux-3.2.2/
|
C:/Users/Aitor Arana/AppData/Local/Pub/Cache/hosted/pub.dev/url_launcher_linux-3.2.2/
|
||||||
@@ -406,6 +406,14 @@ packages:
|
|||||||
description: flutter
|
description: flutter
|
||||||
source: sdk
|
source: sdk
|
||||||
version: "0.0.0"
|
version: "0.0.0"
|
||||||
|
flutter_contacts:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: flutter_contacts
|
||||||
|
sha256: "388d32cd33f16640ee169570128c933b45f3259bddbfae7a100bb49e5ffea9ae"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "1.1.9+2"
|
||||||
flutter_launcher_icons:
|
flutter_launcher_icons:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
@@ -1081,6 +1089,13 @@ packages:
|
|||||||
url: "https://pub.dev"
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.5.0"
|
version: "2.5.0"
|
||||||
|
settings:
|
||||||
|
dependency: "direct main"
|
||||||
|
description:
|
||||||
|
path: "../../modules/legacy/modules/settings"
|
||||||
|
relative: true
|
||||||
|
source: path
|
||||||
|
version: "1.0.0+1"
|
||||||
sf_infrastructure:
|
sf_infrastructure:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
|
|||||||
@@ -65,6 +65,8 @@ dependencies:
|
|||||||
path: ../../modules/legacy/modules/location
|
path: ../../modules/legacy/modules/location
|
||||||
legacy_auth:
|
legacy_auth:
|
||||||
path: ../../modules/legacy/modules/legacy_auth
|
path: ../../modules/legacy/modules/legacy_auth
|
||||||
|
settings:
|
||||||
|
path: ../../modules/legacy/modules/settings
|
||||||
#packages dependencies go here
|
#packages dependencies go here
|
||||||
navigation:
|
navigation:
|
||||||
path: ../../packages/navigation
|
path: ../../packages/navigation
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management,legacy_auth,location
|
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management,legacy_auth,location
|
||||||
|
# melos_managed_dependency_overrides: settings
|
||||||
|
# melos_managed_dependency_overrides: account,activity,auth,customer_service,dashboard_shell,design_system,flutter_treezor_entrust_sdk_bridge,fonts,home,legacy_dashboard_shell,legacy_shared,navigation,notifications,payments,profile,sca_treezor,sf_infrastructure,sf_localizations,sf_shared,splash,utils,control_panel,device_management
|
||||||
dependency_overrides:
|
dependency_overrides:
|
||||||
account:
|
account:
|
||||||
path: ../../modules/legacy/modules/account
|
path: ../../modules/legacy/modules/account
|
||||||
@@ -40,6 +42,8 @@ dependency_overrides:
|
|||||||
path: ../../modules/profile
|
path: ../../modules/profile
|
||||||
sca_treezor:
|
sca_treezor:
|
||||||
path: ../../packages/sca_treezor
|
path: ../../packages/sca_treezor
|
||||||
|
settings:
|
||||||
|
path: ../../modules/legacy/modules/settings
|
||||||
sf_infrastructure:
|
sf_infrastructure:
|
||||||
path: ../../packages/sf_infrastructure
|
path: ../../packages/sf_infrastructure
|
||||||
sf_localizations:
|
sf_localizations:
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
{"version":2,"entries":[{"package":"design_system","rootUri":"../../../packages/design_system/","packageUri":"lib/"},{"package":"flutter_treezor_entrust_sdk_bridge","rootUri":"../../../packages/flutter_treezor_entrust_sdk_bridge/","packageUri":"lib/"},{"package":"fonts","rootUri":"../../../packages/fonts/","packageUri":"lib/"},{"package":"get_it","rootUri":"file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/get_it-9.2.0/","packageUri":"lib/","config":{"name":"get_it","issueTracker":"https://github.com/fluttercommunity/get_it/issues","version":"0.0.1","materialIconCodePoint":"0xe189"}},{"package":"sca_treezor","rootUri":"../../../packages/sca_treezor/","packageUri":"lib/"},{"package":"sf_infrastructure","rootUri":"../../../packages/sf_infrastructure/","packageUri":"lib/"},{"package":"sf_localizations","rootUri":"../../../packages/sf_localizations/","packageUri":"lib/"},{"package":"sf_shared","rootUri":"../../../packages/sf_shared/","packageUri":"lib/"},{"package":"shared_preferences","rootUri":"file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences-2.5.4/","packageUri":"lib/","config":{"name":"shared_preferences","issueTracker":"https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+shared_preferences%22","version":"1.0.0","materialIconCodePoint":"0xe683"}},{"package":"utils","rootUri":"../../../packages/utils/","packageUri":"lib/"},{"package":"activity","rootUri":"../","packageUri":"lib/"}]}
|
||||||
@@ -1 +1 @@
|
|||||||
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.22\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.20\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_treezor_entrust_sdk_bridge","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-03-09 10:57:00.990731","version":"3.35.6","swift_package_manager_enabled":{"ios":false,"macos":false}}
|
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"android":[{"name":"flutter_treezor_entrust_sdk_bridge","path":"C:\\\\dev\\\\sf-app-platform\\\\packages\\\\flutter_treezor_entrust_sdk_bridge\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.2.22\\\\","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_android-2.4.20\\\\","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.5.1\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_foundation","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_foundation-2.5.6\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[],"dev_dependency":false}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.2.1\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_linux-2.4.1\\\\","native_build":false,"dependencies":["path_provider_linux"],"dev_dependency":false}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.3.0\\\\","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_windows-2.4.1\\\\","native_build":false,"dependencies":["path_provider_windows"],"dev_dependency":false}],"web":[{"name":"shared_preferences_web","path":"C:\\\\Users\\\\Aitor Arana\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\shared_preferences_web-2.4.3\\\\","dependencies":[],"dev_dependency":false}]},"dependencyGraph":[{"name":"flutter_treezor_entrust_sdk_bridge","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]}],"date_created":"2026-03-16 09:33:25.098373","version":"3.35.6","swift_package_manager_enabled":{"ios":false,"macos":false}}
|
||||||
3
modules/activity/devtools_options.yaml
Normal file
3
modules/activity/devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
@@ -32,7 +32,7 @@ class OnboardingScreen extends ConsumerWidget {
|
|||||||
|
|
||||||
void goToNext() {
|
void goToNext() {
|
||||||
if (isLast) {
|
if (isLast) {
|
||||||
navigationContract.goTo(AppRoutes.login);
|
navigationContract.goTo(AppRoutes.legacyLogin);
|
||||||
} else {
|
} else {
|
||||||
pageController.nextPage(
|
pageController.nextPage(
|
||||||
duration: const Duration(milliseconds: 400),
|
duration: const Duration(milliseconds: 400),
|
||||||
@@ -111,7 +111,7 @@ class OnboardingScreen extends ConsumerWidget {
|
|||||||
? const SizedBox.shrink()
|
? const SizedBox.shrink()
|
||||||
: TextButton(
|
: TextButton(
|
||||||
onPressed: () =>
|
onPressed: () =>
|
||||||
navigationContract.goTo(AppRoutes.login),
|
navigationContract.goTo(AppRoutes.legacyLogin),
|
||||||
child: Text(
|
child: Text(
|
||||||
context.translate(I18n.skip),
|
context.translate(I18n.skip),
|
||||||
style: AppFonts.stolzlStyle(
|
style: AppFonts.stolzlStyle(
|
||||||
|
|||||||
3
modules/dashboard_shell/devtools_options.yaml
Normal file
3
modules/dashboard_shell/devtools_options.yaml
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
description: This file stores settings for Dart & Flutter DevTools.
|
||||||
|
documentation: https://docs.flutter.dev/tools/devtools/extensions#configure-extension-enablement-states
|
||||||
|
extensions:
|
||||||
@@ -16,11 +16,11 @@ class UsersRemoteDatasourceImpl implements UsersRemoteDatasource {
|
|||||||
Future<List<UserEntity>> getUsers({required String userId}) async {
|
Future<List<UserEntity>> getUsers({required String userId}) async {
|
||||||
try {
|
try {
|
||||||
final response = await _repository.get<Map<String, dynamic>>(
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
'/$userId/devices',
|
'/users/$userId/user-devices',
|
||||||
);
|
);
|
||||||
final data = response.data!['items'];
|
final data = response.data!['items'];
|
||||||
if (data == null || data.isEmpty) {
|
if (data == null || data.isEmpty) {
|
||||||
throw Exception('Empty response from /:userId/devices');
|
throw Exception('Empty response from /users/$userId/user-devices');
|
||||||
}
|
}
|
||||||
|
|
||||||
final model = GetAppUsersResponseModel.fromJson(data);
|
final model = GetAppUsersResponseModel.fromJson(data);
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ part 'update_user_request_model.g.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
|
abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
|
||||||
const factory UpdateUserRequestModel({
|
const factory UpdateUserRequestModel({
|
||||||
required String id,
|
|
||||||
String? email,
|
|
||||||
String? language,
|
|
||||||
String? firstName,
|
String? firstName,
|
||||||
String? lastName,
|
String? lastName,
|
||||||
String? phone,
|
String? phone,
|
||||||
@@ -21,9 +18,6 @@ abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
|
|||||||
|
|
||||||
extension UpdateUserRequestModelMapper on UpdateUserRequestEntity {
|
extension UpdateUserRequestModelMapper on UpdateUserRequestEntity {
|
||||||
UpdateUserRequestModel toModel() => UpdateUserRequestModel(
|
UpdateUserRequestModel toModel() => UpdateUserRequestModel(
|
||||||
id: id,
|
|
||||||
email: email,
|
|
||||||
language: language,
|
|
||||||
firstName: firstName,
|
firstName: firstName,
|
||||||
lastName: lastName,
|
lastName: lastName,
|
||||||
phone: phone,
|
phone: phone,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$UpdateUserRequestModel {
|
mixin _$UpdateUserRequestModel {
|
||||||
|
|
||||||
String get id; String? get email; String? get language; String? get firstName; String? get lastName; String? get phone;
|
String? get firstName; String? get lastName; String? get phone;
|
||||||
/// Create a copy of UpdateUserRequestModel
|
/// Create a copy of UpdateUserRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -28,16 +28,16 @@ $UpdateUserRequestModelCopyWith<UpdateUserRequestModel> get copyWith => _$Update
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,email,language,firstName,lastName,phone);
|
int get hashCode => Object.hash(runtimeType,firstName,lastName,phone);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'UpdateUserRequestModel(id: $id, email: $email, language: $language, firstName: $firstName, lastName: $lastName, phone: $phone)';
|
return 'UpdateUserRequestModel(firstName: $firstName, lastName: $lastName, phone: $phone)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +48,7 @@ abstract mixin class $UpdateUserRequestModelCopyWith<$Res> {
|
|||||||
factory $UpdateUserRequestModelCopyWith(UpdateUserRequestModel value, $Res Function(UpdateUserRequestModel) _then) = _$UpdateUserRequestModelCopyWithImpl;
|
factory $UpdateUserRequestModelCopyWith(UpdateUserRequestModel value, $Res Function(UpdateUserRequestModel) _then) = _$UpdateUserRequestModelCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? email, String? language, String? firstName, String? lastName, String? phone
|
String? firstName, String? lastName, String? phone
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -65,12 +65,9 @@ class _$UpdateUserRequestModelCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of UpdateUserRequestModel
|
/// Create a copy of UpdateUserRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? email = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
@@ -158,10 +155,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? email, String? language, String? firstName, String? lastName, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? firstName, String? lastName, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestModel() when $default != null:
|
case _UpdateUserRequestModel() when $default != null:
|
||||||
return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastName,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -179,10 +176,10 @@ return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastNa
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? email, String? language, String? firstName, String? lastName, String? phone) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? firstName, String? lastName, String? phone) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestModel():
|
case _UpdateUserRequestModel():
|
||||||
return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastName,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -199,10 +196,10 @@ return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastNa
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? email, String? language, String? firstName, String? lastName, String? phone)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? firstName, String? lastName, String? phone)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestModel() when $default != null:
|
case _UpdateUserRequestModel() when $default != null:
|
||||||
return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastName,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -214,12 +211,9 @@ return $default(_that.id,_that.email,_that.language,_that.firstName,_that.lastNa
|
|||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _UpdateUserRequestModel implements UpdateUserRequestModel {
|
class _UpdateUserRequestModel implements UpdateUserRequestModel {
|
||||||
const _UpdateUserRequestModel({required this.id, this.email, this.language, this.firstName, this.lastName, this.phone});
|
const _UpdateUserRequestModel({this.firstName, this.lastName, this.phone});
|
||||||
factory _UpdateUserRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateUserRequestModelFromJson(json);
|
factory _UpdateUserRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateUserRequestModelFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
|
||||||
@override final String? email;
|
|
||||||
@override final String? language;
|
|
||||||
@override final String? firstName;
|
@override final String? firstName;
|
||||||
@override final String? lastName;
|
@override final String? lastName;
|
||||||
@override final String? phone;
|
@override final String? phone;
|
||||||
@@ -237,16 +231,16 @@ Map<String, dynamic> toJson() {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.email, email) || other.email == email)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,email,language,firstName,lastName,phone);
|
int get hashCode => Object.hash(runtimeType,firstName,lastName,phone);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'UpdateUserRequestModel(id: $id, email: $email, language: $language, firstName: $firstName, lastName: $lastName, phone: $phone)';
|
return 'UpdateUserRequestModel(firstName: $firstName, lastName: $lastName, phone: $phone)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -257,7 +251,7 @@ abstract mixin class _$UpdateUserRequestModelCopyWith<$Res> implements $UpdateUs
|
|||||||
factory _$UpdateUserRequestModelCopyWith(_UpdateUserRequestModel value, $Res Function(_UpdateUserRequestModel) _then) = __$UpdateUserRequestModelCopyWithImpl;
|
factory _$UpdateUserRequestModelCopyWith(_UpdateUserRequestModel value, $Res Function(_UpdateUserRequestModel) _then) = __$UpdateUserRequestModelCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? email, String? language, String? firstName, String? lastName, String? phone
|
String? firstName, String? lastName, String? phone
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -274,12 +268,9 @@ class __$UpdateUserRequestModelCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of UpdateUserRequestModel
|
/// Create a copy of UpdateUserRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? email = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
||||||
return _then(_UpdateUserRequestModel(
|
return _then(_UpdateUserRequestModel(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
|
|||||||
@@ -9,9 +9,6 @@ part of 'update_user_request_model.dart';
|
|||||||
_UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
|
_UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
|
||||||
Map<String, dynamic> json,
|
Map<String, dynamic> json,
|
||||||
) => _UpdateUserRequestModel(
|
) => _UpdateUserRequestModel(
|
||||||
id: json['id'] as String,
|
|
||||||
email: json['email'] as String?,
|
|
||||||
language: json['language'] as String?,
|
|
||||||
firstName: json['firstName'] as String?,
|
firstName: json['firstName'] as String?,
|
||||||
lastName: json['lastName'] as String?,
|
lastName: json['lastName'] as String?,
|
||||||
phone: json['phone'] as String?,
|
phone: json['phone'] as String?,
|
||||||
@@ -20,9 +17,6 @@ _UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
|
|||||||
Map<String, dynamic> _$UpdateUserRequestModelToJson(
|
Map<String, dynamic> _$UpdateUserRequestModelToJson(
|
||||||
_UpdateUserRequestModel instance,
|
_UpdateUserRequestModel instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'id': instance.id,
|
|
||||||
'email': instance.email,
|
|
||||||
'language': instance.language,
|
|
||||||
'firstName': instance.firstName,
|
'firstName': instance.firstName,
|
||||||
'lastName': instance.lastName,
|
'lastName': instance.lastName,
|
||||||
'phone': instance.phone,
|
'phone': instance.phone,
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
|
import 'package:account/src/features/account_settings/presentation/state/account_settings_view_model.dart';
|
||||||
import 'package:design_system/design_system.dart';
|
import 'package:design_system/design_system.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:legacy_auth/legacy_auth.dart';
|
|
||||||
import 'package:legacy_shared/legacy_shared.dart';
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
import 'package:navigation/navigation.dart';
|
import 'package:navigation/navigation.dart';
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
@@ -12,163 +12,168 @@ import 'widgets/reg_code_dialog.dart';
|
|||||||
|
|
||||||
class AccountSettingsScreen extends ConsumerWidget {
|
class AccountSettingsScreen extends ConsumerWidget {
|
||||||
final NavigationContract navigationContract;
|
final NavigationContract navigationContract;
|
||||||
static final _privacyUrl = 'https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily';
|
static final _privacyUrl =
|
||||||
|
'https://savefamilygps.com/pages/politica-de-privacidad-reloj-gps-infantil-localizador-savefamily';
|
||||||
|
|
||||||
const AccountSettingsScreen({super.key, required this.navigationContract});
|
const AccountSettingsScreen({super.key, required this.navigationContract});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final theme = ref.watch(themePortProvider);
|
final theme = ref.watch(themePortProvider);
|
||||||
|
final color = theme.getColorFor(ThemeCode.legacyPrimary);
|
||||||
final selectedDevice = ref.watch(selectedDeviceProvider);
|
final selectedDevice = ref.watch(selectedDeviceProvider);
|
||||||
|
final isLoggingOut = ref.watch(
|
||||||
|
accountSettingsViewModelProvider.select((s) => s.isLoggingOut),
|
||||||
|
);
|
||||||
|
|
||||||
|
ref.listen(accountSettingsViewModelProvider.select((s) => s.isLoggingOut), (
|
||||||
|
prev,
|
||||||
|
isLoggingOut,
|
||||||
|
) {
|
||||||
|
if (prev == true && !isLoggingOut) {
|
||||||
|
navigationContract.goTo(AppRoutes.legacyLogin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return LegacyPageLayout(
|
return LegacyPageLayout(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
title: context.translate(I18n.accountSettings),
|
title: context.translate(I18n.accountSettings),
|
||||||
body: SingleChildScrollView(child: Container(
|
body: SingleChildScrollView(
|
||||||
padding: SizeUtils.getByScreen(
|
child: Padding(
|
||||||
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
padding: SizeUtils.getByScreen(
|
||||||
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
|
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
|
||||||
),
|
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8),
|
||||||
child: Column(
|
),
|
||||||
children: [
|
child: Column(
|
||||||
AppSectionButton(
|
children: [
|
||||||
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
|
_item(
|
||||||
icon: SFIcons.account,
|
context,
|
||||||
text: I18n.personalData
|
onPressed: () =>
|
||||||
),
|
navigationContract.pushTo(AppRoutes.personalData),
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
icon: SFIcons.account,
|
||||||
AppSectionButton(
|
text: I18n.personalData,
|
||||||
onPressed: (){navigationContract.pushTo(AppRoutes.changePassword);},
|
color: color,
|
||||||
icon: Icons.lock,
|
),
|
||||||
text: I18n.changePassword
|
_item(
|
||||||
),
|
context,
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
onPressed: () =>
|
||||||
AppSectionButton(
|
navigationContract.pushTo(AppRoutes.changePassword),
|
||||||
onPressed: (){
|
icon: Icons.lock,
|
||||||
Navigator.of(context).push(
|
text: I18n.changePassword,
|
||||||
MaterialPageRoute(
|
color: color,
|
||||||
builder: (_) => LegacyDeviceSetupScreen(
|
),
|
||||||
navigationContract: navigationContract,
|
_item(
|
||||||
isFirstDevice: false
|
context,
|
||||||
|
onPressed: () =>
|
||||||
|
navigationContract.pushTo(AppRoutes.legacyDeviceSetup),
|
||||||
|
icon: Icons.add_circle_outline,
|
||||||
|
text: I18n.addNewSF,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
_item(
|
||||||
|
context,
|
||||||
|
onPressed: () =>
|
||||||
|
navigationContract.pushTo(AppRoutes.linkedDevices),
|
||||||
|
icon: Icons.account_circle_outlined,
|
||||||
|
text: I18n.linkedDevices,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
// _item(context, onPressed: () => navigationContract.pushTo(AppRoutes.appUsers), icon: Icons.groups_outlined, text: I18n.appUsers, color: color),
|
||||||
|
_item(
|
||||||
|
context,
|
||||||
|
onPressed: () async {
|
||||||
|
final Uri url = Uri.parse(_privacyUrl);
|
||||||
|
if (!await launchUrl(url)) {
|
||||||
|
throw Exception('Could not launch $url');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
icon: SFIcons.privacy,
|
||||||
|
text: I18n.privacyPolicy,
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
_item(
|
||||||
|
context,
|
||||||
|
onPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) => Dialog(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
child: RegCodeDialog(
|
||||||
|
regCode: selectedDevice?.id ?? '',
|
||||||
|
deviceId: selectedDevice?.identificator ?? '',
|
||||||
|
name: selectedDevice?.carrierName ?? '',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
);
|
},
|
||||||
},
|
icon: Icons.qr_code,
|
||||||
icon: Icons.add_circle_outline,
|
text: I18n.regCode,
|
||||||
text: I18n.addNewSF
|
color: color,
|
||||||
),
|
),
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
_item(
|
||||||
AppSectionButton(
|
context,
|
||||||
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
|
onPressed: () =>
|
||||||
icon: Icons.account_circle_outlined,
|
navigationContract.pushTo(AppRoutes.deleteAccount),
|
||||||
text: I18n.linkedDevices
|
icon: Icons.no_accounts,
|
||||||
),
|
text: I18n.deleteAccount,
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
color: color,
|
||||||
AppSectionButton(
|
),
|
||||||
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
|
],
|
||||||
icon: Icons.groups_outlined,
|
),
|
||||||
text: I18n.appUsers
|
|
||||||
),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
|
||||||
AppSectionButton(
|
|
||||||
onPressed: () async {
|
|
||||||
final Uri url = Uri.parse(_privacyUrl);
|
|
||||||
if (!await launchUrl(url)) {
|
|
||||||
throw Exception('Could not launch $url');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
icon: SFIcons.privacy,
|
|
||||||
text: I18n.privacyPolicy
|
|
||||||
),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
|
||||||
AppSectionButton(
|
|
||||||
onPressed: (){
|
|
||||||
showDialog(context: context, builder: (context)=>Dialog(
|
|
||||||
backgroundColor: Colors.transparent,
|
|
||||||
child: RegCodeDialog(
|
|
||||||
regCode: selectedDevice?.id ?? '',
|
|
||||||
deviceId: selectedDevice?.identificator ?? '',
|
|
||||||
name: selectedDevice?.carrierName ?? ''
|
|
||||||
),
|
|
||||||
));
|
|
||||||
},
|
|
||||||
icon: Icons.qr_code,
|
|
||||||
text: I18n.regCode
|
|
||||||
),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
|
|
||||||
AppSectionButton(
|
|
||||||
onPressed: (){navigationContract.pushTo(AppRoutes.deleteAccount);},
|
|
||||||
icon: Icons.no_accounts,
|
|
||||||
text: I18n.deleteAccount
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
)),
|
),
|
||||||
footer: Container(
|
footer: Container(
|
||||||
padding: SizeUtils.getByScreen(
|
padding: SizeUtils.getByScreen(
|
||||||
small: EdgeInsets.symmetric(vertical: 12, horizontal: 30),
|
small: EdgeInsets.symmetric(vertical: 12, horizontal: 30),
|
||||||
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28)
|
big: EdgeInsets.symmetric(vertical: 10, horizontal: 28),
|
||||||
),
|
),
|
||||||
child: PrimaryButton(text: context.translate(I18n.logOut), color: theme.getColorFor(ThemeCode.legacyPrimary)),
|
child: PrimaryButton(
|
||||||
)
|
text: context.translate(I18n.logOut),
|
||||||
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
|
leading: isLoggingOut
|
||||||
|
? const SizedBox(
|
||||||
|
height: 18,
|
||||||
|
width: 18,
|
||||||
|
child: CircularProgressIndicator(
|
||||||
|
strokeWidth: 2,
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: null,
|
||||||
|
onPressed: isLoggingOut
|
||||||
|
? () {}
|
||||||
|
: ref.read(accountSettingsViewModelProvider.notifier).logout,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget _item(
|
||||||
|
BuildContext context, {
|
||||||
|
required VoidCallback onPressed,
|
||||||
|
required IconData icon,
|
||||||
|
required String text,
|
||||||
|
required Color color,
|
||||||
|
}) {
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
bottom: SizeUtils.getByScreen(small: 16, big: 15),
|
||||||
|
),
|
||||||
|
child: SectionButton(
|
||||||
|
onPressed: onPressed,
|
||||||
|
icon: Icon(
|
||||||
|
icon,
|
||||||
|
size: SizeUtils.getByScreen(small: 28, big: 26),
|
||||||
|
color: color,
|
||||||
|
),
|
||||||
|
body: Text(
|
||||||
|
context.translate(text),
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
|
||||||
|
fontWeight: FontWeight.w500,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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.watch(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: theme.getColorFor(ThemeCode.legacyPrimary),
|
|
||||||
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,30 @@
|
|||||||
|
import 'package:account/src/features/account_settings/presentation/state/account_settings_view_state.dart';
|
||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:legacy_auth/legacy_auth.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
final accountSettingsViewModelProvider =
|
||||||
|
NotifierProvider.autoDispose<AccountSettingsViewModel, AccountSettingsViewState>(
|
||||||
|
AccountSettingsViewModel.new,
|
||||||
|
);
|
||||||
|
|
||||||
|
class AccountSettingsViewModel extends Notifier<AccountSettingsViewState> {
|
||||||
|
@override
|
||||||
|
AccountSettingsViewState build() {
|
||||||
|
return const AccountSettingsViewState();
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<void> logout() async {
|
||||||
|
if (state.isLoggingOut) return;
|
||||||
|
|
||||||
|
state = state.copyWith(isLoggingOut: true, errorMessage: '');
|
||||||
|
|
||||||
|
try {
|
||||||
|
await ref.read(legacyAuthRepositoryProvider).logout();
|
||||||
|
} catch (_) {}
|
||||||
|
|
||||||
|
await clearSessionData();
|
||||||
|
|
||||||
|
state = state.copyWith(isLoggingOut: false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'account_settings_view_state.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class AccountSettingsViewState with _$AccountSettingsViewState {
|
||||||
|
const factory AccountSettingsViewState({
|
||||||
|
@Default(false) bool isLoggingOut,
|
||||||
|
@Default('') String errorMessage,
|
||||||
|
}) = _AccountSettingsViewState;
|
||||||
|
}
|
||||||
@@ -0,0 +1,274 @@
|
|||||||
|
// 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 'account_settings_view_state.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AccountSettingsViewState {
|
||||||
|
|
||||||
|
bool get isLoggingOut; String get errorMessage;
|
||||||
|
/// Create a copy of AccountSettingsViewState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$AccountSettingsViewStateCopyWith<AccountSettingsViewState> get copyWith => _$AccountSettingsViewStateCopyWithImpl<AccountSettingsViewState>(this as AccountSettingsViewState, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AccountSettingsViewState&&(identical(other.isLoggingOut, isLoggingOut) || other.isLoggingOut == isLoggingOut)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,isLoggingOut,errorMessage);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AccountSettingsViewState(isLoggingOut: $isLoggingOut, errorMessage: $errorMessage)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $AccountSettingsViewStateCopyWith<$Res> {
|
||||||
|
factory $AccountSettingsViewStateCopyWith(AccountSettingsViewState value, $Res Function(AccountSettingsViewState) _then) = _$AccountSettingsViewStateCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
bool isLoggingOut, String errorMessage
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$AccountSettingsViewStateCopyWithImpl<$Res>
|
||||||
|
implements $AccountSettingsViewStateCopyWith<$Res> {
|
||||||
|
_$AccountSettingsViewStateCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final AccountSettingsViewState _self;
|
||||||
|
final $Res Function(AccountSettingsViewState) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AccountSettingsViewState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? isLoggingOut = null,Object? errorMessage = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
isLoggingOut: null == isLoggingOut ? _self.isLoggingOut : isLoggingOut // 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 [AccountSettingsViewState].
|
||||||
|
extension AccountSettingsViewStatePatterns on AccountSettingsViewState {
|
||||||
|
/// 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( _AccountSettingsViewState value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState() 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( _AccountSettingsViewState value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState():
|
||||||
|
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( _AccountSettingsViewState value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState() 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( bool isLoggingOut, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState() when $default != null:
|
||||||
|
return $default(_that.isLoggingOut,_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( bool isLoggingOut, String errorMessage) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState():
|
||||||
|
return $default(_that.isLoggingOut,_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( bool isLoggingOut, String errorMessage)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AccountSettingsViewState() when $default != null:
|
||||||
|
return $default(_that.isLoggingOut,_that.errorMessage);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _AccountSettingsViewState implements AccountSettingsViewState {
|
||||||
|
const _AccountSettingsViewState({this.isLoggingOut = false, this.errorMessage = ''});
|
||||||
|
|
||||||
|
|
||||||
|
@override@JsonKey() final bool isLoggingOut;
|
||||||
|
@override@JsonKey() final String errorMessage;
|
||||||
|
|
||||||
|
/// Create a copy of AccountSettingsViewState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$AccountSettingsViewStateCopyWith<_AccountSettingsViewState> get copyWith => __$AccountSettingsViewStateCopyWithImpl<_AccountSettingsViewState>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AccountSettingsViewState&&(identical(other.isLoggingOut, isLoggingOut) || other.isLoggingOut == isLoggingOut)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,isLoggingOut,errorMessage);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AccountSettingsViewState(isLoggingOut: $isLoggingOut, errorMessage: $errorMessage)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$AccountSettingsViewStateCopyWith<$Res> implements $AccountSettingsViewStateCopyWith<$Res> {
|
||||||
|
factory _$AccountSettingsViewStateCopyWith(_AccountSettingsViewState value, $Res Function(_AccountSettingsViewState) _then) = __$AccountSettingsViewStateCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
bool isLoggingOut, String errorMessage
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$AccountSettingsViewStateCopyWithImpl<$Res>
|
||||||
|
implements _$AccountSettingsViewStateCopyWith<$Res> {
|
||||||
|
__$AccountSettingsViewStateCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _AccountSettingsViewState _self;
|
||||||
|
final $Res Function(_AccountSettingsViewState) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AccountSettingsViewState
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? isLoggingOut = null,Object? errorMessage = null,}) {
|
||||||
|
return _then(_AccountSettingsViewState(
|
||||||
|
isLoggingOut: null == isLoggingOut ? _self.isLoggingOut : isLoggingOut // 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
|
||||||
@@ -6,7 +6,6 @@ import 'package:sf_localizations/sf_localizations.dart';
|
|||||||
import 'package:utils/utils.dart';
|
import 'package:utils/utils.dart';
|
||||||
|
|
||||||
class RegCodeDialog extends StatelessWidget {
|
class RegCodeDialog extends StatelessWidget {
|
||||||
|
|
||||||
final String regCode;
|
final String regCode;
|
||||||
final String deviceId;
|
final String deviceId;
|
||||||
final String name;
|
final String name;
|
||||||
@@ -18,87 +17,118 @@ class RegCodeDialog extends StatelessWidget {
|
|||||||
required this.name,
|
required this.name,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
static const _iconRadius = 40.0;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Stack(
|
||||||
height: SizeUtils.getByScreen(small: 330, big: 328),
|
clipBehavior: Clip.none,
|
||||||
color: Colors.transparent,
|
alignment: Alignment.topCenter,
|
||||||
child: Stack(
|
children: [
|
||||||
children: [
|
Container(
|
||||||
Align(
|
width: SizeUtils.getByScreen(small: 320, big: 340),
|
||||||
alignment: Alignment.bottomCenter,
|
margin: const EdgeInsets.only(top: _iconRadius),
|
||||||
child: Container(
|
padding: EdgeInsets.only(
|
||||||
height: SizeUtils.getByScreen(small: 300, big: 298),
|
top: _iconRadius + SizeUtils.getByScreen(small: 12, big: 10),
|
||||||
width: SizeUtils.getByScreen(small: 350, big: 348),
|
bottom: SizeUtils.getByScreen(small: 20, big: 18),
|
||||||
padding: SizeUtils.getByScreen(
|
left: SizeUtils.getByScreen(small: 20, big: 18),
|
||||||
small: EdgeInsets.symmetric(vertical: 14, horizontal: 18),
|
right: SizeUtils.getByScreen(small: 20, big: 18),
|
||||||
big: EdgeInsets.symmetric(vertical: 12, horizontal: 16)
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.white,
|
||||||
|
borderRadius: BorderRadius.circular(16),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Align(
|
||||||
|
alignment: Alignment.topRight,
|
||||||
|
child: GestureDetector(
|
||||||
|
onTap: () => Navigator.pop(context),
|
||||||
|
child: const Icon(Icons.close, size: 22, color: Colors.grey),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
color: Colors.white,
|
Text(
|
||||||
child: Column(
|
name,
|
||||||
mainAxisAlignment: MainAxisAlignment.end,
|
style: const TextStyle(
|
||||||
children: [
|
fontSize: 18,
|
||||||
Align(
|
fontWeight: FontWeight.w600,
|
||||||
alignment: Alignment.topRight,
|
),
|
||||||
child: IconButton(
|
),
|
||||||
onPressed: (){Navigator.pop(context);},
|
const SizedBox(height: 16),
|
||||||
icon: Icon(Icons.close),
|
_CopyableField(
|
||||||
padding: EdgeInsets.zero,
|
label: context.translate(
|
||||||
),
|
I18n.deviceIdLabel,
|
||||||
),
|
args: {'deviceId': deviceId},
|
||||||
Text(name, style: TextStyle()),
|
),
|
||||||
Row(
|
value: deviceId,
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: [
|
const SizedBox(height: 20),
|
||||||
Text(context.translate(I18n.deviceIdLabel,
|
QrImageView(
|
||||||
args: {'deviceId': deviceId})),
|
data: regCode,
|
||||||
TextButton(
|
version: QrVersions.auto,
|
||||||
onPressed: (){Clipboard.setData(ClipboardData(text: deviceId));},
|
size: SizeUtils.getByScreen(small: 120, big: 120),
|
||||||
child: Text(context.translate(I18n.copy)),
|
padding: EdgeInsets.zero,
|
||||||
)
|
),
|
||||||
],
|
const SizedBox(height: 16),
|
||||||
),
|
_CopyableField(
|
||||||
QrImageView(
|
label: context.translate(
|
||||||
data: regCode,
|
I18n.regCodeLabel,
|
||||||
version: QrVersions.auto,
|
args: {'regCode': regCode},
|
||||||
size: SizeUtils.getByScreen(small: 100, big: 98),
|
),
|
||||||
padding: EdgeInsets.zero,
|
value: regCode,
|
||||||
),
|
),
|
||||||
Row(
|
],
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
),
|
||||||
children: [
|
),
|
||||||
Text(context.translate(I18n.regCodeLabel,
|
Container(
|
||||||
args: {'regCode': regCode})),
|
decoration: const BoxDecoration(
|
||||||
TextButton(
|
shape: BoxShape.circle,
|
||||||
onPressed: (){Clipboard.setData(ClipboardData(text: regCode));},
|
color: Color(0xFF00A1C6),
|
||||||
child: Text(context.translate(I18n.copy))
|
),
|
||||||
)
|
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 16, big: 16)),
|
||||||
],
|
child: Icon(
|
||||||
)
|
SFIcons.watch,
|
||||||
],
|
size: SizeUtils.getByScreen(small: 68, big: 66),
|
||||||
|
color: Colors.white,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _CopyableField extends StatelessWidget {
|
||||||
|
final String label;
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
const _CopyableField({required this.label, required this.value});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: () => Clipboard.setData(ClipboardData(text: value)),
|
||||||
|
child: Container(
|
||||||
|
padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 12),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: Colors.grey.withValues(alpha: 0.08),
|
||||||
|
borderRadius: BorderRadius.circular(8),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: const TextStyle(fontSize: 13),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
const SizedBox(width: 6),
|
||||||
Align(
|
const Icon(Icons.copy, size: 14, color: Colors.grey),
|
||||||
alignment: Alignment.topCenter,
|
],
|
||||||
child: Container(
|
),
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Color(0xFF00A1C6),
|
|
||||||
),
|
|
||||||
padding: SizeUtils.getByScreen(
|
|
||||||
small: EdgeInsets.all(12),
|
|
||||||
big: EdgeInsets.all(12)
|
|
||||||
),
|
|
||||||
child: Icon(
|
|
||||||
SFIcons.watch,
|
|
||||||
size: SizeUtils.getByScreen(small: 68, big: 66),
|
|
||||||
color: Colors.white,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
|||||||
isLoading: false,
|
isLoading: false,
|
||||||
isComplete: true
|
isComplete: true
|
||||||
);
|
);
|
||||||
ref.invalidate(userInfoProvider);
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
_finishWithError(message: e.toString());
|
_finishWithError(message: e.toString());
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ class DeleteAccountViewModel extends Notifier<DeleteAccountViewState> {
|
|||||||
@override
|
@override
|
||||||
DeleteAccountViewState build() {
|
DeleteAccountViewState build() {
|
||||||
_usersRepository = ref.read(usersRepositoryProvider);
|
_usersRepository = ref.read(usersRepositoryProvider);
|
||||||
|
_devicesRepository = ref.read(sharedDevicesRepositoryProvider);
|
||||||
|
|
||||||
passwordController = TextEditingController();
|
passwordController = TextEditingController();
|
||||||
passwordController.addListener(_onPasswordChanged);
|
passwordController.addListener(_onPasswordChanged);
|
||||||
@@ -104,8 +105,6 @@ class DeleteAccountViewModel extends Notifier<DeleteAccountViewState> {
|
|||||||
await _usersRepository.deleteUser(userId: state.loggedUser!.id);
|
await _usersRepository.deleteUser(userId: state.loggedUser!.id);
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
|
|
||||||
ref.invalidate(userInfoProvider);
|
|
||||||
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
isLoading: false,
|
isLoading: false,
|
||||||
isComplete: true
|
isComplete: true
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class EditLinkedDeviceScreen extends ConsumerWidget {
|
|||||||
Stack(
|
Stack(
|
||||||
children: [
|
children: [
|
||||||
DecoratedBox(decoration: BoxDecoration(color: Colors.blueAccent)),
|
DecoratedBox(decoration: BoxDecoration(color: Colors.blueAccent)),
|
||||||
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
|
Center(child: SvgPicture.asset('assets/shared/images/profile.svg')),
|
||||||
Center(child: SizedBox(
|
Center(child: SizedBox(
|
||||||
width: 160,
|
width: 160,
|
||||||
height: 160,
|
height: 160,
|
||||||
|
|||||||
@@ -5,19 +5,8 @@ part 'update_user_request_entity.freezed.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
abstract class UpdateUserRequestEntity with _$UpdateUserRequestEntity {
|
abstract class UpdateUserRequestEntity with _$UpdateUserRequestEntity {
|
||||||
const factory UpdateUserRequestEntity({
|
const factory UpdateUserRequestEntity({
|
||||||
required String id,
|
String? firstName,
|
||||||
String? delegationId,
|
String? lastName,
|
||||||
String? email,
|
String? phone,
|
||||||
String? createdAt,
|
|
||||||
String? updatedAt,
|
|
||||||
String? status,
|
|
||||||
String? role,
|
|
||||||
String? lastLogin,
|
|
||||||
String? currentLogin,
|
|
||||||
String? language,
|
|
||||||
String? firstName,
|
|
||||||
String? lastName,
|
|
||||||
String? hasApiKey,
|
|
||||||
String? phone,
|
|
||||||
}) = _UpdateUserRequestEntity;
|
}) = _UpdateUserRequestEntity;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$UpdateUserRequestEntity {
|
mixin _$UpdateUserRequestEntity {
|
||||||
|
|
||||||
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
|
String? get firstName; String? get lastName; String? get phone;
|
||||||
/// Create a copy of UpdateUserRequestEntity
|
/// Create a copy of UpdateUserRequestEntity
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -25,16 +25,16 @@ $UpdateUserRequestEntityCopyWith<UpdateUserRequestEntity> get copyWith => _$Upda
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestEntity&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
int get hashCode => Object.hash(runtimeType,firstName,lastName,phone);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
return 'UpdateUserRequestEntity(firstName: $firstName, lastName: $lastName, phone: $phone)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ abstract mixin class $UpdateUserRequestEntityCopyWith<$Res> {
|
|||||||
factory $UpdateUserRequestEntityCopyWith(UpdateUserRequestEntity value, $Res Function(UpdateUserRequestEntity) _then) = _$UpdateUserRequestEntityCopyWithImpl;
|
factory $UpdateUserRequestEntityCopyWith(UpdateUserRequestEntity value, $Res Function(UpdateUserRequestEntity) _then) = _$UpdateUserRequestEntityCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
|
String? firstName, String? lastName, String? phone
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -62,21 +62,10 @@ class _$UpdateUserRequestEntityCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of UpdateUserRequestEntity
|
/// Create a copy of UpdateUserRequestEntity
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
));
|
));
|
||||||
@@ -163,10 +152,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String? firstName, String? lastName, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestEntity() when $default != null:
|
case _UpdateUserRequestEntity() when $default != null:
|
||||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -184,10 +173,10 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String? firstName, String? lastName, String? phone) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestEntity():
|
case _UpdateUserRequestEntity():
|
||||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -204,10 +193,10 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String? firstName, String? lastName, String? phone)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _UpdateUserRequestEntity() when $default != null:
|
case _UpdateUserRequestEntity() when $default != null:
|
||||||
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
|
return $default(_that.firstName,_that.lastName,_that.phone);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -219,22 +208,11 @@ return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.up
|
|||||||
|
|
||||||
|
|
||||||
class _UpdateUserRequestEntity implements UpdateUserRequestEntity {
|
class _UpdateUserRequestEntity implements UpdateUserRequestEntity {
|
||||||
const _UpdateUserRequestEntity({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
|
const _UpdateUserRequestEntity({this.firstName, this.lastName, this.phone});
|
||||||
|
|
||||||
|
|
||||||
@override final String id;
|
|
||||||
@override final String? delegationId;
|
|
||||||
@override final String? email;
|
|
||||||
@override final String? createdAt;
|
|
||||||
@override final String? updatedAt;
|
|
||||||
@override final String? status;
|
|
||||||
@override final String? role;
|
|
||||||
@override final String? lastLogin;
|
|
||||||
@override final String? currentLogin;
|
|
||||||
@override final String? language;
|
|
||||||
@override final String? firstName;
|
@override final String? firstName;
|
||||||
@override final String? lastName;
|
@override final String? lastName;
|
||||||
@override final String? hasApiKey;
|
|
||||||
@override final String? phone;
|
@override final String? phone;
|
||||||
|
|
||||||
/// Create a copy of UpdateUserRequestEntity
|
/// Create a copy of UpdateUserRequestEntity
|
||||||
@@ -247,16 +225,16 @@ _$UpdateUserRequestEntityCopyWith<_UpdateUserRequestEntity> get copyWith => __$U
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestEntity&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.phone, phone) || other.phone == phone));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
|
int get hashCode => Object.hash(runtimeType,firstName,lastName,phone);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
|
return 'UpdateUserRequestEntity(firstName: $firstName, lastName: $lastName, phone: $phone)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -267,7 +245,7 @@ abstract mixin class _$UpdateUserRequestEntityCopyWith<$Res> implements $UpdateU
|
|||||||
factory _$UpdateUserRequestEntityCopyWith(_UpdateUserRequestEntity value, $Res Function(_UpdateUserRequestEntity) _then) = __$UpdateUserRequestEntityCopyWithImpl;
|
factory _$UpdateUserRequestEntityCopyWith(_UpdateUserRequestEntity value, $Res Function(_UpdateUserRequestEntity) _then) = __$UpdateUserRequestEntityCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
|
String? firstName, String? lastName, String? phone
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -284,21 +262,10 @@ class __$UpdateUserRequestEntityCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of UpdateUserRequestEntity
|
/// Create a copy of UpdateUserRequestEntity
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? firstName = freezed,Object? lastName = freezed,Object? phone = freezed,}) {
|
||||||
return _then(_UpdateUserRequestEntity(
|
return _then(_UpdateUserRequestEntity(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||||
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
as String?,
|
as String?,
|
||||||
));
|
));
|
||||||
|
|||||||
@@ -1,19 +1,14 @@
|
|||||||
// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart';
|
|
||||||
import 'package:account/src/features/personal_data/presentation/personal_data_screen.dart';
|
import 'package:account/src/features/personal_data/presentation/personal_data_screen.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:go_router/go_router.dart';
|
import 'package:go_router/go_router.dart';
|
||||||
import 'package:get_it/get_it.dart';
|
|
||||||
import 'package:navigation/navigation.dart';
|
|
||||||
|
|
||||||
class PersonalDataBuilder {
|
class PersonalDataBuilder {
|
||||||
const PersonalDataBuilder();
|
const PersonalDataBuilder();
|
||||||
|
|
||||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||||
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
|
|
||||||
|
|
||||||
return MaterialPage<void>(
|
return MaterialPage<void>(
|
||||||
key: state.pageKey,
|
key: state.pageKey,
|
||||||
child: PersonalDataScreen(navigationContract: navigationContract),
|
child: const PersonalDataScreen(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,286 +4,196 @@ import 'package:flutter/material.dart';
|
|||||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:legacy_shared/legacy_shared.dart';
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
import 'package:navigation/navigation.dart';
|
|
||||||
import 'package:sf_localizations/sf_localizations.dart';
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
import 'package:utils/utils.dart';
|
import 'package:utils/utils.dart';
|
||||||
|
|
||||||
class PersonalDataScreen extends ConsumerWidget {
|
class PersonalDataScreen extends ConsumerWidget {
|
||||||
final NavigationContract navigationContract;
|
const PersonalDataScreen({super.key});
|
||||||
|
|
||||||
const PersonalDataScreen({super.key, required this.navigationContract});
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
|
||||||
final theme = ref.watch(themePortProvider);
|
final theme = ref.watch(themePortProvider);
|
||||||
|
final isLoading = ref.watch(
|
||||||
|
personalDataViewModelProvider.select((s) => s.isLoading),
|
||||||
|
);
|
||||||
|
|
||||||
|
ref.listen(personalDataViewModelProvider.select((s) => s.errorMessage), (
|
||||||
|
_,
|
||||||
|
errorMessage,
|
||||||
|
) {
|
||||||
|
if (errorMessage.isNotEmpty) {
|
||||||
|
showTopSnackbar(
|
||||||
|
context,
|
||||||
|
message: errorMessage,
|
||||||
|
type: MessageType.error,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
ref.listen(personalDataViewModelProvider.select((s) => s.isComplete), (
|
||||||
|
_,
|
||||||
|
isComplete,
|
||||||
|
) {
|
||||||
|
if (isComplete) Navigator.pop(context);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (isLoading) {
|
||||||
|
return Scaffold(
|
||||||
|
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||||
|
body: const Center(child: CircularProgressIndicator()),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return LegacyPageLayout(
|
return LegacyPageLayout(
|
||||||
theme: theme,
|
theme: theme,
|
||||||
title: context.translate(I18n.personalData),
|
title: context.translate(I18n.personalData),
|
||||||
body: Container(
|
body: Padding(
|
||||||
padding: SizeUtils.getByScreen(
|
padding: SizeUtils.getByScreen(
|
||||||
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
|
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
|
||||||
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
|
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8),
|
||||||
|
),
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
const _ProfilePicture(),
|
||||||
|
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
|
||||||
|
const _EmailLabel(),
|
||||||
|
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||||
|
const _FirstNameField(),
|
||||||
|
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||||
|
const _LastNameField(),
|
||||||
|
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||||
|
const _PhoneField(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
footer: Padding(
|
||||||
|
padding: SizeUtils.getByScreen(
|
||||||
|
small: EdgeInsets.symmetric(horizontal: 48),
|
||||||
|
big: EdgeInsets.symmetric(horizontal: 47),
|
||||||
|
),
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
Text(context.translate(I18n.personalDataMessage)),
|
||||||
|
const SizedBox(height: 14),
|
||||||
|
const _SaveButton(),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
child: SingleChildScrollView(child: Column(
|
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
const _ProfilePictureSection(),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
|
|
||||||
const _EmailLabelSection(),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
|
||||||
const _GenderSection(),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
|
||||||
const _NameSection(),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
|
||||||
const _PhoneSection(),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
|
||||||
const _EmailSection(),
|
|
||||||
],
|
|
||||||
))
|
|
||||||
),
|
),
|
||||||
footer: Column(
|
|
||||||
children: [
|
|
||||||
Text(context.translate(I18n.personalDataMessage)),
|
|
||||||
SizedBox(height: 14),
|
|
||||||
const _SaveSection(),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ProfilePictureSection extends ConsumerWidget {
|
class _ProfilePicture extends StatelessWidget {
|
||||||
|
const _ProfilePicture();
|
||||||
const _ProfilePictureSection();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context) {
|
||||||
return Stack(
|
return Center(
|
||||||
children: [
|
child: Container(
|
||||||
Center(child: Container(
|
decoration: const BoxDecoration(shape: BoxShape.circle),
|
||||||
decoration: BoxDecoration(shape: BoxShape.circle),
|
child: SvgPicture.asset('assets/shared/images/profile.svg'),
|
||||||
child: SvgPicture.asset('assets/images/ui/profile.svg')),
|
),
|
||||||
),
|
|
||||||
Center(child: SizedBox(
|
|
||||||
width: 160,
|
|
||||||
height: 160,
|
|
||||||
child: Align(alignment: Alignment.bottomRight,
|
|
||||||
child: IconButton(
|
|
||||||
onPressed: (){},
|
|
||||||
icon: Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
shape: BoxShape.circle,
|
|
||||||
color: Color(0xFFCAC9C9)
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.all(8),
|
|
||||||
child: Icon(
|
|
||||||
Icons.edit_outlined,
|
|
||||||
color: Colors.white,
|
|
||||||
size: SizeUtils.getByScreen(small: 32, big: 30),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
))
|
|
||||||
],
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EmailLabelSection extends ConsumerWidget {
|
class _EmailLabel extends ConsumerWidget {
|
||||||
|
const _EmailLabel();
|
||||||
const _EmailLabelSection();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final email = ref.watch(
|
final email = ref.watch(
|
||||||
personalDataViewModelProvider.select((s)=>s.user?.email ?? '')
|
personalDataViewModelProvider.select((s) => s.user?.email ?? ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
children: [
|
children: [
|
||||||
Text(context.translate(I18n.emailLabel),
|
Text(
|
||||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13))
|
context.translate(I18n.emailLabel),
|
||||||
|
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13)),
|
||||||
),
|
),
|
||||||
Text(email,
|
Text(
|
||||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17))
|
email,
|
||||||
|
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17)),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class _GenderSection extends ConsumerWidget {
|
|
||||||
|
|
||||||
const _GenderSection();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
final theme = ref.read(themePortProvider);
|
|
||||||
|
|
||||||
final vm = ref.read(personalDataViewModelProvider.notifier);
|
|
||||||
final gender = ref.watch(
|
|
||||||
personalDataViewModelProvider.select((s)=>s.gender)
|
|
||||||
);
|
|
||||||
|
|
||||||
Map<String, String> genderOptions = <String, String>{
|
|
||||||
'M': context.translate(I18n.male),
|
|
||||||
'F': context.translate(I18n.female),
|
|
||||||
'O': context.translate(I18n.ratherNotSay),
|
|
||||||
};
|
|
||||||
|
|
||||||
final setGender = (value){vm.setGender(value.toString());};
|
|
||||||
|
|
||||||
return Column(
|
|
||||||
children: [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment.bottomLeft,
|
|
||||||
child: Text(context.translate(I18n.genderLabel),),
|
|
||||||
),
|
|
||||||
Container(
|
|
||||||
decoration: BoxDecoration(
|
|
||||||
border: Border.fromBorderSide(BorderSide(
|
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
|
||||||
width: 3
|
|
||||||
)),
|
|
||||||
borderRadius: BorderRadius.all(Radius.circular(32)),
|
|
||||||
),
|
|
||||||
padding: EdgeInsets.symmetric(horizontal: 10),
|
|
||||||
child: RadioGroup(
|
|
||||||
onChanged: setGender,
|
|
||||||
groupValue: gender,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
||||||
children: List<Widget>.generate(genderOptions.length, (int index)=>
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
Radio(
|
|
||||||
value: genderOptions.keys.elementAt(index),
|
|
||||||
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
),
|
|
||||||
TextButton(
|
|
||||||
onPressed: (){setGender(genderOptions.keys.elementAt(index));},
|
|
||||||
style: TextButton.styleFrom(
|
|
||||||
padding: EdgeInsets.zero,
|
|
||||||
minimumSize: Size.zero,
|
|
||||||
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
|
|
||||||
),
|
|
||||||
child: Text(genderOptions.values.elementAt(index),
|
|
||||||
style: TextStyle(fontSize: 10),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _NameSection extends ConsumerWidget {
|
class _FirstNameField extends ConsumerWidget {
|
||||||
|
const _FirstNameField();
|
||||||
const _NameSection();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final vm = ref.read(personalDataViewModelProvider.notifier);
|
final vm = ref.read(personalDataViewModelProvider.notifier);
|
||||||
final name = ref.watch(
|
final hint = ref.watch(
|
||||||
personalDataViewModelProvider.select((s)=>s.user?.firstName ?? '')
|
personalDataViewModelProvider.select((s) => s.user?.firstName ?? ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
return CustomTextField(
|
return CustomTextField(
|
||||||
controller: vm.nameController,
|
controller: vm.firstNameController,
|
||||||
hint: name,
|
hint: hint,
|
||||||
label: context.translate(I18n.firstNameLabel),
|
label: context.translate(I18n.firstNameLabel),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _PhoneSection extends ConsumerWidget {
|
class _LastNameField extends ConsumerWidget {
|
||||||
|
const _LastNameField();
|
||||||
const _PhoneSection();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final vm = ref.read(personalDataViewModelProvider.notifier);
|
final vm = ref.read(personalDataViewModelProvider.notifier);
|
||||||
final phone = ref.watch(
|
final hint = ref.watch(
|
||||||
personalDataViewModelProvider.select((s)=>s.user?.phone ?? '')
|
personalDataViewModelProvider.select((s) => s.user?.lastName ?? ''),
|
||||||
|
);
|
||||||
|
|
||||||
|
return CustomTextField(
|
||||||
|
controller: vm.lastNameController,
|
||||||
|
hint: hint,
|
||||||
|
label: context.translate(I18n.lastNameLabel),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _PhoneField extends ConsumerWidget {
|
||||||
|
const _PhoneField();
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
|
final vm = ref.read(personalDataViewModelProvider.notifier);
|
||||||
|
final hint = ref.watch(
|
||||||
|
personalDataViewModelProvider.select((s) => s.user?.phone ?? ''),
|
||||||
);
|
);
|
||||||
|
|
||||||
return CustomTextField(
|
return CustomTextField(
|
||||||
controller: vm.phoneController,
|
controller: vm.phoneController,
|
||||||
hint: phone,
|
hint: hint,
|
||||||
label: context.translate(I18n.phoneLabel),
|
label: context.translate(I18n.phoneLabel),
|
||||||
keyboardType: TextInputType.phone,
|
keyboardType: TextInputType.phone,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _EmailSection extends ConsumerWidget {
|
class _SaveButton extends ConsumerWidget {
|
||||||
|
const _SaveButton();
|
||||||
const _EmailSection();
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final vm = ref.read(personalDataViewModelProvider.notifier);
|
final theme = ref.watch(themePortProvider);
|
||||||
final email = ref.watch(
|
|
||||||
personalDataViewModelProvider.select((s)=>s.user?.email ?? '')
|
|
||||||
);
|
|
||||||
|
|
||||||
return CustomTextField(
|
|
||||||
controller: vm.emailController,
|
|
||||||
hint: email,
|
|
||||||
label: context.translate(I18n.emailLabel),
|
|
||||||
keyboardType: TextInputType.emailAddress,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class _SaveSection extends ConsumerWidget {
|
|
||||||
|
|
||||||
const _SaveSection();
|
|
||||||
|
|
||||||
@override
|
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
|
||||||
final theme = ref.read(themePortProvider);
|
|
||||||
|
|
||||||
final vm = ref.read(personalDataViewModelProvider.notifier);
|
final vm = ref.read(personalDataViewModelProvider.notifier);
|
||||||
|
|
||||||
return Padding(
|
return Padding(
|
||||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
padding: const EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||||
child: PrimaryButton(
|
child: PrimaryButton(
|
||||||
onPressed: () async {
|
onPressed: vm.updateUser,
|
||||||
await vm.updateUser();
|
|
||||||
|
|
||||||
final errorMessage = ref.read(
|
|
||||||
personalDataViewModelProvider.select((s)=>s.errorMessage)
|
|
||||||
);
|
|
||||||
if (errorMessage.isNotEmpty) {
|
|
||||||
showTopSnackbar(context, message: errorMessage, type: MessageType.error);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
final isComplete = ref.read(
|
|
||||||
personalDataViewModelProvider.select((s)=>s.isComplete)
|
|
||||||
);
|
|
||||||
if (isComplete) {
|
|
||||||
Navigator.pop(context);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
text: context.translate(I18n.submit),
|
text: context.translate(I18n.submit),
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary)
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
||||||
|
|||||||
@@ -8,165 +8,91 @@ import '../../../../core/domain/repositories/users_repository.dart';
|
|||||||
import '../../../../core/providers/users_repository_provider.dart';
|
import '../../../../core/providers/users_repository_provider.dart';
|
||||||
|
|
||||||
final personalDataViewModelProvider =
|
final personalDataViewModelProvider =
|
||||||
NotifierProvider.autoDispose<PersonalDataViewModel, PersonalDataViewState>(
|
NotifierProvider.autoDispose<PersonalDataViewModel, PersonalDataViewState>(
|
||||||
PersonalDataViewModel.new,
|
PersonalDataViewModel.new,
|
||||||
);
|
);
|
||||||
|
|
||||||
class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
|
class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
|
||||||
late final UsersRepository _usersRepository;
|
late final UsersRepository _usersRepository;
|
||||||
|
|
||||||
late final TextEditingController nameController;
|
late final TextEditingController firstNameController;
|
||||||
late final TextEditingController emailController;
|
late final TextEditingController lastNameController;
|
||||||
late final TextEditingController phoneController;
|
late final TextEditingController phoneController;
|
||||||
late final TextEditingController passwordController;
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
PersonalDataViewState build() {
|
PersonalDataViewState build() {
|
||||||
_usersRepository = ref.read(usersRepositoryProvider);
|
_usersRepository = ref.read(usersRepositoryProvider);
|
||||||
|
|
||||||
nameController = TextEditingController();
|
firstNameController = TextEditingController();
|
||||||
nameController.addListener(_onNameChanged);
|
lastNameController = TextEditingController();
|
||||||
|
|
||||||
emailController = TextEditingController();
|
|
||||||
emailController.addListener(_onEmailChanged);
|
|
||||||
|
|
||||||
phoneController = TextEditingController();
|
phoneController = TextEditingController();
|
||||||
phoneController.addListener(_onPhoneChanged);
|
|
||||||
|
|
||||||
passwordController = TextEditingController();
|
Future.microtask(_init);
|
||||||
passwordController.addListener(_onPasswordChanged);
|
|
||||||
|
|
||||||
_init();
|
ref.onDispose(_disposeControllers);
|
||||||
|
|
||||||
ref.onDispose(disposeControllers);
|
|
||||||
|
|
||||||
return const PersonalDataViewState();
|
return const PersonalDataViewState();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _init() async {
|
Future<void> _init() async {
|
||||||
final user = await ref.read(userInfoProvider.future);
|
final user = await ref.read(userInfoProvider.future);
|
||||||
setUser(user);
|
state = state.copyWith(user: user, isLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void setUser(UserEntity user) {
|
bool get _hasChanges =>
|
||||||
state = state.copyWith(user: user);
|
firstNameController.text.trim().isNotEmpty ||
|
||||||
}
|
lastNameController.text.trim().isNotEmpty ||
|
||||||
|
phoneController.text.trim().isNotEmpty;
|
||||||
void setGender(String value) {
|
|
||||||
if (value == state.gender) return;
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
gender: value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onNameChanged() {
|
|
||||||
final value = nameController.text;
|
|
||||||
|
|
||||||
if (value == state.name) return;
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
name: value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onEmailChanged() {
|
|
||||||
final value = emailController.text;
|
|
||||||
|
|
||||||
if (value == state.email) return;
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
email: value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onPhoneChanged() {
|
|
||||||
final value = phoneController.text;
|
|
||||||
|
|
||||||
if (value == state.phoneNumber) return;
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
phoneNumber: value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _onPasswordChanged() {
|
|
||||||
final value = passwordController.text;
|
|
||||||
|
|
||||||
if (value == state.password) return;
|
|
||||||
|
|
||||||
state = state.copyWith(
|
|
||||||
password: value,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool _validateForm() {
|
|
||||||
if (state.name.trim().isEmpty &&
|
|
||||||
state.email.trim().isEmpty &&
|
|
||||||
state.phoneNumber.trim().isEmpty &&
|
|
||||||
state.password.trim().isEmpty) {
|
|
||||||
state = state.copyWith(errorMessage: 'errorMessageAllFieldsAreEmpty');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
UpdateUserRequestEntity _toRequest() {
|
UpdateUserRequestEntity _toRequest() {
|
||||||
|
|
||||||
return UpdateUserRequestEntity(
|
return UpdateUserRequestEntity(
|
||||||
id: state.user!.id,
|
firstName: firstNameController.text.trim().isNotEmpty
|
||||||
//name: state.name.trim(),
|
? firstNameController.text.trim()
|
||||||
email: state.email.trim(),
|
: null,
|
||||||
phone: /*state.dialCode.trim() + */state.phoneNumber.trim(),
|
lastName: lastNameController.text.trim().isNotEmpty
|
||||||
|
? lastNameController.text.trim()
|
||||||
|
: null,
|
||||||
|
phone: phoneController.text.trim().isNotEmpty
|
||||||
|
? phoneController.text.trim()
|
||||||
|
: null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<void> updateUser() async {
|
Future<void> updateUser() async {
|
||||||
try {
|
if (state.isLoading || !_hasChanges) return;
|
||||||
state = state.copyWith(
|
|
||||||
isLoading: true,
|
|
||||||
isComplete: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!_validateForm()) return;
|
try {
|
||||||
|
state = state.copyWith(isLoading: true, isComplete: false, errorMessage: '');
|
||||||
|
|
||||||
final request = _toRequest();
|
final request = _toRequest();
|
||||||
|
|
||||||
_usersRepository.updateUser(userId: state.user!.id, request: request);
|
await _usersRepository.updateUser(
|
||||||
ref.invalidate(userInfoProvider);
|
userId: state.user!.id,
|
||||||
|
request: request,
|
||||||
state = state.copyWith(
|
|
||||||
isLoading: false,
|
|
||||||
isComplete: true,
|
|
||||||
);
|
);
|
||||||
return;
|
if (!ref.mounted) return;
|
||||||
|
|
||||||
|
final updatedUser = state.user!.copyWith(
|
||||||
|
firstName: request.firstName ?? state.user!.firstName,
|
||||||
|
lastName: request.lastName ?? state.user!.lastName,
|
||||||
|
phone: request.phone ?? state.user!.phone,
|
||||||
|
);
|
||||||
|
ref.read(userInfoProvider.notifier).setUser(updatedUser);
|
||||||
|
|
||||||
|
state = state.copyWith(isLoading: false, isComplete: true);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
_finishWithError(message: e.toString());
|
state = state.copyWith(
|
||||||
|
isLoading: false,
|
||||||
|
isComplete: false,
|
||||||
|
errorMessage: e.toString(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void _finishWithError({required String message}) {
|
void _disposeControllers() {
|
||||||
state = state.copyWith(
|
firstNameController.dispose();
|
||||||
isLoading: false,
|
lastNameController.dispose();
|
||||||
isComplete: false,
|
|
||||||
errorMessage: message,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void disposeControllers() {
|
|
||||||
nameController.removeListener(_onNameChanged);
|
|
||||||
nameController.dispose();
|
|
||||||
|
|
||||||
emailController.removeListener(_onEmailChanged);
|
|
||||||
emailController.dispose();
|
|
||||||
|
|
||||||
phoneController.removeListener(_onPhoneChanged);
|
|
||||||
phoneController.dispose();
|
phoneController.dispose();
|
||||||
|
|
||||||
passwordController.removeListener(_onPasswordChanged);
|
|
||||||
passwordController.dispose();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,6 @@ abstract class PersonalDataViewState with _$PersonalDataViewState {
|
|||||||
@Default(true) bool isLoading,
|
@Default(true) bool isLoading,
|
||||||
@Default(false) bool isComplete,
|
@Default(false) bool isComplete,
|
||||||
UserEntity? user,
|
UserEntity? user,
|
||||||
@Default('O') String gender,
|
@Default('') String errorMessage,
|
||||||
@Default('') String name,
|
|
||||||
@Default('') String phoneNumber,
|
|
||||||
@Default('') String email,
|
|
||||||
@Default('') String password,
|
|
||||||
@Default(false) bool showPassword,
|
|
||||||
@Default('') String errorMessage
|
|
||||||
}) = _PersonalDataViewState;
|
}) = _PersonalDataViewState;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$PersonalDataViewState {
|
mixin _$PersonalDataViewState {
|
||||||
|
|
||||||
bool get isLoading; bool get isComplete; UserEntity? get user; String get gender; String get name; String get phoneNumber; String get email; String get password; bool get showPassword; String get errorMessage;
|
bool get isLoading; bool get isComplete; UserEntity? get user; String get errorMessage;
|
||||||
/// Create a copy of PersonalDataViewState
|
/// Create a copy of PersonalDataViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -25,16 +25,16 @@ $PersonalDataViewStateCopyWith<PersonalDataViewState> get copyWith => _$Personal
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.user, user) || other.user == user)&&(identical(other.gender, gender) || other.gender == gender)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.user, user) || other.user == user)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,gender,name,phoneNumber,email,password,showPassword,errorMessage);
|
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,errorMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, gender: $gender, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
|
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, errorMessage: $errorMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ abstract mixin class $PersonalDataViewStateCopyWith<$Res> {
|
|||||||
factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl;
|
factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool isLoading, bool isComplete, UserEntity? user, String gender, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
|
bool isLoading, bool isComplete, UserEntity? user, String errorMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -62,18 +62,12 @@ class _$PersonalDataViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of PersonalDataViewState
|
/// Create a copy of PersonalDataViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isComplete = null,Object? user = freezed,Object? gender = null,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isComplete = null,Object? user = freezed,Object? errorMessage = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||||
as UserEntity?,gender: null == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable
|
as UserEntity?,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -171,10 +165,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String gender, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PersonalDataViewState() when $default != null:
|
case _PersonalDataViewState() when $default != null:
|
||||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
|
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -192,10 +186,10 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.n
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String gender, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PersonalDataViewState():
|
case _PersonalDataViewState():
|
||||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
|
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -212,10 +206,10 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.n
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isComplete, UserEntity? user, String gender, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _PersonalDataViewState() when $default != null:
|
case _PersonalDataViewState() when $default != null:
|
||||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
|
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -227,18 +221,12 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.gender,_that.n
|
|||||||
|
|
||||||
|
|
||||||
class _PersonalDataViewState implements PersonalDataViewState {
|
class _PersonalDataViewState implements PersonalDataViewState {
|
||||||
const _PersonalDataViewState({this.isLoading = true, this.isComplete = false, this.user, this.gender = 'O', this.name = '', this.phoneNumber = '', this.email = '', this.password = '', this.showPassword = false, this.errorMessage = ''});
|
const _PersonalDataViewState({this.isLoading = true, this.isComplete = false, this.user, this.errorMessage = ''});
|
||||||
|
|
||||||
|
|
||||||
@override@JsonKey() final bool isLoading;
|
@override@JsonKey() final bool isLoading;
|
||||||
@override@JsonKey() final bool isComplete;
|
@override@JsonKey() final bool isComplete;
|
||||||
@override final UserEntity? user;
|
@override final UserEntity? user;
|
||||||
@override@JsonKey() final String gender;
|
|
||||||
@override@JsonKey() final String name;
|
|
||||||
@override@JsonKey() final String phoneNumber;
|
|
||||||
@override@JsonKey() final String email;
|
|
||||||
@override@JsonKey() final String password;
|
|
||||||
@override@JsonKey() final bool showPassword;
|
|
||||||
@override@JsonKey() final String errorMessage;
|
@override@JsonKey() final String errorMessage;
|
||||||
|
|
||||||
/// Create a copy of PersonalDataViewState
|
/// Create a copy of PersonalDataViewState
|
||||||
@@ -251,16 +239,16 @@ _$PersonalDataViewStateCopyWith<_PersonalDataViewState> get copyWith => __$Perso
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.user, user) || other.user == user)&&(identical(other.gender, gender) || other.gender == gender)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isComplete, isComplete) || other.isComplete == isComplete)&&(identical(other.user, user) || other.user == user)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,gender,name,phoneNumber,email,password,showPassword,errorMessage);
|
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,errorMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, gender: $gender, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
|
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, errorMessage: $errorMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -271,7 +259,7 @@ abstract mixin class _$PersonalDataViewStateCopyWith<$Res> implements $PersonalD
|
|||||||
factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl;
|
factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
bool isLoading, bool isComplete, UserEntity? user, String gender, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
|
bool isLoading, bool isComplete, UserEntity? user, String errorMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@@ -288,18 +276,12 @@ class __$PersonalDataViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of PersonalDataViewState
|
/// Create a copy of PersonalDataViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isComplete = null,Object? user = freezed,Object? gender = null,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isComplete = null,Object? user = freezed,Object? errorMessage = null,}) {
|
||||||
return _then(_PersonalDataViewState(
|
return _then(_PersonalDataViewState(
|
||||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
as bool,isComplete: null == isComplete ? _self.isComplete : isComplete // ignore: cast_nullable_to_non_nullable
|
||||||
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||||
as UserEntity?,gender: null == gender ? _self.gender : gender // ignore: cast_nullable_to_non_nullable
|
as UserEntity?,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
|
|
||||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
|
||||||
as String,
|
as String,
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ dependency_overrides:
|
|||||||
home:
|
home:
|
||||||
path: ../../../home
|
path: ../../../home
|
||||||
legacy_auth:
|
legacy_auth:
|
||||||
path: ..\\legacy_auth
|
path: ../legacy_auth
|
||||||
legacy_shared:
|
legacy_shared:
|
||||||
path: ../../packages/legacy_shared
|
path: ../../packages/legacy_shared
|
||||||
navigation:
|
navigation:
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ class ControlPanelScreen extends ConsumerWidget {
|
|||||||
SizedBox(
|
SizedBox(
|
||||||
height: SizeUtils.getByScreen(small: 16, big: 22),
|
height: SizeUtils.getByScreen(small: 16, big: 22),
|
||||||
),
|
),
|
||||||
_MapSection(),
|
_MapSection(navigationContract: navigationContract),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: SizeUtils.getByScreen(small: 14, big: 13),
|
height: SizeUtils.getByScreen(small: 14, big: 13),
|
||||||
),
|
),
|
||||||
@@ -104,12 +104,13 @@ class _Header extends ConsumerWidget {
|
|||||||
child: CustomDropdown(
|
child: CustomDropdown(
|
||||||
items: state.devices
|
items: state.devices
|
||||||
.map(
|
.map(
|
||||||
(DeviceEntity device) => Text(
|
(DeviceEntity device) {
|
||||||
device.carrierName!.length > 10
|
final name = device.carrierName ?? '';
|
||||||
? '${device.carrierName!.substring(0, 10)}...'
|
return Text(
|
||||||
: device.carrierName!,
|
name.length > 10 ? '${name.substring(0, 10)}...' : name,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
);
|
||||||
|
},
|
||||||
)
|
)
|
||||||
.toList(),
|
.toList(),
|
||||||
values: state.devices,
|
values: state.devices,
|
||||||
@@ -162,7 +163,7 @@ class _MenuSection extends ConsumerWidget {
|
|||||||
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
||||||
_SectionButton(
|
_SectionButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
navigationContract.pushTo(AppRoutes.deviceManagement);
|
navigationContract.goTo(AppRoutes.deviceManagement);
|
||||||
},
|
},
|
||||||
icon: SFIcons.functions,
|
icon: SFIcons.functions,
|
||||||
text: I18n.functions,
|
text: I18n.functions,
|
||||||
@@ -176,9 +177,10 @@ class _MenuSection extends ConsumerWidget {
|
|||||||
text: I18n.accountSettings,
|
text: I18n.accountSettings,
|
||||||
),
|
),
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
||||||
// TODO: Implementar navegación a Device Settings
|
|
||||||
_SectionButton(
|
_SectionButton(
|
||||||
onPressed: () {},
|
onPressed: () {
|
||||||
|
navigationContract.pushTo(AppRoutes.settings);
|
||||||
|
},
|
||||||
icon: Icons.settings_outlined,
|
icon: Icons.settings_outlined,
|
||||||
text: I18n.deviceSettings,
|
text: I18n.deviceSettings,
|
||||||
),
|
),
|
||||||
@@ -200,7 +202,7 @@ class _SectionButton extends ConsumerWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
final theme = ref.read(themePortProvider);
|
final theme = ref.watch(themePortProvider);
|
||||||
|
|
||||||
return SectionButton(
|
return SectionButton(
|
||||||
onPressed: onPressed,
|
onPressed: onPressed,
|
||||||
@@ -223,7 +225,9 @@ class _SectionButton extends ConsumerWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _MapSection extends ConsumerWidget {
|
class _MapSection extends ConsumerWidget {
|
||||||
const _MapSection();
|
final NavigationContract navigationContract;
|
||||||
|
|
||||||
|
const _MapSection({required this.navigationContract});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context, WidgetRef ref) {
|
Widget build(BuildContext context, WidgetRef ref) {
|
||||||
@@ -231,38 +235,44 @@ class _MapSection extends ConsumerWidget {
|
|||||||
final state = ref.watch(controlPanelViewModelProvider);
|
final state = ref.watch(controlPanelViewModelProvider);
|
||||||
final vm = ref.read(controlPanelViewModelProvider.notifier);
|
final vm = ref.read(controlPanelViewModelProvider.notifier);
|
||||||
|
|
||||||
return Column(
|
return GestureDetector(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
onTap: () => navigationContract.goTo(AppRoutes.legacyLocation),
|
||||||
children: [
|
child: Column(
|
||||||
Row(
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
children: [
|
||||||
children: [
|
Row(
|
||||||
Text(
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
context.translate(I18n.watchesOnMap),
|
children: [
|
||||||
style: TextStyle(
|
Text(
|
||||||
fontSize: SizeUtils.getByScreen(small: 20, big: 19),
|
context.translate(I18n.watchesOnMap),
|
||||||
fontWeight: FontWeight.bold,
|
style: TextStyle(
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
fontSize: SizeUtils.getByScreen(small: 20, big: 19),
|
||||||
|
fontWeight: FontWeight.bold,
|
||||||
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
IconButton(
|
||||||
IconButton(
|
onPressed: vm.refreshPositions,
|
||||||
onPressed: vm.refreshPositions,
|
icon: Icon(
|
||||||
icon: Icon(
|
Icons.refresh,
|
||||||
Icons.refresh,
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
),
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
],
|
|
||||||
),
|
|
||||||
SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)),
|
|
||||||
SizedBox(
|
|
||||||
height: SizeUtils.getByScreen(small: 200, big: 300),
|
|
||||||
child: DeviceMap(
|
|
||||||
selectedPosition: state.selectedPosition,
|
|
||||||
selectedDevice: state.selectedDevice,
|
|
||||||
),
|
),
|
||||||
),
|
SizedBox(height: SizeUtils.getByScreen(small: 4, big: 8)),
|
||||||
],
|
AbsorbPointer(
|
||||||
|
child: SizedBox(
|
||||||
|
height: SizeUtils.getByScreen(small: 200, big: 300),
|
||||||
|
child: DeviceMap(
|
||||||
|
selectedPosition: state.selectedPosition,
|
||||||
|
selectedDevice: state.selectedDevice,
|
||||||
|
markerSize: 40,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ class ControlPanelViewModel extends Notifier<ControlPanelViewState> {
|
|||||||
|
|
||||||
Future<void> _init() async {
|
Future<void> _init() async {
|
||||||
try {
|
try {
|
||||||
final user = await ref.read(userInfoProvider.future);
|
|
||||||
if (!ref.mounted) return;
|
|
||||||
state = state.copyWith(loggedUser: user);
|
|
||||||
|
|
||||||
final devices = await _devicesRepository.getDevices();
|
final devices = await _devicesRepository.getDevices();
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
|
|
||||||
@@ -39,15 +35,21 @@ class ControlPanelViewModel extends Notifier<ControlPanelViewState> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final previouslySelected = ref.read(selectedDeviceProvider);
|
||||||
|
final selected = previouslySelected != null &&
|
||||||
|
devices.any((d) => d.identificator == previouslySelected.identificator)
|
||||||
|
? previouslySelected
|
||||||
|
: devices.first;
|
||||||
|
|
||||||
state = state.copyWith(
|
state = state.copyWith(
|
||||||
devices: devices,
|
devices: devices,
|
||||||
selectedDevice: devices.first,
|
selectedDevice: selected,
|
||||||
);
|
);
|
||||||
_selectedDeviceNotifier.setSelectedDevice(devices.first);
|
_selectedDeviceNotifier.setSelectedDevice(selected);
|
||||||
|
|
||||||
final positionLists = await Future.wait(
|
final positionLists = await Future.wait(
|
||||||
devices.map(
|
devices.map(
|
||||||
(d) => _controlPanelRepository.getLatestPositions(deviceId: d!.identificator),
|
(d) => _controlPanelRepository.getLatestPositions(deviceId: d.identificator),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
@@ -93,7 +95,7 @@ class ControlPanelViewModel extends Notifier<ControlPanelViewState> {
|
|||||||
try {
|
try {
|
||||||
final positionLists = await Future.wait(
|
final positionLists = await Future.wait(
|
||||||
state.devices.map(
|
state.devices.map(
|
||||||
(d) => _controlPanelRepository.getLatestPositions(deviceId: d!.identificator),
|
(d) => _controlPanelRepository.getLatestPositions(deviceId: d.identificator),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (!ref.mounted) return;
|
if (!ref.mounted) return;
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ part 'control_panel_view_state.freezed.dart';
|
|||||||
@freezed
|
@freezed
|
||||||
abstract class ControlPanelViewState with _$ControlPanelViewState {
|
abstract class ControlPanelViewState with _$ControlPanelViewState {
|
||||||
const factory ControlPanelViewState({
|
const factory ControlPanelViewState({
|
||||||
UserEntity? loggedUser,
|
|
||||||
@Default([]) List<DeviceEntity> devices,
|
@Default([]) List<DeviceEntity> devices,
|
||||||
DeviceEntity? selectedDevice,
|
DeviceEntity? selectedDevice,
|
||||||
@Default([]) List<PositionEntity> positions,
|
@Default([]) List<PositionEntity> positions,
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ControlPanelViewState {
|
mixin _$ControlPanelViewState {
|
||||||
|
|
||||||
UserEntity? get loggedUser; List<DeviceEntity> get devices; DeviceEntity? get selectedDevice; List<PositionEntity> get positions; PositionEntity? get selectedPosition; bool get isLoading; String get errorMessage;
|
List<DeviceEntity> get devices; DeviceEntity? get selectedDevice; List<PositionEntity> get positions; PositionEntity? get selectedPosition; bool get isLoading; String get errorMessage;
|
||||||
/// Create a copy of ControlPanelViewState
|
/// Create a copy of ControlPanelViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -25,16 +25,16 @@ $ControlPanelViewStateCopyWith<ControlPanelViewState> get copyWith => _$ControlP
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ControlPanelViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.devices, devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.positions, positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ControlPanelViewState&&const DeepCollectionEquality().equals(other.devices, devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other.positions, positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition,isLoading,errorMessage);
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(devices),selectedDevice,const DeepCollectionEquality().hash(positions),selectedPosition,isLoading,errorMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ControlPanelViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition, isLoading: $isLoading, errorMessage: $errorMessage)';
|
return 'ControlPanelViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition, isLoading: $isLoading, errorMessage: $errorMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -45,11 +45,11 @@ abstract mixin class $ControlPanelViewStateCopyWith<$Res> {
|
|||||||
factory $ControlPanelViewStateCopyWith(ControlPanelViewState value, $Res Function(ControlPanelViewState) _then) = _$ControlPanelViewStateCopyWithImpl;
|
factory $ControlPanelViewStateCopyWith(ControlPanelViewState value, $Res Function(ControlPanelViewState) _then) = _$ControlPanelViewStateCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage
|
List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$UserEntityCopyWith<$Res>? get loggedUser;$DeviceEntityCopyWith<$Res>? get selectedDevice;$PositionEntityCopyWith<$Res>? get selectedPosition;
|
$DeviceEntityCopyWith<$Res>? get selectedDevice;$PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -62,10 +62,9 @@ class _$ControlPanelViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of ControlPanelViewState
|
/// Create a copy of ControlPanelViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,Object? isLoading = null,Object? errorMessage = null,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,Object? isLoading = null,Object? errorMessage = null,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
|
devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable
|
||||||
as UserEntity?,devices: null == devices ? _self.devices : devices // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
|
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
|
||||||
as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable
|
as DeviceEntity?,positions: null == positions ? _self.positions : positions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
|
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -78,18 +77,6 @@ as String,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$UserEntityCopyWith<$Res>? get loggedUser {
|
|
||||||
if (_self.loggedUser == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
|
|
||||||
return _then(_self.copyWith(loggedUser: value));
|
|
||||||
});
|
|
||||||
}/// Create a copy of ControlPanelViewState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$DeviceEntityCopyWith<$Res>? get selectedDevice {
|
$DeviceEntityCopyWith<$Res>? get selectedDevice {
|
||||||
if (_self.selectedDevice == null) {
|
if (_self.selectedDevice == null) {
|
||||||
return null;
|
return null;
|
||||||
@@ -192,10 +179,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ControlPanelViewState() when $default != null:
|
case _ControlPanelViewState() when $default != null:
|
||||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -213,10 +200,10 @@ return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positi
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ControlPanelViewState():
|
case _ControlPanelViewState():
|
||||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -233,10 +220,10 @@ return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positi
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ControlPanelViewState() when $default != null:
|
case _ControlPanelViewState() when $default != null:
|
||||||
return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
return $default(_that.devices,_that.selectedDevice,_that.positions,_that.selectedPosition,_that.isLoading,_that.errorMessage);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -248,10 +235,9 @@ return $default(_that.loggedUser,_that.devices,_that.selectedDevice,_that.positi
|
|||||||
|
|
||||||
|
|
||||||
class _ControlPanelViewState implements ControlPanelViewState {
|
class _ControlPanelViewState implements ControlPanelViewState {
|
||||||
const _ControlPanelViewState({this.loggedUser, final List<DeviceEntity> devices = const [], this.selectedDevice, final List<PositionEntity> positions = const [], this.selectedPosition, this.isLoading = true, this.errorMessage = ''}): _devices = devices,_positions = positions;
|
const _ControlPanelViewState({final List<DeviceEntity> devices = const [], this.selectedDevice, final List<PositionEntity> positions = const [], this.selectedPosition, this.isLoading = true, this.errorMessage = ''}): _devices = devices,_positions = positions;
|
||||||
|
|
||||||
|
|
||||||
@override final UserEntity? loggedUser;
|
|
||||||
final List<DeviceEntity> _devices;
|
final List<DeviceEntity> _devices;
|
||||||
@override@JsonKey() List<DeviceEntity> get devices {
|
@override@JsonKey() List<DeviceEntity> get devices {
|
||||||
if (_devices is EqualUnmodifiableListView) return _devices;
|
if (_devices is EqualUnmodifiableListView) return _devices;
|
||||||
@@ -281,16 +267,16 @@ _$ControlPanelViewStateCopyWith<_ControlPanelViewState> get copyWith => __$Contr
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ControlPanelViewState&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ControlPanelViewState&&const DeepCollectionEquality().equals(other._devices, _devices)&&(identical(other.selectedDevice, selectedDevice) || other.selectedDevice == selectedDevice)&&const DeepCollectionEquality().equals(other._positions, _positions)&&(identical(other.selectedPosition, selectedPosition) || other.selectedPosition == selectedPosition)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
int get hashCode => Object.hash(runtimeType,loggedUser,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition,isLoading,errorMessage);
|
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_devices),selectedDevice,const DeepCollectionEquality().hash(_positions),selectedPosition,isLoading,errorMessage);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ControlPanelViewState(loggedUser: $loggedUser, devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition, isLoading: $isLoading, errorMessage: $errorMessage)';
|
return 'ControlPanelViewState(devices: $devices, selectedDevice: $selectedDevice, positions: $positions, selectedPosition: $selectedPosition, isLoading: $isLoading, errorMessage: $errorMessage)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -301,11 +287,11 @@ abstract mixin class _$ControlPanelViewStateCopyWith<$Res> implements $ControlPa
|
|||||||
factory _$ControlPanelViewStateCopyWith(_ControlPanelViewState value, $Res Function(_ControlPanelViewState) _then) = __$ControlPanelViewStateCopyWithImpl;
|
factory _$ControlPanelViewStateCopyWith(_ControlPanelViewState value, $Res Function(_ControlPanelViewState) _then) = __$ControlPanelViewStateCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
UserEntity? loggedUser, List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage
|
List<DeviceEntity> devices, DeviceEntity? selectedDevice, List<PositionEntity> positions, PositionEntity? selectedPosition, bool isLoading, String errorMessage
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override $UserEntityCopyWith<$Res>? get loggedUser;@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $PositionEntityCopyWith<$Res>? get selectedPosition;
|
@override $DeviceEntityCopyWith<$Res>? get selectedDevice;@override $PositionEntityCopyWith<$Res>? get selectedPosition;
|
||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
@@ -318,10 +304,9 @@ class __$ControlPanelViewStateCopyWithImpl<$Res>
|
|||||||
|
|
||||||
/// Create a copy of ControlPanelViewState
|
/// Create a copy of ControlPanelViewState
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? loggedUser = freezed,Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,Object? isLoading = null,Object? errorMessage = null,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? devices = null,Object? selectedDevice = freezed,Object? positions = null,Object? selectedPosition = freezed,Object? isLoading = null,Object? errorMessage = null,}) {
|
||||||
return _then(_ControlPanelViewState(
|
return _then(_ControlPanelViewState(
|
||||||
loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
|
devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable
|
||||||
as UserEntity?,devices: null == devices ? _self._devices : devices // ignore: cast_nullable_to_non_nullable
|
|
||||||
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
|
as List<DeviceEntity>,selectedDevice: freezed == selectedDevice ? _self.selectedDevice : selectedDevice // ignore: cast_nullable_to_non_nullable
|
||||||
as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable
|
as DeviceEntity?,positions: null == positions ? _self._positions : positions // ignore: cast_nullable_to_non_nullable
|
||||||
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
|
as List<PositionEntity>,selectedPosition: freezed == selectedPosition ? _self.selectedPosition : selectedPosition // ignore: cast_nullable_to_non_nullable
|
||||||
@@ -335,18 +320,6 @@ as String,
|
|||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override
|
@override
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$UserEntityCopyWith<$Res>? get loggedUser {
|
|
||||||
if (_self.loggedUser == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
|
|
||||||
return _then(_self.copyWith(loggedUser: value));
|
|
||||||
});
|
|
||||||
}/// Create a copy of ControlPanelViewState
|
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
|
||||||
@override
|
|
||||||
@pragma('vm:prefer-inline')
|
|
||||||
$DeviceEntityCopyWith<$Res>? get selectedDevice {
|
$DeviceEntityCopyWith<$Res>? get selectedDevice {
|
||||||
if (_self.selectedDevice == null) {
|
if (_self.selectedDevice == null) {
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ const _tileServerUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
|||||||
class DeviceMap extends ConsumerStatefulWidget {
|
class DeviceMap extends ConsumerStatefulWidget {
|
||||||
final PositionEntity? selectedPosition;
|
final PositionEntity? selectedPosition;
|
||||||
final DeviceEntity? selectedDevice;
|
final DeviceEntity? selectedDevice;
|
||||||
|
final double markerSize;
|
||||||
|
|
||||||
const DeviceMap({
|
const DeviceMap({
|
||||||
super.key,
|
super.key,
|
||||||
required this.selectedPosition,
|
required this.selectedPosition,
|
||||||
required this.selectedDevice,
|
required this.selectedDevice,
|
||||||
|
this.markerSize = 80,
|
||||||
});
|
});
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -34,7 +36,7 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
|||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
_mapController = MapControllerImpl();
|
_mapController = MapController();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -87,13 +89,13 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
|||||||
widget.selectedPosition!.latitude,
|
widget.selectedPosition!.latitude,
|
||||||
widget.selectedPosition!.longitude,
|
widget.selectedPosition!.longitude,
|
||||||
),
|
),
|
||||||
width: 200,
|
width: widget.markerSize * 2.5,
|
||||||
height: 145,
|
height: widget.markerSize * 1.8,
|
||||||
child: Align(
|
child: Align(
|
||||||
alignment: Alignment.topCenter,
|
alignment: Alignment.topCenter,
|
||||||
child: SvgPicture.asset(
|
child: SvgPicture.asset(
|
||||||
'assets/shared/images/location.svg',
|
'assets/shared/images/location.svg',
|
||||||
height: 80,
|
height: widget.markerSize,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
rotate: true,
|
rotate: true,
|
||||||
@@ -154,42 +156,44 @@ class LocationBanner extends ConsumerWidget {
|
|||||||
size: SizeUtils.getByScreen(small: 40, big: 38),
|
size: SizeUtils.getByScreen(small: 40, big: 38),
|
||||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||||
),
|
),
|
||||||
Column(
|
Expanded(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
child: Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
SizedBox(
|
children: [
|
||||||
width: SizeUtils.getByScreen(small: 250, big: 248),
|
Text(
|
||||||
child: Text(
|
|
||||||
addressText,
|
addressText,
|
||||||
overflow: TextOverflow.ellipsis,
|
overflow: TextOverflow.ellipsis,
|
||||||
),
|
),
|
||||||
),
|
Row(
|
||||||
Row(
|
children: [
|
||||||
children: [
|
Flexible(
|
||||||
Text(
|
child: Text(
|
||||||
dateText,
|
dateText,
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||||
|
),
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
if (position.networks.isNotEmpty)
|
||||||
if (position.networks.isNotEmpty)
|
Text(
|
||||||
|
' | ${position.networks.first.signal}',
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Icon(batteryIcon),
|
||||||
Text(
|
Text(
|
||||||
' | ${position.networks.first.signal}',
|
'$battery%',
|
||||||
style: TextStyle(
|
style: TextStyle(
|
||||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Icon(batteryIcon),
|
],
|
||||||
Text(
|
),
|
||||||
'$battery%',
|
],
|
||||||
style: TextStyle(
|
),
|
||||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|||||||
@@ -2,6 +2,11 @@ library functions;
|
|||||||
|
|
||||||
export 'src/features/device_management/device_management_builder.dart';
|
export 'src/features/device_management/device_management_builder.dart';
|
||||||
export 'src/features/contacts/contacts_builder.dart';
|
export 'src/features/contacts/contacts_builder.dart';
|
||||||
|
export 'src/features/contacts/edit_contact_builder.dart';
|
||||||
|
export 'src/features/scheduled_activities/scheduled_activities_builder.dart';
|
||||||
export 'src/features/remote_connection/remote_connection_builder.dart';
|
export 'src/features/remote_connection/remote_connection_builder.dart';
|
||||||
export 'src/features/locate_device/locate_device_builder.dart';
|
export 'src/features/locate_device/locate_device_builder.dart';
|
||||||
export 'src/features/rewards/rewards_builder.dart';
|
export 'src/features/health/health_builder.dart';
|
||||||
|
export 'src/features/rewards/rewards_builder.dart';
|
||||||
|
export 'src/features/activity_meter/activity_meter_builder.dart';
|
||||||
|
export 'src/features/apps_use/apps_use_builder.dart';
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import '../models/get_app_usage_times_response_model.dart';
|
||||||
|
|
||||||
|
abstract class AppUsageTimesRemoteDatasource {
|
||||||
|
Future<GetAppUsageTimesResponseModel> getAppUsageTimes({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../models/get_app_usage_times_response_model.dart';
|
||||||
|
import 'app_usage_times_remote_datasource.dart';
|
||||||
|
|
||||||
|
class AppUsageTimesRemoteDatasourceImpl
|
||||||
|
implements AppUsageTimesRemoteDatasource {
|
||||||
|
AppUsageTimesRemoteDatasourceImpl(this._repository);
|
||||||
|
|
||||||
|
final QuestiaRepository _repository;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<GetAppUsageTimesResponseModel> getAppUsageTimes({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
|
'/devices/identificator/$identificator/app-usage-times',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = response.data;
|
||||||
|
if (data == null || data.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Empty response from /devices/identificator/$identificator/app-usage-times',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetAppUsageTimesResponseModel.fromJson(data);
|
||||||
|
} on DioException catch (error) {
|
||||||
|
throw mapDioError(
|
||||||
|
error,
|
||||||
|
defaultMessage: 'Error getting app usage times',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
import 'package:device_management/src/core/data/models/create_contact_request_model.dart';
|
import '../models/create_contact_request_model.dart';
|
||||||
import 'package:device_management/src/core/data/models/get_contacts_response_model.dart';
|
import '../models/get_contacts_response_model.dart';
|
||||||
|
|
||||||
import '../models/update_contact_request_model.dart';
|
import '../models/update_contact_request_model.dart';
|
||||||
|
|
||||||
abstract class ContactsRemoteDatasource {
|
abstract class ContactsRemoteDatasource {
|
||||||
Future<GetContactsResponseModel> getContacts({required String userId});
|
Future<GetContactsResponseModel> getContacts({required String userId});
|
||||||
|
|
||||||
Future<void> updateContact({required String userId, required UpdateContactRequestModel request});
|
Future<void> updateContact({required UpdateContactRequestModel request});
|
||||||
|
|
||||||
Future<void> createContact({required ContactRequestModel request});
|
Future<void> createContact({required CreateContactRequestModel request});
|
||||||
|
|
||||||
Future<void> deleteContact({required String contactId});
|
Future<void> deleteContact({required String contactId});
|
||||||
|
|
||||||
|
Future<void> syncContactsToDevice({
|
||||||
|
required String userId,
|
||||||
|
required String deviceId,
|
||||||
|
required List<Map<String, String>> contacts,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
import 'package:device_management/src/core/data/models/create_contact_request_model.dart';
|
|
||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:legacy_shared/legacy_shared.dart';
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../models/create_contact_request_model.dart';
|
||||||
import '../models/get_contacts_response_model.dart';
|
import '../models/get_contacts_response_model.dart';
|
||||||
import '../models/update_contact_request_model.dart';
|
import '../models/update_contact_request_model.dart';
|
||||||
import 'contacts_remote_datasource.dart';
|
import 'contacts_remote_datasource.dart';
|
||||||
@@ -24,45 +24,61 @@ class ContactsRemoteDatasourceImpl implements ContactsRemoteDatasource {
|
|||||||
throw Exception('Empty response from /users/:userId/contacts');
|
throw Exception('Empty response from /users/:userId/contacts');
|
||||||
}
|
}
|
||||||
|
|
||||||
final model = GetContactsResponseModel.fromJson(data);
|
return GetContactsResponseModel.fromJson(data);
|
||||||
return model;
|
|
||||||
} on DioException catch (error) {
|
} on DioException catch (error) {
|
||||||
throw mapDioError(error, defaultMessage: 'Error to get contacts');
|
throw mapDioError(error, defaultMessage: 'Error getting contacts');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateContact({required String userId, required UpdateContactRequestModel request}) async {
|
Future<void> updateContact({required UpdateContactRequestModel request}) async {
|
||||||
final body = request.toJson();
|
await safeCall(
|
||||||
await safeCall(
|
() => _repository.put<dynamic>(
|
||||||
() => _repository.put<dynamic>(
|
'/contacts/${request.id}',
|
||||||
'/contacts/$userId',
|
body: request.toJson(),
|
||||||
body: body,
|
),
|
||||||
),
|
'Error updating contact',
|
||||||
'Error in /contacts',
|
);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> createContact({required ContactRequestModel request}) async {
|
Future<void> createContact({required CreateContactRequestModel request}) async {
|
||||||
final body = request.toJson();
|
|
||||||
|
|
||||||
await safeCall(
|
await safeCall(
|
||||||
() => _repository.post<dynamic>(
|
() => _repository.post<dynamic>(
|
||||||
'/contacts',
|
'/contacts',
|
||||||
body: body,
|
body: request.toJson(),
|
||||||
),
|
),
|
||||||
'Error in /contacts',
|
'Error creating contact',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> deleteContact({required String contactId}) async {
|
Future<void> deleteContact({required String contactId}) async {
|
||||||
await safeCall(
|
await safeCall(
|
||||||
() => _repository.delete<dynamic>(
|
() => _repository.delete<dynamic>(
|
||||||
'/contacts/$contactId',
|
'/contacts/$contactId',
|
||||||
),
|
),
|
||||||
'Error in /contacts',
|
'Error deleting contact',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> syncContactsToDevice({
|
||||||
|
required String userId,
|
||||||
|
required String deviceId,
|
||||||
|
required List<Map<String, String>> contacts,
|
||||||
|
}) async {
|
||||||
|
await safeCall(
|
||||||
|
() => _repository.post<dynamic>(
|
||||||
|
'/contact-lists',
|
||||||
|
body: {
|
||||||
|
'userId': userId,
|
||||||
|
'deviceId': deviceId,
|
||||||
|
'type': 'secondary',
|
||||||
|
'contacts': contacts,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
'Error syncing contacts to device',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
enum OrderDirection {
|
||||||
|
asc('ASC'),
|
||||||
|
desc('DESC');
|
||||||
|
|
||||||
|
final String value;
|
||||||
|
const OrderDirection(this.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
class HealthQueryBuilder {
|
||||||
|
const HealthQueryBuilder._();
|
||||||
|
|
||||||
|
static Map<String, dynamic> build({
|
||||||
|
required OrderDirection orderDirection,
|
||||||
|
int? page,
|
||||||
|
int? pageSize,
|
||||||
|
List<HealthFilter>? filters,
|
||||||
|
String orderField = 'occurredAt',
|
||||||
|
}) {
|
||||||
|
final orderBy = base64Encode(
|
||||||
|
utf8.encode('[{"field":"$orderField","order":"${orderDirection.value}"}]'),
|
||||||
|
);
|
||||||
|
|
||||||
|
final params = <String, dynamic>{'orderBy': orderBy};
|
||||||
|
if (pageSize != null) params['pageSize'] = pageSize;
|
||||||
|
if (page != null) params['page'] = page;
|
||||||
|
|
||||||
|
if (filters != null && filters.isNotEmpty) {
|
||||||
|
final json = filters
|
||||||
|
.map((f) => {
|
||||||
|
'field': f.field,
|
||||||
|
'operator': f.operator,
|
||||||
|
'value': f.value,
|
||||||
|
})
|
||||||
|
.toList();
|
||||||
|
params['filters'] = base64Encode(utf8.encode(jsonEncode(json)));
|
||||||
|
}
|
||||||
|
|
||||||
|
return params;
|
||||||
|
}
|
||||||
|
|
||||||
|
static List<HealthFilter> timeRangeFilters({
|
||||||
|
required DateTime start,
|
||||||
|
required DateTime end,
|
||||||
|
String field = 'occurredAt',
|
||||||
|
}) {
|
||||||
|
return [
|
||||||
|
HealthFilter(
|
||||||
|
field: field,
|
||||||
|
operator: 'gte',
|
||||||
|
value: start.millisecondsSinceEpoch.toString(),
|
||||||
|
),
|
||||||
|
HealthFilter(
|
||||||
|
field: field,
|
||||||
|
operator: 'lte',
|
||||||
|
value: end.millisecondsSinceEpoch.toString(),
|
||||||
|
),
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class HealthFilter {
|
||||||
|
final String field;
|
||||||
|
final String operator;
|
||||||
|
final String value;
|
||||||
|
|
||||||
|
const HealthFilter({
|
||||||
|
required this.field,
|
||||||
|
required this.operator,
|
||||||
|
required this.value,
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import '../models/get_heartbeats_response_model.dart';
|
||||||
|
import '../models/get_oxygens_response_model.dart';
|
||||||
|
|
||||||
|
abstract class HealthRemoteDatasource {
|
||||||
|
Future<GetHeartbeatsResponseModel> getHeartbeats({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<GetOxygensResponseModel> getOxygens({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../models/get_heartbeats_response_model.dart';
|
||||||
|
import '../models/get_oxygens_response_model.dart';
|
||||||
|
import 'health_remote_datasource.dart';
|
||||||
|
|
||||||
|
class HealthRemoteDatasourceImpl implements HealthRemoteDatasource {
|
||||||
|
HealthRemoteDatasourceImpl(this._repository);
|
||||||
|
|
||||||
|
final QuestiaRepository _repository;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<GetHeartbeatsResponseModel> getHeartbeats({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
|
'/devices/identificator/$identificator/heartbeats',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = response.data;
|
||||||
|
if (data == null || data.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Empty response from /devices/identificator/$identificator/heartbeats',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetHeartbeatsResponseModel.fromJson(data);
|
||||||
|
} on DioException catch (error) {
|
||||||
|
throw mapDioError(error, defaultMessage: 'Error getting heartbeats');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<GetOxygensResponseModel> getOxygens({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
|
'/devices/identificator/$identificator/oxygens',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = response.data;
|
||||||
|
if (data == null || data.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Empty response from /devices/identificator/$identificator/oxygens',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetOxygensResponseModel.fromJson(data);
|
||||||
|
} on DioException catch (error) {
|
||||||
|
throw mapDioError(error, defaultMessage: 'Error getting oxygens');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import '../models/create_scheduled_activity_request_model.dart';
|
||||||
|
import '../models/get_scheduled_activities_response_model.dart';
|
||||||
|
import '../models/update_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
abstract class ScheduledActivitiesRemoteDatasource {
|
||||||
|
Future<GetScheduledActivitiesResponseModel> getActivities({
|
||||||
|
required String deviceId,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> createActivity({
|
||||||
|
required CreateScheduledActivityRequestModel request,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> updateActivity({
|
||||||
|
required String activityId,
|
||||||
|
required UpdateScheduledActivityRequestModel request,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> deleteActivity({required String activityId});
|
||||||
|
}
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../models/create_scheduled_activity_request_model.dart';
|
||||||
|
import '../models/get_scheduled_activities_response_model.dart';
|
||||||
|
import '../models/update_scheduled_activity_request_model.dart';
|
||||||
|
import 'scheduled_activities_remote_datasource.dart';
|
||||||
|
|
||||||
|
class ScheduledActivitiesRemoteDatasourceImpl
|
||||||
|
implements ScheduledActivitiesRemoteDatasource {
|
||||||
|
ScheduledActivitiesRemoteDatasourceImpl(this._repository);
|
||||||
|
|
||||||
|
final QuestiaRepository _repository;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<GetScheduledActivitiesResponseModel> getActivities({
|
||||||
|
required String deviceId,
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
|
'/devices/$deviceId/scheduled-activities',
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = response.data;
|
||||||
|
if (data == null || data.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Empty response from /devices/$deviceId/scheduled-activities',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetScheduledActivitiesResponseModel.fromJson(data);
|
||||||
|
} on DioException catch (error) {
|
||||||
|
throw mapDioError(
|
||||||
|
error,
|
||||||
|
defaultMessage: 'Error getting scheduled activities',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> createActivity({
|
||||||
|
required CreateScheduledActivityRequestModel request,
|
||||||
|
}) async {
|
||||||
|
await safeCall(
|
||||||
|
() => _repository.post<dynamic>(
|
||||||
|
'/scheduled-activities',
|
||||||
|
body: request.toJson(),
|
||||||
|
),
|
||||||
|
'Error creating scheduled activity',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> updateActivity({
|
||||||
|
required String activityId,
|
||||||
|
required UpdateScheduledActivityRequestModel request,
|
||||||
|
}) async {
|
||||||
|
await safeCall(
|
||||||
|
() => _repository.put<dynamic>(
|
||||||
|
'/scheduled-activities/$activityId',
|
||||||
|
body: request.toJson(),
|
||||||
|
),
|
||||||
|
'Error updating scheduled activity',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> deleteActivity({required String activityId}) async {
|
||||||
|
await safeCall(
|
||||||
|
() => _repository.delete<dynamic>(
|
||||||
|
'/scheduled-activities/$activityId',
|
||||||
|
),
|
||||||
|
'Error deleting scheduled activity',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import '../models/get_steps_response_model.dart';
|
||||||
|
|
||||||
|
abstract class StepsRemoteDatasource {
|
||||||
|
Future<GetStepsResponseModel> getSteps({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import 'package:dio/dio.dart';
|
||||||
|
import 'package:legacy_shared/legacy_shared.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../models/get_steps_response_model.dart';
|
||||||
|
import 'steps_remote_datasource.dart';
|
||||||
|
|
||||||
|
class StepsRemoteDatasourceImpl implements StepsRemoteDatasource {
|
||||||
|
StepsRemoteDatasourceImpl(this._repository);
|
||||||
|
|
||||||
|
final QuestiaRepository _repository;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<GetStepsResponseModel> getSteps({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
try {
|
||||||
|
final response = await _repository.get<Map<String, dynamic>>(
|
||||||
|
'/devices/identificator/$identificator/steps',
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
|
||||||
|
final data = response.data;
|
||||||
|
if (data == null || data.isEmpty) {
|
||||||
|
throw Exception(
|
||||||
|
'Empty response from /devices/identificator/$identificator/steps',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GetStepsResponseModel.fromJson(data);
|
||||||
|
} on DioException catch (error) {
|
||||||
|
throw mapDioError(error, defaultMessage: 'Error getting steps');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,14 +4,14 @@ part 'create_contact_request_model.freezed.dart';
|
|||||||
part 'create_contact_request_model.g.dart';
|
part 'create_contact_request_model.g.dart';
|
||||||
|
|
||||||
@freezed
|
@freezed
|
||||||
abstract class ContactRequestModel with _$ContactRequestModel {
|
abstract class CreateContactRequestModel with _$CreateContactRequestModel {
|
||||||
const factory ContactRequestModel({
|
const factory CreateContactRequestModel({
|
||||||
required String id,
|
required String id,
|
||||||
required String name,
|
required String name,
|
||||||
required String phone,
|
required String phone,
|
||||||
String? userId,
|
String? userId,
|
||||||
}) = _ContactRequestModel;
|
}) = _CreateContactRequestModel;
|
||||||
|
|
||||||
factory ContactRequestModel.fromJson(Map<String, dynamic> json) =>
|
factory CreateContactRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||||
_$ContactRequestModelFromJson(json);
|
_$CreateContactRequestModelFromJson(json);
|
||||||
}
|
}
|
||||||
@@ -13,22 +13,22 @@ part of 'create_contact_request_model.dart';
|
|||||||
T _$identity<T>(T value) => value;
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
mixin _$ContactRequestModel {
|
mixin _$CreateContactRequestModel {
|
||||||
|
|
||||||
String get id; String get name; String get phone; String? get userId;
|
String get id; String get name; String get phone; String? get userId;
|
||||||
/// Create a copy of ContactRequestModel
|
/// Create a copy of CreateContactRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
$ContactRequestModelCopyWith<ContactRequestModel> get copyWith => _$ContactRequestModelCopyWithImpl<ContactRequestModel>(this as ContactRequestModel, _$identity);
|
$CreateContactRequestModelCopyWith<CreateContactRequestModel> get copyWith => _$CreateContactRequestModelCopyWithImpl<CreateContactRequestModel>(this as CreateContactRequestModel, _$identity);
|
||||||
|
|
||||||
/// Serializes this ContactRequestModel to a JSON map.
|
/// Serializes this CreateContactRequestModel to a JSON map.
|
||||||
Map<String, dynamic> toJson();
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.userId, userId) || other.userId == userId));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateContactRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.userId, userId) || other.userId == userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -37,15 +37,15 @@ int get hashCode => Object.hash(runtimeType,id,name,phone,userId);
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ContactRequestModel(id: $id, name: $name, phone: $phone, userId: $userId)';
|
return 'CreateContactRequestModel(id: $id, name: $name, phone: $phone, userId: $userId)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract mixin class $ContactRequestModelCopyWith<$Res> {
|
abstract mixin class $CreateContactRequestModelCopyWith<$Res> {
|
||||||
factory $ContactRequestModelCopyWith(ContactRequestModel value, $Res Function(ContactRequestModel) _then) = _$ContactRequestModelCopyWithImpl;
|
factory $CreateContactRequestModelCopyWith(CreateContactRequestModel value, $Res Function(CreateContactRequestModel) _then) = _$CreateContactRequestModelCopyWithImpl;
|
||||||
@useResult
|
@useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String phone, String? userId
|
String id, String name, String phone, String? userId
|
||||||
@@ -56,14 +56,14 @@ $Res call({
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class _$ContactRequestModelCopyWithImpl<$Res>
|
class _$CreateContactRequestModelCopyWithImpl<$Res>
|
||||||
implements $ContactRequestModelCopyWith<$Res> {
|
implements $CreateContactRequestModelCopyWith<$Res> {
|
||||||
_$ContactRequestModelCopyWithImpl(this._self, this._then);
|
_$CreateContactRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
final ContactRequestModel _self;
|
final CreateContactRequestModel _self;
|
||||||
final $Res Function(ContactRequestModel) _then;
|
final $Res Function(CreateContactRequestModel) _then;
|
||||||
|
|
||||||
/// Create a copy of ContactRequestModel
|
/// Create a copy of CreateContactRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? userId = freezed,}) {
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? userId = freezed,}) {
|
||||||
return _then(_self.copyWith(
|
return _then(_self.copyWith(
|
||||||
@@ -78,8 +78,8 @@ as String?,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// Adds pattern-matching-related methods to [ContactRequestModel].
|
/// Adds pattern-matching-related methods to [CreateContactRequestModel].
|
||||||
extension ContactRequestModelPatterns on ContactRequestModel {
|
extension CreateContactRequestModelPatterns on CreateContactRequestModel {
|
||||||
/// A variant of `map` that fallback to returning `orElse`.
|
/// A variant of `map` that fallback to returning `orElse`.
|
||||||
///
|
///
|
||||||
/// It is equivalent to doing:
|
/// It is equivalent to doing:
|
||||||
@@ -92,10 +92,10 @@ extension ContactRequestModelPatterns on ContactRequestModel {
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _ContactRequestModel value)? $default,{required TResult orElse(),}){
|
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _CreateContactRequestModel value)? $default,{required TResult orElse(),}){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel() when $default != null:
|
case _CreateContactRequestModel() when $default != null:
|
||||||
return $default(_that);case _:
|
return $default(_that);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
@@ -114,10 +114,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _ContactRequestModel value) $default,){
|
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _CreateContactRequestModel value) $default,){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel():
|
case _CreateContactRequestModel():
|
||||||
return $default(_that);case _:
|
return $default(_that);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
@@ -135,10 +135,10 @@ return $default(_that);case _:
|
|||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
|
||||||
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _ContactRequestModel value)? $default,){
|
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _CreateContactRequestModel value)? $default,){
|
||||||
final _that = this;
|
final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel() when $default != null:
|
case _CreateContactRequestModel() when $default != null:
|
||||||
return $default(_that);case _:
|
return $default(_that);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -158,7 +158,7 @@ return $default(_that);case _:
|
|||||||
|
|
||||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String phone, String? userId)? $default,{required TResult orElse(),}) {final _that = this;
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String id, String name, String phone, String? userId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel() when $default != null:
|
case _CreateContactRequestModel() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
||||||
return orElse();
|
return orElse();
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
|||||||
|
|
||||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String phone, String? userId) $default,) {final _that = this;
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String id, String name, String phone, String? userId) $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel():
|
case _CreateContactRequestModel():
|
||||||
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
||||||
throw StateError('Unexpected subclass');
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
@@ -199,7 +199,7 @@ return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
|||||||
|
|
||||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String phone, String? userId)? $default,) {final _that = this;
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String id, String name, String phone, String? userId)? $default,) {final _that = this;
|
||||||
switch (_that) {
|
switch (_that) {
|
||||||
case _ContactRequestModel() when $default != null:
|
case _CreateContactRequestModel() when $default != null:
|
||||||
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
@@ -211,29 +211,29 @@ return $default(_that.id,_that.name,_that.phone,_that.userId);case _:
|
|||||||
/// @nodoc
|
/// @nodoc
|
||||||
@JsonSerializable()
|
@JsonSerializable()
|
||||||
|
|
||||||
class _ContactRequestModel implements ContactRequestModel {
|
class _CreateContactRequestModel implements CreateContactRequestModel {
|
||||||
const _ContactRequestModel({required this.id, required this.name, required this.phone, this.userId});
|
const _CreateContactRequestModel({required this.id, required this.name, required this.phone, this.userId});
|
||||||
factory _ContactRequestModel.fromJson(Map<String, dynamic> json) => _$ContactRequestModelFromJson(json);
|
factory _CreateContactRequestModel.fromJson(Map<String, dynamic> json) => _$CreateContactRequestModelFromJson(json);
|
||||||
|
|
||||||
@override final String id;
|
@override final String id;
|
||||||
@override final String name;
|
@override final String name;
|
||||||
@override final String phone;
|
@override final String phone;
|
||||||
@override final String? userId;
|
@override final String? userId;
|
||||||
|
|
||||||
/// Create a copy of ContactRequestModel
|
/// Create a copy of CreateContactRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@pragma('vm:prefer-inline')
|
@pragma('vm:prefer-inline')
|
||||||
_$ContactRequestModelCopyWith<_ContactRequestModel> get copyWith => __$ContactRequestModelCopyWithImpl<_ContactRequestModel>(this, _$identity);
|
_$CreateContactRequestModelCopyWith<_CreateContactRequestModel> get copyWith => __$CreateContactRequestModelCopyWithImpl<_CreateContactRequestModel>(this, _$identity);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Map<String, dynamic> toJson() {
|
Map<String, dynamic> toJson() {
|
||||||
return _$ContactRequestModelToJson(this, );
|
return _$CreateContactRequestModelToJson(this, );
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
bool operator ==(Object other) {
|
bool operator ==(Object other) {
|
||||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.userId, userId) || other.userId == userId));
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateContactRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.phone, phone) || other.phone == phone)&&(identical(other.userId, userId) || other.userId == userId));
|
||||||
}
|
}
|
||||||
|
|
||||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
@@ -242,15 +242,15 @@ int get hashCode => Object.hash(runtimeType,id,name,phone,userId);
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
String toString() {
|
String toString() {
|
||||||
return 'ContactRequestModel(id: $id, name: $name, phone: $phone, userId: $userId)';
|
return 'CreateContactRequestModel(id: $id, name: $name, phone: $phone, userId: $userId)';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
abstract mixin class _$ContactRequestModelCopyWith<$Res> implements $ContactRequestModelCopyWith<$Res> {
|
abstract mixin class _$CreateContactRequestModelCopyWith<$Res> implements $CreateContactRequestModelCopyWith<$Res> {
|
||||||
factory _$ContactRequestModelCopyWith(_ContactRequestModel value, $Res Function(_ContactRequestModel) _then) = __$ContactRequestModelCopyWithImpl;
|
factory _$CreateContactRequestModelCopyWith(_CreateContactRequestModel value, $Res Function(_CreateContactRequestModel) _then) = __$CreateContactRequestModelCopyWithImpl;
|
||||||
@override @useResult
|
@override @useResult
|
||||||
$Res call({
|
$Res call({
|
||||||
String id, String name, String phone, String? userId
|
String id, String name, String phone, String? userId
|
||||||
@@ -261,17 +261,17 @@ $Res call({
|
|||||||
|
|
||||||
}
|
}
|
||||||
/// @nodoc
|
/// @nodoc
|
||||||
class __$ContactRequestModelCopyWithImpl<$Res>
|
class __$CreateContactRequestModelCopyWithImpl<$Res>
|
||||||
implements _$ContactRequestModelCopyWith<$Res> {
|
implements _$CreateContactRequestModelCopyWith<$Res> {
|
||||||
__$ContactRequestModelCopyWithImpl(this._self, this._then);
|
__$CreateContactRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
final _ContactRequestModel _self;
|
final _CreateContactRequestModel _self;
|
||||||
final $Res Function(_ContactRequestModel) _then;
|
final $Res Function(_CreateContactRequestModel) _then;
|
||||||
|
|
||||||
/// Create a copy of ContactRequestModel
|
/// Create a copy of CreateContactRequestModel
|
||||||
/// with the given fields replaced by the non-null parameter values.
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? userId = freezed,}) {
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? name = null,Object? phone = null,Object? userId = freezed,}) {
|
||||||
return _then(_ContactRequestModel(
|
return _then(_CreateContactRequestModel(
|
||||||
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
|
||||||
|
|||||||
@@ -6,16 +6,17 @@ part of 'create_contact_request_model.dart';
|
|||||||
// JsonSerializableGenerator
|
// JsonSerializableGenerator
|
||||||
// **************************************************************************
|
// **************************************************************************
|
||||||
|
|
||||||
_ContactRequestModel _$ContactRequestModelFromJson(Map<String, dynamic> json) =>
|
_CreateContactRequestModel _$CreateContactRequestModelFromJson(
|
||||||
_ContactRequestModel(
|
Map<String, dynamic> json,
|
||||||
id: json['id'] as String,
|
) => _CreateContactRequestModel(
|
||||||
name: json['name'] as String,
|
id: json['id'] as String,
|
||||||
phone: json['phone'] as String,
|
name: json['name'] as String,
|
||||||
userId: json['userId'] as String?,
|
phone: json['phone'] as String,
|
||||||
);
|
userId: json['userId'] as String?,
|
||||||
|
);
|
||||||
|
|
||||||
Map<String, dynamic> _$ContactRequestModelToJson(
|
Map<String, dynamic> _$CreateContactRequestModelToJson(
|
||||||
_ContactRequestModel instance,
|
_CreateContactRequestModel instance,
|
||||||
) => <String, dynamic>{
|
) => <String, dynamic>{
|
||||||
'id': instance.id,
|
'id': instance.id,
|
||||||
'name': instance.name,
|
'name': instance.name,
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'create_scheduled_activity_request_model.freezed.dart';
|
||||||
|
part 'create_scheduled_activity_request_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class CreateScheduledActivityRequestModel
|
||||||
|
with _$CreateScheduledActivityRequestModel {
|
||||||
|
const factory CreateScheduledActivityRequestModel({
|
||||||
|
required String id,
|
||||||
|
required String deviceId,
|
||||||
|
required int weekDay,
|
||||||
|
required String name,
|
||||||
|
required String period,
|
||||||
|
}) = _CreateScheduledActivityRequestModel;
|
||||||
|
|
||||||
|
factory CreateScheduledActivityRequestModel.fromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$CreateScheduledActivityRequestModelFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
// 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 'create_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$CreateScheduledActivityRequestModel {
|
||||||
|
|
||||||
|
String get id; String get deviceId; int get weekDay; String get name; String get period;
|
||||||
|
/// Create a copy of CreateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$CreateScheduledActivityRequestModelCopyWith<CreateScheduledActivityRequestModel> get copyWith => _$CreateScheduledActivityRequestModelCopyWithImpl<CreateScheduledActivityRequestModel>(this as CreateScheduledActivityRequestModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this CreateScheduledActivityRequestModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateScheduledActivityRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.weekDay, weekDay) || other.weekDay == weekDay)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceId,weekDay,name,period);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CreateScheduledActivityRequestModel(id: $id, deviceId: $deviceId, weekDay: $weekDay, name: $name, period: $period)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $CreateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
factory $CreateScheduledActivityRequestModelCopyWith(CreateScheduledActivityRequestModel value, $Res Function(CreateScheduledActivityRequestModel) _then) = _$CreateScheduledActivityRequestModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceId, int weekDay, String name, String period
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$CreateScheduledActivityRequestModelCopyWithImpl<$Res>
|
||||||
|
implements $CreateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
_$CreateScheduledActivityRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final CreateScheduledActivityRequestModel _self;
|
||||||
|
final $Res Function(CreateScheduledActivityRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CreateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceId = null,Object? weekDay = null,Object? name = null,Object? period = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,weekDay: null == weekDay ? _self.weekDay : weekDay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [CreateScheduledActivityRequestModel].
|
||||||
|
extension CreateScheduledActivityRequestModelPatterns on CreateScheduledActivityRequestModel {
|
||||||
|
/// 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( _CreateScheduledActivityRequestModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel() 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( _CreateScheduledActivityRequestModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel():
|
||||||
|
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( _CreateScheduledActivityRequestModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel() 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 deviceId, int weekDay, String name, String period)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period);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 deviceId, int weekDay, String name, String period) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel():
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period);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 deviceId, int weekDay, String name, String period)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _CreateScheduledActivityRequestModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _CreateScheduledActivityRequestModel implements CreateScheduledActivityRequestModel {
|
||||||
|
const _CreateScheduledActivityRequestModel({required this.id, required this.deviceId, required this.weekDay, required this.name, required this.period});
|
||||||
|
factory _CreateScheduledActivityRequestModel.fromJson(Map<String, dynamic> json) => _$CreateScheduledActivityRequestModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceId;
|
||||||
|
@override final int weekDay;
|
||||||
|
@override final String name;
|
||||||
|
@override final String period;
|
||||||
|
|
||||||
|
/// Create a copy of CreateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$CreateScheduledActivityRequestModelCopyWith<_CreateScheduledActivityRequestModel> get copyWith => __$CreateScheduledActivityRequestModelCopyWithImpl<_CreateScheduledActivityRequestModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$CreateScheduledActivityRequestModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateScheduledActivityRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.weekDay, weekDay) || other.weekDay == weekDay)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceId,weekDay,name,period);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'CreateScheduledActivityRequestModel(id: $id, deviceId: $deviceId, weekDay: $weekDay, name: $name, period: $period)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$CreateScheduledActivityRequestModelCopyWith<$Res> implements $CreateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
factory _$CreateScheduledActivityRequestModelCopyWith(_CreateScheduledActivityRequestModel value, $Res Function(_CreateScheduledActivityRequestModel) _then) = __$CreateScheduledActivityRequestModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceId, int weekDay, String name, String period
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$CreateScheduledActivityRequestModelCopyWithImpl<$Res>
|
||||||
|
implements _$CreateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
__$CreateScheduledActivityRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _CreateScheduledActivityRequestModel _self;
|
||||||
|
final $Res Function(_CreateScheduledActivityRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of CreateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceId = null,Object? weekDay = null,Object? name = null,Object? period = null,}) {
|
||||||
|
return _then(_CreateScheduledActivityRequestModel(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,weekDay: null == weekDay ? _self.weekDay : weekDay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'create_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_CreateScheduledActivityRequestModel
|
||||||
|
_$CreateScheduledActivityRequestModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_CreateScheduledActivityRequestModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
deviceId: json['deviceId'] as String,
|
||||||
|
weekDay: (json['weekDay'] as num).toInt(),
|
||||||
|
name: json['name'] as String,
|
||||||
|
period: json['period'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$CreateScheduledActivityRequestModelToJson(
|
||||||
|
_CreateScheduledActivityRequestModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'deviceId': instance.deviceId,
|
||||||
|
'weekDay': instance.weekDay,
|
||||||
|
'name': instance.name,
|
||||||
|
'period': instance.period,
|
||||||
|
};
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../domain/entities/app_usage_time_entity.dart';
|
||||||
|
|
||||||
|
part 'get_app_usage_times_response_model.freezed.dart';
|
||||||
|
part 'get_app_usage_times_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class GetAppUsageTimesResponseModel
|
||||||
|
with _$GetAppUsageTimesResponseModel {
|
||||||
|
const factory GetAppUsageTimesResponseModel({
|
||||||
|
required int total,
|
||||||
|
required List<AppUsageTimeItemResponseModel> items,
|
||||||
|
required int page,
|
||||||
|
required int pages,
|
||||||
|
}) = _GetAppUsageTimesResponseModel;
|
||||||
|
|
||||||
|
factory GetAppUsageTimesResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$GetAppUsageTimesResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class AppUsageTimeItemResponseModel
|
||||||
|
with _$AppUsageTimeItemResponseModel {
|
||||||
|
const factory AppUsageTimeItemResponseModel({
|
||||||
|
required String id,
|
||||||
|
required String uid,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required String name,
|
||||||
|
required String startAt,
|
||||||
|
required int duration,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _AppUsageTimeItemResponseModel;
|
||||||
|
|
||||||
|
factory AppUsageTimeItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$AppUsageTimeItemResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension AppUsageTimesResponseMapper on GetAppUsageTimesResponseModel {
|
||||||
|
List<AppUsageTimeEntity> toEntity() {
|
||||||
|
return items
|
||||||
|
.map(
|
||||||
|
(item) => AppUsageTimeEntity(
|
||||||
|
id: item.id,
|
||||||
|
uid: item.uid,
|
||||||
|
deviceIdentificator: item.deviceIdentificator,
|
||||||
|
name: item.name,
|
||||||
|
startAt: item.startAt,
|
||||||
|
duration: item.duration,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,573 @@
|
|||||||
|
// 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_app_usage_times_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$GetAppUsageTimesResponseModel {
|
||||||
|
|
||||||
|
int get total; List<AppUsageTimeItemResponseModel> get items; int get page; int get pages;
|
||||||
|
/// Create a copy of GetAppUsageTimesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GetAppUsageTimesResponseModelCopyWith<GetAppUsageTimesResponseModel> get copyWith => _$GetAppUsageTimesResponseModelCopyWithImpl<GetAppUsageTimesResponseModel>(this as GetAppUsageTimesResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this GetAppUsageTimesResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetAppUsageTimesResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetAppUsageTimesResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $GetAppUsageTimesResponseModelCopyWith<$Res> {
|
||||||
|
factory $GetAppUsageTimesResponseModelCopyWith(GetAppUsageTimesResponseModel value, $Res Function(GetAppUsageTimesResponseModel) _then) = _$GetAppUsageTimesResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<AppUsageTimeItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$GetAppUsageTimesResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $GetAppUsageTimesResponseModelCopyWith<$Res> {
|
||||||
|
_$GetAppUsageTimesResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final GetAppUsageTimesResponseModel _self;
|
||||||
|
final $Res Function(GetAppUsageTimesResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetAppUsageTimesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<AppUsageTimeItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [GetAppUsageTimesResponseModel].
|
||||||
|
extension GetAppUsageTimesResponseModelPatterns on GetAppUsageTimesResponseModel {
|
||||||
|
/// 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( _GetAppUsageTimesResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel() 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( _GetAppUsageTimesResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel():
|
||||||
|
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( _GetAppUsageTimesResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<AppUsageTimeItemResponseModel> items, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<AppUsageTimeItemResponseModel> items, int page, int pages) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel():
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<AppUsageTimeItemResponseModel> items, int page, int pages)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetAppUsageTimesResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _GetAppUsageTimesResponseModel implements GetAppUsageTimesResponseModel {
|
||||||
|
const _GetAppUsageTimesResponseModel({required this.total, required final List<AppUsageTimeItemResponseModel> items, required this.page, required this.pages}): _items = items;
|
||||||
|
factory _GetAppUsageTimesResponseModel.fromJson(Map<String, dynamic> json) => _$GetAppUsageTimesResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final int total;
|
||||||
|
final List<AppUsageTimeItemResponseModel> _items;
|
||||||
|
@override List<AppUsageTimeItemResponseModel> get items {
|
||||||
|
if (_items is EqualUnmodifiableListView) return _items;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final int page;
|
||||||
|
@override final int pages;
|
||||||
|
|
||||||
|
/// Create a copy of GetAppUsageTimesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$GetAppUsageTimesResponseModelCopyWith<_GetAppUsageTimesResponseModel> get copyWith => __$GetAppUsageTimesResponseModelCopyWithImpl<_GetAppUsageTimesResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$GetAppUsageTimesResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAppUsageTimesResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetAppUsageTimesResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$GetAppUsageTimesResponseModelCopyWith<$Res> implements $GetAppUsageTimesResponseModelCopyWith<$Res> {
|
||||||
|
factory _$GetAppUsageTimesResponseModelCopyWith(_GetAppUsageTimesResponseModel value, $Res Function(_GetAppUsageTimesResponseModel) _then) = __$GetAppUsageTimesResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<AppUsageTimeItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$GetAppUsageTimesResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$GetAppUsageTimesResponseModelCopyWith<$Res> {
|
||||||
|
__$GetAppUsageTimesResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _GetAppUsageTimesResponseModel _self;
|
||||||
|
final $Res Function(_GetAppUsageTimesResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetAppUsageTimesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_GetAppUsageTimesResponseModel(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<AppUsageTimeItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AppUsageTimeItemResponseModel {
|
||||||
|
|
||||||
|
String get id; String get uid; String get deviceIdentificator; String get name; String get startAt; int get duration; int get createdAt;
|
||||||
|
/// Create a copy of AppUsageTimeItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$AppUsageTimeItemResponseModelCopyWith<AppUsageTimeItemResponseModel> get copyWith => _$AppUsageTimeItemResponseModelCopyWithImpl<AppUsageTimeItemResponseModel>(this as AppUsageTimeItemResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this AppUsageTimeItemResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsageTimeItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.startAt, startAt) || other.startAt == startAt)&&(identical(other.duration, duration) || other.duration == duration)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,uid,deviceIdentificator,name,startAt,duration,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AppUsageTimeItemResponseModel(id: $id, uid: $uid, deviceIdentificator: $deviceIdentificator, name: $name, startAt: $startAt, duration: $duration, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $AppUsageTimeItemResponseModelCopyWith<$Res> {
|
||||||
|
factory $AppUsageTimeItemResponseModelCopyWith(AppUsageTimeItemResponseModel value, $Res Function(AppUsageTimeItemResponseModel) _then) = _$AppUsageTimeItemResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$AppUsageTimeItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $AppUsageTimeItemResponseModelCopyWith<$Res> {
|
||||||
|
_$AppUsageTimeItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final AppUsageTimeItemResponseModel _self;
|
||||||
|
final $Res Function(AppUsageTimeItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? uid = null,Object? deviceIdentificator = null,Object? name = null,Object? startAt = null,Object? duration = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,uid: null == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,startAt: null == startAt ? _self.startAt : startAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,duration: null == duration ? _self.duration : duration // 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 [AppUsageTimeItemResponseModel].
|
||||||
|
extension AppUsageTimeItemResponseModelPatterns on AppUsageTimeItemResponseModel {
|
||||||
|
/// 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( _AppUsageTimeItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel() 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( _AppUsageTimeItemResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel():
|
||||||
|
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( _AppUsageTimeItemResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel() 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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel():
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _AppUsageTimeItemResponseModel implements AppUsageTimeItemResponseModel {
|
||||||
|
const _AppUsageTimeItemResponseModel({required this.id, required this.uid, required this.deviceIdentificator, required this.name, required this.startAt, required this.duration, required this.createdAt});
|
||||||
|
factory _AppUsageTimeItemResponseModel.fromJson(Map<String, dynamic> json) => _$AppUsageTimeItemResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String uid;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final String name;
|
||||||
|
@override final String startAt;
|
||||||
|
@override final int duration;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$AppUsageTimeItemResponseModelCopyWith<_AppUsageTimeItemResponseModel> get copyWith => __$AppUsageTimeItemResponseModelCopyWithImpl<_AppUsageTimeItemResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$AppUsageTimeItemResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsageTimeItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.startAt, startAt) || other.startAt == startAt)&&(identical(other.duration, duration) || other.duration == duration)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,uid,deviceIdentificator,name,startAt,duration,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AppUsageTimeItemResponseModel(id: $id, uid: $uid, deviceIdentificator: $deviceIdentificator, name: $name, startAt: $startAt, duration: $duration, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$AppUsageTimeItemResponseModelCopyWith<$Res> implements $AppUsageTimeItemResponseModelCopyWith<$Res> {
|
||||||
|
factory _$AppUsageTimeItemResponseModelCopyWith(_AppUsageTimeItemResponseModel value, $Res Function(_AppUsageTimeItemResponseModel) _then) = __$AppUsageTimeItemResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$AppUsageTimeItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$AppUsageTimeItemResponseModelCopyWith<$Res> {
|
||||||
|
__$AppUsageTimeItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _AppUsageTimeItemResponseModel _self;
|
||||||
|
final $Res Function(_AppUsageTimeItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? uid = null,Object? deviceIdentificator = null,Object? name = null,Object? startAt = null,Object? duration = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_AppUsageTimeItemResponseModel(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,uid: null == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,startAt: null == startAt ? _self.startAt : startAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,duration: null == duration ? _self.duration : duration // 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
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'get_app_usage_times_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_GetAppUsageTimesResponseModel _$GetAppUsageTimesResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _GetAppUsageTimesResponseModel(
|
||||||
|
total: (json['total'] as num).toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) =>
|
||||||
|
AppUsageTimeItemResponseModel.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
page: (json['page'] as num).toInt(),
|
||||||
|
pages: (json['pages'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GetAppUsageTimesResponseModelToJson(
|
||||||
|
_GetAppUsageTimesResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total': instance.total,
|
||||||
|
'items': instance.items,
|
||||||
|
'page': instance.page,
|
||||||
|
'pages': instance.pages,
|
||||||
|
};
|
||||||
|
|
||||||
|
_AppUsageTimeItemResponseModel _$AppUsageTimeItemResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _AppUsageTimeItemResponseModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
uid: json['uid'] as String,
|
||||||
|
deviceIdentificator: json['deviceIdentificator'] as String,
|
||||||
|
name: json['name'] as String,
|
||||||
|
startAt: json['startAt'] as String,
|
||||||
|
duration: (json['duration'] as num).toInt(),
|
||||||
|
createdAt: (json['createdAt'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$AppUsageTimeItemResponseModelToJson(
|
||||||
|
_AppUsageTimeItemResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'uid': instance.uid,
|
||||||
|
'deviceIdentificator': instance.deviceIdentificator,
|
||||||
|
'name': instance.name,
|
||||||
|
'startAt': instance.startAt,
|
||||||
|
'duration': instance.duration,
|
||||||
|
'createdAt': instance.createdAt,
|
||||||
|
};
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../../features/health/domain/entities/heartbeat_entity.dart';
|
||||||
|
|
||||||
|
part 'get_heartbeats_response_model.freezed.dart';
|
||||||
|
part 'get_heartbeats_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class GetHeartbeatsResponseModel with _$GetHeartbeatsResponseModel {
|
||||||
|
const factory GetHeartbeatsResponseModel({
|
||||||
|
required int total,
|
||||||
|
required List<HeartbeatItemResponseModel> items,
|
||||||
|
required int page,
|
||||||
|
required int pages,
|
||||||
|
}) = _GetHeartbeatsResponseModel;
|
||||||
|
|
||||||
|
factory GetHeartbeatsResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$GetHeartbeatsResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class HeartbeatItemResponseModel with _$HeartbeatItemResponseModel {
|
||||||
|
const factory HeartbeatItemResponseModel({
|
||||||
|
required String id,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required int heartbeats,
|
||||||
|
int? lowBloodPressure,
|
||||||
|
int? highBloodPressure,
|
||||||
|
required int occurredAt,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _HeartbeatItemResponseModel;
|
||||||
|
|
||||||
|
factory HeartbeatItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$HeartbeatItemResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension HeartbeatsResponseMapper on GetHeartbeatsResponseModel {
|
||||||
|
List<HeartbeatEntity> toEntity() {
|
||||||
|
return items
|
||||||
|
.map(
|
||||||
|
(item) => HeartbeatEntity(
|
||||||
|
id: item.id,
|
||||||
|
deviceIdentificator: item.deviceIdentificator,
|
||||||
|
heartbeats: item.heartbeats,
|
||||||
|
lowBloodPressure: item.lowBloodPressure,
|
||||||
|
highBloodPressure: item.highBloodPressure,
|
||||||
|
occurredAt: item.occurredAt,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,573 @@
|
|||||||
|
// 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_heartbeats_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$GetHeartbeatsResponseModel {
|
||||||
|
|
||||||
|
int get total; List<HeartbeatItemResponseModel> get items; int get page; int get pages;
|
||||||
|
/// Create a copy of GetHeartbeatsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GetHeartbeatsResponseModelCopyWith<GetHeartbeatsResponseModel> get copyWith => _$GetHeartbeatsResponseModelCopyWithImpl<GetHeartbeatsResponseModel>(this as GetHeartbeatsResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this GetHeartbeatsResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetHeartbeatsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetHeartbeatsResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $GetHeartbeatsResponseModelCopyWith<$Res> {
|
||||||
|
factory $GetHeartbeatsResponseModelCopyWith(GetHeartbeatsResponseModel value, $Res Function(GetHeartbeatsResponseModel) _then) = _$GetHeartbeatsResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<HeartbeatItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$GetHeartbeatsResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $GetHeartbeatsResponseModelCopyWith<$Res> {
|
||||||
|
_$GetHeartbeatsResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final GetHeartbeatsResponseModel _self;
|
||||||
|
final $Res Function(GetHeartbeatsResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetHeartbeatsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<HeartbeatItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [GetHeartbeatsResponseModel].
|
||||||
|
extension GetHeartbeatsResponseModelPatterns on GetHeartbeatsResponseModel {
|
||||||
|
/// 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( _GetHeartbeatsResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel() 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( _GetHeartbeatsResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel():
|
||||||
|
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( _GetHeartbeatsResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<HeartbeatItemResponseModel> items, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<HeartbeatItemResponseModel> items, int page, int pages) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel():
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<HeartbeatItemResponseModel> items, int page, int pages)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetHeartbeatsResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _GetHeartbeatsResponseModel implements GetHeartbeatsResponseModel {
|
||||||
|
const _GetHeartbeatsResponseModel({required this.total, required final List<HeartbeatItemResponseModel> items, required this.page, required this.pages}): _items = items;
|
||||||
|
factory _GetHeartbeatsResponseModel.fromJson(Map<String, dynamic> json) => _$GetHeartbeatsResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final int total;
|
||||||
|
final List<HeartbeatItemResponseModel> _items;
|
||||||
|
@override List<HeartbeatItemResponseModel> get items {
|
||||||
|
if (_items is EqualUnmodifiableListView) return _items;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final int page;
|
||||||
|
@override final int pages;
|
||||||
|
|
||||||
|
/// Create a copy of GetHeartbeatsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$GetHeartbeatsResponseModelCopyWith<_GetHeartbeatsResponseModel> get copyWith => __$GetHeartbeatsResponseModelCopyWithImpl<_GetHeartbeatsResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$GetHeartbeatsResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetHeartbeatsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetHeartbeatsResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$GetHeartbeatsResponseModelCopyWith<$Res> implements $GetHeartbeatsResponseModelCopyWith<$Res> {
|
||||||
|
factory _$GetHeartbeatsResponseModelCopyWith(_GetHeartbeatsResponseModel value, $Res Function(_GetHeartbeatsResponseModel) _then) = __$GetHeartbeatsResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<HeartbeatItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$GetHeartbeatsResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$GetHeartbeatsResponseModelCopyWith<$Res> {
|
||||||
|
__$GetHeartbeatsResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _GetHeartbeatsResponseModel _self;
|
||||||
|
final $Res Function(_GetHeartbeatsResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetHeartbeatsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_GetHeartbeatsResponseModel(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<HeartbeatItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$HeartbeatItemResponseModel {
|
||||||
|
|
||||||
|
String get id; String get deviceIdentificator; int get heartbeats; int? get lowBloodPressure; int? get highBloodPressure; int get occurredAt; int get createdAt;
|
||||||
|
/// Create a copy of HeartbeatItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$HeartbeatItemResponseModelCopyWith<HeartbeatItemResponseModel> get copyWith => _$HeartbeatItemResponseModelCopyWithImpl<HeartbeatItemResponseModel>(this as HeartbeatItemResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this HeartbeatItemResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is HeartbeatItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.lowBloodPressure, lowBloodPressure) || other.lowBloodPressure == lowBloodPressure)&&(identical(other.highBloodPressure, highBloodPressure) || other.highBloodPressure == highBloodPressure)&&(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,heartbeats,lowBloodPressure,highBloodPressure,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HeartbeatItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, heartbeats: $heartbeats, lowBloodPressure: $lowBloodPressure, highBloodPressure: $highBloodPressure, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $HeartbeatItemResponseModelCopyWith<$Res> {
|
||||||
|
factory $HeartbeatItemResponseModelCopyWith(HeartbeatItemResponseModel value, $Res Function(HeartbeatItemResponseModel) _then) = _$HeartbeatItemResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int heartbeats, int? lowBloodPressure, int? highBloodPressure, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$HeartbeatItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $HeartbeatItemResponseModelCopyWith<$Res> {
|
||||||
|
_$HeartbeatItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final HeartbeatItemResponseModel _self;
|
||||||
|
final $Res Function(HeartbeatItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HeartbeatItemResponseModel
|
||||||
|
/// 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? heartbeats = null,Object? lowBloodPressure = freezed,Object? highBloodPressure = freezed,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,heartbeats: null == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,lowBloodPressure: freezed == lowBloodPressure ? _self.lowBloodPressure : lowBloodPressure // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,highBloodPressure: freezed == highBloodPressure ? _self.highBloodPressure : highBloodPressure // 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 [HeartbeatItemResponseModel].
|
||||||
|
extension HeartbeatItemResponseModelPatterns on HeartbeatItemResponseModel {
|
||||||
|
/// 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( _HeartbeatItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel() 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( _HeartbeatItemResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel():
|
||||||
|
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( _HeartbeatItemResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel() 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 heartbeats, int? lowBloodPressure, int? highBloodPressure, int occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.heartbeats,_that.lowBloodPressure,_that.highBloodPressure,_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 heartbeats, int? lowBloodPressure, int? highBloodPressure, int occurredAt, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel():
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.heartbeats,_that.lowBloodPressure,_that.highBloodPressure,_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 heartbeats, int? lowBloodPressure, int? highBloodPressure, int occurredAt, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _HeartbeatItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.heartbeats,_that.lowBloodPressure,_that.highBloodPressure,_that.occurredAt,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _HeartbeatItemResponseModel implements HeartbeatItemResponseModel {
|
||||||
|
const _HeartbeatItemResponseModel({required this.id, required this.deviceIdentificator, required this.heartbeats, this.lowBloodPressure, this.highBloodPressure, required this.occurredAt, required this.createdAt});
|
||||||
|
factory _HeartbeatItemResponseModel.fromJson(Map<String, dynamic> json) => _$HeartbeatItemResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final int heartbeats;
|
||||||
|
@override final int? lowBloodPressure;
|
||||||
|
@override final int? highBloodPressure;
|
||||||
|
@override final int occurredAt;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of HeartbeatItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$HeartbeatItemResponseModelCopyWith<_HeartbeatItemResponseModel> get copyWith => __$HeartbeatItemResponseModelCopyWithImpl<_HeartbeatItemResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$HeartbeatItemResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _HeartbeatItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.heartbeats, heartbeats) || other.heartbeats == heartbeats)&&(identical(other.lowBloodPressure, lowBloodPressure) || other.lowBloodPressure == lowBloodPressure)&&(identical(other.highBloodPressure, highBloodPressure) || other.highBloodPressure == highBloodPressure)&&(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,heartbeats,lowBloodPressure,highBloodPressure,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'HeartbeatItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, heartbeats: $heartbeats, lowBloodPressure: $lowBloodPressure, highBloodPressure: $highBloodPressure, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$HeartbeatItemResponseModelCopyWith<$Res> implements $HeartbeatItemResponseModelCopyWith<$Res> {
|
||||||
|
factory _$HeartbeatItemResponseModelCopyWith(_HeartbeatItemResponseModel value, $Res Function(_HeartbeatItemResponseModel) _then) = __$HeartbeatItemResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int heartbeats, int? lowBloodPressure, int? highBloodPressure, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$HeartbeatItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$HeartbeatItemResponseModelCopyWith<$Res> {
|
||||||
|
__$HeartbeatItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _HeartbeatItemResponseModel _self;
|
||||||
|
final $Res Function(_HeartbeatItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of HeartbeatItemResponseModel
|
||||||
|
/// 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? heartbeats = null,Object? lowBloodPressure = freezed,Object? highBloodPressure = freezed,Object? occurredAt = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_HeartbeatItemResponseModel(
|
||||||
|
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,heartbeats: null == heartbeats ? _self.heartbeats : heartbeats // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,lowBloodPressure: freezed == lowBloodPressure ? _self.lowBloodPressure : lowBloodPressure // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,highBloodPressure: freezed == highBloodPressure ? _self.highBloodPressure : highBloodPressure // 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
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'get_heartbeats_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_GetHeartbeatsResponseModel _$GetHeartbeatsResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _GetHeartbeatsResponseModel(
|
||||||
|
total: (json['total'] as num).toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) => HeartbeatItemResponseModel.fromJson(e as Map<String, dynamic>),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
page: (json['page'] as num).toInt(),
|
||||||
|
pages: (json['pages'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GetHeartbeatsResponseModelToJson(
|
||||||
|
_GetHeartbeatsResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total': instance.total,
|
||||||
|
'items': instance.items,
|
||||||
|
'page': instance.page,
|
||||||
|
'pages': instance.pages,
|
||||||
|
};
|
||||||
|
|
||||||
|
_HeartbeatItemResponseModel _$HeartbeatItemResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _HeartbeatItemResponseModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
deviceIdentificator: json['deviceIdentificator'] as String,
|
||||||
|
heartbeats: (json['heartbeats'] as num).toInt(),
|
||||||
|
lowBloodPressure: (json['lowBloodPressure'] as num?)?.toInt(),
|
||||||
|
highBloodPressure: (json['highBloodPressure'] as num?)?.toInt(),
|
||||||
|
occurredAt: (json['occurredAt'] as num).toInt(),
|
||||||
|
createdAt: (json['createdAt'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$HeartbeatItemResponseModelToJson(
|
||||||
|
_HeartbeatItemResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'deviceIdentificator': instance.deviceIdentificator,
|
||||||
|
'heartbeats': instance.heartbeats,
|
||||||
|
'lowBloodPressure': instance.lowBloodPressure,
|
||||||
|
'highBloodPressure': instance.highBloodPressure,
|
||||||
|
'occurredAt': instance.occurredAt,
|
||||||
|
'createdAt': instance.createdAt,
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../../features/health/domain/entities/oxygen_entity.dart';
|
||||||
|
|
||||||
|
part 'get_oxygens_response_model.freezed.dart';
|
||||||
|
part 'get_oxygens_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class GetOxygensResponseModel with _$GetOxygensResponseModel {
|
||||||
|
const factory GetOxygensResponseModel({
|
||||||
|
required int total,
|
||||||
|
required List<OxygenItemResponseModel> items,
|
||||||
|
required int page,
|
||||||
|
required int pages,
|
||||||
|
}) = _GetOxygensResponseModel;
|
||||||
|
|
||||||
|
factory GetOxygensResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$GetOxygensResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class OxygenItemResponseModel with _$OxygenItemResponseModel {
|
||||||
|
const factory OxygenItemResponseModel({
|
||||||
|
required String id,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required int oxygen,
|
||||||
|
required int occurredAt,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _OxygenItemResponseModel;
|
||||||
|
|
||||||
|
factory OxygenItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$OxygenItemResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension OxygensResponseMapper on GetOxygensResponseModel {
|
||||||
|
List<OxygenEntity> toEntity() {
|
||||||
|
return items
|
||||||
|
.map(
|
||||||
|
(item) => OxygenEntity(
|
||||||
|
id: item.id,
|
||||||
|
deviceIdentificator: item.deviceIdentificator,
|
||||||
|
oxygen: item.oxygen,
|
||||||
|
occurredAt: item.occurredAt,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,567 @@
|
|||||||
|
// 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_oxygens_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$GetOxygensResponseModel {
|
||||||
|
|
||||||
|
int get total; List<OxygenItemResponseModel> get items; int get page; int get pages;
|
||||||
|
/// Create a copy of GetOxygensResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GetOxygensResponseModelCopyWith<GetOxygensResponseModel> get copyWith => _$GetOxygensResponseModelCopyWithImpl<GetOxygensResponseModel>(this as GetOxygensResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this GetOxygensResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetOxygensResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetOxygensResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $GetOxygensResponseModelCopyWith<$Res> {
|
||||||
|
factory $GetOxygensResponseModelCopyWith(GetOxygensResponseModel value, $Res Function(GetOxygensResponseModel) _then) = _$GetOxygensResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<OxygenItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$GetOxygensResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $GetOxygensResponseModelCopyWith<$Res> {
|
||||||
|
_$GetOxygensResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final GetOxygensResponseModel _self;
|
||||||
|
final $Res Function(GetOxygensResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetOxygensResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<OxygenItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [GetOxygensResponseModel].
|
||||||
|
extension GetOxygensResponseModelPatterns on GetOxygensResponseModel {
|
||||||
|
/// 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( _GetOxygensResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel() 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( _GetOxygensResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel():
|
||||||
|
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( _GetOxygensResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<OxygenItemResponseModel> items, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<OxygenItemResponseModel> items, int page, int pages) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel():
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<OxygenItemResponseModel> items, int page, int pages)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetOxygensResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _GetOxygensResponseModel implements GetOxygensResponseModel {
|
||||||
|
const _GetOxygensResponseModel({required this.total, required final List<OxygenItemResponseModel> items, required this.page, required this.pages}): _items = items;
|
||||||
|
factory _GetOxygensResponseModel.fromJson(Map<String, dynamic> json) => _$GetOxygensResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final int total;
|
||||||
|
final List<OxygenItemResponseModel> _items;
|
||||||
|
@override List<OxygenItemResponseModel> get items {
|
||||||
|
if (_items is EqualUnmodifiableListView) return _items;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final int page;
|
||||||
|
@override final int pages;
|
||||||
|
|
||||||
|
/// Create a copy of GetOxygensResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$GetOxygensResponseModelCopyWith<_GetOxygensResponseModel> get copyWith => __$GetOxygensResponseModelCopyWithImpl<_GetOxygensResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$GetOxygensResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetOxygensResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetOxygensResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$GetOxygensResponseModelCopyWith<$Res> implements $GetOxygensResponseModelCopyWith<$Res> {
|
||||||
|
factory _$GetOxygensResponseModelCopyWith(_GetOxygensResponseModel value, $Res Function(_GetOxygensResponseModel) _then) = __$GetOxygensResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<OxygenItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$GetOxygensResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$GetOxygensResponseModelCopyWith<$Res> {
|
||||||
|
__$GetOxygensResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _GetOxygensResponseModel _self;
|
||||||
|
final $Res Function(_GetOxygensResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetOxygensResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_GetOxygensResponseModel(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<OxygenItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$OxygenItemResponseModel {
|
||||||
|
|
||||||
|
String get id; String get deviceIdentificator; int get oxygen; int get occurredAt; int get createdAt;
|
||||||
|
/// Create a copy of OxygenItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$OxygenItemResponseModelCopyWith<OxygenItemResponseModel> get copyWith => _$OxygenItemResponseModelCopyWithImpl<OxygenItemResponseModel>(this as OxygenItemResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this OxygenItemResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is OxygenItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.oxygen, oxygen) || other.oxygen == oxygen)&&(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,oxygen,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'OxygenItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, oxygen: $oxygen, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $OxygenItemResponseModelCopyWith<$Res> {
|
||||||
|
factory $OxygenItemResponseModelCopyWith(OxygenItemResponseModel value, $Res Function(OxygenItemResponseModel) _then) = _$OxygenItemResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int oxygen, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$OxygenItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $OxygenItemResponseModelCopyWith<$Res> {
|
||||||
|
_$OxygenItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final OxygenItemResponseModel _self;
|
||||||
|
final $Res Function(OxygenItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of OxygenItemResponseModel
|
||||||
|
/// 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? oxygen = 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,oxygen: null == oxygen ? _self.oxygen : oxygen // 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 [OxygenItemResponseModel].
|
||||||
|
extension OxygenItemResponseModelPatterns on OxygenItemResponseModel {
|
||||||
|
/// 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( _OxygenItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel() 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( _OxygenItemResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel():
|
||||||
|
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( _OxygenItemResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel() 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 oxygen, int occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.oxygen,_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 oxygen, int occurredAt, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel():
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.oxygen,_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 oxygen, int occurredAt, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _OxygenItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.oxygen,_that.occurredAt,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _OxygenItemResponseModel implements OxygenItemResponseModel {
|
||||||
|
const _OxygenItemResponseModel({required this.id, required this.deviceIdentificator, required this.oxygen, required this.occurredAt, required this.createdAt});
|
||||||
|
factory _OxygenItemResponseModel.fromJson(Map<String, dynamic> json) => _$OxygenItemResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final int oxygen;
|
||||||
|
@override final int occurredAt;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of OxygenItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$OxygenItemResponseModelCopyWith<_OxygenItemResponseModel> get copyWith => __$OxygenItemResponseModelCopyWithImpl<_OxygenItemResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$OxygenItemResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _OxygenItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.oxygen, oxygen) || other.oxygen == oxygen)&&(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,oxygen,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'OxygenItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, oxygen: $oxygen, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$OxygenItemResponseModelCopyWith<$Res> implements $OxygenItemResponseModelCopyWith<$Res> {
|
||||||
|
factory _$OxygenItemResponseModelCopyWith(_OxygenItemResponseModel value, $Res Function(_OxygenItemResponseModel) _then) = __$OxygenItemResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int oxygen, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$OxygenItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$OxygenItemResponseModelCopyWith<$Res> {
|
||||||
|
__$OxygenItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _OxygenItemResponseModel _self;
|
||||||
|
final $Res Function(_OxygenItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of OxygenItemResponseModel
|
||||||
|
/// 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? oxygen = null,Object? occurredAt = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_OxygenItemResponseModel(
|
||||||
|
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,oxygen: null == oxygen ? _self.oxygen : oxygen // 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
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'get_oxygens_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_GetOxygensResponseModel _$GetOxygensResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _GetOxygensResponseModel(
|
||||||
|
total: (json['total'] as num).toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>)
|
||||||
|
.map((e) => OxygenItemResponseModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
page: (json['page'] as num).toInt(),
|
||||||
|
pages: (json['pages'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GetOxygensResponseModelToJson(
|
||||||
|
_GetOxygensResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total': instance.total,
|
||||||
|
'items': instance.items,
|
||||||
|
'page': instance.page,
|
||||||
|
'pages': instance.pages,
|
||||||
|
};
|
||||||
|
|
||||||
|
_OxygenItemResponseModel _$OxygenItemResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _OxygenItemResponseModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
deviceIdentificator: json['deviceIdentificator'] as String,
|
||||||
|
oxygen: (json['oxygen'] as num).toInt(),
|
||||||
|
occurredAt: (json['occurredAt'] as num).toInt(),
|
||||||
|
createdAt: (json['createdAt'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$OxygenItemResponseModelToJson(
|
||||||
|
_OxygenItemResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'deviceIdentificator': instance.deviceIdentificator,
|
||||||
|
'oxygen': instance.oxygen,
|
||||||
|
'occurredAt': instance.occurredAt,
|
||||||
|
'createdAt': instance.createdAt,
|
||||||
|
};
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
import 'package:device_management/src/features/scheduled_activities/domain/entities/scheduled_activity_entity.dart';
|
||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'get_scheduled_activities_response_model.freezed.dart';
|
||||||
|
part 'get_scheduled_activities_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class GetScheduledActivitiesResponseModel
|
||||||
|
with _$GetScheduledActivitiesResponseModel {
|
||||||
|
const factory GetScheduledActivitiesResponseModel({
|
||||||
|
required int total,
|
||||||
|
required List<ScheduledActivityItemResponseModel> items,
|
||||||
|
required int page,
|
||||||
|
required int pages,
|
||||||
|
}) = _GetScheduledActivitiesResponseModel;
|
||||||
|
|
||||||
|
factory GetScheduledActivitiesResponseModel.fromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$GetScheduledActivitiesResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class ScheduledActivityItemResponseModel
|
||||||
|
with _$ScheduledActivityItemResponseModel {
|
||||||
|
const factory ScheduledActivityItemResponseModel({
|
||||||
|
required String id,
|
||||||
|
required String deviceId,
|
||||||
|
required int weekDay,
|
||||||
|
required String name,
|
||||||
|
required String period,
|
||||||
|
required int createdAt,
|
||||||
|
int? updatedAt,
|
||||||
|
}) = _ScheduledActivityItemResponseModel;
|
||||||
|
|
||||||
|
factory ScheduledActivityItemResponseModel.fromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$ScheduledActivityItemResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension ScheduledActivitiesResponseMapper
|
||||||
|
on GetScheduledActivitiesResponseModel {
|
||||||
|
List<ScheduledActivityEntity> toEntity() {
|
||||||
|
return items
|
||||||
|
.map((item) => ScheduledActivityEntity(
|
||||||
|
id: item.id,
|
||||||
|
deviceId: item.deviceId,
|
||||||
|
weekDay: item.weekDay,
|
||||||
|
name: item.name,
|
||||||
|
period: item.period,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
updatedAt: item.updatedAt,
|
||||||
|
))
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,573 @@
|
|||||||
|
// 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_scheduled_activities_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$GetScheduledActivitiesResponseModel {
|
||||||
|
|
||||||
|
int get total; List<ScheduledActivityItemResponseModel> get items; int get page; int get pages;
|
||||||
|
/// Create a copy of GetScheduledActivitiesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GetScheduledActivitiesResponseModelCopyWith<GetScheduledActivitiesResponseModel> get copyWith => _$GetScheduledActivitiesResponseModelCopyWithImpl<GetScheduledActivitiesResponseModel>(this as GetScheduledActivitiesResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this GetScheduledActivitiesResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetScheduledActivitiesResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetScheduledActivitiesResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $GetScheduledActivitiesResponseModelCopyWith<$Res> {
|
||||||
|
factory $GetScheduledActivitiesResponseModelCopyWith(GetScheduledActivitiesResponseModel value, $Res Function(GetScheduledActivitiesResponseModel) _then) = _$GetScheduledActivitiesResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<ScheduledActivityItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$GetScheduledActivitiesResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $GetScheduledActivitiesResponseModelCopyWith<$Res> {
|
||||||
|
_$GetScheduledActivitiesResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final GetScheduledActivitiesResponseModel _self;
|
||||||
|
final $Res Function(GetScheduledActivitiesResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetScheduledActivitiesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<ScheduledActivityItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [GetScheduledActivitiesResponseModel].
|
||||||
|
extension GetScheduledActivitiesResponseModelPatterns on GetScheduledActivitiesResponseModel {
|
||||||
|
/// 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( _GetScheduledActivitiesResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel() 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( _GetScheduledActivitiesResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel():
|
||||||
|
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( _GetScheduledActivitiesResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<ScheduledActivityItemResponseModel> items, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<ScheduledActivityItemResponseModel> items, int page, int pages) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel():
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<ScheduledActivityItemResponseModel> items, int page, int pages)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetScheduledActivitiesResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _GetScheduledActivitiesResponseModel implements GetScheduledActivitiesResponseModel {
|
||||||
|
const _GetScheduledActivitiesResponseModel({required this.total, required final List<ScheduledActivityItemResponseModel> items, required this.page, required this.pages}): _items = items;
|
||||||
|
factory _GetScheduledActivitiesResponseModel.fromJson(Map<String, dynamic> json) => _$GetScheduledActivitiesResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final int total;
|
||||||
|
final List<ScheduledActivityItemResponseModel> _items;
|
||||||
|
@override List<ScheduledActivityItemResponseModel> get items {
|
||||||
|
if (_items is EqualUnmodifiableListView) return _items;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final int page;
|
||||||
|
@override final int pages;
|
||||||
|
|
||||||
|
/// Create a copy of GetScheduledActivitiesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$GetScheduledActivitiesResponseModelCopyWith<_GetScheduledActivitiesResponseModel> get copyWith => __$GetScheduledActivitiesResponseModelCopyWithImpl<_GetScheduledActivitiesResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$GetScheduledActivitiesResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetScheduledActivitiesResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetScheduledActivitiesResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$GetScheduledActivitiesResponseModelCopyWith<$Res> implements $GetScheduledActivitiesResponseModelCopyWith<$Res> {
|
||||||
|
factory _$GetScheduledActivitiesResponseModelCopyWith(_GetScheduledActivitiesResponseModel value, $Res Function(_GetScheduledActivitiesResponseModel) _then) = __$GetScheduledActivitiesResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<ScheduledActivityItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$GetScheduledActivitiesResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$GetScheduledActivitiesResponseModelCopyWith<$Res> {
|
||||||
|
__$GetScheduledActivitiesResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _GetScheduledActivitiesResponseModel _self;
|
||||||
|
final $Res Function(_GetScheduledActivitiesResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetScheduledActivitiesResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_GetScheduledActivitiesResponseModel(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<ScheduledActivityItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$ScheduledActivityItemResponseModel {
|
||||||
|
|
||||||
|
String get id; String get deviceId; int get weekDay; String get name; String get period; int get createdAt; int? get updatedAt;
|
||||||
|
/// Create a copy of ScheduledActivityItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$ScheduledActivityItemResponseModelCopyWith<ScheduledActivityItemResponseModel> get copyWith => _$ScheduledActivityItemResponseModelCopyWithImpl<ScheduledActivityItemResponseModel>(this as ScheduledActivityItemResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this ScheduledActivityItemResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is ScheduledActivityItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.weekDay, weekDay) || other.weekDay == weekDay)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceId,weekDay,name,period,createdAt,updatedAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ScheduledActivityItemResponseModel(id: $id, deviceId: $deviceId, weekDay: $weekDay, name: $name, period: $period, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $ScheduledActivityItemResponseModelCopyWith<$Res> {
|
||||||
|
factory $ScheduledActivityItemResponseModelCopyWith(ScheduledActivityItemResponseModel value, $Res Function(ScheduledActivityItemResponseModel) _then) = _$ScheduledActivityItemResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceId, int weekDay, String name, String period, int createdAt, int? updatedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$ScheduledActivityItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $ScheduledActivityItemResponseModelCopyWith<$Res> {
|
||||||
|
_$ScheduledActivityItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final ScheduledActivityItemResponseModel _self;
|
||||||
|
final $Res Function(ScheduledActivityItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ScheduledActivityItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? deviceId = null,Object? weekDay = null,Object? name = null,Object? period = null,Object? createdAt = null,Object? updatedAt = freezed,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,weekDay: null == weekDay ? _self.weekDay : weekDay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [ScheduledActivityItemResponseModel].
|
||||||
|
extension ScheduledActivityItemResponseModelPatterns on ScheduledActivityItemResponseModel {
|
||||||
|
/// 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( _ScheduledActivityItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel() 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( _ScheduledActivityItemResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel():
|
||||||
|
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( _ScheduledActivityItemResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel() 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 deviceId, int weekDay, String name, String period, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period,_that.createdAt,_that.updatedAt);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 deviceId, int weekDay, String name, String period, int createdAt, int? updatedAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel():
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period,_that.createdAt,_that.updatedAt);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 deviceId, int weekDay, String name, String period, int createdAt, int? updatedAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _ScheduledActivityItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceId,_that.weekDay,_that.name,_that.period,_that.createdAt,_that.updatedAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _ScheduledActivityItemResponseModel implements ScheduledActivityItemResponseModel {
|
||||||
|
const _ScheduledActivityItemResponseModel({required this.id, required this.deviceId, required this.weekDay, required this.name, required this.period, required this.createdAt, this.updatedAt});
|
||||||
|
factory _ScheduledActivityItemResponseModel.fromJson(Map<String, dynamic> json) => _$ScheduledActivityItemResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceId;
|
||||||
|
@override final int weekDay;
|
||||||
|
@override final String name;
|
||||||
|
@override final String period;
|
||||||
|
@override final int createdAt;
|
||||||
|
@override final int? updatedAt;
|
||||||
|
|
||||||
|
/// Create a copy of ScheduledActivityItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$ScheduledActivityItemResponseModelCopyWith<_ScheduledActivityItemResponseModel> get copyWith => __$ScheduledActivityItemResponseModelCopyWithImpl<_ScheduledActivityItemResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$ScheduledActivityItemResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ScheduledActivityItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.weekDay, weekDay) || other.weekDay == weekDay)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceId,weekDay,name,period,createdAt,updatedAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'ScheduledActivityItemResponseModel(id: $id, deviceId: $deviceId, weekDay: $weekDay, name: $name, period: $period, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$ScheduledActivityItemResponseModelCopyWith<$Res> implements $ScheduledActivityItemResponseModelCopyWith<$Res> {
|
||||||
|
factory _$ScheduledActivityItemResponseModelCopyWith(_ScheduledActivityItemResponseModel value, $Res Function(_ScheduledActivityItemResponseModel) _then) = __$ScheduledActivityItemResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceId, int weekDay, String name, String period, int createdAt, int? updatedAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$ScheduledActivityItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$ScheduledActivityItemResponseModelCopyWith<$Res> {
|
||||||
|
__$ScheduledActivityItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _ScheduledActivityItemResponseModel _self;
|
||||||
|
final $Res Function(_ScheduledActivityItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of ScheduledActivityItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? deviceId = null,Object? weekDay = null,Object? name = null,Object? period = null,Object? createdAt = null,Object? updatedAt = freezed,}) {
|
||||||
|
return _then(_ScheduledActivityItemResponseModel(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,weekDay: null == weekDay ? _self.weekDay : weekDay // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int?,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'get_scheduled_activities_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_GetScheduledActivitiesResponseModel
|
||||||
|
_$GetScheduledActivitiesResponseModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_GetScheduledActivitiesResponseModel(
|
||||||
|
total: (json['total'] as num).toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>)
|
||||||
|
.map(
|
||||||
|
(e) => ScheduledActivityItemResponseModel.fromJson(
|
||||||
|
e as Map<String, dynamic>,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList(),
|
||||||
|
page: (json['page'] as num).toInt(),
|
||||||
|
pages: (json['pages'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GetScheduledActivitiesResponseModelToJson(
|
||||||
|
_GetScheduledActivitiesResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total': instance.total,
|
||||||
|
'items': instance.items,
|
||||||
|
'page': instance.page,
|
||||||
|
'pages': instance.pages,
|
||||||
|
};
|
||||||
|
|
||||||
|
_ScheduledActivityItemResponseModel
|
||||||
|
_$ScheduledActivityItemResponseModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_ScheduledActivityItemResponseModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
deviceId: json['deviceId'] as String,
|
||||||
|
weekDay: (json['weekDay'] as num).toInt(),
|
||||||
|
name: json['name'] as String,
|
||||||
|
period: json['period'] as String,
|
||||||
|
createdAt: (json['createdAt'] as num).toInt(),
|
||||||
|
updatedAt: (json['updatedAt'] as num?)?.toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$ScheduledActivityItemResponseModelToJson(
|
||||||
|
_ScheduledActivityItemResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'deviceId': instance.deviceId,
|
||||||
|
'weekDay': instance.weekDay,
|
||||||
|
'name': instance.name,
|
||||||
|
'period': instance.period,
|
||||||
|
'createdAt': instance.createdAt,
|
||||||
|
'updatedAt': instance.updatedAt,
|
||||||
|
};
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
import '../../domain/entities/steps_entity.dart';
|
||||||
|
|
||||||
|
part 'get_steps_response_model.freezed.dart';
|
||||||
|
part 'get_steps_response_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class GetStepsResponseModel with _$GetStepsResponseModel {
|
||||||
|
const factory GetStepsResponseModel({
|
||||||
|
required int total,
|
||||||
|
required List<StepsItemResponseModel> items,
|
||||||
|
required int page,
|
||||||
|
required int pages,
|
||||||
|
}) = _GetStepsResponseModel;
|
||||||
|
|
||||||
|
factory GetStepsResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$GetStepsResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class StepsItemResponseModel with _$StepsItemResponseModel {
|
||||||
|
const factory StepsItemResponseModel({
|
||||||
|
required String id,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required int steps,
|
||||||
|
required int occurredAt,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _StepsItemResponseModel;
|
||||||
|
|
||||||
|
factory StepsItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||||
|
_$StepsItemResponseModelFromJson(json);
|
||||||
|
}
|
||||||
|
|
||||||
|
extension StepsResponseMapper on GetStepsResponseModel {
|
||||||
|
List<StepsEntity> toEntity() {
|
||||||
|
return items
|
||||||
|
.map(
|
||||||
|
(item) => StepsEntity(
|
||||||
|
id: item.id,
|
||||||
|
deviceIdentificator: item.deviceIdentificator,
|
||||||
|
steps: item.steps,
|
||||||
|
occurredAt: item.occurredAt,
|
||||||
|
createdAt: item.createdAt,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,567 @@
|
|||||||
|
// 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_steps_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$GetStepsResponseModel {
|
||||||
|
|
||||||
|
int get total; List<StepsItemResponseModel> get items; int get page; int get pages;
|
||||||
|
/// Create a copy of GetStepsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$GetStepsResponseModelCopyWith<GetStepsResponseModel> get copyWith => _$GetStepsResponseModelCopyWithImpl<GetStepsResponseModel>(this as GetStepsResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this GetStepsResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetStepsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetStepsResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $GetStepsResponseModelCopyWith<$Res> {
|
||||||
|
factory $GetStepsResponseModelCopyWith(GetStepsResponseModel value, $Res Function(GetStepsResponseModel) _then) = _$GetStepsResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<StepsItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$GetStepsResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $GetStepsResponseModelCopyWith<$Res> {
|
||||||
|
_$GetStepsResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final GetStepsResponseModel _self;
|
||||||
|
final $Res Function(GetStepsResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetStepsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StepsItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [GetStepsResponseModel].
|
||||||
|
extension GetStepsResponseModelPatterns on GetStepsResponseModel {
|
||||||
|
/// 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( _GetStepsResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel() 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( _GetStepsResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel():
|
||||||
|
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( _GetStepsResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel() when $default != null:
|
||||||
|
return $default(_that);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to an `orElse` callback.
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return orElse();
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( int total, List<StepsItemResponseModel> items, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return orElse();
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A `switch`-like method, using callbacks.
|
||||||
|
///
|
||||||
|
/// As opposed to `map`, this offers destructuring.
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case Subclass2(:final field2):
|
||||||
|
/// return ...;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( int total, List<StepsItemResponseModel> items, int page, int pages) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel():
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
throw StateError('Unexpected subclass');
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/// A variant of `when` that fallback to returning `null`
|
||||||
|
///
|
||||||
|
/// It is equivalent to doing:
|
||||||
|
/// ```dart
|
||||||
|
/// switch (sealedClass) {
|
||||||
|
/// case Subclass(:final field):
|
||||||
|
/// return ...;
|
||||||
|
/// case _:
|
||||||
|
/// return null;
|
||||||
|
/// }
|
||||||
|
/// ```
|
||||||
|
|
||||||
|
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( int total, List<StepsItemResponseModel> items, int page, int pages)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _GetStepsResponseModel() when $default != null:
|
||||||
|
return $default(_that.total,_that.items,_that.page,_that.pages);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _GetStepsResponseModel implements GetStepsResponseModel {
|
||||||
|
const _GetStepsResponseModel({required this.total, required final List<StepsItemResponseModel> items, required this.page, required this.pages}): _items = items;
|
||||||
|
factory _GetStepsResponseModel.fromJson(Map<String, dynamic> json) => _$GetStepsResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final int total;
|
||||||
|
final List<StepsItemResponseModel> _items;
|
||||||
|
@override List<StepsItemResponseModel> get items {
|
||||||
|
if (_items is EqualUnmodifiableListView) return _items;
|
||||||
|
// ignore: implicit_dynamic_type
|
||||||
|
return EqualUnmodifiableListView(_items);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override final int page;
|
||||||
|
@override final int pages;
|
||||||
|
|
||||||
|
/// Create a copy of GetStepsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$GetStepsResponseModelCopyWith<_GetStepsResponseModel> get copyWith => __$GetStepsResponseModelCopyWithImpl<_GetStepsResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$GetStepsResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetStepsResponseModel&&(identical(other.total, total) || other.total == total)&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.page, page) || other.page == page)&&(identical(other.pages, pages) || other.pages == pages));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,total,const DeepCollectionEquality().hash(_items),page,pages);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'GetStepsResponseModel(total: $total, items: $items, page: $page, pages: $pages)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$GetStepsResponseModelCopyWith<$Res> implements $GetStepsResponseModelCopyWith<$Res> {
|
||||||
|
factory _$GetStepsResponseModelCopyWith(_GetStepsResponseModel value, $Res Function(_GetStepsResponseModel) _then) = __$GetStepsResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
int total, List<StepsItemResponseModel> items, int page, int pages
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$GetStepsResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$GetStepsResponseModelCopyWith<$Res> {
|
||||||
|
__$GetStepsResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _GetStepsResponseModel _self;
|
||||||
|
final $Res Function(_GetStepsResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of GetStepsResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? total = null,Object? items = null,Object? page = null,Object? pages = null,}) {
|
||||||
|
return _then(_GetStepsResponseModel(
|
||||||
|
total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||||
|
as List<StepsItemResponseModel>,page: null == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,pages: null == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||||
|
as int,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StepsItemResponseModel {
|
||||||
|
|
||||||
|
String get id; String get deviceIdentificator; int get steps; int get occurredAt; int get createdAt;
|
||||||
|
/// Create a copy of StepsItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StepsItemResponseModelCopyWith<StepsItemResponseModel> get copyWith => _$StepsItemResponseModelCopyWithImpl<StepsItemResponseModel>(this as StepsItemResponseModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this StepsItemResponseModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StepsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(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,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StepsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $StepsItemResponseModelCopyWith<$Res> {
|
||||||
|
factory $StepsItemResponseModelCopyWith(StepsItemResponseModel value, $Res Function(StepsItemResponseModel) _then) = _$StepsItemResponseModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int steps, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$StepsItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements $StepsItemResponseModelCopyWith<$Res> {
|
||||||
|
_$StepsItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final StepsItemResponseModel _self;
|
||||||
|
final $Res Function(StepsItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StepsItemResponseModel
|
||||||
|
/// 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? 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,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 [StepsItemResponseModel].
|
||||||
|
extension StepsItemResponseModelPatterns on StepsItemResponseModel {
|
||||||
|
/// 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( _StepsItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel() 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( _StepsItemResponseModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel():
|
||||||
|
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( _StepsItemResponseModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel() 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 occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_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 occurredAt, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel():
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_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 occurredAt, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsItemResponseModel() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.occurredAt,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _StepsItemResponseModel implements StepsItemResponseModel {
|
||||||
|
const _StepsItemResponseModel({required this.id, required this.deviceIdentificator, required this.steps, required this.occurredAt, required this.createdAt});
|
||||||
|
factory _StepsItemResponseModel.fromJson(Map<String, dynamic> json) => _$StepsItemResponseModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final int steps;
|
||||||
|
@override final int occurredAt;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of StepsItemResponseModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$StepsItemResponseModelCopyWith<_StepsItemResponseModel> get copyWith => __$StepsItemResponseModelCopyWithImpl<_StepsItemResponseModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$StepsItemResponseModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StepsItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(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,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StepsItemResponseModel(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$StepsItemResponseModelCopyWith<$Res> implements $StepsItemResponseModelCopyWith<$Res> {
|
||||||
|
factory _$StepsItemResponseModelCopyWith(_StepsItemResponseModel value, $Res Function(_StepsItemResponseModel) _then) = __$StepsItemResponseModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int steps, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$StepsItemResponseModelCopyWithImpl<$Res>
|
||||||
|
implements _$StepsItemResponseModelCopyWith<$Res> {
|
||||||
|
__$StepsItemResponseModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _StepsItemResponseModel _self;
|
||||||
|
final $Res Function(_StepsItemResponseModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StepsItemResponseModel
|
||||||
|
/// 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? occurredAt = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_StepsItemResponseModel(
|
||||||
|
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,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
|
||||||
@@ -0,0 +1,47 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'get_steps_response_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_GetStepsResponseModel _$GetStepsResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _GetStepsResponseModel(
|
||||||
|
total: (json['total'] as num).toInt(),
|
||||||
|
items: (json['items'] as List<dynamic>)
|
||||||
|
.map((e) => StepsItemResponseModel.fromJson(e as Map<String, dynamic>))
|
||||||
|
.toList(),
|
||||||
|
page: (json['page'] as num).toInt(),
|
||||||
|
pages: (json['pages'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$GetStepsResponseModelToJson(
|
||||||
|
_GetStepsResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'total': instance.total,
|
||||||
|
'items': instance.items,
|
||||||
|
'page': instance.page,
|
||||||
|
'pages': instance.pages,
|
||||||
|
};
|
||||||
|
|
||||||
|
_StepsItemResponseModel _$StepsItemResponseModelFromJson(
|
||||||
|
Map<String, dynamic> json,
|
||||||
|
) => _StepsItemResponseModel(
|
||||||
|
id: json['id'] as String,
|
||||||
|
deviceIdentificator: json['deviceIdentificator'] as String,
|
||||||
|
steps: (json['steps'] as num).toInt(),
|
||||||
|
occurredAt: (json['occurredAt'] as num).toInt(),
|
||||||
|
createdAt: (json['createdAt'] as num).toInt(),
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$StepsItemResponseModelToJson(
|
||||||
|
_StepsItemResponseModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'id': instance.id,
|
||||||
|
'deviceIdentificator': instance.deviceIdentificator,
|
||||||
|
'steps': instance.steps,
|
||||||
|
'occurredAt': instance.occurredAt,
|
||||||
|
'createdAt': instance.createdAt,
|
||||||
|
};
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'update_scheduled_activity_request_model.freezed.dart';
|
||||||
|
part 'update_scheduled_activity_request_model.g.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class UpdateScheduledActivityRequestModel
|
||||||
|
with _$UpdateScheduledActivityRequestModel {
|
||||||
|
const factory UpdateScheduledActivityRequestModel({
|
||||||
|
required String deviceId,
|
||||||
|
required String name,
|
||||||
|
required String period,
|
||||||
|
}) = _UpdateScheduledActivityRequestModel;
|
||||||
|
|
||||||
|
factory UpdateScheduledActivityRequestModel.fromJson(
|
||||||
|
Map<String, dynamic> json) =>
|
||||||
|
_$UpdateScheduledActivityRequestModelFromJson(json);
|
||||||
|
}
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'update_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$UpdateScheduledActivityRequestModel {
|
||||||
|
|
||||||
|
String get deviceId; String get name; String get period;
|
||||||
|
/// Create a copy of UpdateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$UpdateScheduledActivityRequestModelCopyWith<UpdateScheduledActivityRequestModel> get copyWith => _$UpdateScheduledActivityRequestModelCopyWithImpl<UpdateScheduledActivityRequestModel>(this as UpdateScheduledActivityRequestModel, _$identity);
|
||||||
|
|
||||||
|
/// Serializes this UpdateScheduledActivityRequestModel to a JSON map.
|
||||||
|
Map<String, dynamic> toJson();
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateScheduledActivityRequestModel&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,deviceId,name,period);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'UpdateScheduledActivityRequestModel(deviceId: $deviceId, name: $name, period: $period)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $UpdateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
factory $UpdateScheduledActivityRequestModelCopyWith(UpdateScheduledActivityRequestModel value, $Res Function(UpdateScheduledActivityRequestModel) _then) = _$UpdateScheduledActivityRequestModelCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String deviceId, String name, String period
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$UpdateScheduledActivityRequestModelCopyWithImpl<$Res>
|
||||||
|
implements $UpdateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
_$UpdateScheduledActivityRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final UpdateScheduledActivityRequestModel _self;
|
||||||
|
final $Res Function(UpdateScheduledActivityRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of UpdateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? deviceId = null,Object? name = null,Object? period = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/// Adds pattern-matching-related methods to [UpdateScheduledActivityRequestModel].
|
||||||
|
extension UpdateScheduledActivityRequestModelPatterns on UpdateScheduledActivityRequestModel {
|
||||||
|
/// 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( _UpdateScheduledActivityRequestModel value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel() 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( _UpdateScheduledActivityRequestModel value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel():
|
||||||
|
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( _UpdateScheduledActivityRequestModel value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel() 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 deviceId, String name, String period)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel() when $default != null:
|
||||||
|
return $default(_that.deviceId,_that.name,_that.period);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 deviceId, String name, String period) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel():
|
||||||
|
return $default(_that.deviceId,_that.name,_that.period);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 deviceId, String name, String period)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _UpdateScheduledActivityRequestModel() when $default != null:
|
||||||
|
return $default(_that.deviceId,_that.name,_that.period);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
@JsonSerializable()
|
||||||
|
|
||||||
|
class _UpdateScheduledActivityRequestModel implements UpdateScheduledActivityRequestModel {
|
||||||
|
const _UpdateScheduledActivityRequestModel({required this.deviceId, required this.name, required this.period});
|
||||||
|
factory _UpdateScheduledActivityRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateScheduledActivityRequestModelFromJson(json);
|
||||||
|
|
||||||
|
@override final String deviceId;
|
||||||
|
@override final String name;
|
||||||
|
@override final String period;
|
||||||
|
|
||||||
|
/// Create a copy of UpdateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$UpdateScheduledActivityRequestModelCopyWith<_UpdateScheduledActivityRequestModel> get copyWith => __$UpdateScheduledActivityRequestModelCopyWithImpl<_UpdateScheduledActivityRequestModel>(this, _$identity);
|
||||||
|
|
||||||
|
@override
|
||||||
|
Map<String, dynamic> toJson() {
|
||||||
|
return _$UpdateScheduledActivityRequestModelToJson(this, );
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateScheduledActivityRequestModel&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.name, name) || other.name == name)&&(identical(other.period, period) || other.period == period));
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,deviceId,name,period);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'UpdateScheduledActivityRequestModel(deviceId: $deviceId, name: $name, period: $period)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$UpdateScheduledActivityRequestModelCopyWith<$Res> implements $UpdateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
factory _$UpdateScheduledActivityRequestModelCopyWith(_UpdateScheduledActivityRequestModel value, $Res Function(_UpdateScheduledActivityRequestModel) _then) = __$UpdateScheduledActivityRequestModelCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String deviceId, String name, String period
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$UpdateScheduledActivityRequestModelCopyWithImpl<$Res>
|
||||||
|
implements _$UpdateScheduledActivityRequestModelCopyWith<$Res> {
|
||||||
|
__$UpdateScheduledActivityRequestModelCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _UpdateScheduledActivityRequestModel _self;
|
||||||
|
final $Res Function(_UpdateScheduledActivityRequestModel) _then;
|
||||||
|
|
||||||
|
/// Create a copy of UpdateScheduledActivityRequestModel
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? deviceId = null,Object? name = null,Object? period = null,}) {
|
||||||
|
return _then(_UpdateScheduledActivityRequestModel(
|
||||||
|
deviceId: null == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,period: null == period ? _self.period : period // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// dart format on
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
|
||||||
|
part of 'update_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// JsonSerializableGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
_UpdateScheduledActivityRequestModel
|
||||||
|
_$UpdateScheduledActivityRequestModelFromJson(Map<String, dynamic> json) =>
|
||||||
|
_UpdateScheduledActivityRequestModel(
|
||||||
|
deviceId: json['deviceId'] as String,
|
||||||
|
name: json['name'] as String,
|
||||||
|
period: json['period'] as String,
|
||||||
|
);
|
||||||
|
|
||||||
|
Map<String, dynamic> _$UpdateScheduledActivityRequestModelToJson(
|
||||||
|
_UpdateScheduledActivityRequestModel instance,
|
||||||
|
) => <String, dynamic>{
|
||||||
|
'deviceId': instance.deviceId,
|
||||||
|
'name': instance.name,
|
||||||
|
'period': instance.period,
|
||||||
|
};
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import '../../domain/entities/app_usage_time_entity.dart';
|
||||||
|
import '../../domain/repositories/app_usage_times_repository.dart';
|
||||||
|
import '../datasources/app_usage_times_remote_datasource.dart';
|
||||||
|
import '../models/get_app_usage_times_response_model.dart';
|
||||||
|
|
||||||
|
class AppUsageTimesRepositoryImpl implements AppUsageTimesRepository {
|
||||||
|
const AppUsageTimesRepositoryImpl(this._remote);
|
||||||
|
|
||||||
|
final AppUsageTimesRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<AppUsageTimeEntity>> getAppUsageTimes({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
final model = await _remote.getAppUsageTimes(
|
||||||
|
identificator: identificator,
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
return model.toEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
import 'package:device_management/src/core/data/models/get_contacts_response_model.dart';
|
import '../../../features/contacts/domain/entities/contact_entity.dart';
|
||||||
import 'package:device_management/src/features/contacts/domain/entities/contact_entity.dart';
|
|
||||||
|
|
||||||
import '../../domain/repositories/contacts_repository.dart';
|
import '../../domain/repositories/contacts_repository.dart';
|
||||||
import '../datasources/contacts_remote_datasource.dart';
|
import '../datasources/contacts_remote_datasource.dart';
|
||||||
import '../models/create_contact_request_model.dart';
|
import '../models/create_contact_request_model.dart';
|
||||||
|
import '../models/get_contacts_response_model.dart';
|
||||||
import '../models/update_contact_request_model.dart';
|
import '../models/update_contact_request_model.dart';
|
||||||
|
|
||||||
class ContactsRepositoryImpl implements ContactsRepository {
|
class ContactsRepositoryImpl implements ContactsRepository {
|
||||||
@@ -18,12 +17,12 @@ class ContactsRepositoryImpl implements ContactsRepository {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> updateContact({required String userId, required UpdateContactRequestModel request}) {
|
Future<void> updateContact({required UpdateContactRequestModel request}) {
|
||||||
return _remote.updateContact(userId: userId, request: request);
|
return _remote.updateContact(request: request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<void> createContact({required ContactRequestModel request}) {
|
Future<void> createContact({required CreateContactRequestModel request}) {
|
||||||
return _remote.createContact(request: request);
|
return _remote.createContact(request: request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,4 +30,19 @@ class ContactsRepositoryImpl implements ContactsRepository {
|
|||||||
Future<void> deleteContact({required String contactId}) {
|
Future<void> deleteContact({required String contactId}) {
|
||||||
return _remote.deleteContact(contactId: contactId);
|
return _remote.deleteContact(contactId: contactId);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
@override
|
||||||
|
Future<void> syncContactsToDevice({
|
||||||
|
required String userId,
|
||||||
|
required String deviceId,
|
||||||
|
required List<ContactEntity> contacts,
|
||||||
|
}) {
|
||||||
|
return _remote.syncContactsToDevice(
|
||||||
|
userId: userId,
|
||||||
|
deviceId: deviceId,
|
||||||
|
contacts: contacts
|
||||||
|
.map((c) => {'name': c.name, 'phone': c.phone})
|
||||||
|
.toList(),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
import '../../../features/health/domain/entities/heartbeat_entity.dart';
|
||||||
|
import '../../../features/health/domain/entities/oxygen_entity.dart';
|
||||||
|
import '../../domain/repositories/health_repository.dart';
|
||||||
|
import '../datasources/health_remote_datasource.dart';
|
||||||
|
import '../models/get_heartbeats_response_model.dart';
|
||||||
|
import '../models/get_oxygens_response_model.dart';
|
||||||
|
|
||||||
|
class HealthRepositoryImpl implements HealthRepository {
|
||||||
|
const HealthRepositoryImpl(this._remote);
|
||||||
|
|
||||||
|
final HealthRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<HeartbeatEntity>> getHeartbeats({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
final model = await _remote.getHeartbeats(
|
||||||
|
identificator: identificator,
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
return model.toEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<OxygenEntity>> getOxygens({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
final model = await _remote.getOxygens(
|
||||||
|
identificator: identificator,
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
return model.toEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
import '../../../features/scheduled_activities/domain/entities/scheduled_activity_entity.dart';
|
||||||
|
import '../../domain/repositories/scheduled_activities_repository.dart';
|
||||||
|
import '../datasources/scheduled_activities_remote_datasource.dart';
|
||||||
|
import '../models/create_scheduled_activity_request_model.dart';
|
||||||
|
import '../models/get_scheduled_activities_response_model.dart';
|
||||||
|
import '../models/update_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
class ScheduledActivitiesRepositoryImpl
|
||||||
|
implements ScheduledActivitiesRepository {
|
||||||
|
const ScheduledActivitiesRepositoryImpl(this._remote);
|
||||||
|
|
||||||
|
final ScheduledActivitiesRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<ScheduledActivityEntity>> getActivities({
|
||||||
|
required String deviceId,
|
||||||
|
}) async {
|
||||||
|
final model = await _remote.getActivities(deviceId: deviceId);
|
||||||
|
return model.toEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> createActivity({
|
||||||
|
required CreateScheduledActivityRequestModel request,
|
||||||
|
}) {
|
||||||
|
return _remote.createActivity(request: request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> updateActivity({
|
||||||
|
required String activityId,
|
||||||
|
required UpdateScheduledActivityRequestModel request,
|
||||||
|
}) {
|
||||||
|
return _remote.updateActivity(activityId: activityId, request: request);
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<void> deleteActivity({required String activityId}) {
|
||||||
|
return _remote.deleteActivity(activityId: activityId);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import '../../domain/entities/steps_entity.dart';
|
||||||
|
import '../../domain/repositories/steps_repository.dart';
|
||||||
|
import '../datasources/steps_remote_datasource.dart';
|
||||||
|
import '../models/get_steps_response_model.dart';
|
||||||
|
|
||||||
|
class StepsRepositoryImpl implements StepsRepository {
|
||||||
|
const StepsRepositoryImpl(this._remote);
|
||||||
|
|
||||||
|
final StepsRemoteDatasource _remote;
|
||||||
|
|
||||||
|
@override
|
||||||
|
Future<List<StepsEntity>> getSteps({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
}) async {
|
||||||
|
final model = await _remote.getSteps(
|
||||||
|
identificator: identificator,
|
||||||
|
queryParameters: queryParameters,
|
||||||
|
);
|
||||||
|
return model.toEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'app_usage_time_entity.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class AppUsageTimeEntity with _$AppUsageTimeEntity {
|
||||||
|
const factory AppUsageTimeEntity({
|
||||||
|
required String id,
|
||||||
|
required String uid,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required String name,
|
||||||
|
required String startAt,
|
||||||
|
required int duration,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _AppUsageTimeEntity;
|
||||||
|
}
|
||||||
@@ -0,0 +1,289 @@
|
|||||||
|
// 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 'app_usage_time_entity.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$AppUsageTimeEntity {
|
||||||
|
|
||||||
|
String get id; String get uid; String get deviceIdentificator; String get name; String get startAt; int get duration; int get createdAt;
|
||||||
|
/// Create a copy of AppUsageTimeEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$AppUsageTimeEntityCopyWith<AppUsageTimeEntity> get copyWith => _$AppUsageTimeEntityCopyWithImpl<AppUsageTimeEntity>(this as AppUsageTimeEntity, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsageTimeEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.startAt, startAt) || other.startAt == startAt)&&(identical(other.duration, duration) || other.duration == duration)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,uid,deviceIdentificator,name,startAt,duration,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AppUsageTimeEntity(id: $id, uid: $uid, deviceIdentificator: $deviceIdentificator, name: $name, startAt: $startAt, duration: $duration, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $AppUsageTimeEntityCopyWith<$Res> {
|
||||||
|
factory $AppUsageTimeEntityCopyWith(AppUsageTimeEntity value, $Res Function(AppUsageTimeEntity) _then) = _$AppUsageTimeEntityCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$AppUsageTimeEntityCopyWithImpl<$Res>
|
||||||
|
implements $AppUsageTimeEntityCopyWith<$Res> {
|
||||||
|
_$AppUsageTimeEntityCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final AppUsageTimeEntity _self;
|
||||||
|
final $Res Function(AppUsageTimeEntity) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? uid = null,Object? deviceIdentificator = null,Object? name = null,Object? startAt = null,Object? duration = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_self.copyWith(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,uid: null == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,startAt: null == startAt ? _self.startAt : startAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,duration: null == duration ? _self.duration : duration // 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 [AppUsageTimeEntity].
|
||||||
|
extension AppUsageTimeEntityPatterns on AppUsageTimeEntity {
|
||||||
|
/// 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( _AppUsageTimeEntity value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity() 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( _AppUsageTimeEntity value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity():
|
||||||
|
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( _AppUsageTimeEntity value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity() 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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity() when $default != null:
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity():
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_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 uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _AppUsageTimeEntity() when $default != null:
|
||||||
|
return $default(_that.id,_that.uid,_that.deviceIdentificator,_that.name,_that.startAt,_that.duration,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _AppUsageTimeEntity implements AppUsageTimeEntity {
|
||||||
|
const _AppUsageTimeEntity({required this.id, required this.uid, required this.deviceIdentificator, required this.name, required this.startAt, required this.duration, required this.createdAt});
|
||||||
|
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String uid;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final String name;
|
||||||
|
@override final String startAt;
|
||||||
|
@override final int duration;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$AppUsageTimeEntityCopyWith<_AppUsageTimeEntity> get copyWith => __$AppUsageTimeEntityCopyWithImpl<_AppUsageTimeEntity>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsageTimeEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.uid, uid) || other.uid == uid)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.startAt, startAt) || other.startAt == startAt)&&(identical(other.duration, duration) || other.duration == duration)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,uid,deviceIdentificator,name,startAt,duration,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'AppUsageTimeEntity(id: $id, uid: $uid, deviceIdentificator: $deviceIdentificator, name: $name, startAt: $startAt, duration: $duration, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$AppUsageTimeEntityCopyWith<$Res> implements $AppUsageTimeEntityCopyWith<$Res> {
|
||||||
|
factory _$AppUsageTimeEntityCopyWith(_AppUsageTimeEntity value, $Res Function(_AppUsageTimeEntity) _then) = __$AppUsageTimeEntityCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String uid, String deviceIdentificator, String name, String startAt, int duration, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$AppUsageTimeEntityCopyWithImpl<$Res>
|
||||||
|
implements _$AppUsageTimeEntityCopyWith<$Res> {
|
||||||
|
__$AppUsageTimeEntityCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _AppUsageTimeEntity _self;
|
||||||
|
final $Res Function(_AppUsageTimeEntity) _then;
|
||||||
|
|
||||||
|
/// Create a copy of AppUsageTimeEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? uid = null,Object? deviceIdentificator = null,Object? name = null,Object? startAt = null,Object? duration = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_AppUsageTimeEntity(
|
||||||
|
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,uid: null == uid ? _self.uid : uid // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,deviceIdentificator: null == deviceIdentificator ? _self.deviceIdentificator : deviceIdentificator // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,startAt: null == startAt ? _self.startAt : startAt // ignore: cast_nullable_to_non_nullable
|
||||||
|
as String,duration: null == duration ? _self.duration : duration // 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
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||||
|
|
||||||
|
part 'steps_entity.freezed.dart';
|
||||||
|
|
||||||
|
@freezed
|
||||||
|
abstract class StepsEntity with _$StepsEntity {
|
||||||
|
const factory StepsEntity({
|
||||||
|
required String id,
|
||||||
|
required String deviceIdentificator,
|
||||||
|
required int steps,
|
||||||
|
required int occurredAt,
|
||||||
|
required int createdAt,
|
||||||
|
}) = _StepsEntity;
|
||||||
|
}
|
||||||
@@ -0,0 +1,283 @@
|
|||||||
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||||
|
// coverage:ignore-file
|
||||||
|
// ignore_for_file: type=lint
|
||||||
|
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||||
|
|
||||||
|
part of 'steps_entity.dart';
|
||||||
|
|
||||||
|
// **************************************************************************
|
||||||
|
// FreezedGenerator
|
||||||
|
// **************************************************************************
|
||||||
|
|
||||||
|
// dart format off
|
||||||
|
T _$identity<T>(T value) => value;
|
||||||
|
/// @nodoc
|
||||||
|
mixin _$StepsEntity {
|
||||||
|
|
||||||
|
String get id; String get deviceIdentificator; int get steps; int get occurredAt; int get createdAt;
|
||||||
|
/// Create a copy of StepsEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
$StepsEntityCopyWith<StepsEntity> get copyWith => _$StepsEntityCopyWithImpl<StepsEntity>(this as StepsEntity, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is StepsEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StepsEntity(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class $StepsEntityCopyWith<$Res> {
|
||||||
|
factory $StepsEntityCopyWith(StepsEntity value, $Res Function(StepsEntity) _then) = _$StepsEntityCopyWithImpl;
|
||||||
|
@useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int steps, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class _$StepsEntityCopyWithImpl<$Res>
|
||||||
|
implements $StepsEntityCopyWith<$Res> {
|
||||||
|
_$StepsEntityCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final StepsEntity _self;
|
||||||
|
final $Res Function(StepsEntity) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StepsEntity
|
||||||
|
/// 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? 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,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 [StepsEntity].
|
||||||
|
extension StepsEntityPatterns on StepsEntity {
|
||||||
|
/// 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( _StepsEntity value)? $default,{required TResult orElse(),}){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity() 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( _StepsEntity value) $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity():
|
||||||
|
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( _StepsEntity value)? $default,){
|
||||||
|
final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity() 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 occurredAt, int createdAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_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 occurredAt, int createdAt) $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity():
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_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 occurredAt, int createdAt)? $default,) {final _that = this;
|
||||||
|
switch (_that) {
|
||||||
|
case _StepsEntity() when $default != null:
|
||||||
|
return $default(_that.id,_that.deviceIdentificator,_that.steps,_that.occurredAt,_that.createdAt);case _:
|
||||||
|
return null;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
|
||||||
|
|
||||||
|
class _StepsEntity implements StepsEntity {
|
||||||
|
const _StepsEntity({required this.id, required this.deviceIdentificator, required this.steps, required this.occurredAt, required this.createdAt});
|
||||||
|
|
||||||
|
|
||||||
|
@override final String id;
|
||||||
|
@override final String deviceIdentificator;
|
||||||
|
@override final int steps;
|
||||||
|
@override final int occurredAt;
|
||||||
|
@override final int createdAt;
|
||||||
|
|
||||||
|
/// Create a copy of StepsEntity
|
||||||
|
/// with the given fields replaced by the non-null parameter values.
|
||||||
|
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||||
|
@pragma('vm:prefer-inline')
|
||||||
|
_$StepsEntityCopyWith<_StepsEntity> get copyWith => __$StepsEntityCopyWithImpl<_StepsEntity>(this, _$identity);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(Object other) {
|
||||||
|
return identical(this, other) || (other.runtimeType == runtimeType&&other is _StepsEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.deviceIdentificator, deviceIdentificator) || other.deviceIdentificator == deviceIdentificator)&&(identical(other.steps, steps) || other.steps == steps)&&(identical(other.occurredAt, occurredAt) || other.occurredAt == occurredAt)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
int get hashCode => Object.hash(runtimeType,id,deviceIdentificator,steps,occurredAt,createdAt);
|
||||||
|
|
||||||
|
@override
|
||||||
|
String toString() {
|
||||||
|
return 'StepsEntity(id: $id, deviceIdentificator: $deviceIdentificator, steps: $steps, occurredAt: $occurredAt, createdAt: $createdAt)';
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/// @nodoc
|
||||||
|
abstract mixin class _$StepsEntityCopyWith<$Res> implements $StepsEntityCopyWith<$Res> {
|
||||||
|
factory _$StepsEntityCopyWith(_StepsEntity value, $Res Function(_StepsEntity) _then) = __$StepsEntityCopyWithImpl;
|
||||||
|
@override @useResult
|
||||||
|
$Res call({
|
||||||
|
String id, String deviceIdentificator, int steps, int occurredAt, int createdAt
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
/// @nodoc
|
||||||
|
class __$StepsEntityCopyWithImpl<$Res>
|
||||||
|
implements _$StepsEntityCopyWith<$Res> {
|
||||||
|
__$StepsEntityCopyWithImpl(this._self, this._then);
|
||||||
|
|
||||||
|
final _StepsEntity _self;
|
||||||
|
final $Res Function(_StepsEntity) _then;
|
||||||
|
|
||||||
|
/// Create a copy of StepsEntity
|
||||||
|
/// 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? occurredAt = null,Object? createdAt = null,}) {
|
||||||
|
return _then(_StepsEntity(
|
||||||
|
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,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
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import '../entities/app_usage_time_entity.dart';
|
||||||
|
|
||||||
|
abstract class AppUsageTimesRepository {
|
||||||
|
Future<List<AppUsageTimeEntity>> getAppUsageTimes({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
import 'package:device_management/src/core/data/models/create_contact_request_model.dart';
|
import '../../data/models/create_contact_request_model.dart';
|
||||||
|
|
||||||
import '../../../features/contacts/domain/entities/contact_entity.dart';
|
|
||||||
import '../../data/models/update_contact_request_model.dart';
|
import '../../data/models/update_contact_request_model.dart';
|
||||||
|
import '../../../features/contacts/domain/entities/contact_entity.dart';
|
||||||
|
|
||||||
abstract class ContactsRepository {
|
abstract class ContactsRepository {
|
||||||
Future<List<ContactEntity>> getContacts({required String userId});
|
Future<List<ContactEntity>> getContacts({required String userId});
|
||||||
|
|
||||||
Future<void> updateContact({required String userId, required UpdateContactRequestModel request});
|
Future<void> updateContact({required UpdateContactRequestModel request});
|
||||||
|
|
||||||
Future<void> createContact({required ContactRequestModel request});
|
Future<void> createContact({required CreateContactRequestModel request});
|
||||||
|
|
||||||
Future<void> deleteContact({required String contactId});
|
Future<void> deleteContact({required String contactId});
|
||||||
|
|
||||||
|
Future<void> syncContactsToDevice({
|
||||||
|
required String userId,
|
||||||
|
required String deviceId,
|
||||||
|
required List<ContactEntity> contacts,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
import '../../../features/health/domain/entities/heartbeat_entity.dart';
|
||||||
|
import '../../../features/health/domain/entities/oxygen_entity.dart';
|
||||||
|
|
||||||
|
abstract class HealthRepository {
|
||||||
|
Future<List<HeartbeatEntity>> getHeartbeats({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<List<OxygenEntity>> getOxygens({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
import '../../../features/scheduled_activities/domain/entities/scheduled_activity_entity.dart';
|
||||||
|
import '../../data/models/create_scheduled_activity_request_model.dart';
|
||||||
|
import '../../data/models/update_scheduled_activity_request_model.dart';
|
||||||
|
|
||||||
|
abstract class ScheduledActivitiesRepository {
|
||||||
|
Future<List<ScheduledActivityEntity>> getActivities({
|
||||||
|
required String deviceId,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> createActivity({
|
||||||
|
required CreateScheduledActivityRequestModel request,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> updateActivity({
|
||||||
|
required String activityId,
|
||||||
|
required UpdateScheduledActivityRequestModel request,
|
||||||
|
});
|
||||||
|
|
||||||
|
Future<void> deleteActivity({required String activityId});
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import '../entities/steps_entity.dart';
|
||||||
|
|
||||||
|
abstract class StepsRepository {
|
||||||
|
Future<List<StepsEntity>> getSteps({
|
||||||
|
required String identificator,
|
||||||
|
Map<String, dynamic> queryParameters = const {},
|
||||||
|
});
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
|
||||||
|
String formatTime(int timestampMs) {
|
||||||
|
final date = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
||||||
|
final hour = date.hour.toString().padLeft(2, '0');
|
||||||
|
final minute = date.minute.toString().padLeft(2, '0');
|
||||||
|
return '$hour:$minute';
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatDate(int timestampMs) {
|
||||||
|
final date = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
||||||
|
final day = date.day.toString().padLeft(2, '0');
|
||||||
|
final month = date.month.toString().padLeft(2, '0');
|
||||||
|
return '$day/$month/${date.year}';
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatDayHeader(BuildContext context, DateTime date) {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final today = DateTime(now.year, now.month, now.day);
|
||||||
|
final day = DateTime(date.year, date.month, date.day);
|
||||||
|
|
||||||
|
if (day == today) return context.translate(I18n.today);
|
||||||
|
if (day == today.subtract(const Duration(days: 1))) {
|
||||||
|
return context.translate(I18n.yesterday);
|
||||||
|
}
|
||||||
|
|
||||||
|
final d = date.day.toString().padLeft(2, '0');
|
||||||
|
final m = date.month.toString().padLeft(2, '0');
|
||||||
|
return '$d/$m/${date.year}';
|
||||||
|
}
|
||||||
|
|
||||||
|
String formatTimeAgo(BuildContext context, int timestampMs) {
|
||||||
|
final now = DateTime.now();
|
||||||
|
final date = DateTime.fromMillisecondsSinceEpoch(timestampMs);
|
||||||
|
final diff = now.difference(date);
|
||||||
|
|
||||||
|
final String time;
|
||||||
|
if (diff.inMinutes < 1) {
|
||||||
|
time = '<1 min';
|
||||||
|
} else if (diff.inMinutes < 60) {
|
||||||
|
time = '${diff.inMinutes} min';
|
||||||
|
} else if (diff.inHours < 24) {
|
||||||
|
time = '${diff.inHours}h';
|
||||||
|
} else {
|
||||||
|
time = '${diff.inDays}d';
|
||||||
|
}
|
||||||
|
|
||||||
|
return context.translate(I18n.timeAgo, args: {'time': time});
|
||||||
|
}
|
||||||
|
|
||||||
|
List<(DateTime, List<T>)> groupByDay<T>(
|
||||||
|
List<T> items,
|
||||||
|
int Function(T) getTimestamp,
|
||||||
|
) {
|
||||||
|
final Map<DateTime, List<T>> groups = {};
|
||||||
|
|
||||||
|
for (final item in items) {
|
||||||
|
final date = DateTime.fromMillisecondsSinceEpoch(getTimestamp(item));
|
||||||
|
final dayKey = DateTime(date.year, date.month, date.day);
|
||||||
|
groups.putIfAbsent(dayKey, () => []).add(item);
|
||||||
|
}
|
||||||
|
|
||||||
|
final sorted = groups.entries.toList()
|
||||||
|
..sort((a, b) => b.key.compareTo(a.key));
|
||||||
|
|
||||||
|
return sorted.map((e) => (e.key, e.value)).toList();
|
||||||
|
}
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
enum TimeRange { today, sevenDays, thirtyDays, custom }
|
||||||
@@ -0,0 +1,106 @@
|
|||||||
|
import 'package:design_system/design_system.dart';
|
||||||
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:sf_localizations/sf_localizations.dart';
|
||||||
|
import 'package:utils/utils.dart';
|
||||||
|
|
||||||
|
import '../time_range.dart';
|
||||||
|
|
||||||
|
class TimeRangeSelector extends StatelessWidget {
|
||||||
|
final TimeRange selected;
|
||||||
|
final ValueChanged<TimeRange> onSelected;
|
||||||
|
final VoidCallback onCustomTap;
|
||||||
|
final ThemePort theme;
|
||||||
|
|
||||||
|
const TimeRangeSelector({
|
||||||
|
super.key,
|
||||||
|
required this.selected,
|
||||||
|
required this.onSelected,
|
||||||
|
required this.onCustomTap,
|
||||||
|
required this.theme,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
final chips = [
|
||||||
|
(TimeRange.today, context.translate(I18n.today)),
|
||||||
|
(TimeRange.sevenDays, context.translate(I18n.sevenDays)),
|
||||||
|
(TimeRange.thirtyDays, context.translate(I18n.thirtyDays)),
|
||||||
|
(TimeRange.custom, context.translate(I18n.custom)),
|
||||||
|
];
|
||||||
|
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: SizeUtils.getByScreen(small: 16, big: 14),
|
||||||
|
vertical: SizeUtils.getByScreen(small: 8, big: 6),
|
||||||
|
),
|
||||||
|
child: Row(
|
||||||
|
children: chips
|
||||||
|
.map((chip) {
|
||||||
|
final (range, label) = chip;
|
||||||
|
final isCustom = range == TimeRange.custom;
|
||||||
|
return Padding(
|
||||||
|
padding: EdgeInsets.only(
|
||||||
|
right: range != chips.last.$1
|
||||||
|
? SizeUtils.getByScreen(small: 8, big: 6)
|
||||||
|
: 0,
|
||||||
|
),
|
||||||
|
child: _Chip(
|
||||||
|
label: label,
|
||||||
|
isSelected: selected == range,
|
||||||
|
onTap: isCustom ? onCustomTap : () => onSelected(range),
|
||||||
|
theme: theme,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.toList(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class _Chip extends StatelessWidget {
|
||||||
|
final String label;
|
||||||
|
final bool isSelected;
|
||||||
|
final VoidCallback onTap;
|
||||||
|
final ThemePort theme;
|
||||||
|
|
||||||
|
const _Chip({
|
||||||
|
required this.label,
|
||||||
|
required this.isSelected,
|
||||||
|
required this.onTap,
|
||||||
|
required this.theme,
|
||||||
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return GestureDetector(
|
||||||
|
onTap: onTap,
|
||||||
|
child: Container(
|
||||||
|
padding: EdgeInsets.symmetric(
|
||||||
|
horizontal: SizeUtils.getByScreen(small: 14, big: 12),
|
||||||
|
vertical: SizeUtils.getByScreen(small: 8, big: 6),
|
||||||
|
),
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: isSelected
|
||||||
|
? theme.getColorFor(ThemeCode.legacyPrimary)
|
||||||
|
: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||||
|
borderRadius: BorderRadius.all(
|
||||||
|
Radius.circular(SizeUtils.getByScreen(small: 20, big: 18)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
child: Text(
|
||||||
|
label,
|
||||||
|
style: TextStyle(
|
||||||
|
fontSize: SizeUtils.getByScreen(small: 13, big: 12),
|
||||||
|
fontWeight: FontWeight.w600,
|
||||||
|
color: isSelected
|
||||||
|
? Colors.white
|
||||||
|
: theme
|
||||||
|
.getColorFor(ThemeCode.textPrimary)
|
||||||
|
.withValues(alpha: 0.6),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||||
|
|
||||||
|
import '../data/datasources/app_usage_times_remote_datasource.dart';
|
||||||
|
import '../data/datasources/app_usage_times_remote_datasource_impl.dart';
|
||||||
|
|
||||||
|
final appUsageTimesRemoteDatasourceProvider =
|
||||||
|
Provider<AppUsageTimesRemoteDatasource>((ref) {
|
||||||
|
final questiaRepository = getIt<QuestiaRepository>();
|
||||||
|
return AppUsageTimesRemoteDatasourceImpl(questiaRepository);
|
||||||
|
});
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||||
|
|
||||||
|
import '../data/repositories/app_usage_times_repository_impl.dart';
|
||||||
|
import '../domain/repositories/app_usage_times_repository.dart';
|
||||||
|
import 'app_usage_times_remote_datasource_provider.dart';
|
||||||
|
|
||||||
|
final appUsageTimesRepositoryProvider =
|
||||||
|
Provider<AppUsageTimesRepository>((ref) {
|
||||||
|
final remote = ref.read(appUsageTimesRemoteDatasourceProvider);
|
||||||
|
return AppUsageTimesRepositoryImpl(remote);
|
||||||
|
});
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user