Compare commits
24 Commits
feature/re
...
feature/he
| Author | SHA1 | Date | |
|---|---|---|---|
| 94c042d403 | |||
| 435a9c04f9 | |||
| 8e3a27e0d3 | |||
| cf0c55eafe | |||
| 03c6633504 | |||
| b8184f02ec | |||
| c12d1924c4 | |||
| 869f33f1f1 | |||
| a07246130e | |||
| 67aafafd1e | |||
| c929e1e2d7 | |||
| 990266ba95 | |||
| fa36037aac | |||
| c9e2adf692 | |||
| 995b69eb65 | |||
| 88269c40f8 | |||
| f1226b4c18 | |||
| b636550619 | |||
| 797d236547 | |||
| 90447ce9a0 | |||
| 22ef648b41 | |||
| 4eb4ac81ce | |||
| 904cfee2a9 | |||
| 69b3cf358a |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"env": "development",
|
||||
"apiBaseUrl": "https://api-neki-b2b.neki.es/gateway/api/",
|
||||
"apiOrigin": "bde6ea73-d09c-475f-aabf-1d11137e4d0d"
|
||||
}
|
||||
"apiOrigin": "https://neki-b2b.neki.es"
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
PODS:
|
||||
- Flutter (1.0.0)
|
||||
- flutter_contacts (0.0.1):
|
||||
- Flutter
|
||||
- flutter_native_splash (2.4.3):
|
||||
- Flutter
|
||||
- flutter_treezor_entrust_sdk_bridge (0.0.1):
|
||||
@@ -23,6 +25,7 @@ PODS:
|
||||
|
||||
DEPENDENCIES:
|
||||
- Flutter (from `Flutter`)
|
||||
- flutter_contacts (from `.symlinks/plugins/flutter_contacts/ios`)
|
||||
- flutter_native_splash (from `.symlinks/plugins/flutter_native_splash/ios`)
|
||||
- flutter_treezor_entrust_sdk_bridge (from `.symlinks/plugins/flutter_treezor_entrust_sdk_bridge/ios`)
|
||||
- mobile_scanner (from `.symlinks/plugins/mobile_scanner/darwin`)
|
||||
@@ -35,6 +38,8 @@ DEPENDENCIES:
|
||||
EXTERNAL SOURCES:
|
||||
Flutter:
|
||||
:path: Flutter
|
||||
flutter_contacts:
|
||||
:path: ".symlinks/plugins/flutter_contacts/ios"
|
||||
flutter_native_splash:
|
||||
:path: ".symlinks/plugins/flutter_native_splash/ios"
|
||||
flutter_treezor_entrust_sdk_bridge:
|
||||
@@ -54,6 +59,7 @@ EXTERNAL SOURCES:
|
||||
|
||||
SPEC CHECKSUMS:
|
||||
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
|
||||
flutter_contacts: edb1c5ce76aa433e20e6cb14c615f4c0b66e0983
|
||||
flutter_native_splash: df59bb2e1421aa0282cb2e95618af4dcb0c56c29
|
||||
flutter_treezor_entrust_sdk_bridge: 4c2c94fb74ab57576e8d49f5f2a4b214e41141fe
|
||||
mobile_scanner: 77265f3dc8d580810e91849d4a0811a90467ed5e
|
||||
|
||||
@@ -543,7 +543,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -727,7 +727,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -751,7 +751,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-development;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-development.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1100,7 +1100,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1124,7 +1124,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1148,7 +1148,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1171,7 +1171,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1194,7 +1194,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-staging;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = "Runner/Runner-staging.entitlements";
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
@@ -1217,7 +1217,7 @@
|
||||
isa = XCBuildConfiguration;
|
||||
baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
|
||||
buildSettings = {
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon-production;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CODE_SIGN_ENTITLEMENTS = Runner/Runner.entitlements;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
|
||||
@@ -47,8 +47,14 @@
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Necesitamos la cámara para escanear códigos QR</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
|
||||
@@ -47,8 +47,14 @@
|
||||
<true/>
|
||||
<key>UIStatusBarHidden</key>
|
||||
<true/>
|
||||
<key>NSContactsUsageDescription</key>
|
||||
<string>Necesitamos acceso a tus contactos para seleccionar números de teléfono.</string>
|
||||
<key>NSCameraUsageDescription</key>
|
||||
<string>Necesitamos la cámara para escanear códigos QR</string>
|
||||
<key>NSLocationWhenInUseUsageDescription</key>
|
||||
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
|
||||
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
|
||||
<string>Usamos tu ubicación para verificar la seguridad de las transacciones.</string>
|
||||
<key>UIViewControllerBasedStatusBarAppearance</key>
|
||||
<false/>
|
||||
<key>NSFaceIDUsageDescription</key>
|
||||
|
||||
@@ -386,6 +386,12 @@ void configureAppRouter() {
|
||||
name: 'home_extract',
|
||||
pageBuilder: const ExtractBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'edit',
|
||||
name: 'home_edit_child_profile',
|
||||
pageBuilder:
|
||||
const EditChildProfileBuilder().buildPage,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
@@ -427,6 +433,12 @@ void configureAppRouter() {
|
||||
name: 'profile_settings',
|
||||
pageBuilder: const ProfileSettingsBuilder().buildPage,
|
||||
routes: [
|
||||
GoRoute(
|
||||
path: 'edit-personal-data',
|
||||
name: 'profile_edit_personal_data',
|
||||
pageBuilder:
|
||||
const EditPersonalDataBuilder().buildPage,
|
||||
),
|
||||
GoRoute(
|
||||
path: 'payment-methods',
|
||||
name: 'profile_payment_methods',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
|
||||
@@ -35,8 +36,10 @@ class LegacyHeartbeatService {
|
||||
debugPrint('[LegacyHeartbeat] /auth/me => OK');
|
||||
} catch (e) {
|
||||
debugPrint('[LegacyHeartbeat] error: $e');
|
||||
stop();
|
||||
_onUnauthorized();
|
||||
if (e is DioException && e.response?.statusCode == 401) {
|
||||
stop();
|
||||
_onUnauthorized();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,12 +47,21 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||
walletHeartbeat.stop();
|
||||
legacyHeartbeat.stop();
|
||||
};
|
||||
// walletHeartbeat.start();
|
||||
legacyHeartbeat.start();
|
||||
appRouter.routerDelegate.addListener(_onRouteChanged);
|
||||
}
|
||||
|
||||
void _onRouteChanged() {
|
||||
final location = appRouter.routerDelegate.currentConfiguration.uri.path;
|
||||
if (location.startsWith(AppRoutes.legacyDashboard)) {
|
||||
legacyHeartbeat.start();
|
||||
} else {
|
||||
legacyHeartbeat.stop();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
appRouter.routerDelegate.removeListener(_onRouteChanged);
|
||||
walletHeartbeat.stop();
|
||||
legacyHeartbeat.stop();
|
||||
WidgetsBinding.instance.removeObserver(this);
|
||||
@@ -65,7 +74,7 @@ class SaveFamilyAppState extends ConsumerState<SaveFamilyApp>
|
||||
ref.read(appLifecycleStateProvider.notifier).setState(state);
|
||||
if (state == AppLifecycleState.resumed) {
|
||||
// walletHeartbeat.start();
|
||||
legacyHeartbeat.start();
|
||||
_onRouteChanged();
|
||||
ref.read(permissionsProvider.notifier).checkPermissions();
|
||||
} else if (state == AppLifecycleState.paused) {
|
||||
// walletHeartbeat.stop();
|
||||
|
||||
@@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||
# In Windows, build-name is used as the major, minor, and patch parts
|
||||
# of the product and file versions while build-number is used as the build suffix.
|
||||
version: 1.0.0+1
|
||||
version: 1.0.0+5
|
||||
|
||||
environment:
|
||||
sdk: ^3.9.2
|
||||
|
||||
Binary file not shown.
File diff suppressed because one or more lines are too long
@@ -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-16 09:33:25.098373","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":"/Users/juliandalcalaf/Desktop/save-family-app/sf-app-platform/packages/flutter_treezor_entrust_sdk_bridge/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/Desktop/save-family-app/sf-app-platform/packages/flutter_treezor_entrust_sdk_bridge/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"path_provider_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.22/","native_build":true,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_android","path":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/shared_preferences_android-2.4.20/","native_build":true,"dependencies":[],"dev_dependency":false}],"macos":[{"name":"path_provider_foundation","path":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_linux","path":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0/","native_build":false,"dependencies":[],"dev_dependency":false},{"name":"shared_preferences_windows","path":"/Users/juliandalcalaf/.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":"/Users/juliandalcalaf/.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-18 14:45:38.408085","version":"3.35.7","swift_package_manager_enabled":{"ios":false,"macos":false}}
|
||||
@@ -1,5 +1,6 @@
|
||||
export 'src/presentation/activity_screen.dart';
|
||||
export 'src/widgets/activity_list.dart';
|
||||
export 'src/widgets/pagination_bar.dart';
|
||||
export 'src/widgets/transaction_tile.dart';
|
||||
export 'src/activity_builder.dart';
|
||||
export 'src/providers/activity_providers.dart';
|
||||
|
||||
@@ -17,7 +17,7 @@ class GetWalletTransactionsUseCaseImpl implements GetWalletTransactionsUseCase {
|
||||
required String walletId,
|
||||
Map<String, dynamic>? queryParameters,
|
||||
}) {
|
||||
return _repository.getWalletTransactions(
|
||||
return _repository.getWalletOperations(
|
||||
walletId: walletId,
|
||||
queryParameters: queryParameters,
|
||||
);
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:activity/src/presentation/state/activity_view_model.dart';
|
||||
import 'package:activity/src/presentation/state/activity_view_state.dart';
|
||||
import 'package:activity/src/widgets/pagination_bar.dart';
|
||||
import 'package:activity/src/widgets/transaction_tile.dart';
|
||||
|
||||
class ActivityScreen extends ConsumerStatefulWidget {
|
||||
@@ -173,7 +174,7 @@ class _ActivityScreenState extends ConsumerState<ActivityScreen> {
|
||||
return _buildError(context, theme, viewState.errorMessage);
|
||||
}
|
||||
|
||||
if (viewState.transactions.isEmpty) {
|
||||
if (viewState.transactionPages.isEmpty) {
|
||||
return Center(
|
||||
child: Text(
|
||||
context.translate(I18n.activityNoTransactions),
|
||||
@@ -185,38 +186,48 @@ class _ActivityScreenState extends ConsumerState<ActivityScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
final walletId = viewState.selectedTab!.walletId;
|
||||
final balanceAsync = ref.watch(walletBalanceProvider(walletId));
|
||||
final currentTransactions = viewState.transactionPages[viewState.currentPage];
|
||||
|
||||
return RefreshIndicator(
|
||||
onRefresh: () =>
|
||||
ref.read(activityViewModelProvider.notifier).loadTabs(),
|
||||
child: ListView.builder(
|
||||
child: ListView(
|
||||
physics: const AlwaysScrollableScrollPhysics(),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 24),
|
||||
itemCount: viewState.transactions.length + 1,
|
||||
itemBuilder: (context, index) {
|
||||
if (index == 0) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 16),
|
||||
child: balanceAsync.when(
|
||||
loading: () =>
|
||||
const Center(child: AppLoadingIndicator(size: 48)),
|
||||
error: (_, __) => const SizedBox.shrink(),
|
||||
data: (balance) => WalletBalanceBlock(
|
||||
availableBalance: balance.availableBalance,
|
||||
allocatedBalance: balance.allocatedBalance,
|
||||
totalBalance: balance.totalBalance,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
final transaction = viewState.transactions[index - 1];
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: TransactionTile(transaction: transaction),
|
||||
);
|
||||
},
|
||||
children: [
|
||||
// TODO: WalletBalanceBlock temporarily hidden
|
||||
// final walletId = viewState.selectedTab!.walletId;
|
||||
// final balanceAsync = ref.watch(walletBalanceProvider(walletId));
|
||||
// Padding(
|
||||
// padding: const EdgeInsets.only(bottom: 16),
|
||||
// child: balanceAsync.when(
|
||||
// loading: () =>
|
||||
// const Center(child: AppLoadingIndicator(size: 48)),
|
||||
// error: (_, __) => const SizedBox.shrink(),
|
||||
// data: (balance) => WalletBalanceBlock(
|
||||
// availableBalance: balance.availableBalance,
|
||||
// allocatedBalance: balance.allocatedBalance,
|
||||
// totalBalance: balance.totalBalance,
|
||||
// ),
|
||||
// ),
|
||||
// ),
|
||||
...currentTransactions.map(
|
||||
(tx) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: TransactionTile(transaction: tx),
|
||||
),
|
||||
),
|
||||
PaginationBar(
|
||||
currentPage: viewState.currentPage,
|
||||
totalPages: viewState.transactionPages.length,
|
||||
hasMore: viewState.nextCursor != null,
|
||||
isLoadingMore: viewState.isLoadingMore,
|
||||
onPageChanged: (page) =>
|
||||
ref.read(activityViewModelProvider.notifier).setPage(page),
|
||||
onLoadMore: () =>
|
||||
ref.read(activityViewModelProvider.notifier).loadMore(),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -73,20 +73,27 @@ class ActivityViewModel extends Notifier<ActivityViewState> {
|
||||
final tab = state.selectedTab;
|
||||
if (tab == null) return;
|
||||
|
||||
state = state.copyWith(isLoadingTransactions: true, errorMessage: '');
|
||||
state = state.copyWith(
|
||||
isLoadingTransactions: true,
|
||||
errorMessage: '',
|
||||
transactionPages: [],
|
||||
nextCursor: null,
|
||||
currentPage: 0,
|
||||
);
|
||||
|
||||
try {
|
||||
final query = TransactionsQuery(
|
||||
walletId: tab.walletId,
|
||||
dateFilter: state.selectedDateFilter,
|
||||
);
|
||||
final transactions =
|
||||
final response =
|
||||
await ref.read(walletTransactionsProvider(query).future);
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isLoadingTransactions: false,
|
||||
transactions: transactions,
|
||||
transactionPages: [response.items],
|
||||
nextCursor: response.nextCursor,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
@@ -97,6 +104,38 @@ class ActivityViewModel extends Notifier<ActivityViewState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadMore() async {
|
||||
final tab = state.selectedTab;
|
||||
if (tab == null || state.isLoadingMore || state.nextCursor == null) return;
|
||||
|
||||
state = state.copyWith(isLoadingMore: true);
|
||||
|
||||
try {
|
||||
final query = TransactionsQuery(
|
||||
walletId: tab.walletId,
|
||||
dateFilter: state.selectedDateFilter,
|
||||
cursor: state.nextCursor,
|
||||
);
|
||||
final response =
|
||||
await ref.read(walletTransactionsProvider(query).future);
|
||||
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isLoadingMore: false,
|
||||
transactionPages: [...state.transactionPages, response.items],
|
||||
nextCursor: response.nextCursor,
|
||||
currentPage: state.transactionPages.length,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isLoadingMore: false);
|
||||
}
|
||||
}
|
||||
|
||||
void setPage(int page) {
|
||||
state = state.copyWith(currentPage: page);
|
||||
}
|
||||
|
||||
void selectWallet(int index) {
|
||||
if (index == state.selectedWalletIndex) return;
|
||||
state = state.copyWith(selectedWalletIndex: index);
|
||||
|
||||
@@ -14,7 +14,10 @@ abstract class ActivityViewState with _$ActivityViewState {
|
||||
@Default([]) List<WalletTab> tabs,
|
||||
@Default(0) int selectedWalletIndex,
|
||||
@Default(DateFilter.today) DateFilter selectedDateFilter,
|
||||
@Default([]) List<WalletTransactionEntity> transactions,
|
||||
@Default([]) List<List<WalletTransactionEntity>> transactionPages,
|
||||
String? nextCursor,
|
||||
@Default(false) bool isLoadingMore,
|
||||
@Default(0) int currentPage,
|
||||
@Default('') String errorMessage,
|
||||
}) = _ActivityViewState;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ActivityViewState {
|
||||
|
||||
bool get isLoading; bool get isLoadingTransactions; List<WalletTab> get tabs; int get selectedWalletIndex; DateFilter get selectedDateFilter; List<WalletTransactionEntity> get transactions; String get errorMessage;
|
||||
bool get isLoading; bool get isLoadingTransactions; List<WalletTab> get tabs; int get selectedWalletIndex; DateFilter get selectedDateFilter; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage; String get errorMessage;
|
||||
/// Create a copy of ActivityViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ActivityViewStateCopyWith<ActivityViewState> get copyWith => _$ActivityViewStat
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.tabs, tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other.transactions, transactions)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.tabs, tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(transactions),errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactions: $transactions, errorMessage: $errorMessage)';
|
||||
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ActivityViewStateCopyWith<$Res> {
|
||||
factory $ActivityViewStateCopyWith(ActivityViewState value, $Res Function(ActivityViewState) _then) = _$ActivityViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage
|
||||
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -62,15 +62,18 @@ class _$ActivityViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ActivityViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactions = null,Object? errorMessage = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,Object? errorMessage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
|
||||
as bool,tabs: null == tabs ? _self.tabs : tabs // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTab>,selectedWalletIndex: null == selectedWalletIndex ? _self.selectedWalletIndex : selectedWalletIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,selectedDateFilter: null == selectedDateFilter ? _self.selectedDateFilter : selectedDateFilter // ignore: cast_nullable_to_non_nullable
|
||||
as DateFilter,transactions: null == transactions ? _self.transactions : transactions // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTransactionEntity>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as DateFilter,transactionPages: null == transactionPages ? _self.transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
|
||||
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
|
||||
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
@@ -156,10 +159,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ActivityViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -177,10 +180,10 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ActivityViewState():
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -197,10 +200,10 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ActivityViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactions,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.selectedWalletIndex,_that.selectedDateFilter,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage,_that.errorMessage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -212,7 +215,7 @@ return $default(_that.isLoading,_that.isLoadingTransactions,_that.tabs,_that.sel
|
||||
|
||||
|
||||
class _ActivityViewState extends ActivityViewState {
|
||||
const _ActivityViewState({this.isLoading = false, this.isLoadingTransactions = false, final List<WalletTab> tabs = const [], this.selectedWalletIndex = 0, this.selectedDateFilter = DateFilter.today, final List<WalletTransactionEntity> transactions = const [], this.errorMessage = ''}): _tabs = tabs,_transactions = transactions,super._();
|
||||
const _ActivityViewState({this.isLoading = false, this.isLoadingTransactions = false, final List<WalletTab> tabs = const [], this.selectedWalletIndex = 0, this.selectedDateFilter = DateFilter.today, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0, this.errorMessage = ''}): _tabs = tabs,_transactionPages = transactionPages,super._();
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@@ -226,13 +229,16 @@ class _ActivityViewState extends ActivityViewState {
|
||||
|
||||
@override@JsonKey() final int selectedWalletIndex;
|
||||
@override@JsonKey() final DateFilter selectedDateFilter;
|
||||
final List<WalletTransactionEntity> _transactions;
|
||||
@override@JsonKey() List<WalletTransactionEntity> get transactions {
|
||||
if (_transactions is EqualUnmodifiableListView) return _transactions;
|
||||
final List<List<WalletTransactionEntity>> _transactionPages;
|
||||
@override@JsonKey() List<List<WalletTransactionEntity>> get transactionPages {
|
||||
if (_transactionPages is EqualUnmodifiableListView) return _transactionPages;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_transactions);
|
||||
return EqualUnmodifiableListView(_transactionPages);
|
||||
}
|
||||
|
||||
@override final String? nextCursor;
|
||||
@override@JsonKey() final bool isLoadingMore;
|
||||
@override@JsonKey() final int currentPage;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
|
||||
/// Create a copy of ActivityViewState
|
||||
@@ -245,16 +251,16 @@ _$ActivityViewStateCopyWith<_ActivityViewState> get copyWith => __$ActivityViewS
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._tabs, _tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other._transactions, _transactions)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ActivityViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._tabs, _tabs)&&(identical(other.selectedWalletIndex, selectedWalletIndex) || other.selectedWalletIndex == selectedWalletIndex)&&(identical(other.selectedDateFilter, selectedDateFilter) || other.selectedDateFilter == selectedDateFilter)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(_tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(_transactions),errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isLoadingTransactions,const DeepCollectionEquality().hash(_tabs),selectedWalletIndex,selectedDateFilter,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactions: $transactions, errorMessage: $errorMessage)';
|
||||
return 'ActivityViewState(isLoading: $isLoading, isLoadingTransactions: $isLoadingTransactions, tabs: $tabs, selectedWalletIndex: $selectedWalletIndex, selectedDateFilter: $selectedDateFilter, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -265,7 +271,7 @@ abstract mixin class _$ActivityViewStateCopyWith<$Res> implements $ActivityViewS
|
||||
factory _$ActivityViewStateCopyWith(_ActivityViewState value, $Res Function(_ActivityViewState) _then) = __$ActivityViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<WalletTransactionEntity> transactions, String errorMessage
|
||||
bool isLoading, bool isLoadingTransactions, List<WalletTab> tabs, int selectedWalletIndex, DateFilter selectedDateFilter, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -282,15 +288,18 @@ class __$ActivityViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ActivityViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactions = null,Object? errorMessage = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isLoadingTransactions = null,Object? tabs = null,Object? selectedWalletIndex = null,Object? selectedDateFilter = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,Object? errorMessage = null,}) {
|
||||
return _then(_ActivityViewState(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
|
||||
as bool,tabs: null == tabs ? _self._tabs : tabs // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTab>,selectedWalletIndex: null == selectedWalletIndex ? _self.selectedWalletIndex : selectedWalletIndex // ignore: cast_nullable_to_non_nullable
|
||||
as int,selectedDateFilter: null == selectedDateFilter ? _self.selectedDateFilter : selectedDateFilter // ignore: cast_nullable_to_non_nullable
|
||||
as DateFilter,transactions: null == transactions ? _self._transactions : transactions // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTransactionEntity>,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as DateFilter,transactionPages: null == transactionPages ? _self._transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
|
||||
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
|
||||
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
103
modules/activity/lib/src/widgets/pagination_bar.dart
Normal file
103
modules/activity/lib/src/widgets/pagination_bar.dart
Normal file
@@ -0,0 +1,103 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
|
||||
class PaginationBar extends ConsumerWidget {
|
||||
final int currentPage;
|
||||
final int totalPages;
|
||||
final bool hasMore;
|
||||
final bool isLoadingMore;
|
||||
final ValueChanged<int> onPageChanged;
|
||||
final VoidCallback onLoadMore;
|
||||
|
||||
const PaginationBar({
|
||||
super.key,
|
||||
required this.currentPage,
|
||||
required this.totalPages,
|
||||
required this.hasMore,
|
||||
required this.isLoadingMore,
|
||||
required this.onPageChanged,
|
||||
required this.onLoadMore,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final textColor = theme.getColorFor(ThemeCode.textPrimary);
|
||||
final primaryColor = theme.getColorFor(ThemeCode.buttonPrimary);
|
||||
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 12),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
IconButton(
|
||||
onPressed: currentPage > 0
|
||||
? () => onPageChanged(currentPage - 1)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_left, color: currentPage > 0 ? primaryColor : Colors.grey),
|
||||
iconSize: 28,
|
||||
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
Flexible(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: List.generate(totalPages, (index) {
|
||||
final isSelected = index == currentPage;
|
||||
return GestureDetector(
|
||||
onTap: () => onPageChanged(index),
|
||||
child: Container(
|
||||
width: 32,
|
||||
height: 32,
|
||||
margin: const EdgeInsets.symmetric(horizontal: 4),
|
||||
decoration: BoxDecoration(
|
||||
color: isSelected ? primaryColor : Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
border: isSelected ? null : Border.all(color: Colors.grey.shade300),
|
||||
),
|
||||
alignment: Alignment.center,
|
||||
child: Text(
|
||||
'${index + 1}',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: isSelected ? Colors.white : textColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (hasMore)
|
||||
isLoadingMore
|
||||
? const Padding(
|
||||
padding: EdgeInsets.only(left: 8),
|
||||
child: AppLoadingIndicator(size: 20),
|
||||
)
|
||||
: IconButton(
|
||||
onPressed: onLoadMore,
|
||||
icon: Icon(Icons.add_circle_outline, color: primaryColor),
|
||||
iconSize: 28,
|
||||
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
padding: EdgeInsets.zero,
|
||||
tooltip: 'Load more',
|
||||
),
|
||||
IconButton(
|
||||
onPressed: currentPage < totalPages - 1
|
||||
? () => onPageChanged(currentPage + 1)
|
||||
: null,
|
||||
icon: Icon(Icons.chevron_right, color: currentPage < totalPages - 1 ? primaryColor : Colors.grey),
|
||||
iconSize: 28,
|
||||
constraints: const BoxConstraints(minWidth: 36, minHeight: 36),
|
||||
padding: EdgeInsets.zero,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
@@ -12,9 +13,18 @@ class TransactionTile extends ConsumerWidget {
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final color = _color(transaction.transactionType);
|
||||
final icon = _icon(transaction.transactionType);
|
||||
final label = context.translate(_i18nKey(transaction.transactionType));
|
||||
final isDeclined = transaction.status == 'DECLINED';
|
||||
final isCredit = transaction.direction == 'CREDIT';
|
||||
final color = isDeclined ? Colors.grey : _color(transaction.operationType);
|
||||
final icon = _icon(transaction.operationType);
|
||||
final label = transaction.merchantName ??
|
||||
context.translate(_i18nKey(transaction.operationType));
|
||||
final amountPrefix = isCredit ? '+' : '-';
|
||||
final amountColor = isDeclined
|
||||
? Colors.grey
|
||||
: isCredit
|
||||
? Colors.green
|
||||
: Colors.red;
|
||||
|
||||
return Container(
|
||||
padding: const EdgeInsets.all(16),
|
||||
@@ -41,19 +51,27 @@ class TransactionTile extends ConsumerWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
'${transaction.amount} ${transaction.currency}',
|
||||
'$amountPrefix${transaction.amount.toStringAsFixed(2)} ${transaction.currency}',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
color: amountColor,
|
||||
decoration: isDeclined ? TextDecoration.lineThrough : null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (transaction.name.isNotEmpty) ...[
|
||||
if (transaction.messageToUser != null &&
|
||||
transaction.messageToUser!.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
transaction.name,
|
||||
transaction.messageToUser!,
|
||||
style: const TextStyle(fontSize: 13, color: Colors.red),
|
||||
),
|
||||
] else if (transaction.label.isNotEmpty) ...[
|
||||
const SizedBox(height: 8),
|
||||
Text(
|
||||
transaction.label,
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
@@ -61,12 +79,65 @@ class TransactionTile extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
const SizedBox(height: 4),
|
||||
Text(
|
||||
transaction.executionDate,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
Wrap(
|
||||
spacing: 8,
|
||||
runSpacing: 4,
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
_formatDate(transaction.createdDate, context),
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
if (transaction.merchantCity != null &&
|
||||
transaction.merchantCity!.isNotEmpty)
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(Icons.location_on, size: 12,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
transaction.merchantCity!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (transaction.maskedPan != null &&
|
||||
transaction.maskedPan!.isNotEmpty)
|
||||
Text(
|
||||
transaction.maskedPan!,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
),
|
||||
if (isDeclined)
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 6,
|
||||
vertical: 2,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.red.withAlpha(0x1A),
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
),
|
||||
child: Text(
|
||||
transaction.status,
|
||||
style: const TextStyle(
|
||||
fontSize: 10,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.red,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
@@ -74,82 +145,51 @@ class TransactionTile extends ConsumerWidget {
|
||||
}
|
||||
|
||||
static IconData _icon(TransactionType type) => switch (type) {
|
||||
TransactionType.payin ||
|
||||
TransactionType.payinAcquiring ||
|
||||
TransactionType.checkPayin => Icons.arrow_downward,
|
||||
TransactionType.payout ||
|
||||
TransactionType.payoutSctInstantEmit => Icons.arrow_upward,
|
||||
TransactionType.payinRefund ||
|
||||
TransactionType.payoutRefund ||
|
||||
TransactionType.payinRefundAcquiring ||
|
||||
TransactionType.checkRefund => Icons.replay,
|
||||
TransactionType.transfer ||
|
||||
TransactionType.sctr ||
|
||||
TransactionType.sctrInst ||
|
||||
TransactionType.creditInternationalTransfer => Icons.swap_horiz,
|
||||
TransactionType.cardTopup => Icons.arrow_downward,
|
||||
TransactionType.cardTransaction => Icons.credit_card,
|
||||
TransactionType.sdde || TransactionType.sddr => Icons.account_balance,
|
||||
TransactionType.creditTransferReturned ||
|
||||
TransactionType.payinSctInstantRecall ||
|
||||
TransactionType.payinSctInstantEmitRecall ||
|
||||
TransactionType.sctrRecall ||
|
||||
TransactionType.sddrReversal => Icons.undo,
|
||||
TransactionType.bankTransfer ||
|
||||
TransactionType.instantBankTransfer => Icons.account_balance,
|
||||
TransactionType.walletTransfer => Icons.swap_horiz,
|
||||
TransactionType.bankDirectDebit => Icons.account_balance_wallet,
|
||||
TransactionType.check => Icons.receipt_long,
|
||||
TransactionType.creditNote => Icons.replay,
|
||||
TransactionType.fees => Icons.monetization_on,
|
||||
TransactionType.unknown => Icons.help_outline,
|
||||
};
|
||||
|
||||
static Color _color(TransactionType type) => switch (type) {
|
||||
TransactionType.payin ||
|
||||
TransactionType.payinAcquiring ||
|
||||
TransactionType.checkPayin => Colors.green,
|
||||
TransactionType.payout ||
|
||||
TransactionType.payoutSctInstantEmit => Colors.red,
|
||||
TransactionType.payinRefund ||
|
||||
TransactionType.payoutRefund ||
|
||||
TransactionType.payinRefundAcquiring ||
|
||||
TransactionType.checkRefund ||
|
||||
TransactionType.creditTransferReturned ||
|
||||
TransactionType.payinSctInstantRecall ||
|
||||
TransactionType.payinSctInstantEmitRecall ||
|
||||
TransactionType.sctrRecall ||
|
||||
TransactionType.sddrReversal => Colors.orange,
|
||||
TransactionType.transfer ||
|
||||
TransactionType.sctr ||
|
||||
TransactionType.sctrInst ||
|
||||
TransactionType.creditInternationalTransfer ||
|
||||
TransactionType.sdde ||
|
||||
TransactionType.sddr => Colors.blue,
|
||||
TransactionType.cardTopup => Colors.green,
|
||||
TransactionType.cardTransaction => Colors.purple,
|
||||
TransactionType.bankTransfer ||
|
||||
TransactionType.instantBankTransfer ||
|
||||
TransactionType.walletTransfer => Colors.blue,
|
||||
TransactionType.bankDirectDebit => Colors.red,
|
||||
TransactionType.check => Colors.teal,
|
||||
TransactionType.creditNote => Colors.orange,
|
||||
TransactionType.fees => Colors.red,
|
||||
TransactionType.unknown => Colors.grey,
|
||||
};
|
||||
|
||||
static String _i18nKey(TransactionType type) => switch (type) {
|
||||
TransactionType.payin => I18n.transactionPayin,
|
||||
TransactionType.payout => I18n.transactionPayout,
|
||||
TransactionType.transfer => I18n.transactionTransfer,
|
||||
TransactionType.payinRefund => I18n.transactionPayinRefund,
|
||||
TransactionType.payoutRefund => I18n.transactionPayoutRefund,
|
||||
TransactionType.bankDirectDebit => I18n.transactionBankDirectDebit,
|
||||
TransactionType.bankTransfer => I18n.transactionBankTransfer,
|
||||
TransactionType.cardTopup => I18n.transactionCardTopup,
|
||||
TransactionType.cardTransaction => I18n.transactionCardPayment,
|
||||
TransactionType.payinAcquiring => I18n.transactionPayinAcquiring,
|
||||
TransactionType.payinRefundAcquiring =>
|
||||
I18n.transactionPayinRefundAcquiring,
|
||||
TransactionType.sctrInst => I18n.transactionSctrInst,
|
||||
TransactionType.payinSctInstantRecall =>
|
||||
I18n.transactionPayinSctInstantRecall,
|
||||
TransactionType.payoutSctInstantEmit =>
|
||||
I18n.transactionPayoutSctInstantEmit,
|
||||
TransactionType.payinSctInstantEmitRecall =>
|
||||
I18n.transactionPayinSctInstantEmitRecall,
|
||||
TransactionType.creditTransferReturned =>
|
||||
I18n.transactionCreditTransferReturned,
|
||||
TransactionType.checkPayin => I18n.transactionCheckPayin,
|
||||
TransactionType.sdde => I18n.transactionSdde,
|
||||
TransactionType.sddr => I18n.transactionSddr,
|
||||
TransactionType.sddrReversal => I18n.transactionSddrReversal,
|
||||
TransactionType.sctrRecall => I18n.transactionSctrRecall,
|
||||
TransactionType.checkRefund => I18n.transactionCheckRefund,
|
||||
TransactionType.sctr => I18n.transactionSctr,
|
||||
TransactionType.creditInternationalTransfer =>
|
||||
I18n.transactionCreditInternationalTransfer,
|
||||
TransactionType.check => I18n.transactionCheck,
|
||||
TransactionType.creditNote => I18n.transactionCreditNote,
|
||||
TransactionType.fees => I18n.transactionFees,
|
||||
TransactionType.instantBankTransfer => I18n.transactionInstantBankTransfer,
|
||||
TransactionType.walletTransfer => I18n.transactionWalletTransfer,
|
||||
TransactionType.unknown => I18n.transactionUnknown,
|
||||
};
|
||||
|
||||
static String _formatDate(String raw, BuildContext context) {
|
||||
try {
|
||||
final date = DateTime.parse(raw).toLocal();
|
||||
final locale = Localizations.localeOf(context).languageCode;
|
||||
return DateFormat('d MMM yyyy · HH:mm', locale).format(date);
|
||||
} catch (_) {
|
||||
return raw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,3 +7,4 @@ export 'src/features/lock_card/lock_card_builder.dart';
|
||||
export 'src/features/limits/limits_builder.dart';
|
||||
export 'src/features/goals/goals_builder.dart';
|
||||
export 'src/features/extract/extract_builder.dart';
|
||||
export 'src/features/edit_child_profile/edit_child_profile_builder.dart';
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import 'dart:async';
|
||||
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
@@ -15,11 +14,12 @@ class ChildDataNotifier extends Notifier<ChildDataState> {
|
||||
final String childId;
|
||||
ChildDataNotifier(this.childId);
|
||||
|
||||
late final TreezorRepository _treezorRepository;
|
||||
late final UserRepository _userRepository;
|
||||
late TreezorRepository _treezorRepository;
|
||||
late UserRepository _userRepository;
|
||||
|
||||
@override
|
||||
ChildDataState build() {
|
||||
ref.watch(walletRefreshProvider);
|
||||
final link = ref.keepAlive();
|
||||
final timer = Timer(const Duration(minutes: 5), link.close);
|
||||
ref.onDispose(timer.cancel);
|
||||
@@ -56,9 +56,7 @@ class ChildDataNotifier extends Notifier<ChildDataState> {
|
||||
device = await _userRepository.getDeviceByIdentificator(
|
||||
identificator: childProfile.deviceIdentificator,
|
||||
);
|
||||
} catch (e) {
|
||||
debugPrint('Error fetching device for child $childId: $e');
|
||||
}
|
||||
} catch (_) {}
|
||||
|
||||
if (!ref.mounted) return;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../../card_colors.dart';
|
||||
import '../../presentation/state/home_view_model.dart';
|
||||
@@ -162,14 +163,60 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
),
|
||||
),
|
||||
_buildGenderAvatar(device?.carrierGenre, 50),
|
||||
Text(
|
||||
childName,
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
Expanded(
|
||||
child: Text(
|
||||
childName,
|
||||
style: TextStyle(
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.backgroundPrimary,
|
||||
),
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 20,
|
||||
),
|
||||
),
|
||||
),
|
||||
PopupMenuButton<String>(
|
||||
icon: Icon(
|
||||
Icons.more_vert,
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
onSelected: (value) {
|
||||
if (value == 'edit') {
|
||||
widget.navigation.pushTo(
|
||||
AppRoutes.editChildProfile(widget.childId),
|
||||
);
|
||||
} else if (value == 'delete') {
|
||||
_showDeleteConfirmation();
|
||||
}
|
||||
},
|
||||
itemBuilder: (_) => [
|
||||
PopupMenuItem(
|
||||
value: 'edit',
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(Icons.edit_outlined),
|
||||
Text(
|
||||
context.translate(I18n.editChildProfile),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PopupMenuItem(
|
||||
value: 'delete',
|
||||
child: Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(Icons.delete_outline, color: Colors.red),
|
||||
Text(
|
||||
context.translate(I18n.deleteDevice),
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
@@ -196,76 +243,37 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
minHeight: 10,
|
||||
borderRadius: BorderRadius.all(Radius.circular(5)),
|
||||
),
|
||||
if (CardStatus.fromString(viewState.cardStatus) ==
|
||||
CardStatus.lost ||
|
||||
CardStatus.fromString(viewState.cardStatus) ==
|
||||
CardStatus.stolen)
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
|
||||
),
|
||||
onPressed: viewState.isUpdatingCard
|
||||
? null
|
||||
: () => _showDeleteConfirmation(context, ref),
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.delete_outline,
|
||||
size: 24,
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.textSecondary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
context.translate(I18n.deleteDevice),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
else
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
|
||||
),
|
||||
onPressed: () =>
|
||||
_showCardStatusSheet(context, ref, theme),
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.lock_outline,
|
||||
size: 24,
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.textSecondary,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
locked
|
||||
? context.translate(
|
||||
I18n.childWalletUnlockCard,
|
||||
)
|
||||
: context.translate(
|
||||
I18n.childWalletLockCard,
|
||||
),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TextButton(
|
||||
style: ButtonStyle(
|
||||
padding: WidgetStatePropertyAll(EdgeInsets.all(0)),
|
||||
),
|
||||
onPressed: () =>
|
||||
_showCardStatusSheet(context, ref, theme),
|
||||
child: Row(
|
||||
spacing: 10,
|
||||
children: [
|
||||
Icon(
|
||||
Icons.lock_outline,
|
||||
size: 24,
|
||||
color: theme.getColorFor(ThemeCode.textSecondary),
|
||||
),
|
||||
Text(
|
||||
locked
|
||||
? context.translate(
|
||||
I18n.childWalletUnlockCard,
|
||||
)
|
||||
: context.translate(I18n.childWalletLockCard),
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.w500,
|
||||
fontSize: 16,
|
||||
color: theme.getColorFor(
|
||||
ThemeCode.textSecondary,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
@@ -302,7 +310,7 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
child: AppLoadingIndicator(size: 48),
|
||||
),
|
||||
)
|
||||
else if (viewState.transactions.isEmpty)
|
||||
else if (viewState.transactionPages.isEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Center(
|
||||
@@ -319,13 +327,34 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
),
|
||||
),
|
||||
)
|
||||
else
|
||||
...viewState.transactions.map(
|
||||
else ...[
|
||||
...viewState.transactionPages[viewState.currentPage].map(
|
||||
(tx) => Padding(
|
||||
padding: const EdgeInsets.only(bottom: 12),
|
||||
child: TransactionTile(transaction: tx),
|
||||
),
|
||||
),
|
||||
PaginationBar(
|
||||
currentPage: viewState.currentPage,
|
||||
totalPages: viewState.transactionPages.length,
|
||||
hasMore: viewState.nextCursor != null,
|
||||
isLoadingMore: viewState.isLoadingMore,
|
||||
onPageChanged: (page) => ref
|
||||
.read(
|
||||
childWalletViewModelProvider(
|
||||
widget.childId,
|
||||
).notifier,
|
||||
)
|
||||
.setPage(page),
|
||||
onLoadMore: () => ref
|
||||
.read(
|
||||
childWalletViewModelProvider(
|
||||
widget.childId,
|
||||
).notifier,
|
||||
)
|
||||
.loadMore(),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -342,17 +371,13 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
|
||||
Widget _buildGenderAvatar(String? carrierGenre, double size) {
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
switch (carrierGenre) {
|
||||
case 'M':
|
||||
icon = Icons.face;
|
||||
color = const Color(0xFF64B5F6);
|
||||
case 'F':
|
||||
icon = Icons.face_3;
|
||||
color = const Color(0xFFF48FB1);
|
||||
default:
|
||||
icon = Icons.face_2;
|
||||
color = const Color(0xFF90A4AE);
|
||||
}
|
||||
return CircleAvatar(
|
||||
radius: size / 2,
|
||||
@@ -376,47 +401,108 @@ class _ChildWalletScreenState extends ConsumerState<ChildWalletScreen> {
|
||||
);
|
||||
}
|
||||
|
||||
void _showDeleteConfirmation(BuildContext context, WidgetRef ref) {
|
||||
Future<void> _showDeleteConfirmation() async {
|
||||
final theme = ref.read(themePortProvider);
|
||||
final userRepo = ref.read(userRepositoryProvider);
|
||||
final navigator = Navigator.of(context, rootNavigator: true);
|
||||
final checkingText = context.translate(I18n.deleteDeviceChecking);
|
||||
final notAllowedTitle = context.translate(I18n.deleteDeviceNotAllowedTitle);
|
||||
final nonZeroText = context.translate(
|
||||
I18n.deleteDeviceWalletNonZeroBalance,
|
||||
);
|
||||
final acceptText = context.translate(I18n.accept);
|
||||
final confirmTitle = context.translate(I18n.deleteDeviceConfirmTitle);
|
||||
final confirmMessage = context.translate(I18n.deleteDeviceConfirmMessage);
|
||||
final cancelText = context.translate(I18n.cancel);
|
||||
final deleteText = context.translate(I18n.deleteDevice);
|
||||
final successText = context.translate(I18n.deleteDeviceSuccess);
|
||||
final bgColor = theme.getColorFor(ThemeCode.backgroundPrimary);
|
||||
final shape = RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
);
|
||||
|
||||
showDialog(
|
||||
context: context,
|
||||
barrierDismissible: false,
|
||||
builder: (_) => AlertDialog(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
|
||||
title: Text(context.translate(I18n.deleteDeviceConfirmTitle)),
|
||||
content: Text(context.translate(I18n.deleteDeviceConfirmMessage)),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(context).pop(),
|
||||
child: Text(context.translate(I18n.cancel)),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(context).pop();
|
||||
final viewModel = ref.read(
|
||||
childWalletViewModelProvider(widget.childId).notifier,
|
||||
);
|
||||
final success = await viewModel.deleteDevice();
|
||||
if (success && context.mounted) {
|
||||
ref
|
||||
.read(homeViewModelProvider.notifier)
|
||||
.removeChild(widget.childId);
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.deleteDeviceSuccess),
|
||||
type: MessageType.success,
|
||||
);
|
||||
widget.navigation.goBack();
|
||||
}
|
||||
},
|
||||
child: Text(
|
||||
context.translate(I18n.deleteDevice),
|
||||
style: TextStyle(color: Colors.red),
|
||||
),
|
||||
),
|
||||
],
|
||||
backgroundColor: bgColor,
|
||||
shape: shape,
|
||||
content: Row(
|
||||
spacing: 16,
|
||||
children: [const AppLoadingIndicator(size: 24), Text(checkingText)],
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
try {
|
||||
final deletability = await userRepo.checkChildProfileDeletability(
|
||||
childProfileId: widget.childId,
|
||||
);
|
||||
if (!mounted) return;
|
||||
navigator.pop();
|
||||
|
||||
if (!deletability.isDeletable) {
|
||||
if (!mounted) return;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: bgColor,
|
||||
shape: shape,
|
||||
title: Text(notAllowedTitle),
|
||||
content: Text(nonZeroText),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(acceptText),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mounted) return;
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (ctx) => AlertDialog(
|
||||
backgroundColor: bgColor,
|
||||
shape: shape,
|
||||
title: Text(confirmTitle),
|
||||
content: Text(confirmMessage),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.of(ctx).pop(),
|
||||
child: Text(cancelText),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
Navigator.of(ctx).pop();
|
||||
final viewModel = ref.read(
|
||||
childWalletViewModelProvider(widget.childId).notifier,
|
||||
);
|
||||
final success = await viewModel.deleteDevice();
|
||||
if (success && mounted) {
|
||||
ref
|
||||
.read(homeViewModelProvider.notifier)
|
||||
.removeChild(widget.childId);
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: successText,
|
||||
type: MessageType.success,
|
||||
);
|
||||
widget.navigation.goBack();
|
||||
}
|
||||
},
|
||||
child: Text(deleteText, style: TextStyle(color: Colors.red)),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
} catch (e) {
|
||||
if (!mounted) return;
|
||||
navigator.pop();
|
||||
showTopSnackbar(context, message: e.toString(), type: MessageType.error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -463,13 +549,19 @@ class _CardStatusSheetState extends ConsumerState<_CardStatusSheet> {
|
||||
style: const TextStyle(fontSize: 20, fontWeight: FontWeight.w500),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
...statuses.map(
|
||||
(status) => RadioListTile<String>(
|
||||
title: Text(context.translate(_labelKey(status))),
|
||||
value: status,
|
||||
groupValue: _selected,
|
||||
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
onChanged: (v) => setState(() => _selected = v!),
|
||||
RadioGroup<String>(
|
||||
groupValue: _selected!,
|
||||
onChanged: (v) => setState(() => _selected = v),
|
||||
child: Column(
|
||||
children: statuses
|
||||
.map(
|
||||
(status) => RadioListTile<String>(
|
||||
title: Text(context.translate(_labelKey(status))),
|
||||
value: status,
|
||||
activeColor: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
),
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
|
||||
@@ -5,7 +5,6 @@ import 'package:get_it/get_it.dart';
|
||||
import 'package:sca_treezor/sca_treezor.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
|
||||
import '../../card_colors.dart';
|
||||
import 'child_data_provider.dart';
|
||||
import 'child_wallet_view_state.dart';
|
||||
@@ -19,8 +18,8 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
final String childId;
|
||||
ChildWalletViewModel(this.childId);
|
||||
|
||||
late final TreezorWalletConnectionService _connectionService;
|
||||
late final TreezorWalletSignatureService _signatureService;
|
||||
late TreezorWalletConnectionService _connectionService;
|
||||
late TreezorWalletSignatureService _signatureService;
|
||||
|
||||
@override
|
||||
ChildWalletViewState build() {
|
||||
@@ -43,6 +42,8 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
}
|
||||
});
|
||||
|
||||
ref.watch(walletRefreshProvider);
|
||||
|
||||
final data = ref.read(childDataProvider(childId));
|
||||
final initialState = ChildWalletViewState(
|
||||
isLoading: data.isLoading,
|
||||
@@ -66,19 +67,53 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
state = state.copyWith(isLoadingTransactions: true);
|
||||
try {
|
||||
final query = TransactionsQuery(walletId: walletId);
|
||||
final transactions =
|
||||
await ref.read(walletTransactionsProvider(query).future);
|
||||
final response = await ref.read(
|
||||
walletTransactionsProvider(query).future,
|
||||
);
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isLoadingTransactions: false,
|
||||
transactions: transactions,
|
||||
transactionPages: [response.items],
|
||||
nextCursor: response.nextCursor,
|
||||
currentPage: 0,
|
||||
);
|
||||
} catch (_) {
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isLoadingTransactions: false);
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> loadMore() async {
|
||||
final walletId = state.childProfile?.walletId;
|
||||
if (walletId == null || state.isLoadingMore || state.nextCursor == null) return;
|
||||
|
||||
state = state.copyWith(isLoadingMore: true);
|
||||
|
||||
try {
|
||||
final query = TransactionsQuery(
|
||||
walletId: walletId,
|
||||
cursor: state.nextCursor,
|
||||
);
|
||||
final response = await ref.read(
|
||||
walletTransactionsProvider(query).future,
|
||||
);
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isLoadingMore: false,
|
||||
transactionPages: [...state.transactionPages, response.items],
|
||||
nextCursor: response.nextCursor,
|
||||
currentPage: state.transactionPages.length,
|
||||
);
|
||||
} catch (_) {
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isLoadingMore: false);
|
||||
}
|
||||
}
|
||||
|
||||
void setPage(int page) {
|
||||
state = state.copyWith(currentPage: page);
|
||||
}
|
||||
|
||||
Future<void> _loadCard(String walletId) async {
|
||||
try {
|
||||
final card = await ref
|
||||
@@ -181,6 +216,12 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
}
|
||||
}
|
||||
|
||||
Future<ChildProfileDeletabilityEntity> checkDeletability() async {
|
||||
return ref
|
||||
.read(userRepositoryProvider)
|
||||
.checkChildProfileDeletability(childProfileId: childId);
|
||||
}
|
||||
|
||||
Future<bool> deleteDevice() async {
|
||||
final deviceId = state.device?.id;
|
||||
if (deviceId == null || deviceId.isEmpty) return false;
|
||||
@@ -195,7 +236,10 @@ class ChildWalletViewModel extends Notifier<ChildWalletViewState> {
|
||||
return true;
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return false;
|
||||
state = state.copyWith(isUpdatingCard: false, cardStatusError: e.toString());
|
||||
state = state.copyWith(
|
||||
isUpdatingCard: false,
|
||||
cardStatusError: e.toString(),
|
||||
);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,9 @@ abstract class ChildWalletViewState with _$ChildWalletViewState {
|
||||
@Default('') String pin,
|
||||
@Default(false) bool isSigning,
|
||||
@Default(false) bool isLoadingTransactions,
|
||||
@Default([]) List<WalletTransactionEntity> transactions,
|
||||
@Default([]) List<List<WalletTransactionEntity>> transactionPages,
|
||||
String? nextCursor,
|
||||
@Default(false) bool isLoadingMore,
|
||||
@Default(0) int currentPage,
|
||||
}) = _ChildWalletViewState;
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ChildWalletViewState {
|
||||
|
||||
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<WalletTransactionEntity> get transactions;
|
||||
bool get isLoading; ChildProfileEntity? get childProfile; ChildWalletEntity? get childWallet; DeviceEntity? get device; String get cardId; String get cardStatus; bool get locked; String get errorMessage; bool get isUpdatingCard; String get cardStatusError; bool get cardStatusSuccess; bool get showPin; String get selectedStatus; String get pin; bool get isSigning; bool get isLoadingTransactions; List<List<WalletTransactionEntity>> get transactionPages; String? get nextCursor; bool get isLoadingMore; int get currentPage;
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ChildWalletViewStateCopyWith<ChildWalletViewState> get copyWith => _$ChildWalle
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactions, transactions));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other.transactionPages, transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactions));
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactions: $transactions)';
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ChildWalletViewStateCopyWith<$Res> {
|
||||
factory $ChildWalletViewStateCopyWith(ChildWalletViewState value, $Res Function(ChildWalletViewState) _then) = _$ChildWalletViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ class _$ChildWalletViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactions = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
@@ -80,8 +80,11 @@ as bool,selectedStatus: null == selectedStatus ? _self.selectedStatus : selected
|
||||
as String,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
|
||||
as String,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
|
||||
as bool,transactions: null == transactions ? _self.transactions : transactions // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTransactionEntity>,
|
||||
as bool,transactionPages: null == transactionPages ? _self.transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
|
||||
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
|
||||
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
/// Create a copy of ChildWalletViewState
|
||||
@@ -202,10 +205,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -223,10 +226,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState():
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -243,10 +246,10 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ChildWalletViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactions);case _:
|
||||
return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.device,_that.cardId,_that.cardStatus,_that.locked,_that.errorMessage,_that.isUpdatingCard,_that.cardStatusError,_that.cardStatusSuccess,_that.showPin,_that.selectedStatus,_that.pin,_that.isSigning,_that.isLoadingTransactions,_that.transactionPages,_that.nextCursor,_that.isLoadingMore,_that.currentPage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -258,7 +261,7 @@ return $default(_that.isLoading,_that.childProfile,_that.childWallet,_that.devic
|
||||
|
||||
|
||||
class _ChildWalletViewState implements ChildWalletViewState {
|
||||
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<WalletTransactionEntity> transactions = const []}): _transactions = transactions;
|
||||
const _ChildWalletViewState({this.isLoading = true, this.childProfile, this.childWallet, this.device, this.cardId = '', this.cardStatus = '', this.locked = false, this.errorMessage = '', this.isUpdatingCard = false, this.cardStatusError = '', this.cardStatusSuccess = false, this.showPin = false, this.selectedStatus = '', this.pin = '', this.isSigning = false, this.isLoadingTransactions = false, final List<List<WalletTransactionEntity>> transactionPages = const [], this.nextCursor, this.isLoadingMore = false, this.currentPage = 0}): _transactionPages = transactionPages;
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@@ -277,13 +280,16 @@ class _ChildWalletViewState implements ChildWalletViewState {
|
||||
@override@JsonKey() final String pin;
|
||||
@override@JsonKey() final bool isSigning;
|
||||
@override@JsonKey() final bool isLoadingTransactions;
|
||||
final List<WalletTransactionEntity> _transactions;
|
||||
@override@JsonKey() List<WalletTransactionEntity> get transactions {
|
||||
if (_transactions is EqualUnmodifiableListView) return _transactions;
|
||||
final List<List<WalletTransactionEntity>> _transactionPages;
|
||||
@override@JsonKey() List<List<WalletTransactionEntity>> get transactionPages {
|
||||
if (_transactionPages is EqualUnmodifiableListView) return _transactionPages;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_transactions);
|
||||
return EqualUnmodifiableListView(_transactionPages);
|
||||
}
|
||||
|
||||
@override final String? nextCursor;
|
||||
@override@JsonKey() final bool isLoadingMore;
|
||||
@override@JsonKey() final int currentPage;
|
||||
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@@ -295,16 +301,16 @@ _$ChildWalletViewStateCopyWith<_ChildWalletViewState> get copyWith => __$ChildWa
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactions, _transactions));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ChildWalletViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.childProfile, childProfile) || other.childProfile == childProfile)&&(identical(other.childWallet, childWallet) || other.childWallet == childWallet)&&(identical(other.device, device) || other.device == device)&&(identical(other.cardId, cardId) || other.cardId == cardId)&&(identical(other.cardStatus, cardStatus) || other.cardStatus == cardStatus)&&(identical(other.locked, locked) || other.locked == locked)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.isUpdatingCard, isUpdatingCard) || other.isUpdatingCard == isUpdatingCard)&&(identical(other.cardStatusError, cardStatusError) || other.cardStatusError == cardStatusError)&&(identical(other.cardStatusSuccess, cardStatusSuccess) || other.cardStatusSuccess == cardStatusSuccess)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.selectedStatus, selectedStatus) || other.selectedStatus == selectedStatus)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.isLoadingTransactions, isLoadingTransactions) || other.isLoadingTransactions == isLoadingTransactions)&&const DeepCollectionEquality().equals(other._transactionPages, _transactionPages)&&(identical(other.nextCursor, nextCursor) || other.nextCursor == nextCursor)&&(identical(other.isLoadingMore, isLoadingMore) || other.isLoadingMore == isLoadingMore)&&(identical(other.currentPage, currentPage) || other.currentPage == currentPage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactions));
|
||||
int get hashCode => Object.hashAll([runtimeType,isLoading,childProfile,childWallet,device,cardId,cardStatus,locked,errorMessage,isUpdatingCard,cardStatusError,cardStatusSuccess,showPin,selectedStatus,pin,isSigning,isLoadingTransactions,const DeepCollectionEquality().hash(_transactionPages),nextCursor,isLoadingMore,currentPage]);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactions: $transactions)';
|
||||
return 'ChildWalletViewState(isLoading: $isLoading, childProfile: $childProfile, childWallet: $childWallet, device: $device, cardId: $cardId, cardStatus: $cardStatus, locked: $locked, errorMessage: $errorMessage, isUpdatingCard: $isUpdatingCard, cardStatusError: $cardStatusError, cardStatusSuccess: $cardStatusSuccess, showPin: $showPin, selectedStatus: $selectedStatus, pin: $pin, isSigning: $isSigning, isLoadingTransactions: $isLoadingTransactions, transactionPages: $transactionPages, nextCursor: $nextCursor, isLoadingMore: $isLoadingMore, currentPage: $currentPage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -315,7 +321,7 @@ abstract mixin class _$ChildWalletViewStateCopyWith<$Res> implements $ChildWalle
|
||||
factory _$ChildWalletViewStateCopyWith(_ChildWalletViewState value, $Res Function(_ChildWalletViewState) _then) = __$ChildWalletViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<WalletTransactionEntity> transactions
|
||||
bool isLoading, ChildProfileEntity? childProfile, ChildWalletEntity? childWallet, DeviceEntity? device, String cardId, String cardStatus, bool locked, String errorMessage, bool isUpdatingCard, String cardStatusError, bool cardStatusSuccess, bool showPin, String selectedStatus, String pin, bool isSigning, bool isLoadingTransactions, List<List<WalletTransactionEntity>> transactionPages, String? nextCursor, bool isLoadingMore, int currentPage
|
||||
});
|
||||
|
||||
|
||||
@@ -332,7 +338,7 @@ class __$ChildWalletViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ChildWalletViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactions = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? childProfile = freezed,Object? childWallet = freezed,Object? device = freezed,Object? cardId = null,Object? cardStatus = null,Object? locked = null,Object? errorMessage = null,Object? isUpdatingCard = null,Object? cardStatusError = null,Object? cardStatusSuccess = null,Object? showPin = null,Object? selectedStatus = null,Object? pin = null,Object? isSigning = null,Object? isLoadingTransactions = null,Object? transactionPages = null,Object? nextCursor = freezed,Object? isLoadingMore = null,Object? currentPage = null,}) {
|
||||
return _then(_ChildWalletViewState(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,childProfile: freezed == childProfile ? _self.childProfile : childProfile // ignore: cast_nullable_to_non_nullable
|
||||
@@ -350,8 +356,11 @@ as bool,selectedStatus: null == selectedStatus ? _self.selectedStatus : selected
|
||||
as String,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
|
||||
as String,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isLoadingTransactions: null == isLoadingTransactions ? _self.isLoadingTransactions : isLoadingTransactions // ignore: cast_nullable_to_non_nullable
|
||||
as bool,transactions: null == transactions ? _self._transactions : transactions // ignore: cast_nullable_to_non_nullable
|
||||
as List<WalletTransactionEntity>,
|
||||
as bool,transactionPages: null == transactionPages ? _self._transactionPages : transactionPages // ignore: cast_nullable_to_non_nullable
|
||||
as List<List<WalletTransactionEntity>>,nextCursor: freezed == nextCursor ? _self.nextCursor : nextCursor // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isLoadingMore: null == isLoadingMore ? _self.isLoadingMore : isLoadingMore // ignore: cast_nullable_to_non_nullable
|
||||
as bool,currentPage: null == currentPage ? _self.currentPage : currentPage // ignore: cast_nullable_to_non_nullable
|
||||
as int,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../../presentation/state/home_view_model.dart';
|
||||
import '../child_wallet/child_data_provider.dart';
|
||||
import 'deposit_view_state.dart';
|
||||
|
||||
@@ -100,8 +99,7 @@ class DepositViewModel extends Notifier<DepositViewState> {
|
||||
);
|
||||
|
||||
if (!ref.mounted) return;
|
||||
ref.read(childDataProvider(childId).notifier).load();
|
||||
ref.read(homeViewModelProvider.notifier).refreshChildWallet(childId);
|
||||
ref.read(walletRefreshProvider.notifier).refresh();
|
||||
await ref.read(parentWalletBalanceProvider.notifier).refresh();
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isSubmitting: false, success: true);
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
|
||||
import 'presentation/edit_child_profile_screen.dart';
|
||||
|
||||
class EditChildProfileBuilder {
|
||||
const EditChildProfileBuilder();
|
||||
|
||||
Page<void> buildPage(BuildContext context, GoRouterState state) {
|
||||
final childWalletId = state.pathParameters['childWalletId'] ?? '';
|
||||
final navigationContract = GetIt.I<NavigationContract>();
|
||||
return MaterialPage(
|
||||
key: state.pageKey,
|
||||
child: EditChildProfileScreen(
|
||||
childId: childWalletId,
|
||||
navigation: navigationContract,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,191 @@
|
||||
import 'package:auth/auth.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
|
||||
import 'edit_child_profile_view_model.dart';
|
||||
|
||||
class EditChildProfileScreen extends ConsumerWidget {
|
||||
final String childId;
|
||||
final NavigationContract navigation;
|
||||
|
||||
const EditChildProfileScreen({
|
||||
super.key,
|
||||
required this.childId,
|
||||
required this.navigation,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final viewState = ref.watch(editChildProfileViewModelProvider(childId));
|
||||
final viewModel =
|
||||
ref.read(editChildProfileViewModelProvider(childId).notifier);
|
||||
|
||||
ref.listen(editChildProfileViewModelProvider(childId), (prev, next) {
|
||||
if (next.saveSuccess && !(prev?.saveSuccess ?? false)) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: context.translate(I18n.editChildProfileSaveSuccess),
|
||||
type: MessageType.success,
|
||||
);
|
||||
navigation.goBack();
|
||||
}
|
||||
if (next.errorMessage.isNotEmpty &&
|
||||
!next.showPin &&
|
||||
next.errorMessage != (prev?.errorMessage ?? '')) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: next.errorMessage,
|
||||
type: MessageType.error,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
if (viewState.isLoading) {
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
body: const Center(child: AppLoadingIndicator()),
|
||||
);
|
||||
}
|
||||
|
||||
if (viewState.showPin) {
|
||||
return _buildPinScaffold(context, theme, viewState, viewModel);
|
||||
}
|
||||
|
||||
return _buildFormScaffold(context, theme, viewState, viewModel);
|
||||
}
|
||||
|
||||
Widget _buildPinScaffold(
|
||||
BuildContext context,
|
||||
ThemePort theme,
|
||||
EditChildProfileViewState viewState,
|
||||
EditChildProfileViewModel viewModel,
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
appBar: AppBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
onPressed: viewModel.cancelPin,
|
||||
),
|
||||
),
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: ScaPinView(
|
||||
title: context.translate(I18n.scaPinEnter),
|
||||
pin: viewState.pin,
|
||||
isProcessing: viewState.isSigning || viewState.isSaving,
|
||||
processingText: context.translate(I18n.scaSigning),
|
||||
canSubmit: viewModel.canSubmitPin,
|
||||
submitText: context.translate(I18n.scaConnect),
|
||||
clearPinText: context.translate(I18n.scaClearPin),
|
||||
onDigitPressed: viewModel.onDigitPressed,
|
||||
onBackspacePressed: viewModel.onBackspacePressed,
|
||||
onClearPin: viewModel.onClearPin,
|
||||
onSubmit: () => viewModel.onPinSubmit(),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (viewState.errorMessage.isNotEmpty)
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20),
|
||||
child: Text(
|
||||
viewState.errorMessage,
|
||||
style: const TextStyle(color: Colors.red),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: viewModel.cancelPin,
|
||||
child: Text(context.translate(I18n.cancel)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildFormScaffold(
|
||||
BuildContext context,
|
||||
ThemePort theme,
|
||||
EditChildProfileViewState viewState,
|
||||
EditChildProfileViewModel viewModel,
|
||||
) {
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
appBar: AppBar(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundSecondary),
|
||||
leading: IconButton(
|
||||
icon: Icon(
|
||||
Icons.arrow_back,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
onPressed: () => navigation.goBack(),
|
||||
),
|
||||
title: Text(
|
||||
context.translate(I18n.editChildProfileTitle),
|
||||
style: TextStyle(color: theme.getColorFor(ThemeCode.textPrimary)),
|
||||
),
|
||||
),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(20),
|
||||
child: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: ListView(
|
||||
children: [
|
||||
TextFormField(
|
||||
initialValue: viewState.firstName,
|
||||
decoration: InputDecoration(
|
||||
labelText: context.translate(I18n.firstNameLabel),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
onChanged: viewModel.setFirstName,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
initialValue: viewState.lastName,
|
||||
decoration: InputDecoration(
|
||||
labelText: context.translate(I18n.lastNameLabel),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
onChanged: viewModel.setLastName,
|
||||
),
|
||||
const SizedBox(height: 16),
|
||||
TextFormField(
|
||||
initialValue: viewState.address,
|
||||
decoration: InputDecoration(
|
||||
labelText: context.translate(I18n.streetLabel),
|
||||
border: const OutlineInputBorder(),
|
||||
),
|
||||
onChanged: viewModel.setAddress,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
PrimaryButton(
|
||||
onPressed: () => viewModel.requestPin(),
|
||||
text: context.translate(I18n.profileSettingsSave),
|
||||
color: theme.getColorFor(ThemeCode.buttonPrimary),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () => navigation.goBack(),
|
||||
child: Text(context.translate(I18n.cancel)),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,155 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:get_it/get_it.dart';
|
||||
import 'package:sca_treezor/sca_treezor.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../../child_wallet/child_data_provider.dart';
|
||||
|
||||
export 'edit_child_profile_view_state.dart';
|
||||
import 'edit_child_profile_view_state.dart';
|
||||
|
||||
final editChildProfileViewModelProvider = NotifierProvider.autoDispose
|
||||
.family<EditChildProfileViewModel, EditChildProfileViewState, String>(
|
||||
EditChildProfileViewModel.new,
|
||||
);
|
||||
|
||||
class EditChildProfileViewModel extends Notifier<EditChildProfileViewState> {
|
||||
final String childId;
|
||||
EditChildProfileViewModel(this.childId);
|
||||
|
||||
late TreezorWalletConnectionService _connectionService;
|
||||
late TreezorWalletSignatureService _signatureService;
|
||||
|
||||
@override
|
||||
EditChildProfileViewState build() {
|
||||
_connectionService = GetIt.I<TreezorWalletConnectionService>();
|
||||
_signatureService = GetIt.I<TreezorWalletSignatureService>();
|
||||
|
||||
Future.microtask(() => _loadChildProfile());
|
||||
return const EditChildProfileViewState();
|
||||
}
|
||||
|
||||
Future<void> _loadChildProfile() async {
|
||||
state = state.copyWith(isLoading: true, errorMessage: '');
|
||||
|
||||
try {
|
||||
final childData = ref.read(childDataProvider(childId));
|
||||
var childProfile = childData.childProfile;
|
||||
|
||||
if (childProfile == null) {
|
||||
final profiles =
|
||||
await ref.read(userRepositoryProvider).getChildProfiles();
|
||||
childProfile = profiles.where((p) => p.id == childId).firstOrNull;
|
||||
if (childProfile == null) {
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: 'Child profile not found',
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (!ref.mounted) return;
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
firstName: childProfile.firstName,
|
||||
lastName: childProfile.lastName,
|
||||
address: childProfile.address,
|
||||
childProfileId: childProfile.id,
|
||||
treezorUserId: childProfile.treezorUserId,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(isLoading: false, errorMessage: e.toString());
|
||||
}
|
||||
}
|
||||
|
||||
void setFirstName(String value) =>
|
||||
state = state.copyWith(firstName: value, saveSuccess: false);
|
||||
|
||||
void setLastName(String value) =>
|
||||
state = state.copyWith(lastName: value, saveSuccess: false);
|
||||
|
||||
void setAddress(String value) =>
|
||||
state = state.copyWith(address: value, saveSuccess: false);
|
||||
|
||||
void requestPin() {
|
||||
state = state.copyWith(showPin: true, pin: '', errorMessage: '');
|
||||
}
|
||||
|
||||
void cancelPin() {
|
||||
state = state.copyWith(showPin: false, pin: '');
|
||||
}
|
||||
|
||||
void onDigitPressed(String digit) {
|
||||
if (state.pin.length >= 6) return;
|
||||
state = state.copyWith(pin: state.pin + digit, errorMessage: '');
|
||||
}
|
||||
|
||||
void onBackspacePressed() {
|
||||
if (state.pin.isEmpty) return;
|
||||
state = state.copyWith(pin: state.pin.substring(0, state.pin.length - 1));
|
||||
}
|
||||
|
||||
void onClearPin() {
|
||||
state = state.copyWith(pin: '');
|
||||
}
|
||||
|
||||
bool get canSubmitPin => state.pin.length == 6;
|
||||
|
||||
Future<void> onPinSubmit() async {
|
||||
state = state.copyWith(isSigning: true, errorMessage: '');
|
||||
|
||||
try {
|
||||
await _connectionService.connectWithPin(loginPin: state.pin);
|
||||
if (!ref.mounted) return;
|
||||
|
||||
final scaProof = await _generateScaProof();
|
||||
if (!ref.mounted) return;
|
||||
|
||||
state = state.copyWith(isSigning: false, isSaving: true, pin: '');
|
||||
|
||||
await ref.read(userRepositoryProvider).updateChildProfile(
|
||||
childProfileId: state.childProfileId,
|
||||
scaProof: scaProof,
|
||||
firstName: state.firstName,
|
||||
lastName: state.lastName,
|
||||
address: state.address,
|
||||
);
|
||||
if (!ref.mounted) return;
|
||||
|
||||
ref.read(walletRefreshProvider.notifier).refresh();
|
||||
|
||||
state = state.copyWith(
|
||||
isSaving: false,
|
||||
saveSuccess: true,
|
||||
showPin: false,
|
||||
);
|
||||
} catch (e) {
|
||||
if (!ref.mounted) return;
|
||||
state = state.copyWith(
|
||||
isSigning: false,
|
||||
isSaving: false,
|
||||
pin: '',
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> _generateScaProof() async {
|
||||
final url =
|
||||
'https://savefamily.sandbox.treezor.co/v1/users/${state.treezorUserId}';
|
||||
final scaBody = <String, dynamic>{
|
||||
'firstName': state.firstName,
|
||||
'lastName': state.lastName,
|
||||
};
|
||||
|
||||
return _signatureService.generateJwsWithPin(
|
||||
message: '',
|
||||
input: jsonEncode({'url': url, 'body': scaBody}),
|
||||
pin: state.pin,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'edit_child_profile_view_state.freezed.dart';
|
||||
|
||||
@freezed
|
||||
abstract class EditChildProfileViewState with _$EditChildProfileViewState {
|
||||
const factory EditChildProfileViewState({
|
||||
@Default(true) bool isLoading,
|
||||
@Default(false) bool isSaving,
|
||||
@Default(false) bool isSigning,
|
||||
@Default(false) bool showPin,
|
||||
@Default('') String pin,
|
||||
@Default('') String firstName,
|
||||
@Default('') String lastName,
|
||||
@Default('') String address,
|
||||
@Default('') String childProfileId,
|
||||
@Default('') String treezorUserId,
|
||||
@Default('') String errorMessage,
|
||||
@Default(false) bool saveSuccess,
|
||||
}) = _EditChildProfileViewState;
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
// 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 'edit_child_profile_view_state.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$EditChildProfileViewState {
|
||||
|
||||
bool get isLoading; bool get isSaving; bool get isSigning; bool get showPin; String get pin; String get firstName; String get lastName; String get address; String get childProfileId; String get treezorUserId; String get errorMessage; bool get saveSuccess;
|
||||
/// Create a copy of EditChildProfileViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$EditChildProfileViewStateCopyWith<EditChildProfileViewState> get copyWith => _$EditChildProfileViewStateCopyWithImpl<EditChildProfileViewState>(this as EditChildProfileViewState, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is EditChildProfileViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.address, address) || other.address == address)&&(identical(other.childProfileId, childProfileId) || other.childProfileId == childProfileId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.saveSuccess, saveSuccess) || other.saveSuccess == saveSuccess));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,isSigning,showPin,pin,firstName,lastName,address,childProfileId,treezorUserId,errorMessage,saveSuccess);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EditChildProfileViewState(isLoading: $isLoading, isSaving: $isSaving, isSigning: $isSigning, showPin: $showPin, pin: $pin, firstName: $firstName, lastName: $lastName, address: $address, childProfileId: $childProfileId, treezorUserId: $treezorUserId, errorMessage: $errorMessage, saveSuccess: $saveSuccess)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $EditChildProfileViewStateCopyWith<$Res> {
|
||||
factory $EditChildProfileViewStateCopyWith(EditChildProfileViewState value, $Res Function(EditChildProfileViewState) _then) = _$EditChildProfileViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$EditChildProfileViewStateCopyWithImpl<$Res>
|
||||
implements $EditChildProfileViewStateCopyWith<$Res> {
|
||||
_$EditChildProfileViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final EditChildProfileViewState _self;
|
||||
final $Res Function(EditChildProfileViewState) _then;
|
||||
|
||||
/// Create a copy of EditChildProfileViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isSaving = null,Object? isSigning = null,Object? showPin = null,Object? pin = null,Object? firstName = null,Object? lastName = null,Object? address = null,Object? childProfileId = null,Object? treezorUserId = null,Object? errorMessage = null,Object? saveSuccess = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showPin: null == showPin ? _self.showPin : showPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,childProfileId: null == childProfileId ? _self.childProfileId : childProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,saveSuccess: null == saveSuccess ? _self.saveSuccess : saveSuccess // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [EditChildProfileViewState].
|
||||
extension EditChildProfileViewStatePatterns on EditChildProfileViewState {
|
||||
/// 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( _EditChildProfileViewState value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState() 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( _EditChildProfileViewState value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState():
|
||||
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( _EditChildProfileViewState value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState() 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 isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);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 isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState():
|
||||
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);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 isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _EditChildProfileViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isSaving,_that.isSigning,_that.showPin,_that.pin,_that.firstName,_that.lastName,_that.address,_that.childProfileId,_that.treezorUserId,_that.errorMessage,_that.saveSuccess);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
|
||||
|
||||
class _EditChildProfileViewState implements EditChildProfileViewState {
|
||||
const _EditChildProfileViewState({this.isLoading = true, this.isSaving = false, this.isSigning = false, this.showPin = false, this.pin = '', this.firstName = '', this.lastName = '', this.address = '', this.childProfileId = '', this.treezorUserId = '', this.errorMessage = '', this.saveSuccess = false});
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool isSaving;
|
||||
@override@JsonKey() final bool isSigning;
|
||||
@override@JsonKey() final bool showPin;
|
||||
@override@JsonKey() final String pin;
|
||||
@override@JsonKey() final String firstName;
|
||||
@override@JsonKey() final String lastName;
|
||||
@override@JsonKey() final String address;
|
||||
@override@JsonKey() final String childProfileId;
|
||||
@override@JsonKey() final String treezorUserId;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
@override@JsonKey() final bool saveSuccess;
|
||||
|
||||
/// Create a copy of EditChildProfileViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$EditChildProfileViewStateCopyWith<_EditChildProfileViewState> get copyWith => __$EditChildProfileViewStateCopyWithImpl<_EditChildProfileViewState>(this, _$identity);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _EditChildProfileViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isSaving, isSaving) || other.isSaving == isSaving)&&(identical(other.isSigning, isSigning) || other.isSigning == isSigning)&&(identical(other.showPin, showPin) || other.showPin == showPin)&&(identical(other.pin, pin) || other.pin == pin)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.address, address) || other.address == address)&&(identical(other.childProfileId, childProfileId) || other.childProfileId == childProfileId)&&(identical(other.treezorUserId, treezorUserId) || other.treezorUserId == treezorUserId)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage)&&(identical(other.saveSuccess, saveSuccess) || other.saveSuccess == saveSuccess));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isSaving,isSigning,showPin,pin,firstName,lastName,address,childProfileId,treezorUserId,errorMessage,saveSuccess);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'EditChildProfileViewState(isLoading: $isLoading, isSaving: $isSaving, isSigning: $isSigning, showPin: $showPin, pin: $pin, firstName: $firstName, lastName: $lastName, address: $address, childProfileId: $childProfileId, treezorUserId: $treezorUserId, errorMessage: $errorMessage, saveSuccess: $saveSuccess)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$EditChildProfileViewStateCopyWith<$Res> implements $EditChildProfileViewStateCopyWith<$Res> {
|
||||
factory _$EditChildProfileViewStateCopyWith(_EditChildProfileViewState value, $Res Function(_EditChildProfileViewState) _then) = __$EditChildProfileViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isSaving, bool isSigning, bool showPin, String pin, String firstName, String lastName, String address, String childProfileId, String treezorUserId, String errorMessage, bool saveSuccess
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$EditChildProfileViewStateCopyWithImpl<$Res>
|
||||
implements _$EditChildProfileViewStateCopyWith<$Res> {
|
||||
__$EditChildProfileViewStateCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _EditChildProfileViewState _self;
|
||||
final $Res Function(_EditChildProfileViewState) _then;
|
||||
|
||||
/// Create a copy of EditChildProfileViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isSaving = null,Object? isSigning = null,Object? showPin = null,Object? pin = null,Object? firstName = null,Object? lastName = null,Object? address = null,Object? childProfileId = null,Object? treezorUserId = null,Object? errorMessage = null,Object? saveSuccess = null,}) {
|
||||
return _then(_EditChildProfileViewState(
|
||||
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSaving: null == isSaving ? _self.isSaving : isSaving // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isSigning: null == isSigning ? _self.isSigning : isSigning // ignore: cast_nullable_to_non_nullable
|
||||
as bool,showPin: null == showPin ? _self.showPin : showPin // ignore: cast_nullable_to_non_nullable
|
||||
as bool,pin: null == pin ? _self.pin : pin // ignore: cast_nullable_to_non_nullable
|
||||
as String,firstName: null == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
|
||||
as String,lastName: null == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
|
||||
as String,address: null == address ? _self.address : address // ignore: cast_nullable_to_non_nullable
|
||||
as String,childProfileId: null == childProfileId ? _self.childProfileId : childProfileId // ignore: cast_nullable_to_non_nullable
|
||||
as String,treezorUserId: null == treezorUserId ? _self.treezorUserId : treezorUserId // ignore: cast_nullable_to_non_nullable
|
||||
as String,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,saveSuccess: null == saveSuccess ? _self.saveSuccess : saveSuccess // ignore: cast_nullable_to_non_nullable
|
||||
as bool,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
|
||||
import '../../presentation/state/home_view_model.dart';
|
||||
import '../child_wallet/child_data_provider.dart';
|
||||
import 'extract_view_state.dart';
|
||||
|
||||
@@ -92,8 +91,7 @@ class ExtractViewModel extends Notifier<ExtractViewState> {
|
||||
);
|
||||
|
||||
if (!ref.mounted) return;
|
||||
ref.read(childDataProvider(childId).notifier).load();
|
||||
ref.read(homeViewModelProvider.notifier).refreshChildWallet(childId);
|
||||
ref.read(walletRefreshProvider.notifier).refresh();
|
||||
ref.read(parentWalletBalanceProvider.notifier).applyOptimisticPayin(amount);
|
||||
state = state.copyWith(isSubmitting: false, success: true);
|
||||
} catch (e) {
|
||||
|
||||
@@ -37,32 +37,20 @@ class HomeScreen extends ConsumerWidget {
|
||||
margin: EdgeInsets.all(30),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text.rich(
|
||||
Align(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text.rich(
|
||||
TextSpan(
|
||||
text: context.translate(I18n.homeGreeting),
|
||||
style: TextStyle(fontSize: 25),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: context.translate(I18n.homeGreeting),
|
||||
style: TextStyle(fontSize: 25),
|
||||
children: <TextSpan>[
|
||||
TextSpan(
|
||||
text: viewState.userName,
|
||||
style: TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
],
|
||||
text: viewState.userName,
|
||||
style: TextStyle(fontWeight: FontWeight.w500),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () =>
|
||||
navigationContract.pushTo(AppRoutes.deviceSetup),
|
||||
icon: Icon(
|
||||
Icons.person_add_outlined,
|
||||
color: theme.getColorFor(ThemeCode.textPrimary),
|
||||
),
|
||||
tooltip: context.translate(I18n.homeAddAnotherKid),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const ChildWalletsSlider(),
|
||||
Align(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
|
||||
|
||||
abstract class DevicesRemoteDatasource {
|
||||
Future<void> deleteDevice({required String userId, required String deviceId});
|
||||
Future<void> deleteDevice({required String deviceId});
|
||||
|
||||
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request});
|
||||
Future<void> updateDevice({required UpdateDeviceRequestEntity request});
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class DevicesRemoteDatasourceImpl implements DevicesRemoteDatasource {
|
||||
final QuestiaRepository _repository;
|
||||
|
||||
@override
|
||||
Future<void> deleteDevice({required String userId, required String deviceId}) async {
|
||||
Future<void> deleteDevice({required String deviceId}) async {
|
||||
try {
|
||||
await _repository.delete<void>(
|
||||
'/devices/$deviceId',
|
||||
@@ -23,7 +23,7 @@ class DevicesRemoteDatasourceImpl implements DevicesRemoteDatasource {
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request}) async {
|
||||
Future<void> updateDevice({required UpdateDeviceRequestEntity request}) async {
|
||||
try {
|
||||
final body = request.toModel().toJson();
|
||||
await _repository.put<void>(
|
||||
|
||||
@@ -9,12 +9,12 @@ class DevicesRepositoryImpl implements DevicesRepository {
|
||||
final DevicesRemoteDatasource _remote;
|
||||
|
||||
@override
|
||||
Future<void> deleteDevice({required String userId, required String deviceId}) {
|
||||
return _remote.deleteDevice(userId: userId, deviceId: deviceId);
|
||||
Future<void> deleteDevice({required String deviceId}) {
|
||||
return _remote.deleteDevice(deviceId: deviceId);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> updateDevice({required String userId, required UpdateDeviceRequestEntity request}) {
|
||||
return _remote.updateDevice(userId: userId, request: request);
|
||||
Future<void> updateDevice({required UpdateDeviceRequestEntity request}) {
|
||||
return _remote.updateDevice(request: request);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
|
||||
|
||||
abstract class DevicesRepository {
|
||||
Future<void> deleteDevice({required String userId, required String deviceId});
|
||||
Future<void> deleteDevice({required String deviceId});
|
||||
|
||||
Future<void> updateDevice({
|
||||
required String userId,
|
||||
required UpdateDeviceRequestEntity request
|
||||
});
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ class ChangePasswordScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final password = ref.watch(
|
||||
changePasswordViewModelProvider.select((s)=>s.newPassword)
|
||||
);
|
||||
|
||||
return LegacyPageLayout(
|
||||
theme: theme,
|
||||
@@ -28,11 +31,11 @@ class ChangePasswordScreen extends ConsumerWidget {
|
||||
child: SingleChildScrollView(child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const _PasswordSection(),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||
const _NewPasswordSection(),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||
const _RepeatPasswordSection(),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
|
||||
_PasswordCriteriaList(password: password),
|
||||
const _ErrorMessageSection()
|
||||
],
|
||||
))
|
||||
@@ -42,29 +45,6 @@ class ChangePasswordScreen extends ConsumerWidget {
|
||||
}
|
||||
}
|
||||
|
||||
class _PasswordSection extends ConsumerWidget {
|
||||
|
||||
const _PasswordSection();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
|
||||
final vm = ref.read(changePasswordViewModelProvider.notifier);
|
||||
final showPassword = ref.watch(
|
||||
changePasswordViewModelProvider.select((s)=>s.showCurrentPassword)
|
||||
);
|
||||
|
||||
return CustomTextField(
|
||||
controller: vm.currentPasswordController,
|
||||
hint: '********',
|
||||
label: context.translate(I18n.password),
|
||||
showPassword: showPassword,
|
||||
onVisibilityChanged: vm.toggleCurrentPasswordVisibility,
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class _NewPasswordSection extends ConsumerWidget {
|
||||
|
||||
const _NewPasswordSection();
|
||||
@@ -111,6 +91,89 @@ class _RepeatPasswordSection extends ConsumerWidget {
|
||||
|
||||
}
|
||||
|
||||
class _PasswordCriteriaList extends StatelessWidget {
|
||||
final String password;
|
||||
|
||||
const _PasswordCriteriaList({required this.password});
|
||||
|
||||
static final _upperRegex = RegExp(r'[A-Z]');
|
||||
static final _digitRegex = RegExp(r'[0-9]');
|
||||
static final _specialRegex =
|
||||
RegExp(r'[!@#$%^&*(),.?":{}|<>\-_+=\[\]\\\/~`]');
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final hasInput = password.isNotEmpty;
|
||||
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
spacing: 6,
|
||||
children: [
|
||||
_CriteriaRow(
|
||||
label: context.translate(I18n.passwordLength),
|
||||
met: password.length >= 8,
|
||||
hasInput: hasInput,
|
||||
),
|
||||
_CriteriaRow(
|
||||
label: context.translate(I18n.passwordCapital),
|
||||
met: _upperRegex.hasMatch(password),
|
||||
hasInput: hasInput,
|
||||
),
|
||||
_CriteriaRow(
|
||||
label: context.translate(I18n.passwordNumber),
|
||||
met: _digitRegex.hasMatch(password),
|
||||
hasInput: hasInput,
|
||||
),
|
||||
_CriteriaRow(
|
||||
label: context.translate(I18n.passwordSpecial),
|
||||
met: _specialRegex.hasMatch(password),
|
||||
hasInput: hasInput,
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _CriteriaRow extends StatelessWidget {
|
||||
final String label;
|
||||
final bool met;
|
||||
final bool hasInput;
|
||||
|
||||
const _CriteriaRow({
|
||||
required this.label,
|
||||
required this.met,
|
||||
required this.hasInput,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final Color color;
|
||||
final IconData icon;
|
||||
|
||||
if (!hasInput) {
|
||||
color = Colors.grey;
|
||||
icon = Icons.circle_outlined;
|
||||
} else if (met) {
|
||||
color = Colors.green;
|
||||
icon = Icons.check_circle;
|
||||
} else {
|
||||
color = Colors.red.shade400;
|
||||
icon = Icons.cancel;
|
||||
}
|
||||
|
||||
return Row(
|
||||
spacing: 8,
|
||||
children: [
|
||||
Icon(icon, size: 16, color: color),
|
||||
Text(
|
||||
label,
|
||||
style: TextStyle(fontSize: 13, color: color),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _ErrorMessageSection extends ConsumerWidget {
|
||||
|
||||
const _ErrorMessageSection();
|
||||
@@ -136,7 +199,9 @@ class _ErrorMessageSection extends ConsumerWidget {
|
||||
),
|
||||
],
|
||||
);
|
||||
} else return SizedBox.shrink();
|
||||
} else {
|
||||
return SizedBox.shrink();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ NotifierProvider.autoDispose<ChangePasswordViewModel, ChangePasswordViewState>(
|
||||
class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
late final ChangePasswordUseCase _changePasswordUseCase;
|
||||
|
||||
late final TextEditingController currentPasswordController;
|
||||
late final TextEditingController newPasswordController;
|
||||
late final TextEditingController repeatPasswordController;
|
||||
late final TextEditingController passwordController;
|
||||
@@ -29,10 +28,6 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
}
|
||||
|
||||
void _initControllers() {
|
||||
|
||||
currentPasswordController = TextEditingController();
|
||||
currentPasswordController.addListener(_onCurrentPasswordChanged);
|
||||
|
||||
newPasswordController = TextEditingController();
|
||||
newPasswordController.addListener(_onNewPasswordChanged);
|
||||
|
||||
@@ -60,17 +55,6 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
);
|
||||
}
|
||||
|
||||
void _onCurrentPasswordChanged() {
|
||||
final value = currentPasswordController.text;
|
||||
|
||||
if (value == state.currentPassword) return;
|
||||
|
||||
state = state.copyWith(
|
||||
currentPassword: value,
|
||||
errorMessage: ''
|
||||
);
|
||||
}
|
||||
|
||||
void _onNewPasswordChanged() {
|
||||
final value = newPasswordController.text;
|
||||
|
||||
@@ -94,11 +78,14 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
}
|
||||
|
||||
bool _validateForm() {
|
||||
if (state.currentPassword.trim().isEmpty){
|
||||
state = state.copyWith(errorMessage: 'errorMessageCurrentPasswordIsEmpty');
|
||||
return false;
|
||||
}
|
||||
if (state.newPassword.trim().isEmpty){
|
||||
final _upperRegex = RegExp(r'[A-Z]');
|
||||
final _digitRegex = RegExp(r'[0-9]');
|
||||
final _specialRegex =
|
||||
RegExp(r'[!@#$%^&*(),.?":{}|<>\-_+=\[\]\\\/~`]');
|
||||
|
||||
final password = state.newPassword.trim();
|
||||
|
||||
if (password.isEmpty){
|
||||
state = state.copyWith(errorMessage: 'errorMessageNewPasswordIsEmpty');
|
||||
return false;
|
||||
}
|
||||
@@ -106,10 +93,26 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
state = state.copyWith(errorMessage: 'errorMessageRepeatPasswordIsEmpty');
|
||||
return false;
|
||||
}
|
||||
if (state.newPassword.trim() != state.repeatPassword.trim()){
|
||||
if (password != state.repeatPassword.trim()){
|
||||
state = state.copyWith(errorMessage: 'errorMessagePasswordsDontMatch');
|
||||
return false;
|
||||
}
|
||||
if (password.length < 8){
|
||||
state = state.copyWith(errorMessage: 'errorPasswordMinLength');
|
||||
return false;
|
||||
}
|
||||
if (!_upperRegex.hasMatch(password)) {
|
||||
state = state.copyWith(errorMessage: 'errorPasswordUppercase');
|
||||
return false;
|
||||
}
|
||||
if (!_digitRegex.hasMatch(password)) {
|
||||
state = state.copyWith(errorMessage: 'errorPasswordDigits');
|
||||
return false;
|
||||
}
|
||||
if (!_specialRegex.hasMatch(password)) {
|
||||
state = state.copyWith(errorMessage: 'errorPasswordSpecial');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -155,9 +158,6 @@ class ChangePasswordViewModel extends Notifier<ChangePasswordViewState> {
|
||||
}
|
||||
|
||||
void disposeControllers() {
|
||||
currentPasswordController.removeListener(_onCurrentPasswordChanged);
|
||||
currentPasswordController.dispose();
|
||||
|
||||
newPasswordController.removeListener(_onNewPasswordChanged);
|
||||
newPasswordController.dispose();
|
||||
|
||||
|
||||
@@ -7,10 +7,8 @@ abstract class ChangePasswordViewState with _$ChangePasswordViewState {
|
||||
const factory ChangePasswordViewState({
|
||||
@Default(false) bool isLoading,
|
||||
@Default(false) bool isComplete,
|
||||
@Default(false) bool showCurrentPassword,
|
||||
@Default(false) bool showNewPassword,
|
||||
@Default(false) bool showRepeatedPassword,
|
||||
@Default('') String currentPassword,
|
||||
@Default('') String newPassword,
|
||||
@Default('') String repeatPassword,
|
||||
@Default('') String errorMessage
|
||||
|
||||
@@ -27,16 +27,20 @@ class LinkedDevicesScreen extends ConsumerWidget {
|
||||
title: context.translate(I18n.linkedDevices),
|
||||
showEdit: true,
|
||||
onEditChange: vm.toggleIsEditing,
|
||||
body: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index)=>_LinkedDeviceCard(
|
||||
device: state.linkedDevices[index],
|
||||
isEditing: state.isEditing,
|
||||
onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: SizeUtils.getByScreen(small: 10, big: 12)),
|
||||
child: ListView.separated(
|
||||
itemBuilder: (BuildContext context, int index)=>_LinkedDeviceCard(
|
||||
navigationContract: navigationContract,
|
||||
device: state.linkedDevices[index],
|
||||
isEditing: state.isEditing,
|
||||
onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]),
|
||||
),
|
||||
separatorBuilder: (BuildContext context, int index)=>SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 18, big: 17)
|
||||
),
|
||||
itemCount: state.linkedDevices.length
|
||||
),
|
||||
separatorBuilder: (BuildContext context, int index)=>SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 18, big: 17)
|
||||
),
|
||||
itemCount: state.linkedDevices.length
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -44,11 +48,13 @@ class LinkedDevicesScreen extends ConsumerWidget {
|
||||
|
||||
class _LinkedDeviceCard extends ConsumerWidget {
|
||||
|
||||
final NavigationContract navigationContract;
|
||||
final DeviceEntity device;
|
||||
final bool isEditing;
|
||||
final Function onDelete;
|
||||
|
||||
const _LinkedDeviceCard({
|
||||
required this.navigationContract,
|
||||
required this.device,
|
||||
required this.isEditing,
|
||||
required this.onDelete,
|
||||
@@ -76,7 +82,7 @@ class _LinkedDeviceCard extends ConsumerWidget {
|
||||
shape: BoxShape.circle,
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
|
||||
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 8, big: 12)),
|
||||
child: Icon(SFIcons.watch,
|
||||
size: SizeUtils.getByScreen(small: 40, big: 44),
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||
@@ -110,7 +116,10 @@ class _LinkedDeviceCard extends ConsumerWidget {
|
||||
),
|
||||
child: IconButton(
|
||||
onPressed: (){showDialog(context: context, builder: (context)=>Dialog(
|
||||
child: DeleteDeviceDialog(device: device),
|
||||
child: DeleteDeviceDialog(
|
||||
navigationContract: navigationContract,
|
||||
device: device,
|
||||
),
|
||||
));},
|
||||
icon: Icon(
|
||||
Icons.close,
|
||||
|
||||
@@ -70,19 +70,32 @@ class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> deleteDevice(DeviceEntity device) async {
|
||||
Future<void> deleteDevice(DeviceEntity device) async {
|
||||
try {
|
||||
await _devicesRepository.deleteDevice(userId: state.loggedUser!.id, deviceId: device.identificator);
|
||||
List<DeviceEntity> newList = state.linkedDevices;
|
||||
newList.remove(device);
|
||||
|
||||
state = state.copyWith(
|
||||
linkedDevices: newList
|
||||
isLoading: true,
|
||||
isComplete: false,
|
||||
);
|
||||
|
||||
return true;
|
||||
await _devicesRepository.deleteDevice(deviceId: device.id);
|
||||
List<DeviceEntity> newList = state.linkedDevices.toList();
|
||||
newList.remove(device);
|
||||
|
||||
if (device == state.selectedDevice) {
|
||||
ref.invalidate(selectedDeviceProvider);
|
||||
}
|
||||
|
||||
state = state.copyWith(
|
||||
linkedDevices: newList,
|
||||
isLoading: false,
|
||||
isComplete: true,
|
||||
);
|
||||
} catch (e) {
|
||||
return false;
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -102,9 +115,7 @@ class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
|
||||
if (deviceName.isEmpty) return;
|
||||
|
||||
try {
|
||||
final userId = state.loggedUser!.id;
|
||||
_devicesRepository.updateDevice(
|
||||
userId: userId,
|
||||
request: _toRequest(device));
|
||||
|
||||
} catch(e) {
|
||||
@@ -114,8 +125,6 @@ class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
|
||||
errorMessage: e.toString()
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void disposeControllers() {
|
||||
|
||||
@@ -2,15 +2,20 @@ import 'package:account/src/features/linked_devices/presentation/state/linked_de
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
class DeleteDeviceDialog extends ConsumerWidget {
|
||||
|
||||
final NavigationContract navigationContract;
|
||||
final DeviceEntity device;
|
||||
|
||||
const DeleteDeviceDialog({required this.device});
|
||||
const DeleteDeviceDialog({
|
||||
required this.navigationContract,
|
||||
required this.device
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
@@ -21,15 +26,15 @@ class DeleteDeviceDialog extends ConsumerWidget {
|
||||
return Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 32, vertical: 30),
|
||||
big: EdgeInsets.symmetric(horizontal: 30, vertical: 28)
|
||||
big: EdgeInsets.symmetric(horizontal: 24, vertical: 18)
|
||||
),
|
||||
width: SizeUtils.getByScreen(small: 360, big: 350),
|
||||
height: SizeUtils.getByScreen(small: 195, big: 185),
|
||||
height: SizeUtils.getByScreen(small: 184, big: 160),
|
||||
child: Column(
|
||||
children: [
|
||||
Text(context.translate(I18n.deleteDeviceDialog),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)),
|
||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 17, big: 16)),
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)),
|
||||
Row(
|
||||
@@ -46,7 +51,20 @@ class DeleteDeviceDialog extends ConsumerWidget {
|
||||
Expanded(child: PrimaryButton(
|
||||
onPressed: () async {
|
||||
await vm.deleteDevice(device);
|
||||
Navigator.pop(context);
|
||||
|
||||
final isComplete = ref.read(
|
||||
linkedDevicesViewModelProvider.select((s)=>s.isComplete)
|
||||
);
|
||||
if (isComplete) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
|
||||
final noMoreDevices = ref.read(
|
||||
linkedDevicesViewModelProvider.select((s)=>s.linkedDevices)
|
||||
).isEmpty;
|
||||
if (noMoreDevices) {
|
||||
navigationContract.goTo(AppRoutes.legacyDeviceSetup);
|
||||
}
|
||||
},
|
||||
text: context.translate(I18n.delete),
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||
|
||||
@@ -77,7 +77,7 @@ class PersonalDataScreen extends ConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Text(context.translate(I18n.personalDataMessage)),
|
||||
const SizedBox(height: 14),
|
||||
const SizedBox(height: 4),
|
||||
const _SaveButton(),
|
||||
],
|
||||
),
|
||||
@@ -169,12 +169,33 @@ class _PhoneField extends ConsumerWidget {
|
||||
final hint = ref.watch(
|
||||
personalDataViewModelProvider.select((s) => s.user?.phone ?? ''),
|
||||
);
|
||||
final dialCode = ref.read(
|
||||
personalDataViewModelProvider.select((s)=>s.dialCode)
|
||||
);
|
||||
|
||||
return CustomTextField(
|
||||
controller: vm.phoneController,
|
||||
hint: hint,
|
||||
label: context.translate(I18n.phoneLabel),
|
||||
keyboardType: TextInputType.phone,
|
||||
return Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
initialSelection: dialCode,
|
||||
onChanged: (country) {
|
||||
vm.updateDialCode(
|
||||
country.dialCode ?? dialCode,
|
||||
);
|
||||
},
|
||||
width: 80,
|
||||
),
|
||||
SizedBox(width: 8),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
controller: vm.phoneController,
|
||||
hint: hint,
|
||||
label: context.translate(I18n.phoneLabel),
|
||||
keyboardType: TextInputType.phone,
|
||||
)
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,12 +39,26 @@ class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
|
||||
state = state.copyWith(user: user, isLoading: false);
|
||||
}
|
||||
|
||||
void updateDialCode(String value) {
|
||||
if (value == state.dialCode) return;
|
||||
|
||||
state = state.copyWith(
|
||||
dialCode: value,
|
||||
errorMessage: '',
|
||||
);
|
||||
}
|
||||
|
||||
bool get _hasChanges =>
|
||||
firstNameController.text.trim().isNotEmpty ||
|
||||
lastNameController.text.trim().isNotEmpty ||
|
||||
phoneController.text.trim().isNotEmpty;
|
||||
|
||||
UpdateUserRequestEntity _toRequest() {
|
||||
final dialCode = state.dialCode;
|
||||
final fullPhone = phoneController.text.trim().isNotEmpty
|
||||
? dialCode+phoneController.text.trim()
|
||||
: null;
|
||||
|
||||
return UpdateUserRequestEntity(
|
||||
firstName: firstNameController.text.trim().isNotEmpty
|
||||
? firstNameController.text.trim()
|
||||
@@ -52,9 +66,7 @@ class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
|
||||
lastName: lastNameController.text.trim().isNotEmpty
|
||||
? lastNameController.text.trim()
|
||||
: null,
|
||||
phone: phoneController.text.trim().isNotEmpty
|
||||
? phoneController.text.trim()
|
||||
: null,
|
||||
phone: fullPhone,
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ abstract class PersonalDataViewState with _$PersonalDataViewState {
|
||||
const factory PersonalDataViewState({
|
||||
@Default(true) bool isLoading,
|
||||
@Default(false) bool isComplete,
|
||||
@Default('+34') String dialCode,
|
||||
UserEntity? user,
|
||||
@Default('') String errorMessage,
|
||||
}) = _PersonalDataViewState;
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$PersonalDataViewState {
|
||||
|
||||
bool get isLoading; bool get isComplete; UserEntity? get user; String get errorMessage;
|
||||
bool get isLoading; bool get isComplete; String get dialCode; UserEntity? get user; String get errorMessage;
|
||||
/// Create a copy of PersonalDataViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $PersonalDataViewStateCopyWith<PersonalDataViewState> get copyWith => _$Personal
|
||||
|
||||
@override
|
||||
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.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.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.user, user) || other.user == user)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,dialCode,user,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, errorMessage: $errorMessage)';
|
||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, dialCode: $dialCode, user: $user, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $PersonalDataViewStateCopyWith<$Res> {
|
||||
factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isComplete, UserEntity? user, String errorMessage
|
||||
bool isLoading, bool isComplete, String dialCode, UserEntity? user, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -62,11 +62,12 @@ class _$PersonalDataViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of PersonalDataViewState
|
||||
/// 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? errorMessage = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? isComplete = null,Object? dialCode = null,Object? user = freezed,Object? errorMessage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
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,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as bool,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as UserEntity?,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
@@ -165,10 +166,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, String dialCode, UserEntity? user, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PersonalDataViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isComplete,_that.dialCode,_that.user,_that.errorMessage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -186,10 +187,10 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, bool isComplete, String dialCode, UserEntity? user, String errorMessage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PersonalDataViewState():
|
||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isComplete,_that.dialCode,_that.user,_that.errorMessage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -206,10 +207,10 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isComplete, UserEntity? user, String errorMessage)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, bool isComplete, String dialCode, UserEntity? user, String errorMessage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PersonalDataViewState() when $default != null:
|
||||
return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);case _:
|
||||
return $default(_that.isLoading,_that.isComplete,_that.dialCode,_that.user,_that.errorMessage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -221,11 +222,12 @@ return $default(_that.isLoading,_that.isComplete,_that.user,_that.errorMessage);
|
||||
|
||||
|
||||
class _PersonalDataViewState implements PersonalDataViewState {
|
||||
const _PersonalDataViewState({this.isLoading = true, this.isComplete = false, this.user, this.errorMessage = ''});
|
||||
const _PersonalDataViewState({this.isLoading = true, this.isComplete = false, this.dialCode = '+34', this.user, this.errorMessage = ''});
|
||||
|
||||
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool isComplete;
|
||||
@override@JsonKey() final String dialCode;
|
||||
@override final UserEntity? user;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
|
||||
@@ -239,16 +241,16 @@ _$PersonalDataViewStateCopyWith<_PersonalDataViewState> get copyWith => __$Perso
|
||||
|
||||
@override
|
||||
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.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.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.user, user) || other.user == user)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,user,errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,isLoading,isComplete,dialCode,user,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, user: $user, errorMessage: $errorMessage)';
|
||||
return 'PersonalDataViewState(isLoading: $isLoading, isComplete: $isComplete, dialCode: $dialCode, user: $user, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -259,7 +261,7 @@ abstract mixin class _$PersonalDataViewStateCopyWith<$Res> implements $PersonalD
|
||||
factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isLoading, bool isComplete, UserEntity? user, String errorMessage
|
||||
bool isLoading, bool isComplete, String dialCode, UserEntity? user, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -276,11 +278,12 @@ class __$PersonalDataViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of PersonalDataViewState
|
||||
/// 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? errorMessage = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? isComplete = null,Object? dialCode = null,Object? user = freezed,Object? errorMessage = null,}) {
|
||||
return _then(_PersonalDataViewState(
|
||||
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,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as bool,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
|
||||
as UserEntity?,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
|
||||
@@ -96,7 +96,7 @@ packages:
|
||||
source: hosted
|
||||
version: "3.0.3"
|
||||
build_runner:
|
||||
dependency: transitive
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: build_runner
|
||||
sha256: b24597fceb695969d47025c958f3837f9f0122e237c6a22cb082a5ac66c3ca30
|
||||
@@ -338,10 +338,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: fl_chart
|
||||
sha256: "7ca9a40f4eb85949190e54087be8b4d6ac09dc4c54238d782a34cf1f7c011de9"
|
||||
sha256: b938f77d042cbcd822936a7a359a7235bad8bd72070de1f827efc2cc297ac888
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.1"
|
||||
version: "1.2.0"
|
||||
flutter:
|
||||
dependency: "direct main"
|
||||
description: flutter
|
||||
@@ -367,18 +367,18 @@ packages:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_riverpod
|
||||
sha256: e2026c72738a925a60db30258ff1f29974e40716749f3c9850aabf34ffc1a14c
|
||||
sha256: "4e166be88e1dbbaa34a280bdb744aeae73b7ef25fdf8db7a3bb776760a3648e2"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.2.1"
|
||||
version: "3.3.1"
|
||||
flutter_svg:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
name: flutter_svg
|
||||
sha256: "87fbd7c534435b6c5d9d98b01e1fd527812b82e68ddd8bd35fc45ed0fa8f0a95"
|
||||
sha256: "1ded017b39c8e15c8948ea855070a5ff8ff8b3d5e83f3446e02d6bb12add7ad9"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.2.3"
|
||||
version: "2.2.4"
|
||||
flutter_test:
|
||||
dependency: "direct dev"
|
||||
description: flutter
|
||||
@@ -620,10 +620,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: logger
|
||||
sha256: a7967e31b703831a893bbc3c3dd11db08126fe5f369b5c648a36f821979f5be3
|
||||
sha256: "25aee487596a6257655a1e091ec2ae66bc30e7af663592cc3a27e6591e05035c"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "2.6.2"
|
||||
version: "2.7.0"
|
||||
logging:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1257,10 +1257,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: vector_graphics
|
||||
sha256: a4f059dc26fc8295b5921376600a194c4ec7d55e72f2fe4c7d2831e103d461e6
|
||||
sha256: "7076216a10d5c390315fbe536a30f1254c341e7543e6c4c8a815e591307772b1"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "1.1.19"
|
||||
version: "1.1.20"
|
||||
vector_graphics_codec:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -1361,10 +1361,10 @@ packages:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: webview_flutter_wkwebview
|
||||
sha256: fc0af89d403e1c053f03d023d97550412fa79f35332e2939514c82e6fe633198
|
||||
sha256: "2df8fd9ada04d699b9db8e79aa783a16e5d89b69e5b74009b87e16b59912cf98"
|
||||
url: "https://pub.dev"
|
||||
source: hosted
|
||||
version: "3.23.8"
|
||||
version: "3.24.0"
|
||||
wkt_parser:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
@@ -56,6 +56,7 @@ dependencies:
|
||||
uuid: ^4.5.2
|
||||
qr_flutter: ^4.1.0
|
||||
url_launcher: ^6.3.2
|
||||
build_runner: ^2.7.1
|
||||
|
||||
# The following adds the Cupertino Icons font to your application.
|
||||
# Use with the CupertinoIcons class for iOS style icons.
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
export 'src/core/data/models/latest_positions_response_model.dart';
|
||||
export 'src/core/domain/entities/address_entity.dart';
|
||||
export 'src/core/domain/entities/network_entity.dart';
|
||||
export 'src/core/domain/entities/position_entity.dart';
|
||||
export 'src/core/utils/battery_utils.dart';
|
||||
export 'src/core/utils/date_format_utils.dart';
|
||||
export 'src/features/control_panel/control_panel_builder.dart';
|
||||
export 'src/features/control_panel/presentation/state/control_panel_view_model.dart';
|
||||
export 'src/shared/widgets/device_map.dart';
|
||||
@@ -13,28 +13,21 @@ import 'package:utils/utils.dart';
|
||||
class ControlPanelScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
|
||||
const ControlPanelScreen({
|
||||
super.key,
|
||||
required this.navigationContract,
|
||||
});
|
||||
const ControlPanelScreen({super.key, required this.navigationContract});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
final state = ref.watch(controlPanelViewModelProvider);
|
||||
|
||||
ref.listen(
|
||||
controlPanelViewModelProvider.select((s) => s.errorMessage),
|
||||
(previous, next) {
|
||||
if (next.isNotEmpty) {
|
||||
showTopSnackbar(
|
||||
context,
|
||||
message: next,
|
||||
type: MessageType.error,
|
||||
);
|
||||
}
|
||||
},
|
||||
);
|
||||
ref.listen(controlPanelViewModelProvider.select((s) => s.errorMessage), (
|
||||
previous,
|
||||
next,
|
||||
) {
|
||||
if (next.isNotEmpty) {
|
||||
showTopSnackbar(context, message: next, type: MessageType.error);
|
||||
}
|
||||
});
|
||||
|
||||
if (state.isLoading) {
|
||||
return Scaffold(
|
||||
@@ -90,7 +83,9 @@ class _Header extends ConsumerWidget {
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: SizeUtils.getByScreen(small: 14, big: 14)),
|
||||
padding: EdgeInsets.only(
|
||||
top: SizeUtils.getByScreen(small: 14, big: 14),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Image.asset(
|
||||
@@ -102,17 +97,13 @@ class _Header extends ConsumerWidget {
|
||||
width: SizeUtils.getByScreen(small: 130, big: 140),
|
||||
height: 32,
|
||||
child: CustomDropdown(
|
||||
items: state.devices
|
||||
.map(
|
||||
(DeviceEntity device) {
|
||||
final name = device.carrierName ?? '';
|
||||
return Text(
|
||||
name.length > 10 ? '${name.substring(0, 10)}...' : name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
},
|
||||
)
|
||||
.toList(),
|
||||
items: state.devices.map((DeviceEntity device) {
|
||||
final name = device.carrierName ?? '';
|
||||
return Text(
|
||||
name.length > 10 ? '${name.substring(0, 10)}...' : name,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
);
|
||||
}).toList(),
|
||||
values: state.devices,
|
||||
value: state.selectedDevice,
|
||||
onChanged: (device) {
|
||||
@@ -153,13 +144,13 @@ class _MenuSection extends ConsumerWidget {
|
||||
text: I18n.customerService,
|
||||
),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
||||
_SectionButton(
|
||||
onPressed: () {
|
||||
navigationContract.pushTo(AppRoutes.dashboardHome);
|
||||
},
|
||||
icon: SFIcons.payments,
|
||||
text: I18n.sfPay,
|
||||
),
|
||||
// _SectionButton(
|
||||
// onPressed: () {
|
||||
// navigationContract.pushTo(AppRoutes.dashboardHome);
|
||||
// },
|
||||
// icon: SFIcons.payments,
|
||||
// text: I18n.sfPay,
|
||||
// ),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 7)),
|
||||
_SectionButton(
|
||||
onPressed: () {
|
||||
@@ -267,7 +258,6 @@ class _MapSection extends ConsumerWidget {
|
||||
child: DeviceMap(
|
||||
selectedPosition: state.selectedPosition,
|
||||
selectedDevice: state.selectedDevice,
|
||||
markerSize: 40,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
@@ -5,25 +5,21 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:latlong2/latlong.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
import 'package:sf_shared/sf_shared.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
const _defaultCenter = LatLng(40.4168, -3.7038);
|
||||
const _defaultZoom = 15.0;
|
||||
const _tileServerUrl = 'https://tile.openstreetmap.org/{z}/{x}/{y}.png';
|
||||
|
||||
class DeviceMap extends ConsumerStatefulWidget {
|
||||
final PositionEntity? selectedPosition;
|
||||
final DeviceEntity? selectedDevice;
|
||||
final double markerSize;
|
||||
|
||||
const DeviceMap({
|
||||
super.key,
|
||||
required this.selectedPosition,
|
||||
required this.selectedDevice,
|
||||
this.markerSize = 80,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -62,6 +58,7 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final mapStyle = ref.watch(mapStyleProvider);
|
||||
final initialCenter = widget.selectedPosition != null
|
||||
? LatLng(
|
||||
widget.selectedPosition!.latitude,
|
||||
@@ -78,7 +75,7 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
||||
),
|
||||
children: [
|
||||
TileLayer(
|
||||
urlTemplate: _tileServerUrl,
|
||||
urlTemplate: mapStyle.urlTemplate,
|
||||
userAgentPackageName: 'com.savefamily.sf_platform',
|
||||
),
|
||||
MarkerLayer(
|
||||
@@ -89,15 +86,9 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
||||
widget.selectedPosition!.latitude,
|
||||
widget.selectedPosition!.longitude,
|
||||
),
|
||||
width: widget.markerSize * 2.5,
|
||||
height: widget.markerSize * 1.8,
|
||||
child: Align(
|
||||
alignment: Alignment.topCenter,
|
||||
child: SvgPicture.asset(
|
||||
'assets/shared/images/location.svg',
|
||||
height: widget.markerSize,
|
||||
),
|
||||
),
|
||||
width: 100,
|
||||
height: 100,
|
||||
child: const PulsingLocationMarker(),
|
||||
rotate: true,
|
||||
),
|
||||
],
|
||||
@@ -107,7 +98,7 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
||||
alignment: Alignment.bottomCenter,
|
||||
child: LocationBanner(
|
||||
position: widget.selectedPosition!,
|
||||
battery: widget.selectedDevice?.battery ?? 0,
|
||||
device: widget.selectedDevice,
|
||||
),
|
||||
),
|
||||
],
|
||||
@@ -117,86 +108,156 @@ class _DeviceMapState extends ConsumerState<DeviceMap> {
|
||||
|
||||
class LocationBanner extends ConsumerWidget {
|
||||
final PositionEntity position;
|
||||
final int battery;
|
||||
final DeviceEntity? device;
|
||||
|
||||
const LocationBanner({
|
||||
super.key,
|
||||
required this.position,
|
||||
required this.battery,
|
||||
this.device,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.read(themePortProvider);
|
||||
final batteryIcon = toBatteryIcon(battery);
|
||||
final primaryColor = theme.getColorFor(ThemeCode.legacyPrimary);
|
||||
final batteryValue = device?.battery ?? 0;
|
||||
final batteryIcon = toBatteryIcon(batteryValue);
|
||||
final dateText = formatPositionDate(position.positionDate);
|
||||
|
||||
final localDevice = device;
|
||||
final name = localDevice?.carrierName;
|
||||
final deviceName = localDevice != null
|
||||
? (name != null && name.isNotEmpty ? name : localDevice.identificator)
|
||||
: null;
|
||||
final initial = deviceName != null && deviceName.isNotEmpty
|
||||
? deviceName[0].toUpperCase()
|
||||
: null;
|
||||
|
||||
final addressText = [
|
||||
position.address?.street,
|
||||
position.address?.province,
|
||||
position.address?.country,
|
||||
].whereType<String>().where((s) => s.isNotEmpty).join(', ');
|
||||
|
||||
return Container(
|
||||
height: SizeUtils.getByScreen(small: 60, big: 58),
|
||||
width: SizeUtils.getByScreen(small: 300, big: 298),
|
||||
margin: EdgeInsets.only(
|
||||
bottom: SizeUtils.getByScreen(small: 20, big: 16),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.circular(SizeUtils.getByScreen(small: 9, big: 8)),
|
||||
),
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
SFIcons.location,
|
||||
size: SizeUtils.getByScreen(small: 40, big: 38),
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) {
|
||||
final isCompact = constraints.maxWidth < 320;
|
||||
|
||||
return Container(
|
||||
width: isCompact ? constraints.maxWidth * 0.85 : 340,
|
||||
margin: EdgeInsets.only(bottom: isCompact ? 8 : 16),
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: isCompact ? 8 : 12,
|
||||
vertical: isCompact ? 6 : 10,
|
||||
),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
addressText,
|
||||
overflow: TextOverflow.ellipsis,
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.white,
|
||||
borderRadius: BorderRadius.circular(isCompact ? 10 : 16),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Colors.black.withValues(alpha: 0.1),
|
||||
blurRadius: isCompact ? 6 : 10,
|
||||
offset: const Offset(0, 2),
|
||||
),
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
if (initial != null)
|
||||
Container(
|
||||
width: isCompact ? 30 : 42,
|
||||
height: isCompact ? 30 : 42,
|
||||
decoration: BoxDecoration(
|
||||
color: primaryColor.withValues(alpha: 0.12),
|
||||
shape: BoxShape.circle,
|
||||
),
|
||||
child: Center(
|
||||
child: Text(
|
||||
initial,
|
||||
style: TextStyle(
|
||||
fontSize: isCompact ? 13 : 18,
|
||||
fontWeight: FontWeight.w700,
|
||||
color: primaryColor,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Row(
|
||||
SizedBox(width: isCompact ? 6 : 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Flexible(
|
||||
child: Text(
|
||||
dateText,
|
||||
if (deviceName != null)
|
||||
Text(
|
||||
deviceName,
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||
fontSize: isCompact ? 12 : 14,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: Colors.grey.shade800,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
if (position.networks.isNotEmpty)
|
||||
Text(
|
||||
' | ${position.networks.first.signal}',
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||
if (addressText.isNotEmpty)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: deviceName != null ? 1 : 0),
|
||||
child: Text(
|
||||
addressText,
|
||||
style: TextStyle(
|
||||
fontSize: isCompact ? 9 : 11,
|
||||
color: Colors.grey.shade500,
|
||||
),
|
||||
overflow: TextOverflow.ellipsis,
|
||||
),
|
||||
),
|
||||
Icon(batteryIcon),
|
||||
Text(
|
||||
'$battery%',
|
||||
style: TextStyle(
|
||||
fontSize: SizeUtils.getByScreen(small: 12, big: 11),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Icon(
|
||||
batteryIcon,
|
||||
size: isCompact ? 13 : 16,
|
||||
color: batteryValue > 20
|
||||
? primaryColor
|
||||
: Colors.orange,
|
||||
),
|
||||
const SizedBox(width: 2),
|
||||
Text(
|
||||
'$batteryValue%',
|
||||
style: TextStyle(
|
||||
fontSize: isCompact ? 10 : 12,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: batteryValue > 20
|
||||
? primaryColor
|
||||
: Colors.orange,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
if (!isCompact)
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 3),
|
||||
child: Text(
|
||||
dateText,
|
||||
style: TextStyle(
|
||||
fontSize: 10,
|
||||
color: Colors.grey.shade400,
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,8 @@ class _EditContactScreenState extends ConsumerState<EditContactScreen> {
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final state = ref.watch(contactsViewModelProvider);
|
||||
|
||||
return Scaffold(
|
||||
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
body: SafeArea(
|
||||
@@ -101,10 +103,31 @@ class _EditContactScreenState extends ConsumerState<EditContactScreen> {
|
||||
SizedBox(
|
||||
height: SizeUtils.getByScreen(small: 28, big: 26),
|
||||
),
|
||||
CustomTextField(
|
||||
controller: _phoneController,
|
||||
keyboardType: TextInputType.number,
|
||||
label: context.translate(I18n.phoneNumber),
|
||||
Row(
|
||||
children: [
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
initialSelection: state.dialCode,
|
||||
onChanged: (country) {
|
||||
final vm =
|
||||
ref.read(contactsViewModelProvider.notifier);
|
||||
vm.updateDialCode(
|
||||
country.dialCode ?? state.dialCode,
|
||||
);
|
||||
},
|
||||
width: 80,
|
||||
),
|
||||
SizedBox(
|
||||
width: SizeUtils.getByScreen(small: 10, big: 10, xl: 6),
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
controller: _phoneController,
|
||||
keyboardType: TextInputType.number,
|
||||
label: context.translate(I18n.phoneNumber),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -48,6 +48,15 @@ class ContactsViewModel extends Notifier<ContactsViewState> {
|
||||
state = state.copyWith(isEditing: !state.isEditing);
|
||||
}
|
||||
|
||||
void updateDialCode(String value) {
|
||||
if (value == state.dialCode) return;
|
||||
|
||||
state = state.copyWith(
|
||||
dialCode: value,
|
||||
errorMessage: '',
|
||||
);
|
||||
}
|
||||
|
||||
Future<bool> createContact({
|
||||
required String name,
|
||||
required String phone,
|
||||
@@ -64,13 +73,16 @@ class ContactsViewModel extends Notifier<ContactsViewState> {
|
||||
try {
|
||||
state = state.copyWith(isLoading: true, errorMessage: '');
|
||||
|
||||
final dialCode = state.dialCode;
|
||||
final fullPhone = dialCode+phone;
|
||||
|
||||
final user = await ref.read(userInfoProvider.future);
|
||||
if (!ref.mounted) return false;
|
||||
|
||||
final request = CreateContactRequestModel(
|
||||
id: _uuid.v4(),
|
||||
name: name,
|
||||
phone: phone,
|
||||
phone: fullPhone,
|
||||
userId: user.id,
|
||||
);
|
||||
|
||||
@@ -98,10 +110,13 @@ class ContactsViewModel extends Notifier<ContactsViewState> {
|
||||
try {
|
||||
state = state.copyWith(isLoading: true, errorMessage: '');
|
||||
|
||||
final dialCode = state.dialCode;
|
||||
final fullPhone = phone.isEmpty ? contact.phone : dialCode + phone;
|
||||
|
||||
final request = UpdateContactRequestModel(
|
||||
id: contact.id,
|
||||
name: name.isEmpty ? contact.name : name,
|
||||
phone: phone.isEmpty ? contact.phone : phone,
|
||||
phone: fullPhone,
|
||||
);
|
||||
|
||||
await _contactsRepository.updateContact(request: request);
|
||||
|
||||
@@ -8,6 +8,7 @@ part 'contacts_view_state.freezed.dart';
|
||||
abstract class ContactsViewState with _$ContactsViewState {
|
||||
const factory ContactsViewState({
|
||||
@Default([]) List<ContactEntity> contacts,
|
||||
@Default('+34') String dialCode,
|
||||
@Default(true) bool isLoading,
|
||||
@Default(false) bool isEditing,
|
||||
@Default('') String errorMessage,
|
||||
|
||||
@@ -14,7 +14,7 @@ T _$identity<T>(T value) => value;
|
||||
/// @nodoc
|
||||
mixin _$ContactsViewState {
|
||||
|
||||
List<ContactEntity> get contacts; bool get isLoading; bool get isEditing; String get errorMessage;
|
||||
List<ContactEntity> get contacts; String get dialCode; bool get isLoading; bool get isEditing; String get errorMessage;
|
||||
/// Create a copy of ContactsViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@@ -25,16 +25,16 @@ $ContactsViewStateCopyWith<ContactsViewState> get copyWith => _$ContactsViewStat
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactsViewState&&const DeepCollectionEquality().equals(other.contacts, contacts)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is ContactsViewState&&const DeepCollectionEquality().equals(other.contacts, contacts)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(contacts),isLoading,isEditing,errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(contacts),dialCode,isLoading,isEditing,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ContactsViewState(contacts: $contacts, isLoading: $isLoading, isEditing: $isEditing, errorMessage: $errorMessage)';
|
||||
return 'ContactsViewState(contacts: $contacts, dialCode: $dialCode, isLoading: $isLoading, isEditing: $isEditing, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract mixin class $ContactsViewStateCopyWith<$Res> {
|
||||
factory $ContactsViewStateCopyWith(ContactsViewState value, $Res Function(ContactsViewState) _then) = _$ContactsViewStateCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
List<ContactEntity> contacts, bool isLoading, bool isEditing, String errorMessage
|
||||
List<ContactEntity> contacts, String dialCode, bool isLoading, bool isEditing, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -62,10 +62,11 @@ class _$ContactsViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ContactsViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? contacts = null,Object? isLoading = null,Object? isEditing = null,Object? errorMessage = null,}) {
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? contacts = null,Object? dialCode = null,Object? isLoading = null,Object? isEditing = null,Object? errorMessage = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
contacts: null == contacts ? _self.contacts : contacts // ignore: cast_nullable_to_non_nullable
|
||||
as List<ContactEntity>,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as List<ContactEntity>,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
@@ -153,10 +154,10 @@ return $default(_that);case _:
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<ContactEntity> contacts, bool isLoading, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<ContactEntity> contacts, String dialCode, bool isLoading, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactsViewState() when $default != null:
|
||||
return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
return $default(_that.contacts,_that.dialCode,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
@@ -174,10 +175,10 @@ return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessag
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<ContactEntity> contacts, bool isLoading, bool isEditing, String errorMessage) $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<ContactEntity> contacts, String dialCode, bool isLoading, bool isEditing, String errorMessage) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactsViewState():
|
||||
return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
return $default(_that.contacts,_that.dialCode,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
@@ -194,10 +195,10 @@ return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessag
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<ContactEntity> contacts, bool isLoading, bool isEditing, String errorMessage)? $default,) {final _that = this;
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<ContactEntity> contacts, String dialCode, bool isLoading, bool isEditing, String errorMessage)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _ContactsViewState() when $default != null:
|
||||
return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
return $default(_that.contacts,_that.dialCode,_that.isLoading,_that.isEditing,_that.errorMessage);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
@@ -209,7 +210,7 @@ return $default(_that.contacts,_that.isLoading,_that.isEditing,_that.errorMessag
|
||||
|
||||
|
||||
class _ContactsViewState implements ContactsViewState {
|
||||
const _ContactsViewState({final List<ContactEntity> contacts = const [], this.isLoading = true, this.isEditing = false, this.errorMessage = ''}): _contacts = contacts;
|
||||
const _ContactsViewState({final List<ContactEntity> contacts = const [], this.dialCode = '+34', this.isLoading = true, this.isEditing = false, this.errorMessage = ''}): _contacts = contacts;
|
||||
|
||||
|
||||
final List<ContactEntity> _contacts;
|
||||
@@ -219,6 +220,7 @@ class _ContactsViewState implements ContactsViewState {
|
||||
return EqualUnmodifiableListView(_contacts);
|
||||
}
|
||||
|
||||
@override@JsonKey() final String dialCode;
|
||||
@override@JsonKey() final bool isLoading;
|
||||
@override@JsonKey() final bool isEditing;
|
||||
@override@JsonKey() final String errorMessage;
|
||||
@@ -233,16 +235,16 @@ _$ContactsViewStateCopyWith<_ContactsViewState> get copyWith => __$ContactsViewS
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactsViewState&&const DeepCollectionEquality().equals(other._contacts, _contacts)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _ContactsViewState&&const DeepCollectionEquality().equals(other._contacts, _contacts)&&(identical(other.dialCode, dialCode) || other.dialCode == dialCode)&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
|
||||
}
|
||||
|
||||
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_contacts),isLoading,isEditing,errorMessage);
|
||||
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_contacts),dialCode,isLoading,isEditing,errorMessage);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'ContactsViewState(contacts: $contacts, isLoading: $isLoading, isEditing: $isEditing, errorMessage: $errorMessage)';
|
||||
return 'ContactsViewState(contacts: $contacts, dialCode: $dialCode, isLoading: $isLoading, isEditing: $isEditing, errorMessage: $errorMessage)';
|
||||
}
|
||||
|
||||
|
||||
@@ -253,7 +255,7 @@ abstract mixin class _$ContactsViewStateCopyWith<$Res> implements $ContactsViewS
|
||||
factory _$ContactsViewStateCopyWith(_ContactsViewState value, $Res Function(_ContactsViewState) _then) = __$ContactsViewStateCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
List<ContactEntity> contacts, bool isLoading, bool isEditing, String errorMessage
|
||||
List<ContactEntity> contacts, String dialCode, bool isLoading, bool isEditing, String errorMessage
|
||||
});
|
||||
|
||||
|
||||
@@ -270,10 +272,11 @@ class __$ContactsViewStateCopyWithImpl<$Res>
|
||||
|
||||
/// Create a copy of ContactsViewState
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? contacts = null,Object? isLoading = null,Object? isEditing = null,Object? errorMessage = null,}) {
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? contacts = null,Object? dialCode = null,Object? isLoading = null,Object? isEditing = null,Object? errorMessage = null,}) {
|
||||
return _then(_ContactsViewState(
|
||||
contacts: null == contacts ? _self._contacts : contacts // ignore: cast_nullable_to_non_nullable
|
||||
as List<ContactEntity>,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as List<ContactEntity>,dialCode: null == dialCode ? _self.dialCode : dialCode // ignore: cast_nullable_to_non_nullable
|
||||
as String,isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
|
||||
as bool,isEditing: null == isEditing ? _self.isEditing : isEditing // ignore: cast_nullable_to_non_nullable
|
||||
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
|
||||
@@ -25,7 +25,7 @@ class ContactCard extends ConsumerWidget {
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SizeUtils.getByScreen(small: 22, big: 21),
|
||||
vertical: SizeUtils.getByScreen(small: 10, big: 8),
|
||||
vertical: SizeUtils.getByScreen(small: 12, big: 8),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.all(
|
||||
@@ -41,7 +41,7 @@ class ContactCard extends ConsumerWidget {
|
||||
color: theme.getColorFor(ThemeCode.backgroundPrimary),
|
||||
),
|
||||
padding:
|
||||
EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
|
||||
EdgeInsets.all(SizeUtils.getByScreen(small: 10, big: 12)),
|
||||
child: Icon(
|
||||
SFIcons.account,
|
||||
size: SizeUtils.getByScreen(small: 40, big: 44),
|
||||
|
||||
@@ -29,6 +29,10 @@ class _NewContactDialogState extends ConsumerState<NewContactDialog> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
final dialCode = ref.read(
|
||||
contactsViewModelProvider.select((s)=>s.dialCode)
|
||||
);
|
||||
|
||||
return Container(
|
||||
padding: EdgeInsets.symmetric(
|
||||
@@ -82,12 +86,23 @@ class _NewContactDialogState extends ConsumerState<NewContactDialog> {
|
||||
Row(
|
||||
spacing: SizeUtils.getByScreen(small: 10, big: 8),
|
||||
children: [
|
||||
|
||||
CountryPrefixPicker(
|
||||
headerText: context.translate(I18n.selectYourCountry),
|
||||
initialSelection: dialCode,
|
||||
onChanged: (country) {
|
||||
final vm = ref.read(contactsViewModelProvider.notifier);
|
||||
vm.updateDialCode(
|
||||
country.dialCode ?? dialCode,
|
||||
);
|
||||
},
|
||||
width: 80,
|
||||
),
|
||||
Expanded(
|
||||
child: CustomTextField(
|
||||
controller: _phoneController,
|
||||
hint: context.translate(I18n.phoneNumber),
|
||||
keyboardType: TextInputType.phone,
|
||||
readOnly: true,
|
||||
),
|
||||
),
|
||||
DecoratedBox(
|
||||
|
||||
@@ -130,6 +130,31 @@ class _HealthScreenState extends ConsumerState<HealthScreen>
|
||||
),
|
||||
],
|
||||
),
|
||||
footer: _SaveSection()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class _SaveSection extends ConsumerWidget{
|
||||
|
||||
const _SaveSection();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.read(themePortProvider);
|
||||
|
||||
final vm = ref.read(healthViewModelProvider.notifier);
|
||||
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 10),
|
||||
child:
|
||||
PrimaryButton(
|
||||
onPressed: () async {
|
||||
await vm.measure();
|
||||
},
|
||||
text: context.translate(I18n.measure),
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,14 @@ final healthViewModelProvider =
|
||||
|
||||
class HealthViewModel extends Notifier<HealthViewState> {
|
||||
late final HealthRepository _repository;
|
||||
late final CommandsRepository _commandsRepository;
|
||||
|
||||
static const int _historyPageSize = 20;
|
||||
|
||||
@override
|
||||
HealthViewState build() {
|
||||
_repository = ref.read(healthRepositoryProvider);
|
||||
_commandsRepository = ref.read(commandsRepositoryProvider);
|
||||
_init();
|
||||
return const HealthViewState();
|
||||
}
|
||||
@@ -243,4 +245,32 @@ class HealthViewModel extends Notifier<HealthViewState> {
|
||||
final msg = e.toString();
|
||||
return msg.startsWith('Exception: ') ? msg.substring(11) : msg;
|
||||
}
|
||||
|
||||
Future<void> measure() async {
|
||||
|
||||
try {
|
||||
state = state.copyWith(
|
||||
isLoading: true,
|
||||
);
|
||||
|
||||
final device = ref.read(selectedDeviceProvider);
|
||||
if (device == null) return;
|
||||
|
||||
final request = SendCommandRequestModel(
|
||||
device: device.identificator,
|
||||
command: DeviceCommand.requestHeartRate,
|
||||
);
|
||||
|
||||
await _commandsRepository.send(request: request);
|
||||
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
);
|
||||
} catch (e) {
|
||||
state = state.copyWith(
|
||||
isLoading: false,
|
||||
errorMessage: e.toString(),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:navigation/navigation_contract.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
import 'widgets/activation_code_dialog.dart';
|
||||
|
||||
class LegacyDeviceSetupScreen extends ConsumerWidget {
|
||||
final NavigationContract navigationContract;
|
||||
@@ -54,7 +57,7 @@ class LegacyDeviceSetupScreen extends ConsumerWidget {
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(top: 12, left: 8, right: 8),
|
||||
padding: EdgeInsets.only(top: SizeUtils.getByScreen(small: 4, big: 12), left: 8, right: 8),
|
||||
child: Row(
|
||||
children: [
|
||||
if (isIntro)
|
||||
@@ -114,6 +117,9 @@ class LegacyDeviceSetupScreen extends ConsumerWidget {
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (state.step == LegacyAddKidStep.scanWatch) {
|
||||
showActivationCodeDialog(context);
|
||||
}
|
||||
await vm.next();
|
||||
},
|
||||
theme: theme,
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
class LegacyIntroStepScreen extends ConsumerWidget {
|
||||
const LegacyIntroStepScreen({super.key});
|
||||
@@ -11,29 +12,34 @@ class LegacyIntroStepScreen extends ConsumerWidget {
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final theme = ref.watch(themePortProvider);
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.translate(I18n.deviceSetup_intro_title),
|
||||
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
context.translate(I18n.deviceSetup_intro_subtitle),
|
||||
style: TextStyle(fontSize: 18),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
LegacyNumberedSteps(
|
||||
steps: [
|
||||
context.translate(I18n.deviceSetup_intro_step_1),
|
||||
context.translate(I18n.deviceSetup_intro_step_2),
|
||||
],
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||
),
|
||||
],
|
||||
return Padding(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal: SizeUtils.getByScreen(small: 8, big: 2)
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
context.translate(I18n.deviceSetup_intro_title),
|
||||
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(height: 30),
|
||||
Text(
|
||||
context.translate(I18n.deviceSetup_intro_subtitle),
|
||||
style: TextStyle(fontSize: 18),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
SizedBox(height: 40),
|
||||
LegacyNumberedSteps(
|
||||
steps: [
|
||||
context.translate(I18n.deviceSetup_intro_step_1),
|
||||
context.translate(I18n.deviceSetup_intro_step_2),
|
||||
],
|
||||
color: theme.getColorFor(ThemeCode.legacyPrimary),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
class LegacyLinkInfoStepScreen extends ConsumerWidget {
|
||||
const LegacyLinkInfoStepScreen({super.key});
|
||||
@@ -13,7 +14,7 @@ class LegacyLinkInfoStepScreen extends ConsumerWidget {
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 30),
|
||||
SizedBox(height: SizeUtils.getByScreen(small: 8, big: 30)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 65),
|
||||
child: Text(
|
||||
|
||||
@@ -147,7 +147,7 @@ class LegacyProfileStepScreen extends ConsumerWidget {
|
||||
|
||||
CustomTextField(
|
||||
label: context.translate(I18n.activationKeyLabel),
|
||||
hint: 'XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX',
|
||||
hint: 'XXXXXXXX',
|
||||
controller: vm.activationKeyController,
|
||||
),
|
||||
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:sf_localizations/sf_localizations.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
void showActivationCodeDialog(BuildContext context) {
|
||||
showDialog(context: context, builder: (context) =>
|
||||
Dialog(
|
||||
backgroundColor: Colors.transparent,
|
||||
child: _ActivationCodeDialog(),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
class _ActivationCodeDialog extends StatelessWidget {
|
||||
|
||||
const _ActivationCodeDialog();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
padding: SizeUtils.getByScreen(
|
||||
small: EdgeInsets.symmetric(horizontal: 14, vertical: 24),
|
||||
big: EdgeInsets.symmetric(horizontal: 12, vertical: 20),
|
||||
),
|
||||
color: Colors.white,
|
||||
child: Text(context.translate(I18n.activationCodeMessage),
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 16, big: 15)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,7 @@ import 'dart:async';
|
||||
import 'package:legacy_auth/src/features/login/presentation/widgets/otp_code_fields.dart';
|
||||
import 'package:design_system/design_system.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:utils/utils.dart';
|
||||
|
||||
class LegacyTwoFactorBottomSheetView extends StatelessWidget {
|
||||
const LegacyTwoFactorBottomSheetView({
|
||||
@@ -88,6 +89,7 @@ class LegacyTwoFactorBottomSheetView extends StatelessWidget {
|
||||
if (isOtpLoading || !_isValidOtp) return;
|
||||
unawaited(onVerify());
|
||||
},
|
||||
gap: SizeUtils.getByScreen(small: 10, big: 8),
|
||||
),
|
||||
const SizedBox(height: 20),
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:control_panel/control_panel.dart';
|
||||
import 'package:location/src/core/data/models/create_frequent_place_request_model.dart';
|
||||
import 'package:location/src/core/data/models/create_geofence_request_model.dart';
|
||||
import 'package:location/src/core/data/models/update_frequent_place_request_model.dart';
|
||||
import 'package:location/src/core/data/models/update_geofence_request_model.dart';
|
||||
import 'package:location/src/core/domain/entities/geofence_entity.dart';
|
||||
import 'package:location/src/core/domain/entities/frequent_place_entity.dart';
|
||||
|
||||
abstract class LocationRemoteDatasource {
|
||||
Future<List<GeofenceEntity>> getGeofences({required String deviceId});
|
||||
Future<GeofenceEntity> createGeofence({required CreateGeofenceRequestModel request});
|
||||
Future<GeofenceEntity> updateGeofence({required UpdateGeofenceRequestModel request});
|
||||
Future<void> deleteGeofence({required String geofenceId});
|
||||
|
||||
Future<List<FrequentPlaceEntity>> getFrequentPlaces({required String deviceId});
|
||||
Future<FrequentPlaceEntity> createFrequentPlace({required CreateFrequentPlaceRequestModel request});
|
||||
Future<FrequentPlaceEntity> updateFrequentPlace({required UpdateFrequentPlaceRequestModel request});
|
||||
Future<void> deleteFrequentPlace({required String frequentPlaceId});
|
||||
|
||||
Future<List<PositionEntity>> getPositionHistory({
|
||||
required String deviceIdentificator,
|
||||
required DateTime from,
|
||||
required DateTime to,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,204 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:control_panel/control_panel.dart';
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:legacy_shared/legacy_shared.dart';
|
||||
import 'package:location/src/core/data/datasource/location_remote_datasource.dart';
|
||||
import 'package:location/src/core/data/models/create_frequent_place_request_model.dart';
|
||||
import 'package:location/src/core/data/models/create_frequent_place_response_model.dart';
|
||||
import 'package:location/src/core/data/models/create_geofence_request_model.dart';
|
||||
import 'package:location/src/core/data/models/create_geofence_response_model.dart';
|
||||
import 'package:location/src/core/data/models/position_history_response_model.dart';
|
||||
import 'package:location/src/core/data/models/update_frequent_place_request_model.dart';
|
||||
import 'package:location/src/core/data/models/update_frequent_place_response_model.dart';
|
||||
import 'package:location/src/core/data/models/update_geofence_request_model.dart';
|
||||
import 'package:location/src/core/data/models/update_geofence_response_model.dart';
|
||||
import 'package:location/src/core/data/models/geofences_response_model.dart';
|
||||
import 'package:location/src/core/data/models/frequent_places_response_model.dart';
|
||||
import 'package:location/src/core/domain/entities/geofence_entity.dart';
|
||||
import 'package:location/src/core/domain/entities/frequent_place_entity.dart';
|
||||
import 'package:sf_infrastructure/sf_infrastructure.dart';
|
||||
|
||||
class LocationRemoteDatasourceImpl implements LocationRemoteDatasource {
|
||||
LocationRemoteDatasourceImpl(this._repository);
|
||||
|
||||
final QuestiaRepository _repository;
|
||||
|
||||
@override
|
||||
Future<List<GeofenceEntity>> getGeofences({
|
||||
required String deviceId,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/devices/$deviceId/geofences',
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) return [];
|
||||
final model = GeofencesResponseModel.fromJson(data);
|
||||
return model.toEntity();
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) return [];
|
||||
throw mapDioError(e, defaultMessage: 'Error getting geofences');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GeofenceEntity> createGeofence({
|
||||
required CreateGeofenceRequestModel request,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.post<Map<String, dynamic>>(
|
||||
'/geofences',
|
||||
body: request.toJson(),
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null) throw Exception('Empty response from server');
|
||||
return CreateGeofenceResponseModel.fromJson(data).toEntity();
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error creating geofence');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<GeofenceEntity> updateGeofence({
|
||||
required UpdateGeofenceRequestModel request,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.put<Map<String, dynamic>>(
|
||||
'/geofences/${request.id}',
|
||||
body: request.toJson(),
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null) throw Exception('Empty response from server');
|
||||
return UpdateGeofenceResponseModel.fromJson(data).toEntity();
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error updating geofence');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteGeofence({required String geofenceId}) async {
|
||||
try {
|
||||
await _repository.delete<Map<String, dynamic>>(
|
||||
'/geofences/$geofenceId',
|
||||
);
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error deleting geofence');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<FrequentPlaceEntity>> getFrequentPlaces({
|
||||
required String deviceId,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/devices/$deviceId/frequent-places',
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) return [];
|
||||
final model = FrequentPlacesResponseModel.fromJson(data);
|
||||
return model.toEntity();
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) return [];
|
||||
throw mapDioError(e, defaultMessage: 'Error getting frequent places');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FrequentPlaceEntity> createFrequentPlace({
|
||||
required CreateFrequentPlaceRequestModel request,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.post<Map<String, dynamic>>(
|
||||
'/frequent-places',
|
||||
body: request.toJson(),
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null) throw Exception('Empty response from server');
|
||||
return CreateFrequentPlaceResponseModel.fromJson(data).toEntity();
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error creating frequent place');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<FrequentPlaceEntity> updateFrequentPlace({
|
||||
required UpdateFrequentPlaceRequestModel request,
|
||||
}) async {
|
||||
try {
|
||||
final response = await _repository.put<Map<String, dynamic>>(
|
||||
'/frequent-places/${request.id}',
|
||||
body: request.toJson(),
|
||||
);
|
||||
final data = response.data;
|
||||
if (data == null) throw Exception('Empty response from server');
|
||||
return UpdateFrequentPlaceResponseModel.fromJson(data).toEntity();
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error updating frequent place');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<void> deleteFrequentPlace({required String frequentPlaceId}) async {
|
||||
try {
|
||||
await _repository.delete<Map<String, dynamic>>(
|
||||
'/frequent-places/$frequentPlaceId',
|
||||
);
|
||||
} on DioException catch (e) {
|
||||
throw mapDioError(e, defaultMessage: 'Error deleting frequent place');
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<PositionEntity>> getPositionHistory({
|
||||
required String deviceIdentificator,
|
||||
required DateTime from,
|
||||
required DateTime to,
|
||||
}) async {
|
||||
try {
|
||||
final fromMs = from.millisecondsSinceEpoch;
|
||||
final toMs = to.millisecondsSinceEpoch;
|
||||
|
||||
final filters = base64Encode(utf8.encode(jsonEncode([
|
||||
{'field': 'positionDate', 'operator': 'gte', 'value': fromMs},
|
||||
{'field': 'positionDate', 'operator': 'lte', 'value': toMs},
|
||||
])));
|
||||
|
||||
final orderBy = base64Encode(utf8.encode(jsonEncode([
|
||||
{'field': 'positionDate', 'sortDirection': 'ASC'},
|
||||
])));
|
||||
|
||||
final allPositions = <PositionEntity>[];
|
||||
int currentPage = 1;
|
||||
int totalPages = 1;
|
||||
|
||||
while (currentPage <= totalPages) {
|
||||
final response = await _repository.get<Map<String, dynamic>>(
|
||||
'/devices/identificator/$deviceIdentificator/positions',
|
||||
queryParameters: {
|
||||
'page': currentPage,
|
||||
'pageSize': 1000,
|
||||
'filters': filters,
|
||||
'orderBy': orderBy,
|
||||
},
|
||||
);
|
||||
|
||||
final data = response.data;
|
||||
if (data == null || data.isEmpty) break;
|
||||
|
||||
final model = PositionHistoryResponseModel.fromJson(data);
|
||||
allPositions.addAll(model.toEntity());
|
||||
totalPages = model.pages;
|
||||
currentPage++;
|
||||
}
|
||||
|
||||
return allPositions
|
||||
.where((p) => p.latitude != 0 || p.longitude != 0)
|
||||
.toList();
|
||||
} on DioException catch (e) {
|
||||
if (e.response?.statusCode == 404) return [];
|
||||
throw mapDioError(e, defaultMessage: 'Error getting position history');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/frequent_places_response_model.dart';
|
||||
|
||||
part 'create_frequent_place_request_model.freezed.dart';
|
||||
part 'create_frequent_place_request_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CreateFrequentPlaceRequestModel
|
||||
with _$CreateFrequentPlaceRequestModel {
|
||||
const factory CreateFrequentPlaceRequestModel({
|
||||
required String id,
|
||||
required String name,
|
||||
required double lat,
|
||||
required double lng,
|
||||
@Default([]) List<WifiInfoResponseModel> wifiList,
|
||||
String? userId,
|
||||
String? delegationId,
|
||||
String? groupId,
|
||||
String? deviceId,
|
||||
}) = _CreateFrequentPlaceRequestModel;
|
||||
|
||||
factory CreateFrequentPlaceRequestModel.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CreateFrequentPlaceRequestModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
// 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_frequent_place_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateFrequentPlaceRequestModel {
|
||||
|
||||
String get id; String get name; double get lat; double get lng; List<WifiInfoResponseModel> get wifiList; String? get userId; String? get delegationId; String? get groupId; String? get deviceId;
|
||||
/// Create a copy of CreateFrequentPlaceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CreateFrequentPlaceRequestModelCopyWith<CreateFrequentPlaceRequestModel> get copyWith => _$CreateFrequentPlaceRequestModelCopyWithImpl<CreateFrequentPlaceRequestModel>(this as CreateFrequentPlaceRequestModel, _$identity);
|
||||
|
||||
/// Serializes this CreateFrequentPlaceRequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateFrequentPlaceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other.wifiList, wifiList)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,lat,lng,const DeepCollectionEquality().hash(wifiList),userId,delegationId,groupId,deviceId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateFrequentPlaceRequestModel(id: $id, name: $name, lat: $lat, lng: $lng, wifiList: $wifiList, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CreateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
factory $CreateFrequentPlaceRequestModelCopyWith(CreateFrequentPlaceRequestModel value, $Res Function(CreateFrequentPlaceRequestModel) _then) = _$CreateFrequentPlaceRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, double lat, double lng, List<WifiInfoResponseModel> wifiList, String? userId, String? delegationId, String? groupId, String? deviceId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CreateFrequentPlaceRequestModelCopyWithImpl<$Res>
|
||||
implements $CreateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
_$CreateFrequentPlaceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CreateFrequentPlaceRequestModel _self;
|
||||
final $Res Function(CreateFrequentPlaceRequestModel) _then;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceRequestModel
|
||||
/// 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? lat = null,Object? lng = null,Object? wifiList = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
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,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self.wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CreateFrequentPlaceRequestModel].
|
||||
extension CreateFrequentPlaceRequestModelPatterns on CreateFrequentPlaceRequestModel {
|
||||
/// 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( _CreateFrequentPlaceRequestModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel() 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( _CreateFrequentPlaceRequestModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel():
|
||||
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( _CreateFrequentPlaceRequestModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel() 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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList, String? userId, String? delegationId, String? groupId, String? deviceId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList, String? userId, String? delegationId, String? groupId, String? deviceId) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel():
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList, String? userId, String? delegationId, String? groupId, String? deviceId)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _CreateFrequentPlaceRequestModel implements CreateFrequentPlaceRequestModel {
|
||||
const _CreateFrequentPlaceRequestModel({required this.id, required this.name, required this.lat, required this.lng, final List<WifiInfoResponseModel> wifiList = const [], this.userId, this.delegationId, this.groupId, this.deviceId}): _wifiList = wifiList;
|
||||
factory _CreateFrequentPlaceRequestModel.fromJson(Map<String, dynamic> json) => _$CreateFrequentPlaceRequestModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final double lat;
|
||||
@override final double lng;
|
||||
final List<WifiInfoResponseModel> _wifiList;
|
||||
@override@JsonKey() List<WifiInfoResponseModel> get wifiList {
|
||||
if (_wifiList is EqualUnmodifiableListView) return _wifiList;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_wifiList);
|
||||
}
|
||||
|
||||
@override final String? userId;
|
||||
@override final String? delegationId;
|
||||
@override final String? groupId;
|
||||
@override final String? deviceId;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CreateFrequentPlaceRequestModelCopyWith<_CreateFrequentPlaceRequestModel> get copyWith => __$CreateFrequentPlaceRequestModelCopyWithImpl<_CreateFrequentPlaceRequestModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$CreateFrequentPlaceRequestModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateFrequentPlaceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other._wifiList, _wifiList)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,lat,lng,const DeepCollectionEquality().hash(_wifiList),userId,delegationId,groupId,deviceId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateFrequentPlaceRequestModel(id: $id, name: $name, lat: $lat, lng: $lng, wifiList: $wifiList, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CreateFrequentPlaceRequestModelCopyWith<$Res> implements $CreateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
factory _$CreateFrequentPlaceRequestModelCopyWith(_CreateFrequentPlaceRequestModel value, $Res Function(_CreateFrequentPlaceRequestModel) _then) = __$CreateFrequentPlaceRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, double lat, double lng, List<WifiInfoResponseModel> wifiList, String? userId, String? delegationId, String? groupId, String? deviceId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CreateFrequentPlaceRequestModelCopyWithImpl<$Res>
|
||||
implements _$CreateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
__$CreateFrequentPlaceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CreateFrequentPlaceRequestModel _self;
|
||||
final $Res Function(_CreateFrequentPlaceRequestModel) _then;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceRequestModel
|
||||
/// 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? lat = null,Object? lng = null,Object? wifiList = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,}) {
|
||||
return _then(_CreateFrequentPlaceRequestModel(
|
||||
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,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self._wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,41 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'create_frequent_place_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_CreateFrequentPlaceRequestModel _$CreateFrequentPlaceRequestModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _CreateFrequentPlaceRequestModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
lat: (json['lat'] as num).toDouble(),
|
||||
lng: (json['lng'] as num).toDouble(),
|
||||
wifiList:
|
||||
(json['wifiList'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => WifiInfoResponseModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList() ??
|
||||
const [],
|
||||
userId: json['userId'] as String?,
|
||||
delegationId: json['delegationId'] as String?,
|
||||
groupId: json['groupId'] as String?,
|
||||
deviceId: json['deviceId'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateFrequentPlaceRequestModelToJson(
|
||||
_CreateFrequentPlaceRequestModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'lat': instance.lat,
|
||||
'lng': instance.lng,
|
||||
'wifiList': instance.wifiList,
|
||||
'userId': instance.userId,
|
||||
'delegationId': instance.delegationId,
|
||||
'groupId': instance.groupId,
|
||||
'deviceId': instance.deviceId,
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/frequent_places_response_model.dart';
|
||||
import 'package:location/src/core/domain/entities/frequent_place_entity.dart';
|
||||
|
||||
part 'create_frequent_place_response_model.freezed.dart';
|
||||
part 'create_frequent_place_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CreateFrequentPlaceResponseModel
|
||||
with _$CreateFrequentPlaceResponseModel {
|
||||
const factory CreateFrequentPlaceResponseModel({
|
||||
required bool isCreated,
|
||||
required FrequentPlaceItemResponseModel item,
|
||||
}) = _CreateFrequentPlaceResponseModel;
|
||||
|
||||
factory CreateFrequentPlaceResponseModel.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$CreateFrequentPlaceResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension CreateFrequentPlaceResponseModelMapper
|
||||
on CreateFrequentPlaceResponseModel {
|
||||
FrequentPlaceEntity toEntity() => item.toEntity();
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// 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_frequent_place_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateFrequentPlaceResponseModel {
|
||||
|
||||
bool get isCreated; FrequentPlaceItemResponseModel get item;
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CreateFrequentPlaceResponseModelCopyWith<CreateFrequentPlaceResponseModel> get copyWith => _$CreateFrequentPlaceResponseModelCopyWithImpl<CreateFrequentPlaceResponseModel>(this as CreateFrequentPlaceResponseModel, _$identity);
|
||||
|
||||
/// Serializes this CreateFrequentPlaceResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateFrequentPlaceResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isCreated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateFrequentPlaceResponseModel(isCreated: $isCreated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CreateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
factory $CreateFrequentPlaceResponseModelCopyWith(CreateFrequentPlaceResponseModel value, $Res Function(CreateFrequentPlaceResponseModel) _then) = _$CreateFrequentPlaceResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isCreated, FrequentPlaceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CreateFrequentPlaceResponseModelCopyWithImpl<$Res>
|
||||
implements $CreateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
_$CreateFrequentPlaceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CreateFrequentPlaceResponseModel _self;
|
||||
final $Res Function(CreateFrequentPlaceResponseModel) _then;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isCreated = null,Object? item = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as FrequentPlaceItemResponseModel,
|
||||
));
|
||||
}
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $FrequentPlaceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CreateFrequentPlaceResponseModel].
|
||||
extension CreateFrequentPlaceResponseModelPatterns on CreateFrequentPlaceResponseModel {
|
||||
/// 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( _CreateFrequentPlaceResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel() 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( _CreateFrequentPlaceResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel():
|
||||
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( _CreateFrequentPlaceResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel() 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 isCreated, FrequentPlaceItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel() when $default != null:
|
||||
return $default(_that.isCreated,_that.item);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 isCreated, FrequentPlaceItemResponseModel item) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel():
|
||||
return $default(_that.isCreated,_that.item);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 isCreated, FrequentPlaceItemResponseModel item)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateFrequentPlaceResponseModel() when $default != null:
|
||||
return $default(_that.isCreated,_that.item);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _CreateFrequentPlaceResponseModel implements CreateFrequentPlaceResponseModel {
|
||||
const _CreateFrequentPlaceResponseModel({required this.isCreated, required this.item});
|
||||
factory _CreateFrequentPlaceResponseModel.fromJson(Map<String, dynamic> json) => _$CreateFrequentPlaceResponseModelFromJson(json);
|
||||
|
||||
@override final bool isCreated;
|
||||
@override final FrequentPlaceItemResponseModel item;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CreateFrequentPlaceResponseModelCopyWith<_CreateFrequentPlaceResponseModel> get copyWith => __$CreateFrequentPlaceResponseModelCopyWithImpl<_CreateFrequentPlaceResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$CreateFrequentPlaceResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateFrequentPlaceResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isCreated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateFrequentPlaceResponseModel(isCreated: $isCreated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CreateFrequentPlaceResponseModelCopyWith<$Res> implements $CreateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
factory _$CreateFrequentPlaceResponseModelCopyWith(_CreateFrequentPlaceResponseModel value, $Res Function(_CreateFrequentPlaceResponseModel) _then) = __$CreateFrequentPlaceResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isCreated, FrequentPlaceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
@override $FrequentPlaceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CreateFrequentPlaceResponseModelCopyWithImpl<$Res>
|
||||
implements _$CreateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
__$CreateFrequentPlaceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CreateFrequentPlaceResponseModel _self;
|
||||
final $Res Function(_CreateFrequentPlaceResponseModel) _then;
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isCreated = null,Object? item = null,}) {
|
||||
return _then(_CreateFrequentPlaceResponseModel(
|
||||
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as FrequentPlaceItemResponseModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of CreateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $FrequentPlaceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,20 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'create_frequent_place_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_CreateFrequentPlaceResponseModel _$CreateFrequentPlaceResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _CreateFrequentPlaceResponseModel(
|
||||
isCreated: json['isCreated'] as bool,
|
||||
item: FrequentPlaceItemResponseModel.fromJson(
|
||||
json['item'] as Map<String, dynamic>,
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateFrequentPlaceResponseModelToJson(
|
||||
_CreateFrequentPlaceResponseModel instance,
|
||||
) => <String, dynamic>{'isCreated': instance.isCreated, 'item': instance.item};
|
||||
@@ -0,0 +1,23 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'create_geofence_request_model.freezed.dart';
|
||||
part 'create_geofence_request_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CreateGeofenceRequestModel with _$CreateGeofenceRequestModel {
|
||||
const factory CreateGeofenceRequestModel({
|
||||
required String id,
|
||||
required String name,
|
||||
String? description,
|
||||
required double latitude,
|
||||
required double longitude,
|
||||
required double radius,
|
||||
String? userId,
|
||||
String? delegationId,
|
||||
String? groupId,
|
||||
String? deviceId,
|
||||
}) = _CreateGeofenceRequestModel;
|
||||
|
||||
factory CreateGeofenceRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateGeofenceRequestModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,304 @@
|
||||
// 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_geofence_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateGeofenceRequestModel {
|
||||
|
||||
String get id; String get name; String? get description; double get latitude; double get longitude; double get radius; String? get userId; String? get delegationId; String? get groupId; String? get deviceId;
|
||||
/// Create a copy of CreateGeofenceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CreateGeofenceRequestModelCopyWith<CreateGeofenceRequestModel> get copyWith => _$CreateGeofenceRequestModelCopyWithImpl<CreateGeofenceRequestModel>(this as CreateGeofenceRequestModel, _$identity);
|
||||
|
||||
/// Serializes this CreateGeofenceRequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateGeofenceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,description,latitude,longitude,radius,userId,delegationId,groupId,deviceId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateGeofenceRequestModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CreateGeofenceRequestModelCopyWith<$Res> {
|
||||
factory $CreateGeofenceRequestModelCopyWith(CreateGeofenceRequestModel value, $Res Function(CreateGeofenceRequestModel) _then) = _$CreateGeofenceRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CreateGeofenceRequestModelCopyWithImpl<$Res>
|
||||
implements $CreateGeofenceRequestModelCopyWith<$Res> {
|
||||
_$CreateGeofenceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CreateGeofenceRequestModel _self;
|
||||
final $Res Function(CreateGeofenceRequestModel) _then;
|
||||
|
||||
/// Create a copy of CreateGeofenceRequestModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
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,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CreateGeofenceRequestModel].
|
||||
extension CreateGeofenceRequestModelPatterns on CreateGeofenceRequestModel {
|
||||
/// 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( _CreateGeofenceRequestModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel() 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( _CreateGeofenceRequestModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel():
|
||||
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( _CreateGeofenceRequestModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel() 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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel():
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _CreateGeofenceRequestModel implements CreateGeofenceRequestModel {
|
||||
const _CreateGeofenceRequestModel({required this.id, required this.name, this.description, required this.latitude, required this.longitude, required this.radius, this.userId, this.delegationId, this.groupId, this.deviceId});
|
||||
factory _CreateGeofenceRequestModel.fromJson(Map<String, dynamic> json) => _$CreateGeofenceRequestModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final String? description;
|
||||
@override final double latitude;
|
||||
@override final double longitude;
|
||||
@override final double radius;
|
||||
@override final String? userId;
|
||||
@override final String? delegationId;
|
||||
@override final String? groupId;
|
||||
@override final String? deviceId;
|
||||
|
||||
/// Create a copy of CreateGeofenceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CreateGeofenceRequestModelCopyWith<_CreateGeofenceRequestModel> get copyWith => __$CreateGeofenceRequestModelCopyWithImpl<_CreateGeofenceRequestModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$CreateGeofenceRequestModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateGeofenceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,description,latitude,longitude,radius,userId,delegationId,groupId,deviceId);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateGeofenceRequestModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CreateGeofenceRequestModelCopyWith<$Res> implements $CreateGeofenceRequestModelCopyWith<$Res> {
|
||||
factory _$CreateGeofenceRequestModelCopyWith(_CreateGeofenceRequestModel value, $Res Function(_CreateGeofenceRequestModel) _then) = __$CreateGeofenceRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CreateGeofenceRequestModelCopyWithImpl<$Res>
|
||||
implements _$CreateGeofenceRequestModelCopyWith<$Res> {
|
||||
__$CreateGeofenceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CreateGeofenceRequestModel _self;
|
||||
final $Res Function(_CreateGeofenceRequestModel) _then;
|
||||
|
||||
/// Create a copy of CreateGeofenceRequestModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,}) {
|
||||
return _then(_CreateGeofenceRequestModel(
|
||||
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,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,37 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'create_geofence_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_CreateGeofenceRequestModel _$CreateGeofenceRequestModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _CreateGeofenceRequestModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String?,
|
||||
latitude: (json['latitude'] as num).toDouble(),
|
||||
longitude: (json['longitude'] as num).toDouble(),
|
||||
radius: (json['radius'] as num).toDouble(),
|
||||
userId: json['userId'] as String?,
|
||||
delegationId: json['delegationId'] as String?,
|
||||
groupId: json['groupId'] as String?,
|
||||
deviceId: json['deviceId'] as String?,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateGeofenceRequestModelToJson(
|
||||
_CreateGeofenceRequestModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'latitude': instance.latitude,
|
||||
'longitude': instance.longitude,
|
||||
'radius': instance.radius,
|
||||
'userId': instance.userId,
|
||||
'delegationId': instance.delegationId,
|
||||
'groupId': instance.groupId,
|
||||
'deviceId': instance.deviceId,
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/geofences_response_model.dart';
|
||||
import 'package:location/src/core/domain/entities/geofence_entity.dart';
|
||||
|
||||
part 'create_geofence_response_model.freezed.dart';
|
||||
part 'create_geofence_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class CreateGeofenceResponseModel with _$CreateGeofenceResponseModel {
|
||||
const factory CreateGeofenceResponseModel({
|
||||
required bool isCreated,
|
||||
required GeofenceItemResponseModel item,
|
||||
}) = _CreateGeofenceResponseModel;
|
||||
|
||||
factory CreateGeofenceResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$CreateGeofenceResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension CreateGeofenceResponseModelMapper on CreateGeofenceResponseModel {
|
||||
GeofenceEntity toEntity() {
|
||||
return GeofenceEntity(
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
description: item.description,
|
||||
latitude: item.latitude,
|
||||
longitude: item.longitude,
|
||||
radius: item.radius,
|
||||
isActive: item.isActive,
|
||||
deviceId: item.deviceId,
|
||||
createdAt: item.createdAt,
|
||||
updatedAt: item.updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// 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_geofence_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$CreateGeofenceResponseModel {
|
||||
|
||||
bool get isCreated; GeofenceItemResponseModel get item;
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$CreateGeofenceResponseModelCopyWith<CreateGeofenceResponseModel> get copyWith => _$CreateGeofenceResponseModelCopyWithImpl<CreateGeofenceResponseModel>(this as CreateGeofenceResponseModel, _$identity);
|
||||
|
||||
/// Serializes this CreateGeofenceResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is CreateGeofenceResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isCreated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateGeofenceResponseModel(isCreated: $isCreated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $CreateGeofenceResponseModelCopyWith<$Res> {
|
||||
factory $CreateGeofenceResponseModelCopyWith(CreateGeofenceResponseModel value, $Res Function(CreateGeofenceResponseModel) _then) = _$CreateGeofenceResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isCreated, GeofenceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
$GeofenceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$CreateGeofenceResponseModelCopyWithImpl<$Res>
|
||||
implements $CreateGeofenceResponseModelCopyWith<$Res> {
|
||||
_$CreateGeofenceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final CreateGeofenceResponseModel _self;
|
||||
final $Res Function(CreateGeofenceResponseModel) _then;
|
||||
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isCreated = null,Object? item = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as GeofenceItemResponseModel,
|
||||
));
|
||||
}
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$GeofenceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $GeofenceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [CreateGeofenceResponseModel].
|
||||
extension CreateGeofenceResponseModelPatterns on CreateGeofenceResponseModel {
|
||||
/// 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( _CreateGeofenceResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel() 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( _CreateGeofenceResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel():
|
||||
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( _CreateGeofenceResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel() 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 isCreated, GeofenceItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel() when $default != null:
|
||||
return $default(_that.isCreated,_that.item);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 isCreated, GeofenceItemResponseModel item) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel():
|
||||
return $default(_that.isCreated,_that.item);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 isCreated, GeofenceItemResponseModel item)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _CreateGeofenceResponseModel() when $default != null:
|
||||
return $default(_that.isCreated,_that.item);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _CreateGeofenceResponseModel implements CreateGeofenceResponseModel {
|
||||
const _CreateGeofenceResponseModel({required this.isCreated, required this.item});
|
||||
factory _CreateGeofenceResponseModel.fromJson(Map<String, dynamic> json) => _$CreateGeofenceResponseModelFromJson(json);
|
||||
|
||||
@override final bool isCreated;
|
||||
@override final GeofenceItemResponseModel item;
|
||||
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$CreateGeofenceResponseModelCopyWith<_CreateGeofenceResponseModel> get copyWith => __$CreateGeofenceResponseModelCopyWithImpl<_CreateGeofenceResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$CreateGeofenceResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _CreateGeofenceResponseModel&&(identical(other.isCreated, isCreated) || other.isCreated == isCreated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isCreated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'CreateGeofenceResponseModel(isCreated: $isCreated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$CreateGeofenceResponseModelCopyWith<$Res> implements $CreateGeofenceResponseModelCopyWith<$Res> {
|
||||
factory _$CreateGeofenceResponseModelCopyWith(_CreateGeofenceResponseModel value, $Res Function(_CreateGeofenceResponseModel) _then) = __$CreateGeofenceResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isCreated, GeofenceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
@override $GeofenceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$CreateGeofenceResponseModelCopyWithImpl<$Res>
|
||||
implements _$CreateGeofenceResponseModelCopyWith<$Res> {
|
||||
__$CreateGeofenceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _CreateGeofenceResponseModel _self;
|
||||
final $Res Function(_CreateGeofenceResponseModel) _then;
|
||||
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isCreated = null,Object? item = null,}) {
|
||||
return _then(_CreateGeofenceResponseModel(
|
||||
isCreated: null == isCreated ? _self.isCreated : isCreated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as GeofenceItemResponseModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of CreateGeofenceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$GeofenceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $GeofenceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,20 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'create_geofence_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_CreateGeofenceResponseModel _$CreateGeofenceResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _CreateGeofenceResponseModel(
|
||||
isCreated: json['isCreated'] as bool,
|
||||
item: GeofenceItemResponseModel.fromJson(
|
||||
json['item'] as Map<String, dynamic>,
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$CreateGeofenceResponseModelToJson(
|
||||
_CreateGeofenceResponseModel instance,
|
||||
) => <String, dynamic>{'isCreated': instance.isCreated, 'item': instance.item};
|
||||
@@ -0,0 +1,81 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/domain/entities/frequent_place_entity.dart';
|
||||
|
||||
part 'frequent_places_response_model.freezed.dart';
|
||||
part 'frequent_places_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class FrequentPlacesResponseModel with _$FrequentPlacesResponseModel {
|
||||
const factory FrequentPlacesResponseModel({
|
||||
required List<FrequentPlaceItemResponseModel> items,
|
||||
int? total,
|
||||
int? page,
|
||||
int? pages,
|
||||
}) = _FrequentPlacesResponseModel;
|
||||
|
||||
factory FrequentPlacesResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$FrequentPlacesResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class FrequentPlaceItemResponseModel
|
||||
with _$FrequentPlaceItemResponseModel {
|
||||
const factory FrequentPlaceItemResponseModel({
|
||||
required String id,
|
||||
required String name,
|
||||
String? userId,
|
||||
String? delegationId,
|
||||
String? groupId,
|
||||
String? deviceId,
|
||||
required double lat,
|
||||
required double lng,
|
||||
@Default([]) List<WifiInfoResponseModel> wifiList,
|
||||
required int createdAt,
|
||||
int? updatedAt,
|
||||
}) = _FrequentPlaceItemResponseModel;
|
||||
|
||||
factory FrequentPlaceItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$FrequentPlaceItemResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class WifiInfoResponseModel with _$WifiInfoResponseModel {
|
||||
const factory WifiInfoResponseModel({
|
||||
required String SSID,
|
||||
required String BSSID,
|
||||
required String signal,
|
||||
}) = _WifiInfoResponseModel;
|
||||
|
||||
factory WifiInfoResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$WifiInfoResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension FrequentPlacesResponseModelMapper on FrequentPlacesResponseModel {
|
||||
List<FrequentPlaceEntity> toEntity() {
|
||||
return items.map((item) => item.toEntity()).toList();
|
||||
}
|
||||
}
|
||||
|
||||
extension FrequentPlaceItemResponseModelMapper
|
||||
on FrequentPlaceItemResponseModel {
|
||||
FrequentPlaceEntity toEntity() {
|
||||
return FrequentPlaceEntity(
|
||||
id: id,
|
||||
name: name,
|
||||
lat: lat,
|
||||
lng: lng,
|
||||
wifiList: wifiList
|
||||
.map(
|
||||
(w) => WifiInfoEntity(
|
||||
ssid: w.SSID,
|
||||
bssid: w.BSSID,
|
||||
signal: w.signal,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
deviceId: deviceId,
|
||||
createdAt: createdAt,
|
||||
updatedAt: updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,860 @@
|
||||
// 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 'frequent_places_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FrequentPlacesResponseModel {
|
||||
|
||||
List<FrequentPlaceItemResponseModel> get items; int? get total; int? get page; int? get pages;
|
||||
/// Create a copy of FrequentPlacesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlacesResponseModelCopyWith<FrequentPlacesResponseModel> get copyWith => _$FrequentPlacesResponseModelCopyWithImpl<FrequentPlacesResponseModel>(this as FrequentPlacesResponseModel, _$identity);
|
||||
|
||||
/// Serializes this FrequentPlacesResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is FrequentPlacesResponseModel&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FrequentPlacesResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $FrequentPlacesResponseModelCopyWith<$Res> {
|
||||
factory $FrequentPlacesResponseModelCopyWith(FrequentPlacesResponseModel value, $Res Function(FrequentPlacesResponseModel) _then) = _$FrequentPlacesResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
List<FrequentPlaceItemResponseModel> items, int? total, int? page, int? pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$FrequentPlacesResponseModelCopyWithImpl<$Res>
|
||||
implements $FrequentPlacesResponseModelCopyWith<$Res> {
|
||||
_$FrequentPlacesResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final FrequentPlacesResponseModel _self;
|
||||
final $Res Function(FrequentPlacesResponseModel) _then;
|
||||
|
||||
/// Create a copy of FrequentPlacesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,Object? total = freezed,Object? page = freezed,Object? pages = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<FrequentPlaceItemResponseModel>,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [FrequentPlacesResponseModel].
|
||||
extension FrequentPlacesResponseModelPatterns on FrequentPlacesResponseModel {
|
||||
/// 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( _FrequentPlacesResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel() 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( _FrequentPlacesResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel():
|
||||
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( _FrequentPlacesResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<FrequentPlaceItemResponseModel> items, int? total, int? page, int? pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_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( List<FrequentPlaceItemResponseModel> items, int? total, int? page, int? pages) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel():
|
||||
return $default(_that.items,_that.total,_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( List<FrequentPlaceItemResponseModel> items, int? total, int? page, int? pages)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlacesResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_that.page,_that.pages);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _FrequentPlacesResponseModel implements FrequentPlacesResponseModel {
|
||||
const _FrequentPlacesResponseModel({required final List<FrequentPlaceItemResponseModel> items, this.total, this.page, this.pages}): _items = items;
|
||||
factory _FrequentPlacesResponseModel.fromJson(Map<String, dynamic> json) => _$FrequentPlacesResponseModelFromJson(json);
|
||||
|
||||
final List<FrequentPlaceItemResponseModel> _items;
|
||||
@override List<FrequentPlaceItemResponseModel> get items {
|
||||
if (_items is EqualUnmodifiableListView) return _items;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
@override final int? total;
|
||||
@override final int? page;
|
||||
@override final int? pages;
|
||||
|
||||
/// Create a copy of FrequentPlacesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FrequentPlacesResponseModelCopyWith<_FrequentPlacesResponseModel> get copyWith => __$FrequentPlacesResponseModelCopyWithImpl<_FrequentPlacesResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$FrequentPlacesResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FrequentPlacesResponseModel&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(_items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FrequentPlacesResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FrequentPlacesResponseModelCopyWith<$Res> implements $FrequentPlacesResponseModelCopyWith<$Res> {
|
||||
factory _$FrequentPlacesResponseModelCopyWith(_FrequentPlacesResponseModel value, $Res Function(_FrequentPlacesResponseModel) _then) = __$FrequentPlacesResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
List<FrequentPlaceItemResponseModel> items, int? total, int? page, int? pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FrequentPlacesResponseModelCopyWithImpl<$Res>
|
||||
implements _$FrequentPlacesResponseModelCopyWith<$Res> {
|
||||
__$FrequentPlacesResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FrequentPlacesResponseModel _self;
|
||||
final $Res Function(_FrequentPlacesResponseModel) _then;
|
||||
|
||||
/// Create a copy of FrequentPlacesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,Object? total = freezed,Object? page = freezed,Object? pages = freezed,}) {
|
||||
return _then(_FrequentPlacesResponseModel(
|
||||
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<FrequentPlaceItemResponseModel>,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$FrequentPlaceItemResponseModel {
|
||||
|
||||
String get id; String get name; String? get userId; String? get delegationId; String? get groupId; String? get deviceId; double get lat; double get lng; List<WifiInfoResponseModel> get wifiList; int get createdAt; int? get updatedAt;
|
||||
/// Create a copy of FrequentPlaceItemResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlaceItemResponseModelCopyWith<FrequentPlaceItemResponseModel> get copyWith => _$FrequentPlaceItemResponseModelCopyWithImpl<FrequentPlaceItemResponseModel>(this as FrequentPlaceItemResponseModel, _$identity);
|
||||
|
||||
/// Serializes this FrequentPlaceItemResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is FrequentPlaceItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other.wifiList, wifiList)&&(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,name,userId,delegationId,groupId,deviceId,lat,lng,const DeepCollectionEquality().hash(wifiList),createdAt,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FrequentPlaceItemResponseModel(id: $id, name: $name, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId, lat: $lat, lng: $lng, wifiList: $wifiList, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $FrequentPlaceItemResponseModelCopyWith<$Res> {
|
||||
factory $FrequentPlaceItemResponseModelCopyWith(FrequentPlaceItemResponseModel value, $Res Function(FrequentPlaceItemResponseModel) _then) = _$FrequentPlaceItemResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, String? userId, String? delegationId, String? groupId, String? deviceId, double lat, double lng, List<WifiInfoResponseModel> wifiList, int createdAt, int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$FrequentPlaceItemResponseModelCopyWithImpl<$Res>
|
||||
implements $FrequentPlaceItemResponseModelCopyWith<$Res> {
|
||||
_$FrequentPlaceItemResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final FrequentPlaceItemResponseModel _self;
|
||||
final $Res Function(FrequentPlaceItemResponseModel) _then;
|
||||
|
||||
/// Create a copy of FrequentPlaceItemResponseModel
|
||||
/// 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? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,Object? lat = null,Object? lng = null,Object? wifiList = 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,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self.wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,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 [FrequentPlaceItemResponseModel].
|
||||
extension FrequentPlaceItemResponseModelPatterns on FrequentPlaceItemResponseModel {
|
||||
/// 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( _FrequentPlaceItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel() 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( _FrequentPlaceItemResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel():
|
||||
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( _FrequentPlaceItemResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel() 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 name, String? userId, String? delegationId, String? groupId, String? deviceId, double lat, double lng, List<WifiInfoResponseModel> wifiList, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.lat,_that.lng,_that.wifiList,_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 name, String? userId, String? delegationId, String? groupId, String? deviceId, double lat, double lng, List<WifiInfoResponseModel> wifiList, int createdAt, int? updatedAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel():
|
||||
return $default(_that.id,_that.name,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.lat,_that.lng,_that.wifiList,_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 name, String? userId, String? delegationId, String? groupId, String? deviceId, double lat, double lng, List<WifiInfoResponseModel> wifiList, int createdAt, int? updatedAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _FrequentPlaceItemResponseModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.lat,_that.lng,_that.wifiList,_that.createdAt,_that.updatedAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _FrequentPlaceItemResponseModel implements FrequentPlaceItemResponseModel {
|
||||
const _FrequentPlaceItemResponseModel({required this.id, required this.name, this.userId, this.delegationId, this.groupId, this.deviceId, required this.lat, required this.lng, final List<WifiInfoResponseModel> wifiList = const [], required this.createdAt, this.updatedAt}): _wifiList = wifiList;
|
||||
factory _FrequentPlaceItemResponseModel.fromJson(Map<String, dynamic> json) => _$FrequentPlaceItemResponseModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final String? userId;
|
||||
@override final String? delegationId;
|
||||
@override final String? groupId;
|
||||
@override final String? deviceId;
|
||||
@override final double lat;
|
||||
@override final double lng;
|
||||
final List<WifiInfoResponseModel> _wifiList;
|
||||
@override@JsonKey() List<WifiInfoResponseModel> get wifiList {
|
||||
if (_wifiList is EqualUnmodifiableListView) return _wifiList;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_wifiList);
|
||||
}
|
||||
|
||||
@override final int createdAt;
|
||||
@override final int? updatedAt;
|
||||
|
||||
/// Create a copy of FrequentPlaceItemResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$FrequentPlaceItemResponseModelCopyWith<_FrequentPlaceItemResponseModel> get copyWith => __$FrequentPlaceItemResponseModelCopyWithImpl<_FrequentPlaceItemResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$FrequentPlaceItemResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _FrequentPlaceItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other._wifiList, _wifiList)&&(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,name,userId,delegationId,groupId,deviceId,lat,lng,const DeepCollectionEquality().hash(_wifiList),createdAt,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'FrequentPlaceItemResponseModel(id: $id, name: $name, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId, lat: $lat, lng: $lng, wifiList: $wifiList, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$FrequentPlaceItemResponseModelCopyWith<$Res> implements $FrequentPlaceItemResponseModelCopyWith<$Res> {
|
||||
factory _$FrequentPlaceItemResponseModelCopyWith(_FrequentPlaceItemResponseModel value, $Res Function(_FrequentPlaceItemResponseModel) _then) = __$FrequentPlaceItemResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, String? userId, String? delegationId, String? groupId, String? deviceId, double lat, double lng, List<WifiInfoResponseModel> wifiList, int createdAt, int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$FrequentPlaceItemResponseModelCopyWithImpl<$Res>
|
||||
implements _$FrequentPlaceItemResponseModelCopyWith<$Res> {
|
||||
__$FrequentPlaceItemResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _FrequentPlaceItemResponseModel _self;
|
||||
final $Res Function(_FrequentPlaceItemResponseModel) _then;
|
||||
|
||||
/// Create a copy of FrequentPlaceItemResponseModel
|
||||
/// 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? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,Object? lat = null,Object? lng = null,Object? wifiList = null,Object? createdAt = null,Object? updatedAt = freezed,}) {
|
||||
return _then(_FrequentPlaceItemResponseModel(
|
||||
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,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self._wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,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?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$WifiInfoResponseModel {
|
||||
|
||||
String get SSID; String get BSSID; String get signal;
|
||||
/// Create a copy of WifiInfoResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$WifiInfoResponseModelCopyWith<WifiInfoResponseModel> get copyWith => _$WifiInfoResponseModelCopyWithImpl<WifiInfoResponseModel>(this as WifiInfoResponseModel, _$identity);
|
||||
|
||||
/// Serializes this WifiInfoResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is WifiInfoResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WifiInfoResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $WifiInfoResponseModelCopyWith<$Res> {
|
||||
factory $WifiInfoResponseModelCopyWith(WifiInfoResponseModel value, $Res Function(WifiInfoResponseModel) _then) = _$WifiInfoResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String SSID, String BSSID, String signal
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$WifiInfoResponseModelCopyWithImpl<$Res>
|
||||
implements $WifiInfoResponseModelCopyWith<$Res> {
|
||||
_$WifiInfoResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final WifiInfoResponseModel _self;
|
||||
final $Res Function(WifiInfoResponseModel) _then;
|
||||
|
||||
/// Create a copy of WifiInfoResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
|
||||
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
|
||||
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [WifiInfoResponseModel].
|
||||
extension WifiInfoResponseModelPatterns on WifiInfoResponseModel {
|
||||
/// 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( _WifiInfoResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel() 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( _WifiInfoResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel():
|
||||
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( _WifiInfoResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel() when $default != null:
|
||||
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
|
||||
return orElse();
|
||||
|
||||
}
|
||||
}
|
||||
/// A `switch`-like method, using callbacks.
|
||||
///
|
||||
/// As opposed to `map`, this offers destructuring.
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case Subclass2(:final field2):
|
||||
/// return ...;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String SSID, String BSSID, String signal) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel():
|
||||
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
|
||||
throw StateError('Unexpected subclass');
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to returning `null`
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return null;
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String SSID, String BSSID, String signal)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _WifiInfoResponseModel() when $default != null:
|
||||
return $default(_that.SSID,_that.BSSID,_that.signal);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _WifiInfoResponseModel implements WifiInfoResponseModel {
|
||||
const _WifiInfoResponseModel({required this.SSID, required this.BSSID, required this.signal});
|
||||
factory _WifiInfoResponseModel.fromJson(Map<String, dynamic> json) => _$WifiInfoResponseModelFromJson(json);
|
||||
|
||||
@override final String SSID;
|
||||
@override final String BSSID;
|
||||
@override final String signal;
|
||||
|
||||
/// Create a copy of WifiInfoResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$WifiInfoResponseModelCopyWith<_WifiInfoResponseModel> get copyWith => __$WifiInfoResponseModelCopyWithImpl<_WifiInfoResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$WifiInfoResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _WifiInfoResponseModel&&(identical(other.SSID, SSID) || other.SSID == SSID)&&(identical(other.BSSID, BSSID) || other.BSSID == BSSID)&&(identical(other.signal, signal) || other.signal == signal));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,SSID,BSSID,signal);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'WifiInfoResponseModel(SSID: $SSID, BSSID: $BSSID, signal: $signal)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$WifiInfoResponseModelCopyWith<$Res> implements $WifiInfoResponseModelCopyWith<$Res> {
|
||||
factory _$WifiInfoResponseModelCopyWith(_WifiInfoResponseModel value, $Res Function(_WifiInfoResponseModel) _then) = __$WifiInfoResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String SSID, String BSSID, String signal
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$WifiInfoResponseModelCopyWithImpl<$Res>
|
||||
implements _$WifiInfoResponseModelCopyWith<$Res> {
|
||||
__$WifiInfoResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _WifiInfoResponseModel _self;
|
||||
final $Res Function(_WifiInfoResponseModel) _then;
|
||||
|
||||
/// Create a copy of WifiInfoResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? SSID = null,Object? BSSID = null,Object? signal = null,}) {
|
||||
return _then(_WifiInfoResponseModel(
|
||||
SSID: null == SSID ? _self.SSID : SSID // ignore: cast_nullable_to_non_nullable
|
||||
as String,BSSID: null == BSSID ? _self.BSSID : BSSID // ignore: cast_nullable_to_non_nullable
|
||||
as String,signal: null == signal ? _self.signal : signal // ignore: cast_nullable_to_non_nullable
|
||||
as String,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,84 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'frequent_places_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_FrequentPlacesResponseModel _$FrequentPlacesResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _FrequentPlacesResponseModel(
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map(
|
||||
(e) =>
|
||||
FrequentPlaceItemResponseModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList(),
|
||||
total: (json['total'] as num?)?.toInt(),
|
||||
page: (json['page'] as num?)?.toInt(),
|
||||
pages: (json['pages'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FrequentPlacesResponseModelToJson(
|
||||
_FrequentPlacesResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'items': instance.items,
|
||||
'total': instance.total,
|
||||
'page': instance.page,
|
||||
'pages': instance.pages,
|
||||
};
|
||||
|
||||
_FrequentPlaceItemResponseModel _$FrequentPlaceItemResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _FrequentPlaceItemResponseModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
userId: json['userId'] as String?,
|
||||
delegationId: json['delegationId'] as String?,
|
||||
groupId: json['groupId'] as String?,
|
||||
deviceId: json['deviceId'] as String?,
|
||||
lat: (json['lat'] as num).toDouble(),
|
||||
lng: (json['lng'] as num).toDouble(),
|
||||
wifiList:
|
||||
(json['wifiList'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => WifiInfoResponseModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList() ??
|
||||
const [],
|
||||
createdAt: (json['createdAt'] as num).toInt(),
|
||||
updatedAt: (json['updatedAt'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$FrequentPlaceItemResponseModelToJson(
|
||||
_FrequentPlaceItemResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'userId': instance.userId,
|
||||
'delegationId': instance.delegationId,
|
||||
'groupId': instance.groupId,
|
||||
'deviceId': instance.deviceId,
|
||||
'lat': instance.lat,
|
||||
'lng': instance.lng,
|
||||
'wifiList': instance.wifiList,
|
||||
'createdAt': instance.createdAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
};
|
||||
|
||||
_WifiInfoResponseModel _$WifiInfoResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _WifiInfoResponseModel(
|
||||
SSID: json['SSID'] as String,
|
||||
BSSID: json['BSSID'] as String,
|
||||
signal: json['signal'] as String,
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$WifiInfoResponseModelToJson(
|
||||
_WifiInfoResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'SSID': instance.SSID,
|
||||
'BSSID': instance.BSSID,
|
||||
'signal': instance.signal,
|
||||
};
|
||||
@@ -0,0 +1,61 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/domain/entities/geofence_entity.dart';
|
||||
|
||||
part 'geofences_response_model.freezed.dart';
|
||||
part 'geofences_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class GeofencesResponseModel with _$GeofencesResponseModel {
|
||||
const factory GeofencesResponseModel({
|
||||
required List<GeofenceItemResponseModel> items,
|
||||
int? total,
|
||||
int? page,
|
||||
int? pages,
|
||||
}) = _GeofencesResponseModel;
|
||||
|
||||
factory GeofencesResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$GeofencesResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
@freezed
|
||||
abstract class GeofenceItemResponseModel with _$GeofenceItemResponseModel {
|
||||
const factory GeofenceItemResponseModel({
|
||||
required String id,
|
||||
required String name,
|
||||
String? description,
|
||||
required double latitude,
|
||||
required double longitude,
|
||||
required double radius,
|
||||
String? userId,
|
||||
String? delegationId,
|
||||
String? groupId,
|
||||
String? deviceId,
|
||||
required bool isActive,
|
||||
required int createdAt,
|
||||
int? updatedAt,
|
||||
}) = _GeofenceItemResponseModel;
|
||||
|
||||
factory GeofenceItemResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$GeofenceItemResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension GeofencesResponseModelMapper on GeofencesResponseModel {
|
||||
List<GeofenceEntity> toEntity() {
|
||||
return items
|
||||
.map(
|
||||
(item) => GeofenceEntity(
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
description: item.description,
|
||||
latitude: item.latitude,
|
||||
longitude: item.longitude,
|
||||
radius: item.radius,
|
||||
isActive: item.isActive,
|
||||
deviceId: item.deviceId,
|
||||
createdAt: item.createdAt,
|
||||
updatedAt: item.updatedAt,
|
||||
),
|
||||
)
|
||||
.toList();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,591 @@
|
||||
// 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 'geofences_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$GeofencesResponseModel {
|
||||
|
||||
List<GeofenceItemResponseModel> get items; int? get total; int? get page; int? get pages;
|
||||
/// Create a copy of GeofencesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$GeofencesResponseModelCopyWith<GeofencesResponseModel> get copyWith => _$GeofencesResponseModelCopyWithImpl<GeofencesResponseModel>(this as GeofencesResponseModel, _$identity);
|
||||
|
||||
/// Serializes this GeofencesResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is GeofencesResponseModel&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeofencesResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $GeofencesResponseModelCopyWith<$Res> {
|
||||
factory $GeofencesResponseModelCopyWith(GeofencesResponseModel value, $Res Function(GeofencesResponseModel) _then) = _$GeofencesResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
List<GeofenceItemResponseModel> items, int? total, int? page, int? pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$GeofencesResponseModelCopyWithImpl<$Res>
|
||||
implements $GeofencesResponseModelCopyWith<$Res> {
|
||||
_$GeofencesResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final GeofencesResponseModel _self;
|
||||
final $Res Function(GeofencesResponseModel) _then;
|
||||
|
||||
/// Create a copy of GeofencesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,Object? total = freezed,Object? page = freezed,Object? pages = freezed,}) {
|
||||
return _then(_self.copyWith(
|
||||
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<GeofenceItemResponseModel>,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [GeofencesResponseModel].
|
||||
extension GeofencesResponseModelPatterns on GeofencesResponseModel {
|
||||
/// 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( _GeofencesResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel() 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( _GeofencesResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel():
|
||||
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( _GeofencesResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<GeofenceItemResponseModel> items, int? total, int? page, int? pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_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( List<GeofenceItemResponseModel> items, int? total, int? page, int? pages) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel():
|
||||
return $default(_that.items,_that.total,_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( List<GeofenceItemResponseModel> items, int? total, int? page, int? pages)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofencesResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_that.page,_that.pages);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _GeofencesResponseModel implements GeofencesResponseModel {
|
||||
const _GeofencesResponseModel({required final List<GeofenceItemResponseModel> items, this.total, this.page, this.pages}): _items = items;
|
||||
factory _GeofencesResponseModel.fromJson(Map<String, dynamic> json) => _$GeofencesResponseModelFromJson(json);
|
||||
|
||||
final List<GeofenceItemResponseModel> _items;
|
||||
@override List<GeofenceItemResponseModel> get items {
|
||||
if (_items is EqualUnmodifiableListView) return _items;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
@override final int? total;
|
||||
@override final int? page;
|
||||
@override final int? pages;
|
||||
|
||||
/// Create a copy of GeofencesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$GeofencesResponseModelCopyWith<_GeofencesResponseModel> get copyWith => __$GeofencesResponseModelCopyWithImpl<_GeofencesResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$GeofencesResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GeofencesResponseModel&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(_items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeofencesResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$GeofencesResponseModelCopyWith<$Res> implements $GeofencesResponseModelCopyWith<$Res> {
|
||||
factory _$GeofencesResponseModelCopyWith(_GeofencesResponseModel value, $Res Function(_GeofencesResponseModel) _then) = __$GeofencesResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
List<GeofenceItemResponseModel> items, int? total, int? page, int? pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$GeofencesResponseModelCopyWithImpl<$Res>
|
||||
implements _$GeofencesResponseModelCopyWith<$Res> {
|
||||
__$GeofencesResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _GeofencesResponseModel _self;
|
||||
final $Res Function(_GeofencesResponseModel) _then;
|
||||
|
||||
/// Create a copy of GeofencesResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,Object? total = freezed,Object? page = freezed,Object? pages = freezed,}) {
|
||||
return _then(_GeofencesResponseModel(
|
||||
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<GeofenceItemResponseModel>,total: freezed == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int?,page: freezed == page ? _self.page : page // ignore: cast_nullable_to_non_nullable
|
||||
as int?,pages: freezed == pages ? _self.pages : pages // ignore: cast_nullable_to_non_nullable
|
||||
as int?,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// @nodoc
|
||||
mixin _$GeofenceItemResponseModel {
|
||||
|
||||
String get id; String get name; String? get description; double get latitude; double get longitude; double get radius; String? get userId; String? get delegationId; String? get groupId; String? get deviceId; bool get isActive; int get createdAt; int? get updatedAt;
|
||||
/// Create a copy of GeofenceItemResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$GeofenceItemResponseModelCopyWith<GeofenceItemResponseModel> get copyWith => _$GeofenceItemResponseModelCopyWithImpl<GeofenceItemResponseModel>(this as GeofenceItemResponseModel, _$identity);
|
||||
|
||||
/// Serializes this GeofenceItemResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is GeofenceItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.isActive, isActive) || other.isActive == isActive)&&(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,name,description,latitude,longitude,radius,userId,delegationId,groupId,deviceId,isActive,createdAt,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeofenceItemResponseModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $GeofenceItemResponseModelCopyWith<$Res> {
|
||||
factory $GeofenceItemResponseModelCopyWith(GeofenceItemResponseModel value, $Res Function(GeofenceItemResponseModel) _then) = _$GeofenceItemResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId, bool isActive, int createdAt, int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$GeofenceItemResponseModelCopyWithImpl<$Res>
|
||||
implements $GeofenceItemResponseModelCopyWith<$Res> {
|
||||
_$GeofenceItemResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final GeofenceItemResponseModel _self;
|
||||
final $Res Function(GeofenceItemResponseModel) _then;
|
||||
|
||||
/// Create a copy of GeofenceItemResponseModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,Object? isActive = 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,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
|
||||
as String,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isActive: null == isActive ? _self.isActive : isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,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 [GeofenceItemResponseModel].
|
||||
extension GeofenceItemResponseModelPatterns on GeofenceItemResponseModel {
|
||||
/// 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( _GeofenceItemResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel() 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( _GeofenceItemResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel():
|
||||
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( _GeofenceItemResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel() 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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId, bool isActive, int createdAt, int? updatedAt)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.isActive,_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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId, bool isActive, int createdAt, int? updatedAt) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel():
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.isActive,_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 name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId, bool isActive, int createdAt, int? updatedAt)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _GeofenceItemResponseModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius,_that.userId,_that.delegationId,_that.groupId,_that.deviceId,_that.isActive,_that.createdAt,_that.updatedAt);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _GeofenceItemResponseModel implements GeofenceItemResponseModel {
|
||||
const _GeofenceItemResponseModel({required this.id, required this.name, this.description, required this.latitude, required this.longitude, required this.radius, this.userId, this.delegationId, this.groupId, this.deviceId, required this.isActive, required this.createdAt, this.updatedAt});
|
||||
factory _GeofenceItemResponseModel.fromJson(Map<String, dynamic> json) => _$GeofenceItemResponseModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final String? description;
|
||||
@override final double latitude;
|
||||
@override final double longitude;
|
||||
@override final double radius;
|
||||
@override final String? userId;
|
||||
@override final String? delegationId;
|
||||
@override final String? groupId;
|
||||
@override final String? deviceId;
|
||||
@override final bool isActive;
|
||||
@override final int createdAt;
|
||||
@override final int? updatedAt;
|
||||
|
||||
/// Create a copy of GeofenceItemResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$GeofenceItemResponseModelCopyWith<_GeofenceItemResponseModel> get copyWith => __$GeofenceItemResponseModelCopyWithImpl<_GeofenceItemResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$GeofenceItemResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GeofenceItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius)&&(identical(other.userId, userId) || other.userId == userId)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.groupId, groupId) || other.groupId == groupId)&&(identical(other.deviceId, deviceId) || other.deviceId == deviceId)&&(identical(other.isActive, isActive) || other.isActive == isActive)&&(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,name,description,latitude,longitude,radius,userId,delegationId,groupId,deviceId,isActive,createdAt,updatedAt);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'GeofenceItemResponseModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius, userId: $userId, delegationId: $delegationId, groupId: $groupId, deviceId: $deviceId, isActive: $isActive, createdAt: $createdAt, updatedAt: $updatedAt)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$GeofenceItemResponseModelCopyWith<$Res> implements $GeofenceItemResponseModelCopyWith<$Res> {
|
||||
factory _$GeofenceItemResponseModelCopyWith(_GeofenceItemResponseModel value, $Res Function(_GeofenceItemResponseModel) _then) = __$GeofenceItemResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius, String? userId, String? delegationId, String? groupId, String? deviceId, bool isActive, int createdAt, int? updatedAt
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$GeofenceItemResponseModelCopyWithImpl<$Res>
|
||||
implements _$GeofenceItemResponseModelCopyWith<$Res> {
|
||||
__$GeofenceItemResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _GeofenceItemResponseModel _self;
|
||||
final $Res Function(_GeofenceItemResponseModel) _then;
|
||||
|
||||
/// Create a copy of GeofenceItemResponseModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,Object? userId = freezed,Object? delegationId = freezed,Object? groupId = freezed,Object? deviceId = freezed,Object? isActive = null,Object? createdAt = null,Object? updatedAt = freezed,}) {
|
||||
return _then(_GeofenceItemResponseModel(
|
||||
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,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,userId: freezed == userId ? _self.userId : userId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,groupId: freezed == groupId ? _self.groupId : groupId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,deviceId: freezed == deviceId ? _self.deviceId : deviceId // ignore: cast_nullable_to_non_nullable
|
||||
as String?,isActive: null == isActive ? _self.isActive : isActive // ignore: cast_nullable_to_non_nullable
|
||||
as bool,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,63 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'geofences_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_GeofencesResponseModel _$GeofencesResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _GeofencesResponseModel(
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map((e) => GeofenceItemResponseModel.fromJson(e as Map<String, dynamic>))
|
||||
.toList(),
|
||||
total: (json['total'] as num?)?.toInt(),
|
||||
page: (json['page'] as num?)?.toInt(),
|
||||
pages: (json['pages'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GeofencesResponseModelToJson(
|
||||
_GeofencesResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'items': instance.items,
|
||||
'total': instance.total,
|
||||
'page': instance.page,
|
||||
'pages': instance.pages,
|
||||
};
|
||||
|
||||
_GeofenceItemResponseModel _$GeofenceItemResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _GeofenceItemResponseModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String?,
|
||||
latitude: (json['latitude'] as num).toDouble(),
|
||||
longitude: (json['longitude'] as num).toDouble(),
|
||||
radius: (json['radius'] as num).toDouble(),
|
||||
userId: json['userId'] as String?,
|
||||
delegationId: json['delegationId'] as String?,
|
||||
groupId: json['groupId'] as String?,
|
||||
deviceId: json['deviceId'] as String?,
|
||||
isActive: json['isActive'] as bool,
|
||||
createdAt: (json['createdAt'] as num).toInt(),
|
||||
updatedAt: (json['updatedAt'] as num?)?.toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$GeofenceItemResponseModelToJson(
|
||||
_GeofenceItemResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'latitude': instance.latitude,
|
||||
'longitude': instance.longitude,
|
||||
'radius': instance.radius,
|
||||
'userId': instance.userId,
|
||||
'delegationId': instance.delegationId,
|
||||
'groupId': instance.groupId,
|
||||
'deviceId': instance.deviceId,
|
||||
'isActive': instance.isActive,
|
||||
'createdAt': instance.createdAt,
|
||||
'updatedAt': instance.updatedAt,
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:control_panel/control_panel.dart';
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'position_history_response_model.freezed.dart';
|
||||
part 'position_history_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class PositionHistoryResponseModel
|
||||
with _$PositionHistoryResponseModel {
|
||||
const factory PositionHistoryResponseModel({
|
||||
required List<LatestPositionsItemResponseModel> items,
|
||||
required int total,
|
||||
required int page,
|
||||
required int pages,
|
||||
}) = _PositionHistoryResponseModel;
|
||||
|
||||
factory PositionHistoryResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$PositionHistoryResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension PositionHistoryResponseModelMapper on PositionHistoryResponseModel {
|
||||
List<PositionEntity> toEntity() {
|
||||
return LatestPositionsResponseModel(items: items).toEntity();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'position_history_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$PositionHistoryResponseModel {
|
||||
|
||||
List<LatestPositionsItemResponseModel> get items; int get total; int get page; int get pages;
|
||||
/// Create a copy of PositionHistoryResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$PositionHistoryResponseModelCopyWith<PositionHistoryResponseModel> get copyWith => _$PositionHistoryResponseModelCopyWithImpl<PositionHistoryResponseModel>(this as PositionHistoryResponseModel, _$identity);
|
||||
|
||||
/// Serializes this PositionHistoryResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is PositionHistoryResponseModel&&const DeepCollectionEquality().equals(other.items, items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PositionHistoryResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $PositionHistoryResponseModelCopyWith<$Res> {
|
||||
factory $PositionHistoryResponseModelCopyWith(PositionHistoryResponseModel value, $Res Function(PositionHistoryResponseModel) _then) = _$PositionHistoryResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
List<LatestPositionsItemResponseModel> items, int total, int page, int pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$PositionHistoryResponseModelCopyWithImpl<$Res>
|
||||
implements $PositionHistoryResponseModelCopyWith<$Res> {
|
||||
_$PositionHistoryResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final PositionHistoryResponseModel _self;
|
||||
final $Res Function(PositionHistoryResponseModel) _then;
|
||||
|
||||
/// Create a copy of PositionHistoryResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,Object? total = null,Object? page = null,Object? pages = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<LatestPositionsItemResponseModel>,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,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 [PositionHistoryResponseModel].
|
||||
extension PositionHistoryResponseModelPatterns on PositionHistoryResponseModel {
|
||||
/// 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( _PositionHistoryResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel() 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( _PositionHistoryResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel():
|
||||
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( _PositionHistoryResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel() when $default != null:
|
||||
return $default(_that);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
/// A variant of `when` that fallback to an `orElse` callback.
|
||||
///
|
||||
/// It is equivalent to doing:
|
||||
/// ```dart
|
||||
/// switch (sealedClass) {
|
||||
/// case Subclass(:final field):
|
||||
/// return ...;
|
||||
/// case _:
|
||||
/// return orElse();
|
||||
/// }
|
||||
/// ```
|
||||
|
||||
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( List<LatestPositionsItemResponseModel> items, int total, int page, int pages)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_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( List<LatestPositionsItemResponseModel> items, int total, int page, int pages) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel():
|
||||
return $default(_that.items,_that.total,_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( List<LatestPositionsItemResponseModel> items, int total, int page, int pages)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _PositionHistoryResponseModel() when $default != null:
|
||||
return $default(_that.items,_that.total,_that.page,_that.pages);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _PositionHistoryResponseModel implements PositionHistoryResponseModel {
|
||||
const _PositionHistoryResponseModel({required final List<LatestPositionsItemResponseModel> items, required this.total, required this.page, required this.pages}): _items = items;
|
||||
factory _PositionHistoryResponseModel.fromJson(Map<String, dynamic> json) => _$PositionHistoryResponseModelFromJson(json);
|
||||
|
||||
final List<LatestPositionsItemResponseModel> _items;
|
||||
@override List<LatestPositionsItemResponseModel> get items {
|
||||
if (_items is EqualUnmodifiableListView) return _items;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_items);
|
||||
}
|
||||
|
||||
@override final int total;
|
||||
@override final int page;
|
||||
@override final int pages;
|
||||
|
||||
/// Create a copy of PositionHistoryResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$PositionHistoryResponseModelCopyWith<_PositionHistoryResponseModel> get copyWith => __$PositionHistoryResponseModelCopyWithImpl<_PositionHistoryResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$PositionHistoryResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PositionHistoryResponseModel&&const DeepCollectionEquality().equals(other._items, _items)&&(identical(other.total, total) || other.total == total)&&(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,const DeepCollectionEquality().hash(_items),total,page,pages);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'PositionHistoryResponseModel(items: $items, total: $total, page: $page, pages: $pages)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$PositionHistoryResponseModelCopyWith<$Res> implements $PositionHistoryResponseModelCopyWith<$Res> {
|
||||
factory _$PositionHistoryResponseModelCopyWith(_PositionHistoryResponseModel value, $Res Function(_PositionHistoryResponseModel) _then) = __$PositionHistoryResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
List<LatestPositionsItemResponseModel> items, int total, int page, int pages
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$PositionHistoryResponseModelCopyWithImpl<$Res>
|
||||
implements _$PositionHistoryResponseModelCopyWith<$Res> {
|
||||
__$PositionHistoryResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _PositionHistoryResponseModel _self;
|
||||
final $Res Function(_PositionHistoryResponseModel) _then;
|
||||
|
||||
/// Create a copy of PositionHistoryResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,Object? total = null,Object? page = null,Object? pages = null,}) {
|
||||
return _then(_PositionHistoryResponseModel(
|
||||
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
|
||||
as List<LatestPositionsItemResponseModel>,total: null == total ? _self.total : total // ignore: cast_nullable_to_non_nullable
|
||||
as int,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,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,31 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'position_history_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_PositionHistoryResponseModel _$PositionHistoryResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _PositionHistoryResponseModel(
|
||||
items: (json['items'] as List<dynamic>)
|
||||
.map(
|
||||
(e) => LatestPositionsItemResponseModel.fromJson(
|
||||
e as Map<String, dynamic>,
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
total: (json['total'] as num).toInt(),
|
||||
page: (json['page'] as num).toInt(),
|
||||
pages: (json['pages'] as num).toInt(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$PositionHistoryResponseModelToJson(
|
||||
_PositionHistoryResponseModel instance,
|
||||
) => <String, dynamic>{
|
||||
'items': instance.items,
|
||||
'total': instance.total,
|
||||
'page': instance.page,
|
||||
'pages': instance.pages,
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/frequent_places_response_model.dart';
|
||||
|
||||
part 'update_frequent_place_request_model.freezed.dart';
|
||||
part 'update_frequent_place_request_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UpdateFrequentPlaceRequestModel
|
||||
with _$UpdateFrequentPlaceRequestModel {
|
||||
const factory UpdateFrequentPlaceRequestModel({
|
||||
required String id,
|
||||
required String name,
|
||||
required double lat,
|
||||
required double lng,
|
||||
@Default([]) List<WifiInfoResponseModel> wifiList,
|
||||
}) = _UpdateFrequentPlaceRequestModel;
|
||||
|
||||
factory UpdateFrequentPlaceRequestModel.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$UpdateFrequentPlaceRequestModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,295 @@
|
||||
// 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_frequent_place_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UpdateFrequentPlaceRequestModel {
|
||||
|
||||
String get id; String get name; double get lat; double get lng; List<WifiInfoResponseModel> get wifiList;
|
||||
/// Create a copy of UpdateFrequentPlaceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UpdateFrequentPlaceRequestModelCopyWith<UpdateFrequentPlaceRequestModel> get copyWith => _$UpdateFrequentPlaceRequestModelCopyWithImpl<UpdateFrequentPlaceRequestModel>(this as UpdateFrequentPlaceRequestModel, _$identity);
|
||||
|
||||
/// Serializes this UpdateFrequentPlaceRequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateFrequentPlaceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other.wifiList, wifiList));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,lat,lng,const DeepCollectionEquality().hash(wifiList));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFrequentPlaceRequestModel(id: $id, name: $name, lat: $lat, lng: $lng, wifiList: $wifiList)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UpdateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
factory $UpdateFrequentPlaceRequestModelCopyWith(UpdateFrequentPlaceRequestModel value, $Res Function(UpdateFrequentPlaceRequestModel) _then) = _$UpdateFrequentPlaceRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, double lat, double lng, List<WifiInfoResponseModel> wifiList
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UpdateFrequentPlaceRequestModelCopyWithImpl<$Res>
|
||||
implements $UpdateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
_$UpdateFrequentPlaceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UpdateFrequentPlaceRequestModel _self;
|
||||
final $Res Function(UpdateFrequentPlaceRequestModel) _then;
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceRequestModel
|
||||
/// 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? lat = null,Object? lng = null,Object? wifiList = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
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,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self.wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UpdateFrequentPlaceRequestModel].
|
||||
extension UpdateFrequentPlaceRequestModelPatterns on UpdateFrequentPlaceRequestModel {
|
||||
/// 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( _UpdateFrequentPlaceRequestModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel() 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( _UpdateFrequentPlaceRequestModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel():
|
||||
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( _UpdateFrequentPlaceRequestModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel() 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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList);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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel():
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList);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 name, double lat, double lng, List<WifiInfoResponseModel> wifiList)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.lat,_that.lng,_that.wifiList);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UpdateFrequentPlaceRequestModel implements UpdateFrequentPlaceRequestModel {
|
||||
const _UpdateFrequentPlaceRequestModel({required this.id, required this.name, required this.lat, required this.lng, final List<WifiInfoResponseModel> wifiList = const []}): _wifiList = wifiList;
|
||||
factory _UpdateFrequentPlaceRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateFrequentPlaceRequestModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final double lat;
|
||||
@override final double lng;
|
||||
final List<WifiInfoResponseModel> _wifiList;
|
||||
@override@JsonKey() List<WifiInfoResponseModel> get wifiList {
|
||||
if (_wifiList is EqualUnmodifiableListView) return _wifiList;
|
||||
// ignore: implicit_dynamic_type
|
||||
return EqualUnmodifiableListView(_wifiList);
|
||||
}
|
||||
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UpdateFrequentPlaceRequestModelCopyWith<_UpdateFrequentPlaceRequestModel> get copyWith => __$UpdateFrequentPlaceRequestModelCopyWithImpl<_UpdateFrequentPlaceRequestModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UpdateFrequentPlaceRequestModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateFrequentPlaceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.lat, lat) || other.lat == lat)&&(identical(other.lng, lng) || other.lng == lng)&&const DeepCollectionEquality().equals(other._wifiList, _wifiList));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,lat,lng,const DeepCollectionEquality().hash(_wifiList));
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFrequentPlaceRequestModel(id: $id, name: $name, lat: $lat, lng: $lng, wifiList: $wifiList)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UpdateFrequentPlaceRequestModelCopyWith<$Res> implements $UpdateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
factory _$UpdateFrequentPlaceRequestModelCopyWith(_UpdateFrequentPlaceRequestModel value, $Res Function(_UpdateFrequentPlaceRequestModel) _then) = __$UpdateFrequentPlaceRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, double lat, double lng, List<WifiInfoResponseModel> wifiList
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UpdateFrequentPlaceRequestModelCopyWithImpl<$Res>
|
||||
implements _$UpdateFrequentPlaceRequestModelCopyWith<$Res> {
|
||||
__$UpdateFrequentPlaceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UpdateFrequentPlaceRequestModel _self;
|
||||
final $Res Function(_UpdateFrequentPlaceRequestModel) _then;
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceRequestModel
|
||||
/// 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? lat = null,Object? lng = null,Object? wifiList = null,}) {
|
||||
return _then(_UpdateFrequentPlaceRequestModel(
|
||||
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,lat: null == lat ? _self.lat : lat // ignore: cast_nullable_to_non_nullable
|
||||
as double,lng: null == lng ? _self.lng : lng // ignore: cast_nullable_to_non_nullable
|
||||
as double,wifiList: null == wifiList ? _self._wifiList : wifiList // ignore: cast_nullable_to_non_nullable
|
||||
as List<WifiInfoResponseModel>,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,33 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'update_frequent_place_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UpdateFrequentPlaceRequestModel _$UpdateFrequentPlaceRequestModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _UpdateFrequentPlaceRequestModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
lat: (json['lat'] as num).toDouble(),
|
||||
lng: (json['lng'] as num).toDouble(),
|
||||
wifiList:
|
||||
(json['wifiList'] as List<dynamic>?)
|
||||
?.map(
|
||||
(e) => WifiInfoResponseModel.fromJson(e as Map<String, dynamic>),
|
||||
)
|
||||
.toList() ??
|
||||
const [],
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UpdateFrequentPlaceRequestModelToJson(
|
||||
_UpdateFrequentPlaceRequestModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'lat': instance.lat,
|
||||
'lng': instance.lng,
|
||||
'wifiList': instance.wifiList,
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/frequent_places_response_model.dart';
|
||||
import 'package:location/src/core/domain/entities/frequent_place_entity.dart';
|
||||
|
||||
part 'update_frequent_place_response_model.freezed.dart';
|
||||
part 'update_frequent_place_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UpdateFrequentPlaceResponseModel
|
||||
with _$UpdateFrequentPlaceResponseModel {
|
||||
const factory UpdateFrequentPlaceResponseModel({
|
||||
required bool isUpdated,
|
||||
required FrequentPlaceItemResponseModel item,
|
||||
}) = _UpdateFrequentPlaceResponseModel;
|
||||
|
||||
factory UpdateFrequentPlaceResponseModel.fromJson(
|
||||
Map<String, dynamic> json) =>
|
||||
_$UpdateFrequentPlaceResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension UpdateFrequentPlaceResponseModelMapper
|
||||
on UpdateFrequentPlaceResponseModel {
|
||||
FrequentPlaceEntity toEntity() => item.toEntity();
|
||||
}
|
||||
@@ -0,0 +1,298 @@
|
||||
// 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_frequent_place_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UpdateFrequentPlaceResponseModel {
|
||||
|
||||
bool get isUpdated; FrequentPlaceItemResponseModel get item;
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UpdateFrequentPlaceResponseModelCopyWith<UpdateFrequentPlaceResponseModel> get copyWith => _$UpdateFrequentPlaceResponseModelCopyWithImpl<UpdateFrequentPlaceResponseModel>(this as UpdateFrequentPlaceResponseModel, _$identity);
|
||||
|
||||
/// Serializes this UpdateFrequentPlaceResponseModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateFrequentPlaceResponseModel&&(identical(other.isUpdated, isUpdated) || other.isUpdated == isUpdated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isUpdated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFrequentPlaceResponseModel(isUpdated: $isUpdated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UpdateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
factory $UpdateFrequentPlaceResponseModelCopyWith(UpdateFrequentPlaceResponseModel value, $Res Function(UpdateFrequentPlaceResponseModel) _then) = _$UpdateFrequentPlaceResponseModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
bool isUpdated, FrequentPlaceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UpdateFrequentPlaceResponseModelCopyWithImpl<$Res>
|
||||
implements $UpdateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
_$UpdateFrequentPlaceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UpdateFrequentPlaceResponseModel _self;
|
||||
final $Res Function(UpdateFrequentPlaceResponseModel) _then;
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@pragma('vm:prefer-inline') @override $Res call({Object? isUpdated = null,Object? item = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
isUpdated: null == isUpdated ? _self.isUpdated : isUpdated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as FrequentPlaceItemResponseModel,
|
||||
));
|
||||
}
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $FrequentPlaceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UpdateFrequentPlaceResponseModel].
|
||||
extension UpdateFrequentPlaceResponseModelPatterns on UpdateFrequentPlaceResponseModel {
|
||||
/// 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( _UpdateFrequentPlaceResponseModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel() 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( _UpdateFrequentPlaceResponseModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel():
|
||||
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( _UpdateFrequentPlaceResponseModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel() 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 isUpdated, FrequentPlaceItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel() when $default != null:
|
||||
return $default(_that.isUpdated,_that.item);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 isUpdated, FrequentPlaceItemResponseModel item) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel():
|
||||
return $default(_that.isUpdated,_that.item);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 isUpdated, FrequentPlaceItemResponseModel item)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateFrequentPlaceResponseModel() when $default != null:
|
||||
return $default(_that.isUpdated,_that.item);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UpdateFrequentPlaceResponseModel implements UpdateFrequentPlaceResponseModel {
|
||||
const _UpdateFrequentPlaceResponseModel({required this.isUpdated, required this.item});
|
||||
factory _UpdateFrequentPlaceResponseModel.fromJson(Map<String, dynamic> json) => _$UpdateFrequentPlaceResponseModelFromJson(json);
|
||||
|
||||
@override final bool isUpdated;
|
||||
@override final FrequentPlaceItemResponseModel item;
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UpdateFrequentPlaceResponseModelCopyWith<_UpdateFrequentPlaceResponseModel> get copyWith => __$UpdateFrequentPlaceResponseModelCopyWithImpl<_UpdateFrequentPlaceResponseModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UpdateFrequentPlaceResponseModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateFrequentPlaceResponseModel&&(identical(other.isUpdated, isUpdated) || other.isUpdated == isUpdated)&&(identical(other.item, item) || other.item == item));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,isUpdated,item);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateFrequentPlaceResponseModel(isUpdated: $isUpdated, item: $item)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UpdateFrequentPlaceResponseModelCopyWith<$Res> implements $UpdateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
factory _$UpdateFrequentPlaceResponseModelCopyWith(_UpdateFrequentPlaceResponseModel value, $Res Function(_UpdateFrequentPlaceResponseModel) _then) = __$UpdateFrequentPlaceResponseModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
bool isUpdated, FrequentPlaceItemResponseModel item
|
||||
});
|
||||
|
||||
|
||||
@override $FrequentPlaceItemResponseModelCopyWith<$Res> get item;
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UpdateFrequentPlaceResponseModelCopyWithImpl<$Res>
|
||||
implements _$UpdateFrequentPlaceResponseModelCopyWith<$Res> {
|
||||
__$UpdateFrequentPlaceResponseModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UpdateFrequentPlaceResponseModel _self;
|
||||
final $Res Function(_UpdateFrequentPlaceResponseModel) _then;
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @pragma('vm:prefer-inline') $Res call({Object? isUpdated = null,Object? item = null,}) {
|
||||
return _then(_UpdateFrequentPlaceResponseModel(
|
||||
isUpdated: null == isUpdated ? _self.isUpdated : isUpdated // ignore: cast_nullable_to_non_nullable
|
||||
as bool,item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
|
||||
as FrequentPlaceItemResponseModel,
|
||||
));
|
||||
}
|
||||
|
||||
/// Create a copy of UpdateFrequentPlaceResponseModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override
|
||||
@pragma('vm:prefer-inline')
|
||||
$FrequentPlaceItemResponseModelCopyWith<$Res> get item {
|
||||
|
||||
return $FrequentPlaceItemResponseModelCopyWith<$Res>(_self.item, (value) {
|
||||
return _then(_self.copyWith(item: value));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,20 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'update_frequent_place_response_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UpdateFrequentPlaceResponseModel _$UpdateFrequentPlaceResponseModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _UpdateFrequentPlaceResponseModel(
|
||||
isUpdated: json['isUpdated'] as bool,
|
||||
item: FrequentPlaceItemResponseModel.fromJson(
|
||||
json['item'] as Map<String, dynamic>,
|
||||
),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UpdateFrequentPlaceResponseModelToJson(
|
||||
_UpdateFrequentPlaceResponseModel instance,
|
||||
) => <String, dynamic>{'isUpdated': instance.isUpdated, 'item': instance.item};
|
||||
@@ -0,0 +1,19 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
|
||||
part 'update_geofence_request_model.freezed.dart';
|
||||
part 'update_geofence_request_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UpdateGeofenceRequestModel with _$UpdateGeofenceRequestModel {
|
||||
const factory UpdateGeofenceRequestModel({
|
||||
required String id,
|
||||
required String name,
|
||||
String? description,
|
||||
required double latitude,
|
||||
required double longitude,
|
||||
required double radius,
|
||||
}) = _UpdateGeofenceRequestModel;
|
||||
|
||||
factory UpdateGeofenceRequestModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UpdateGeofenceRequestModelFromJson(json);
|
||||
}
|
||||
@@ -0,0 +1,292 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
// coverage:ignore-file
|
||||
// ignore_for_file: type=lint
|
||||
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
|
||||
|
||||
part of 'update_geofence_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// FreezedGenerator
|
||||
// **************************************************************************
|
||||
|
||||
// dart format off
|
||||
T _$identity<T>(T value) => value;
|
||||
|
||||
/// @nodoc
|
||||
mixin _$UpdateGeofenceRequestModel {
|
||||
|
||||
String get id; String get name; String? get description; double get latitude; double get longitude; double get radius;
|
||||
/// Create a copy of UpdateGeofenceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
$UpdateGeofenceRequestModelCopyWith<UpdateGeofenceRequestModel> get copyWith => _$UpdateGeofenceRequestModelCopyWithImpl<UpdateGeofenceRequestModel>(this as UpdateGeofenceRequestModel, _$identity);
|
||||
|
||||
/// Serializes this UpdateGeofenceRequestModel to a JSON map.
|
||||
Map<String, dynamic> toJson();
|
||||
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateGeofenceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,description,latitude,longitude,radius);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateGeofenceRequestModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class $UpdateGeofenceRequestModelCopyWith<$Res> {
|
||||
factory $UpdateGeofenceRequestModelCopyWith(UpdateGeofenceRequestModel value, $Res Function(UpdateGeofenceRequestModel) _then) = _$UpdateGeofenceRequestModelCopyWithImpl;
|
||||
@useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class _$UpdateGeofenceRequestModelCopyWithImpl<$Res>
|
||||
implements $UpdateGeofenceRequestModelCopyWith<$Res> {
|
||||
_$UpdateGeofenceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final UpdateGeofenceRequestModel _self;
|
||||
final $Res Function(UpdateGeofenceRequestModel) _then;
|
||||
|
||||
/// Create a copy of UpdateGeofenceRequestModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,}) {
|
||||
return _then(_self.copyWith(
|
||||
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,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// Adds pattern-matching-related methods to [UpdateGeofenceRequestModel].
|
||||
extension UpdateGeofenceRequestModelPatterns on UpdateGeofenceRequestModel {
|
||||
/// 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( _UpdateGeofenceRequestModel value)? $default,{required TResult orElse(),}){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel() 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( _UpdateGeofenceRequestModel value) $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel():
|
||||
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( _UpdateGeofenceRequestModel value)? $default,){
|
||||
final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel() 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 name, String? description, double latitude, double longitude, double radius)? $default,{required TResult orElse(),}) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius);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 name, String? description, double latitude, double longitude, double radius) $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel():
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius);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 name, String? description, double latitude, double longitude, double radius)? $default,) {final _that = this;
|
||||
switch (_that) {
|
||||
case _UpdateGeofenceRequestModel() when $default != null:
|
||||
return $default(_that.id,_that.name,_that.description,_that.latitude,_that.longitude,_that.radius);case _:
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
@JsonSerializable()
|
||||
|
||||
class _UpdateGeofenceRequestModel implements UpdateGeofenceRequestModel {
|
||||
const _UpdateGeofenceRequestModel({required this.id, required this.name, this.description, required this.latitude, required this.longitude, required this.radius});
|
||||
factory _UpdateGeofenceRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateGeofenceRequestModelFromJson(json);
|
||||
|
||||
@override final String id;
|
||||
@override final String name;
|
||||
@override final String? description;
|
||||
@override final double latitude;
|
||||
@override final double longitude;
|
||||
@override final double radius;
|
||||
|
||||
/// Create a copy of UpdateGeofenceRequestModel
|
||||
/// with the given fields replaced by the non-null parameter values.
|
||||
@override @JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@pragma('vm:prefer-inline')
|
||||
_$UpdateGeofenceRequestModelCopyWith<_UpdateGeofenceRequestModel> get copyWith => __$UpdateGeofenceRequestModelCopyWithImpl<_UpdateGeofenceRequestModel>(this, _$identity);
|
||||
|
||||
@override
|
||||
Map<String, dynamic> toJson() {
|
||||
return _$UpdateGeofenceRequestModelToJson(this, );
|
||||
}
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) {
|
||||
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateGeofenceRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.name, name) || other.name == name)&&(identical(other.description, description) || other.description == description)&&(identical(other.latitude, latitude) || other.latitude == latitude)&&(identical(other.longitude, longitude) || other.longitude == longitude)&&(identical(other.radius, radius) || other.radius == radius));
|
||||
}
|
||||
|
||||
@JsonKey(includeFromJson: false, includeToJson: false)
|
||||
@override
|
||||
int get hashCode => Object.hash(runtimeType,id,name,description,latitude,longitude,radius);
|
||||
|
||||
@override
|
||||
String toString() {
|
||||
return 'UpdateGeofenceRequestModel(id: $id, name: $name, description: $description, latitude: $latitude, longitude: $longitude, radius: $radius)';
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// @nodoc
|
||||
abstract mixin class _$UpdateGeofenceRequestModelCopyWith<$Res> implements $UpdateGeofenceRequestModelCopyWith<$Res> {
|
||||
factory _$UpdateGeofenceRequestModelCopyWith(_UpdateGeofenceRequestModel value, $Res Function(_UpdateGeofenceRequestModel) _then) = __$UpdateGeofenceRequestModelCopyWithImpl;
|
||||
@override @useResult
|
||||
$Res call({
|
||||
String id, String name, String? description, double latitude, double longitude, double radius
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
/// @nodoc
|
||||
class __$UpdateGeofenceRequestModelCopyWithImpl<$Res>
|
||||
implements _$UpdateGeofenceRequestModelCopyWith<$Res> {
|
||||
__$UpdateGeofenceRequestModelCopyWithImpl(this._self, this._then);
|
||||
|
||||
final _UpdateGeofenceRequestModel _self;
|
||||
final $Res Function(_UpdateGeofenceRequestModel) _then;
|
||||
|
||||
/// Create a copy of UpdateGeofenceRequestModel
|
||||
/// 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? description = freezed,Object? latitude = null,Object? longitude = null,Object? radius = null,}) {
|
||||
return _then(_UpdateGeofenceRequestModel(
|
||||
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,description: freezed == description ? _self.description : description // ignore: cast_nullable_to_non_nullable
|
||||
as String?,latitude: null == latitude ? _self.latitude : latitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,longitude: null == longitude ? _self.longitude : longitude // ignore: cast_nullable_to_non_nullable
|
||||
as double,radius: null == radius ? _self.radius : radius // ignore: cast_nullable_to_non_nullable
|
||||
as double,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// dart format on
|
||||
@@ -0,0 +1,29 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'update_geofence_request_model.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
// **************************************************************************
|
||||
|
||||
_UpdateGeofenceRequestModel _$UpdateGeofenceRequestModelFromJson(
|
||||
Map<String, dynamic> json,
|
||||
) => _UpdateGeofenceRequestModel(
|
||||
id: json['id'] as String,
|
||||
name: json['name'] as String,
|
||||
description: json['description'] as String?,
|
||||
latitude: (json['latitude'] as num).toDouble(),
|
||||
longitude: (json['longitude'] as num).toDouble(),
|
||||
radius: (json['radius'] as num).toDouble(),
|
||||
);
|
||||
|
||||
Map<String, dynamic> _$UpdateGeofenceRequestModelToJson(
|
||||
_UpdateGeofenceRequestModel instance,
|
||||
) => <String, dynamic>{
|
||||
'id': instance.id,
|
||||
'name': instance.name,
|
||||
'description': instance.description,
|
||||
'latitude': instance.latitude,
|
||||
'longitude': instance.longitude,
|
||||
'radius': instance.radius,
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
import 'package:freezed_annotation/freezed_annotation.dart';
|
||||
import 'package:location/src/core/data/models/geofences_response_model.dart';
|
||||
import 'package:location/src/core/domain/entities/geofence_entity.dart';
|
||||
|
||||
part 'update_geofence_response_model.freezed.dart';
|
||||
part 'update_geofence_response_model.g.dart';
|
||||
|
||||
@freezed
|
||||
abstract class UpdateGeofenceResponseModel with _$UpdateGeofenceResponseModel {
|
||||
const factory UpdateGeofenceResponseModel({
|
||||
required bool isUpdated,
|
||||
required GeofenceItemResponseModel item,
|
||||
}) = _UpdateGeofenceResponseModel;
|
||||
|
||||
factory UpdateGeofenceResponseModel.fromJson(Map<String, dynamic> json) =>
|
||||
_$UpdateGeofenceResponseModelFromJson(json);
|
||||
}
|
||||
|
||||
extension UpdateGeofenceResponseModelMapper on UpdateGeofenceResponseModel {
|
||||
GeofenceEntity toEntity() {
|
||||
return GeofenceEntity(
|
||||
id: item.id,
|
||||
name: item.name,
|
||||
description: item.description,
|
||||
latitude: item.latitude,
|
||||
longitude: item.longitude,
|
||||
radius: item.radius,
|
||||
isActive: item.isActive,
|
||||
deviceId: item.deviceId,
|
||||
createdAt: item.createdAt,
|
||||
updatedAt: item.updatedAt,
|
||||
);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user