Compare commits

...

22 Commits

Author SHA1 Message Date
f76a88a53c Fix translations and icons
Added page layout to customer service screens
2026-02-16 11:20:33 +01:00
e581895246 Refactor UserEntity to legacy_shared package 2026-02-16 08:54:15 +01:00
5186c21e9a Merge branch 'customer-service' into legacy
# Conflicts:
#	apps/mobile_app/lib/navigation/app_router.dart
#	modules/legacy/melos_legacy.iml
#	packages/navigation/lib/app_routes.dart
#	packages/sf_localizations/assets/l10n/en.json
#	packages/sf_localizations/assets/l10n/es.json
#	packages/sf_localizations/lib/src/generated/i18n.dart
2026-02-13 09:34:45 +01:00
4f5e69c6fc Merge branch 'functions' into legacy
# Conflicts:
#	apps/mobile_app/lib/navigation/app_router.dart
#	apps/mobile_app/pubspec.yaml
#	modules/legacy/melos_legacy.iml
#	packages/design_system/fonts/config.json
2026-02-13 09:20:45 +01:00
e4c0a23ded Added call watch dialog 2026-02-12 17:27:55 +01:00
a53cfb24ea Added locate device screen, state and endpoints 2026-02-12 15:48:11 +01:00
f8ff70c35d fixed remote connection dialogs and edit contact screen 2026-02-11 11:57:45 +01:00
46b7ba4a1d added remote_connection screens and state 2026-02-10 17:33:18 +01:00
da90ed94ea create legacy_shared package and added page_layout and logged_user_provider 2026-02-10 17:30:58 +01:00
3283494cb1 fix contacts endpoint and entity 2026-02-10 17:25:23 +01:00
6049ce0bee added edit_contact screen and functions icons 2026-02-09 09:38:58 +01:00
1cd18b002c added functions module and functions and contacts screens, state and use cases 2026-02-05 17:51:52 +01:00
16a5ed2e80 added account settings texts to I18n 2026-02-04 16:32:33 +01:00
54818ead25 added delete_app_user and update_device use cases 2026-02-04 12:45:11 +01:00
3955fbf4bc added app_users screen and states 2026-02-03 10:57:57 +01:00
d515d0596f added personal_data endpoints, providers and states 2026-02-02 15:14:44 +01:00
880dd85d2b added account_settings, linked_devices and edit_linked_device screens and state 2026-01-29 17:45:14 +01:00
cd578352f9 Added customer service and contact screens and state 2026-01-28 17:36:01 +01:00
12edcd0940 added legacy and legacy_dashboard_shell modules 2026-01-27 12:45:25 +01:00
60a49060a1 added hub module 2026-01-23 14:52:08 +01:00
337a00e98f Merge branch 'app-bundle-and-splash' into legacy 2026-01-18 14:01:53 +01:00
59d566e9a6 onboarding copy 2026-01-17 22:20:34 +01:00
239 changed files with 18419 additions and 1488 deletions

View File

@@ -3,349 +3,349 @@
"packages": [
{
"name": "ansi_styles",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/ansi_styles-0.3.2+1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/ansi_styles-0.3.2+1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "args",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/args-2.7.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/args-2.7.0",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "async",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/async-2.13.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/async-2.13.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "characters",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/characters-1.4.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/characters-1.4.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "charcode",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/charcode-1.4.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/charcode-1.4.0",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "checked_yaml",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/checked_yaml-2.0.4",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/checked_yaml-2.0.4",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "cli_launcher",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/cli_launcher-0.3.2+1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/cli_launcher-0.3.2+1",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "cli_util",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/cli_util-0.4.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/cli_util-0.4.2",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "collection",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/collection-1.19.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/collection-1.19.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "conventional_commit",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/conventional_commit-0.6.1+1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/conventional_commit-0.6.1+1",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "ffi",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/ffi-2.1.4",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/ffi-2.1.4",
"packageUri": "lib/",
"languageVersion": "3.7"
},
{
"name": "file",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/file-7.0.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/file-7.0.1",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "flutter",
"rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter",
"rootUri": "file:///C:/Program%20Files/Flutter/packages/flutter",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "flutter_secure_storage",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage-9.2.4",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage-9.2.4",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_secure_storage_linux",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_linux-1.2.3",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_secure_storage_macos",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_macos-3.1.3",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_secure_storage_platform_interface",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_platform_interface-1.1.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_platform_interface-1.1.2",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_secure_storage_web",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_web-1.2.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_secure_storage_windows",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.1.2",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "flutter_web_plugins",
"rootUri": "file:///Users/juliandalcalaf/Development/flutter/packages/flutter_web_plugins",
"rootUri": "file:///C:/Program%20Files/Flutter/packages/flutter_web_plugins",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "glob",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/glob-2.1.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/glob-2.1.3",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "graphs",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/graphs-2.3.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/graphs-2.3.2",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "http",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/http-1.5.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/http-1.5.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "http_parser",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/http_parser-4.1.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/http_parser-4.1.2",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "io",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/io-1.0.5",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/io-1.0.5",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "js",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/js-0.6.7",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/js-0.6.7",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "json_annotation",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/json_annotation-4.9.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/json_annotation-4.9.0",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "material_color_utilities",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/material_color_utilities-0.11.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/material_color_utilities-0.11.1",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "melos",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/melos-6.3.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/melos-6.3.3",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "meta",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/meta-1.16.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/meta-1.16.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "mustache_template",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/mustache_template-2.0.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/mustache_template-2.0.2",
"packageUri": "lib/",
"languageVersion": "3.7"
},
{
"name": "path",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path-1.9.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path-1.9.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "path_provider",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider-2.1.5",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider-2.1.5",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "path_provider_android",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_android-2.2.20",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_android-2.2.20",
"packageUri": "lib/",
"languageVersion": "3.9"
},
{
"name": "path_provider_foundation",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_foundation-2.4.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_foundation-2.4.3",
"packageUri": "lib/",
"languageVersion": "3.9"
},
{
"name": "path_provider_linux",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_linux-2.2.1",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "path_provider_platform_interface",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_platform_interface-2.1.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_platform_interface-2.1.2",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "path_provider_windows",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/path_provider_windows-2.3.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/path_provider_windows-2.3.0",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "platform",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/platform-3.1.6",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/platform-3.1.6",
"packageUri": "lib/",
"languageVersion": "3.2"
},
{
"name": "plugin_platform_interface",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.8",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/plugin_platform_interface-2.1.8",
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "pool",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pool-1.5.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pool-1.5.2",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "process",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/process-5.0.5",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/process-5.0.5",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "prompts",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/prompts-2.0.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/prompts-2.0.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "pub_semver",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pub_semver-2.2.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pub_semver-2.2.0",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "pub_updater",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pub_updater-0.5.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pub_updater-0.5.0",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "pubspec_parse",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/pubspec_parse-1.5.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/pubspec_parse-1.5.0",
"packageUri": "lib/",
"languageVersion": "3.6"
},
{
"name": "sky_engine",
"rootUri": "file:///Users/juliandalcalaf/Development/flutter/bin/cache/pkg/sky_engine",
"rootUri": "file:///C:/Program%20Files/Flutter/bin/cache/pkg/sky_engine",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "source_span",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/source_span-1.10.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/source_span-1.10.1",
"packageUri": "lib/",
"languageVersion": "3.1"
},
{
"name": "stack_trace",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/stack_trace-1.12.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/stack_trace-1.12.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "string_scanner",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/string_scanner-1.4.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/string_scanner-1.4.1",
"packageUri": "lib/",
"languageVersion": "3.1"
},
{
"name": "term_glyph",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/term_glyph-1.2.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/term_glyph-1.2.2",
"packageUri": "lib/",
"languageVersion": "3.1"
},
{
"name": "typed_data",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/typed_data-1.4.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/typed_data-1.4.0",
"packageUri": "lib/",
"languageVersion": "3.5"
},
{
"name": "vector_math",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/vector_math-2.2.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/vector_math-2.2.0",
"packageUri": "lib/",
"languageVersion": "3.1"
},
{
"name": "web",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/web-1.1.1",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/web-1.1.1",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "win32",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/win32-5.15.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.15.0",
"packageUri": "lib/",
"languageVersion": "3.8"
},
{
"name": "xdg_directories",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/xdg_directories-1.1.0",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/xdg_directories-1.1.0",
"packageUri": "lib/",
"languageVersion": "3.3"
},
{
"name": "yaml",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/yaml-3.1.3",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/yaml-3.1.3",
"packageUri": "lib/",
"languageVersion": "3.4"
},
{
"name": "yaml_edit",
"rootUri": "file:///Users/juliandalcalaf/.pub-cache/hosted/pub.dev/yaml_edit-2.2.2",
"rootUri": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache/hosted/pub.dev/yaml_edit-2.2.2",
"packageUri": "lib/",
"languageVersion": "3.1"
},
@@ -358,7 +358,7 @@
],
"generator": "pub",
"generatorVersion": "3.9.2",
"flutterRoot": "file:///Users/juliandalcalaf/Development/flutter",
"flutterVersion": "3.35.7",
"pubCache": "file:///Users/juliandalcalaf/.pub-cache"
"flutterRoot": "file:///C:/Program%20Files/Flutter",
"flutterVersion": "3.35.6",
"pubCache": "file:///C:/Users/Aitor%20Arana/AppData/Local/Pub/Cache"
}

8
.idea/modules.xml generated
View File

@@ -2,11 +2,18 @@
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/account/melos_account.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/account/melos_account.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/auth/melos_auth.iml" filepath="$PROJECT_DIR$/modules/auth/melos_auth.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/customer_service/melos_customer_service.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/customer_service/melos_customer_service.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" filepath="$PROJECT_DIR$/modules/dashboard_shell/melos_dashboard_shell.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/design_system/melos_design_system.iml" filepath="$PROJECT_DIR$/packages/design_system/melos_design_system.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/fonts/melos_fonts.iml" filepath="$PROJECT_DIR$/packages/fonts/melos_fonts.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/functions/melos_functions.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/functions/melos_functions.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/home/melos_home.iml" filepath="$PROJECT_DIR$/modules/home/melos_home.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/hub/melos_hub.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/hub/melos_hub.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/melos_legacy.iml" filepath="$PROJECT_DIR$/modules/legacy/melos_legacy.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/modules/legacy_dashboard_shell/melos_legacy_dashboard_shell.iml" filepath="$PROJECT_DIR$/modules/legacy/modules/legacy_dashboard_shell/melos_legacy_dashboard_shell.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/legacy/packages/legacy_shared/melos_legacy_shared.iml" filepath="$PROJECT_DIR$/modules/legacy/packages/legacy_shared/melos_legacy_shared.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/navigation/melos_navigation.iml" filepath="$PROJECT_DIR$/packages/navigation/melos_navigation.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/notifications/melos_notifications.iml" filepath="$PROJECT_DIR$/modules/notifications/melos_notifications.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/profile/melos_profile.iml" filepath="$PROJECT_DIR$/modules/profile/melos_profile.iml" />
@@ -14,6 +21,7 @@
<module fileurl="file://$PROJECT_DIR$/packages/sf_infrastructure/melos_sf_infrastructure.iml" filepath="$PROJECT_DIR$/packages/sf_infrastructure/melos_sf_infrastructure.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" filepath="$PROJECT_DIR$/packages/sf_localizations/melos_sf_localizations.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" filepath="$PROJECT_DIR$/packages/sf_shared/melos_sf_shared.iml" />
<module fileurl="file://$PROJECT_DIR$/modules/splash/melos_splash.iml" filepath="$PROJECT_DIR$/modules/splash/melos_splash.iml" />
<module fileurl="file://$PROJECT_DIR$/packages/utils/melos_utils.iml" filepath="$PROJECT_DIR$/packages/utils/melos_utils.iml" />
<module fileurl="file://$PROJECT_DIR$/melos_sf-app-platform.iml" filepath="$PROJECT_DIR$/melos_sf-app-platform.iml" />
</modules>

View File

@@ -1,6 +1,6 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Flutter Run -&gt; 'sf_app_platform'" type="FlutterRunConfigurationType" factoryName="Flutter">
<option name="filePath" value="$PROJECT_DIR$/apps/mobile_app/lib/main.dart" />
<option name="filePath" value="$PROJECT_DIR$/apps//mobile_app/lib/main.dart" />
<method v="2" />
</configuration>
</component>

View File

@@ -1,7 +1,7 @@
<!-- Generated by Melos -->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Flutter Test -&gt; 'design_system'" type="FlutterTestConfigType" factoryName="Flutter Test">
<option name="testDir" value="$PROJECT_DIR$/packages/design_system/test" />
<option name="testDir" value="$PROJECT_DIR$/packages\\design_system\test" />
<method v="2" />
</configuration>
</component>

View File

@@ -1,7 +1,7 @@
<!-- Generated by Melos -->
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Flutter Test -&gt; 'home'" type="FlutterTestConfigType" factoryName="Flutter Test">
<option name="testDir" value="$PROJECT_DIR$/modules/home/test" />
<option name="testDir" value="$PROJECT_DIR$/modules\\home\test" />
<method v="2" />
</configuration>
</component>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,19 @@
<svg width="43" height="55" viewBox="0 0 43 55" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_1_973)">
<path d="M22.339 0C23.8812 0.269461 25.4552 0.434132 26.9498 0.838323C31.1949 1.96108 34.6769 4.20659 37.4434 7.41018C39.4944 9.79042 40.9094 12.5 41.5931 15.494C42.7856 20.7335 41.9906 25.7186 38.9379 30.2545C33.6752 38.0988 28.3012 45.8982 22.9749 53.7126C22.8954 53.8323 22.816 53.9521 22.7365 54.0718C21.8143 55.3293 20.2721 55.3293 19.3817 54.0569C18.38 52.6347 17.4261 51.1976 16.4562 49.7605C12.068 43.3084 7.64795 36.8713 3.29152 30.4042C0.429637 26.1527 -0.572024 21.512 0.334241 16.5569C1.81288 8.36826 8.20443 2.15569 16.8378 0.404192C17.8077 0.209581 18.8093 0.134731 19.7951 0C20.6377 0 21.4963 0 22.339 0Z" fill="#F9B03C"/>
<path d="M28.8576 25.8982L31.5923 28.473C32.3396 29.1766 32.3396 30.3293 31.5923 31.0479C30.8451 31.7515 29.6208 31.7515 28.8576 31.0479L26.123 28.473C25.3757 27.7694 25.3757 26.6167 26.123 25.8982C26.8702 25.1796 28.0945 25.1796 28.8576 25.8982Z" fill="white"/>
<path d="M12.926 20.7485C12.926 21.7515 12.0675 22.5599 11.0022 22.5599H7.13867C6.07341 22.5599 5.21484 21.7515 5.21484 20.7485C5.21484 19.7455 6.07341 18.9371 7.13867 18.9371H11.0022C12.0675 18.9371 12.926 19.7455 12.926 20.7485Z" fill="white"/>
<path d="M12.4651 15.5987L9.73037 13.0388C8.9831 12.3352 8.9831 11.1825 9.73037 10.464C10.4776 9.76038 11.7019 9.76038 12.4651 10.464L15.1998 13.0388C15.947 13.7424 15.947 14.8951 15.1998 15.6137C14.4366 16.3173 13.2123 16.3173 12.4651 15.5987Z" fill="white"/>
<path d="M12.4651 31.0329C11.7178 31.7365 10.4935 31.7365 9.73037 31.0329C8.9831 30.3293 8.9831 29.1766 9.73037 28.458L12.4651 25.8832C13.2123 25.1796 14.4366 25.1796 15.1998 25.8832C15.947 26.5868 15.947 27.7394 15.1998 28.458L12.4651 31.0329Z" fill="white"/>
<path d="M20.6533 13.473C19.5881 13.473 18.7295 12.6646 18.7295 11.6616V8.0239C18.7295 7.02091 19.5881 6.21252 20.6533 6.21252C21.7186 6.21252 22.5771 7.02091 22.5771 8.0239V11.6616C22.593 12.6646 21.7186 13.473 20.6533 13.473Z" fill="white"/>
<path d="M20.6533 35.2993C19.5881 35.2993 18.7295 34.4909 18.7295 33.4879V29.8502C18.7295 28.8472 19.5881 28.0388 20.6533 28.0388C21.7186 28.0388 22.5771 28.8472 22.5771 29.8502V33.4879C22.593 34.4909 21.7186 35.2993 20.6533 35.2993Z" fill="white"/>
<path d="M28.8576 15.5988C28.1104 16.3024 26.8861 16.3024 26.123 15.5988C25.3757 14.8952 25.3757 13.7425 26.123 13.0239L28.8576 10.4491C29.6049 9.74549 30.8292 9.74549 31.5923 10.4491C32.3396 11.1527 32.3396 12.3054 31.5923 13.0239L28.8576 15.5988Z" fill="white"/>
<path d="M34.1839 22.5748H30.3203C29.255 22.5748 28.3965 21.7664 28.3965 20.7634C28.3965 19.7604 29.255 18.952 30.3203 18.952H34.1839C35.2491 18.952 36.1077 19.7604 36.1077 20.7634C36.1077 21.7514 35.2491 22.5748 34.1839 22.5748Z" fill="white"/>
<path d="M20.1288 15.7634C20.256 15.6587 20.3991 15.5539 20.574 15.5389C21.0033 15.509 21.21 16.003 21.2895 16.4072C21.4485 17.2155 21.5916 18.0389 21.7506 18.8473C21.7824 19.0269 21.8301 19.2215 21.9891 19.3263C22.1322 19.4161 22.3389 19.4012 22.5138 19.3712C23.5472 19.2664 24.6284 19.476 25.5187 19.985C25.8049 20.1497 26.0752 20.3593 26.1229 20.6736C26.1706 21.1227 25.6777 21.4371 25.2166 21.5868C24.4058 21.8563 23.5154 21.9161 22.6727 21.7664C22.9589 22.2904 23.1815 22.8593 23.3564 23.4281C23.5631 24.1467 23.5154 25.1197 22.784 25.3892C22.2276 25.5838 21.6234 25.2245 21.2577 24.7904C20.892 24.3563 20.6376 23.8323 20.1765 23.473C19.5406 24.1916 18.5389 24.5359 17.5849 24.7904C16.9013 24.97 16.0268 25.0299 15.6452 24.4611C15.4544 24.1616 15.8519 23.2335 16.3766 22.8443C16.9649 22.4102 17.2829 21.991 17.887 21.6916C16.5674 21.2275 15.8996 21.0479 15.0569 19.985C14.8185 19.6856 14.6595 19.2066 14.9933 19.0119C15.1046 18.9521 15.2318 18.9521 15.3431 18.9521C16.4879 18.9221 17.7439 19.3114 18.5071 18.488C19.2067 17.7096 19.2067 16.5419 20.1288 15.7634Z" fill="white"/>
</g>
<defs>
<clipPath id="clip0_1_973">
<rect width="42.1333" height="55" fill="white"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 4.0 KiB

View File

@@ -0,0 +1,12 @@
<svg width="160" height="160" viewBox="0 0 160 160" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M108.055 98.4048L117.431 107.744C119.993 110.297 119.993 114.478 117.431 117.084C114.869 119.636 110.672 119.636 108.055 117.084L98.6799 107.744C96.1179 105.192 96.1179 101.011 98.6799 98.4048C101.242 95.7983 105.439 95.7983 108.055 98.4048Z" fill="#588EA5"/>
<path d="M53.4371 79.7255C53.4371 83.3636 50.4936 86.2958 46.8414 86.2958H33.5956C29.9435 86.2958 27 83.3636 27 79.7255C27 76.0874 29.9435 73.1552 33.5956 73.1552H46.8414C50.4936 73.1552 53.4371 76.0874 53.4371 79.7255Z" fill="#588EA5"/>
<path d="M51.8563 61.0462L42.4807 51.7609C39.9187 49.2087 39.9187 45.0276 42.4807 42.4212C45.0426 39.8691 49.2398 39.8691 51.8563 42.4212L61.2319 51.7609C63.7938 54.313 63.7938 58.4941 61.2319 61.1005C58.6155 63.6526 54.4182 63.6526 51.8563 61.0462Z" fill="#588EA5"/>
<path d="M51.8563 117.03C49.2943 119.582 45.0971 119.582 42.4807 117.03C39.9187 114.478 39.9187 110.297 42.4807 107.69L51.8563 98.3505C54.4182 95.7984 58.6155 95.7984 61.2319 98.3505C63.7938 100.903 63.7938 105.084 61.2319 107.69L51.8563 117.03Z" fill="#588EA5"/>
<path d="M79.9287 53.3356C76.2765 53.3356 73.333 50.4034 73.333 46.7653V33.5703C73.333 29.9322 76.2765 27 79.9287 27C83.5808 27 86.5243 29.9322 86.5243 33.5703V46.7653C86.5788 50.4034 83.5808 53.3356 79.9287 53.3356Z" fill="#588EA5"/>
<path d="M79.9287 132.505C76.2765 132.505 73.333 129.573 73.333 125.935V112.74C73.333 109.102 76.2765 106.17 79.9287 106.17C83.5808 106.17 86.5243 109.102 86.5243 112.74V125.935C86.5788 129.573 83.5808 132.505 79.9287 132.505Z" fill="#588EA5"/>
<path d="M108.055 61.0462C105.494 63.5983 101.296 63.5983 98.6799 61.0462C96.1179 58.4941 96.1179 54.313 98.6799 51.7066L108.055 42.367C110.617 39.8149 114.815 39.8149 117.431 42.367C119.993 44.9191 119.993 49.1002 117.431 51.7066L108.055 61.0462Z" fill="#588EA5"/>
<path d="M126.316 86.3501H113.07C109.418 86.3501 106.475 83.4179 106.475 79.7798C106.475 76.1417 109.418 73.2095 113.07 73.2095H126.316C129.968 73.2095 132.912 76.1417 132.912 79.7798C132.912 83.3636 129.968 86.3501 126.316 86.3501Z" fill="#588EA5"/>
<path d="M78.1299 61.6435C78.5659 61.2634 79.0565 60.8833 79.6561 60.829C81.1279 60.7204 81.8365 62.5124 82.109 63.9785C82.6541 66.9107 83.1447 69.8972 83.6898 72.8294C83.7988 73.481 83.9624 74.1869 84.5075 74.567C84.998 74.8928 85.7067 74.8385 86.3063 74.7299C89.8494 74.3498 93.556 75.11 96.6085 76.9562C97.5897 77.5535 98.5164 78.3137 98.6799 79.454C98.8434 81.083 97.1536 82.2233 95.5729 82.7663C92.7929 83.7437 89.7404 83.9609 86.8514 83.4179C87.8325 85.3184 88.5957 87.3818 89.1953 89.4452C89.9039 92.0517 89.7404 95.5812 87.2329 96.5586C85.3251 97.2645 83.2537 95.9613 82 94.3866C80.7463 92.8119 79.8742 90.9114 78.2934 89.6082C76.113 92.2146 72.6789 93.4635 69.4083 94.3866C67.0644 95.0382 64.0664 95.2554 62.7582 93.192C62.1041 92.106 63.4668 88.7394 65.2656 87.3275C67.2825 85.7528 68.3727 84.2324 70.444 83.1464C65.9197 81.4631 63.6303 80.8115 60.7413 76.9562C59.9237 75.8702 59.3786 74.1326 60.5233 73.4267C60.9049 73.2095 61.3409 73.2095 61.7225 73.2095C65.6472 73.1009 69.9534 74.5127 72.5699 71.5262C74.9683 68.7026 74.9683 64.4672 78.1299 61.6435Z" fill="#588EA5"/>
<circle cx="80" cy="80" r="78" stroke="#588EA5" stroke-width="4"/>
</svg>

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@@ -1,8 +1,13 @@
import 'package:account/account.dart';
import 'package:auth/auth.dart';
import 'package:functions/functions.dart';
import 'package:customer_service/customer_service.dart';
import 'package:legacy_dashboard_shell/legacy_dashboard_builder.dart';
import 'package:dashboard_shell/dashboard_builder.dart';
import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart';
import 'package:go_router/go_router.dart';
import 'package:hub/hub.dart';
import 'package:home/home.dart';
import 'package:navigation/navigation.dart';
import 'package:notifications/notifications.dart';
@@ -16,7 +21,7 @@ late final GoRouter appRouter;
void configureAppRouter() {
appRouter = GoRouter(
navigatorKey: rootNavigatorKey,
initialLocation: AppRoutes.splash,
initialLocation: AppRoutes.dashboardHub,
debugLogDiagnostics: true,
routes: [
GoRoute(
@@ -24,6 +29,72 @@ void configureAppRouter() {
name: 'splash',
pageBuilder: SplashBuilder().buildPage,
),
StatefulShellRoute.indexedStack(
builder: (context, state, navShell) {
return LegacyDashboardBuilder().build(context, navShell);
},
branches: [
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.dashboardHub,
name: 'hub',
pageBuilder: const HubBuilder().buildPage,
),
],
),
StatefulShellBranch(
routes: [
GoRoute(
path: AppRoutes.dashboardFunctions,
name: 'functions',
pageBuilder: FunctionsBuilder().buildPage,
),
],
),
],
),
GoRoute(
path: AppRoutes.contacts,
name: 'contacts',
pageBuilder: ContactsBuilder().buildPage,
),
GoRoute(
path: AppRoutes.remoteConnection,
name: 'remote_connection',
pageBuilder: RemoteConnectionBuilder().buildPage,
),
GoRoute(
path: AppRoutes.locateDevice,
name: 'locate_device',
pageBuilder: LocateDeviceBuilder().buildPage,
),
GoRoute(
path: AppRoutes.accountSettings,
name: 'account_settings',
pageBuilder: AccountSettingsBuilder().buildPage,
),
GoRoute(
path: AppRoutes.personalData,
name: 'personal_data',
pageBuilder: PersonalDataBuilder().buildPage,
),
GoRoute(
path: AppRoutes.linkedDevices,
name: 'linked_devices',
pageBuilder: LinkedDevicesBuilder().buildPage,
),
GoRoute(
path: AppRoutes.appUsers,
name: 'app_users',
pageBuilder: AppUsersBuilder().buildPage,
),
GoRoute(
path: AppRoutes.customerService,
name: 'customer_service',
pageBuilder: CustomerServiceBuilder().buildPage,
),
GoRoute(
path: AppRoutes.login,
name: 'login',

View File

@@ -6,6 +6,10 @@
#include "generated_plugin_registrant.h"
#include <url_launcher_linux/url_launcher_plugin.h>
void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);
}

View File

@@ -3,6 +3,7 @@
#
list(APPEND FLUTTER_PLUGIN_LIST
url_launcher_linux
)
list(APPEND FLUTTER_FFI_PLUGIN_LIST

View File

@@ -47,8 +47,18 @@ dependencies:
path: ../../modules/notifications
dashboard_shell:
path: ../../modules/dashboard_shell
legacy_dashboard_shell:
path: ../../modules/legacy/modules/legacy_dashboard_shell
hub:
path: ../../modules/legacy/modules/hub
customer_service:
path: ../../modules/legacy/modules/customer_service
splash:
path: ../../modules/splash
account:
path: ../../modules/legacy/modules/account
functions:
path: ../../modules/legacy/modules/functions
#packages dependencies go here
navigation:
path: ../../packages/navigation

View File

@@ -1,26 +0,0 @@
# melos_managed_dependency_overrides: auth,dashboard_shell,design_system,home,navigation,notifications,profile,sf_shared,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides:
auth:
path: ../../modules/auth
dashboard_shell:
path: ../../modules/dashboard_shell
design_system:
path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home:
path: ../../modules/home
navigation:
path: ../../packages/navigation
notifications:
path: ../../modules/notifications
profile:
path: ../../modules/profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations:
path: ../../packages/sf_localizations
sf_shared:
path: ../../packages/sf_shared
utils:
path: ../../packages/utils

View File

@@ -4,9 +4,27 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/splash/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/splash/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/splash/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/hub/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/hub/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/hub/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/dashboard_shell/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/dashboard_shell/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/dashboard_shell/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/hub/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/hub/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/modules/hub/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/legacy/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>
</module>

View File

@@ -14,17 +14,17 @@ class OnboardingPage {
const List<OnboardingPage> onboardingPages = <OnboardingPage>[
OnboardingPage(
image: 'assets/images/ui/bienvenida_paso1.svg',
image: 'assets/images/ui/real_time_device_location.svg',
title: I18n.onboardingTitle1,
subtitle: I18n.onboardingSubtitle1,
),
OnboardingPage(
image: 'assets/images/ui/bienvenida_paso2.svg',
image: 'assets/images/ui/safety_zone.svg',
title: I18n.onboardingTitle2,
subtitle: I18n.onboardingSubtitle2,
),
OnboardingPage(
image: 'assets/images/ui/bienvenida_paso3.svg',
image: 'assets/images/ui/chat.svg',
title: I18n.onboardingTitle3,
subtitle: I18n.onboardingSubtitle3,
),

View File

@@ -5,6 +5,7 @@ import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:fonts/fonts.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
@@ -41,7 +42,7 @@ class OnboardingScreen extends ConsumerWidget {
}
return Scaffold(
backgroundColor: Colors.white,
backgroundColor: Color.fromRGBO(247, 247, 247, 1),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Column(
@@ -64,7 +65,7 @@ class OnboardingScreen extends ConsumerWidget {
StepIndicator(
current: state.cardIndex + 1,
total: onboardingPages.length,
color: const Color(0xFF4A4A4A),
color: Color.fromRGBO(88, 142, 165, 1),
),
const SizedBox(height: 38),
Container(
@@ -74,24 +75,30 @@ class OnboardingScreen extends ConsumerWidget {
onPressed: goToNext,
style: TextButton.styleFrom(
backgroundColor: isLast
? const Color(0xFF329E95)
: const Color(0xFF333333),
foregroundColor: Colors.white,
? const Color.fromRGBO(88, 142, 165, 1)
: const Color.fromRGBO(255, 255, 255, 1),
foregroundColor: isLast
? const Color.fromRGBO(255, 255, 255, 1)
: const Color.fromRGBO(88, 142, 165, 1),
padding: const EdgeInsets.symmetric(
vertical: 16,
horizontal: 24,
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(18),
side: const BorderSide(
color: Color.fromRGBO(88, 142, 165, 1),
width: 3,
),
),
),
child: Text(
isLast
? context.translate(I18n.start)
: context.translate(I18n.next),
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.w600,
style: AppFonts.stolzlStyle(
size: 18,
weight: FontWeight.w600,
),
),
),
@@ -107,11 +114,11 @@ class OnboardingScreen extends ConsumerWidget {
navigationContract.goTo(AppRoutes.linkPhone),
child: Text(
context.translate(I18n.skip),
style: TextStyle(
color: Color(0xFF333333),
style: AppFonts.stolzlStyle(
color: Color.fromRGBO(88, 142, 165, 1),
decoration: TextDecoration.underline,
fontWeight: FontWeight.w500,
fontSize: 18,
weight: FontWeight.w600,
size: 18,
),
),
),

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:fonts/fonts.dart';
import 'package:sf_localizations/sf_localizations.dart';
class OnboardingContent extends StatelessWidget {
@@ -21,28 +22,35 @@ class OnboardingContent extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(flex: 3, child: SvgPicture.asset(image)),
SvgPicture.asset(image, height: 250),
const SizedBox(height: 48),
Text(
context.translate(title),
textAlign: TextAlign.center,
style: const TextStyle(
fontWeight: FontWeight.w700,
fontSize: 28,
style: AppFonts.stolzlStyle(
size: 28,
weight: FontWeight.w700,
color: const Color(0xFF4A4A4A),
height: 1.4,
letterSpacing: 0.3,
color: Color(0xFF4A4A4A),
),
// style: const TextStyle(
// fontWeight: FontWeight.w700,
// fontSize: 28,
// height: 1.4,
// letterSpacing: 0.3,
// color: Color(0xFF4A4A4A),
// ),
),
const SizedBox(height: 16),
Text(
context.translate(subtitle),
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 18,
style: AppFonts.stolzlStyle(
size: 18,
height: 1.4,
letterSpacing: 0.3,
color: Color(0xFF9B9B9B),
color: const Color(0xFF333333),
),
),
],

View File

@@ -80,7 +80,7 @@ class AccountCreatedScreen extends ConsumerWidget {
PrimaryButton(
onPressed: () => navigationContract.goTo(AppRoutes.login),
text: context.translate(I18n.accountCreatedContinue),
color: theme.getColorFor(ThemeCode.buttonPrimary),
color: Color.fromRGBO(88, 142, 165, 1),
),
const Spacer(flex: 8),
],

View File

@@ -226,7 +226,7 @@ class SecretCodeScreen extends ConsumerWidget {
}
},
text: context.translate(I18n.secretCodeConfigure),
color: theme.getColorFor(ThemeCode.buttonPrimary),
color: Color.fromRGBO(88, 142, 165, 1),
),
],
),

View File

@@ -99,7 +99,7 @@ class SignUpLayout extends StatelessWidget {
onPressed: onNextPressed,
text: "Siguiente",
size: 16,
color: theme.getColorFor(ThemeCode.buttonSecondary),
color: Color.fromRGBO(88, 142, 165, 1),
),
),
],

View File

@@ -13,8 +13,8 @@ dependencies:
flutter:
sdk: flutter
#modules dependencies go here
dashboard_shell:
path: ../../modules/dashboard_shell
home:
path: ../../modules/home
#packages dependencies go here
design_system:
path: ../../packages/design_system
@@ -26,6 +26,8 @@ dependencies:
path: ../../packages/sf_infrastructure
utils:
path: ../../packages/utils
fonts:
path: ../../packages/fonts
#dependencies go here
flutter_svg: ^2.2.1
get_it: ^9.0.5
@@ -38,6 +40,8 @@ dependencies:
json_annotation: ^4.9.0
json_serializable: ^6.11.2
uuid: ^4.5.2
flutter_map: ^8.2.2
latlong2: ^0.9.1
dev_dependencies:
flutter_test:

View File

@@ -1,24 +0,0 @@
# melos_managed_dependency_overrides: dashboard_shell,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides:
dashboard_shell:
path: ../dashboard_shell
design_system:
path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home:
path: ../home
navigation:
path: ../../packages/navigation
notifications:
path: ../notifications
profile:
path: ../profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations:
path: ../../packages/sf_localizations
sf_shared:
path: ../../packages/sf_shared
utils:
path: ../../packages/utils

View File

@@ -1,24 +0,0 @@
# melos_managed_dependency_overrides: auth,design_system,home,notifications,profile,sf_shared,navigation,utils,sf_localizations,fonts,sf_infrastructure
dependency_overrides:
auth:
path: ../auth
design_system:
path: ../../packages/design_system
fonts:
path: ../../packages/fonts
home:
path: ../home
navigation:
path: ../../packages/navigation
notifications:
path: ../notifications
profile:
path: ../profile
sf_infrastructure:
path: ../../packages/sf_infrastructure
sf_localizations:
path: ../../packages/sf_localizations
sf_shared:
path: ../../packages/sf_shared
utils:
path: ../../packages/utils

48
modules/legacy/.gitignore vendored Normal file
View File

@@ -0,0 +1,48 @@
.DS_Store
.dart_tool/
.pub/
.idea/
.vagrant/
.sconsign.dblite
.svn/
migrate_working_dir/
*.swp
profile
DerivedData/
.generated/
*.pbxuser
*.mode1v3
*.mode2v3
*.perspectivev3
!default.pbxuser
!default.mode1v3
!default.mode2v3
!default.perspectivev3
xcuserdata
*.moved-aside
*.pyc
*sync/
Icon?
.tags*
build/
.android/
.ios/
.flutter-plugins-dependencies
# Symbolication related
app.*.symbols
# Obfuscation related
app.*.map.json

10
modules/legacy/.metadata Normal file
View File

@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.
version:
revision: "9f455d2486bcb28cad87b062475f42edc959f636"
channel: "stable"
project_type: module

11
modules/legacy/README.md Normal file
View File

@@ -0,0 +1,11 @@
# legacy
A new Flutter project.
## Getting Started
For help getting started with Flutter development, view the online
[documentation](https://flutter.dev/).
For instructions integrating Flutter modules to your existing applications,
see the [add-to-app documentation](https://flutter.dev/to/add-to-app).

View File

@@ -0,0 +1,4 @@
include: package:flutter_lints/flutter.yaml
# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options

14
modules/legacy/legacy.iml Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
<excludeFolder url="file://$MODULE_DIR$/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/.idea" />
<excludeFolder url="file://$MODULE_DIR$/.pub" />
<excludeFolder url="file://$MODULE_DIR$/build" />
<excludeFolder url="file://$MODULE_DIR$/android/.gradle" />
<excludeFolder url="file://$MODULE_DIR$/android/.idea" />
<excludeFolder url="file://$MODULE_DIR$/ios/Flutter" />
<excludeFolder url="file://$MODULE_DIR$/ios/Pods" />
<excludeFolder url="file://$MODULE_DIR$/ios/.symlinks" />
<excludeFolder url="file://$MODULE_DIR$/macos/Flutter" />
<excludeFolder url="file://$MODULE_DIR$/macos/Pods" />
<excludeFolder url="file://$MODULE_DIR$/macos/.symlinks" />
<excludeFolder url="file://$MODULE_DIR$/modules/customer_service/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/customer_service/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/customer_service/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/account/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/account/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/account/build" />
<excludeFolder url="file://$MODULE_DIR$/modules/functions/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/modules/functions/.pub" />
<excludeFolder url="file://$MODULE_DIR$/modules/functions/build" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/.dart_tool" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/.pub" />
<excludeFolder url="file://$MODULE_DIR$/packages/legacy_shared/build" />
</content>
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Dart SDK" level="project" />
<orderEntry type="library" name="Flutter Plugins" level="project" />
<orderEntry type="library" name="Dart Packages" level="project" />
</component>
</module>

View File

@@ -0,0 +1,18 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
abstract class AccountRemoteDatasource {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
}

View File

@@ -0,0 +1,189 @@
import 'dart:convert';
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/data/models/get_app_users_response_model.dart';
import 'package:account/src/core/data/models/get_linked_devices_response_model.dart';
import 'package:account/src/core/data/models/update_device_request_model.dart';
import 'package:account/src/core/data/models/update_user_request_model.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:dio/dio.dart';
// import 'package:flutter/material.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
class AccountRemoteDatasourceImpl implements AccountRemoteDatasource {
AccountRemoteDatasourceImpl(this._repository);
final QuestiaRepository _repository;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/$userId/devices',
);
final data = response.data!['items'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /:userId/devices');
}
final model = GetLinkedDevicesResponseModel.fromJson(data);
/*final model = GetLinkedDevicesResponseModel(items: [
GetLinkedDevicesItemResponseModel(
identificator: '1111',
name: 'Carlos',
number: '111111111'),
GetLinkedDevicesItemResponseModel(
identificator: '1112',
name: 'Ana',
number: '222222222'),
]);*/
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.message ?? 'Error getting devices',
);
}
}
@override
Future<void> deleteDevice({required String userId, required String deviceId}) async {
try {
await _repository.put<void>(
'/users/$userId/devices/$deviceId',
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to delete device');
}
}
@override
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) async {
throw UnimplementedError();
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId/devices/$deviceId',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to update device');
}
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) async {
try {
final body = request.toModel().toJson();
await _repository.put<void>(
'/users/$userId',
body: body,
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to update user');
}
}
@override
Future<List<UserEntity>> getAppUsers({required String userId}) async {
try {
final response = await _repository.get<Map<String, dynamic>>(
'/$userId/devices',
);
final data = response.data!['items'];
if (data == null || data.isEmpty) {
throw Exception('Empty response from /:userId/devices');
}
final model = GetAppUsersResponseModel.fromJson(data);
/*final model = GetAppUsersResponseModel(items: [
GetAppUsersItemResponseModel(
id: 'id',
delegationId: 'delegationId',
email: 'carlos@test.com',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
status: 'status',
role: 'role',
lastLogin: 'lastLogin',
currentLogin: 'currentLogin',
language: 'language',
firstName: 'Carlos',
lastName: 'lastName',
hasApiKey: 'hasApiKey',
phone: 'phone',),
GetAppUsersItemResponseModel(
id: 'id',
delegationId: 'delegationId',
email: 'ana@test.com',
createdAt: 'createdAt',
updatedAt: 'updatedAt',
status: 'status',
role: 'role',
lastLogin: 'lastLogin',
currentLogin: 'currentLogin',
language: 'language',
firstName: 'Ana',
lastName: 'lastName',
hasApiKey: 'hasApiKey',
phone: 'phone',),
]);*/
return model.toEntity();
} on DioException catch (error) {
throw _mapDioError(
error,
defaultMessage: error.message ?? 'Error getting devices',
);
}
}
@override
Future<void> deleteAppUser({required String userId}) async {
throw UnimplementedError();
try {
await _repository.delete<void>(
'/users/$userId',
);
} on DioException catch (error) {
throw _mapDioError(error, defaultMessage: 'Error to delete device');
}
}
}
Exception _mapDioError(DioException error, {required String defaultMessage}) {
final apiMsg = _extractApiMessage(error.response?.data);
final msg = apiMsg ?? error.message ?? defaultMessage;
return Exception(msg);
}
String? _extractApiMessage(Object? data) {
if (data == null) return null;
if (data is Map) {
final errorObj = data['error'];
if (errorObj is Map && errorObj['message'] is String) {
return (errorObj['message'] as String).trim();
}
if (data['message'] is String) {
return (data['message'] as String).trim();
}
return null;
}
if (data is String) {
final raw = data.trim();
if (raw.isEmpty) return null;
try {
final decoded = jsonDecode(raw);
return _extractApiMessage(decoded);
} catch (_) {
return raw;
}
}
return null;
}

View File

@@ -0,0 +1,61 @@
import 'package:legacy_shared/legacy_shared.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_app_users_response_model.freezed.dart';
part 'get_app_users_response_model.g.dart';
@freezed
abstract class GetAppUsersResponseModel with _$GetAppUsersResponseModel {
const factory GetAppUsersResponseModel({
required List<GetAppUsersItemResponseModel> items,
}) = _GetAppUsersResponseModel;
factory GetAppUsersResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetAppUsersResponseModelFromJson(json);
}
@freezed
abstract class GetAppUsersItemResponseModel with _$GetAppUsersItemResponseModel {
const factory GetAppUsersItemResponseModel({
required String id,
required String delegationId,
required String email,
required String createdAt,
required String updatedAt,
required String status,
required String role,
required String lastLogin,
required String currentLogin,
required String language,
required String firstName,
required String lastName,
required String hasApiKey,
required String phone
}) =
_GetAppUsersItemResponseModel;
factory GetAppUsersItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetAppUsersItemResponseModelFromJson(json);
}
extension GetUsersResponseModelMapper on GetAppUsersResponseModel {
List<UserEntity> toEntity() {
return items.map((GetAppUsersItemResponseModel item) => UserEntity(
id: item.id,
delegationId: item.delegationId,
email: item.email,
createdAt: item.createdAt,
updatedAt: item.updatedAt,
status: item.status,
role: item.role,
lastLogin: item.lastLogin,
currentLogin: item.currentLogin,
language: item.language,
firstName: item.firstName,
lastName: item.lastName,
hasApiKey: item.hasApiKey,
phone: item.phone,
)).toList();
}
}

View File

@@ -0,0 +1,585 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'get_app_users_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetAppUsersResponseModel {
List<GetAppUsersItemResponseModel> get items;
/// Create a copy of GetAppUsersResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetAppUsersResponseModelCopyWith<GetAppUsersResponseModel> get copyWith => _$GetAppUsersResponseModelCopyWithImpl<GetAppUsersResponseModel>(this as GetAppUsersResponseModel, _$identity);
/// Serializes this GetAppUsersResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetAppUsersResponseModel&&const DeepCollectionEquality().equals(other.items, items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(items));
@override
String toString() {
return 'GetAppUsersResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class $GetAppUsersResponseModelCopyWith<$Res> {
factory $GetAppUsersResponseModelCopyWith(GetAppUsersResponseModel value, $Res Function(GetAppUsersResponseModel) _then) = _$GetAppUsersResponseModelCopyWithImpl;
@useResult
$Res call({
List<GetAppUsersItemResponseModel> items
});
}
/// @nodoc
class _$GetAppUsersResponseModelCopyWithImpl<$Res>
implements $GetAppUsersResponseModelCopyWith<$Res> {
_$GetAppUsersResponseModelCopyWithImpl(this._self, this._then);
final GetAppUsersResponseModel _self;
final $Res Function(GetAppUsersResponseModel) _then;
/// Create a copy of GetAppUsersResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,}) {
return _then(_self.copyWith(
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
as List<GetAppUsersItemResponseModel>,
));
}
}
/// Adds pattern-matching-related methods to [GetAppUsersResponseModel].
extension GetAppUsersResponseModelPatterns on GetAppUsersResponseModel {
/// 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( _GetAppUsersResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetAppUsersResponseModel() 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( _GetAppUsersResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetAppUsersResponseModel():
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( _GetAppUsersResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetAppUsersResponseModel() 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<GetAppUsersItemResponseModel> items)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetAppUsersResponseModel() when $default != null:
return $default(_that.items);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<GetAppUsersItemResponseModel> items) $default,) {final _that = this;
switch (_that) {
case _GetAppUsersResponseModel():
return $default(_that.items);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<GetAppUsersItemResponseModel> items)? $default,) {final _that = this;
switch (_that) {
case _GetAppUsersResponseModel() when $default != null:
return $default(_that.items);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetAppUsersResponseModel implements GetAppUsersResponseModel {
const _GetAppUsersResponseModel({required final List<GetAppUsersItemResponseModel> items}): _items = items;
factory _GetAppUsersResponseModel.fromJson(Map<String, dynamic> json) => _$GetAppUsersResponseModelFromJson(json);
final List<GetAppUsersItemResponseModel> _items;
@override List<GetAppUsersItemResponseModel> get items {
if (_items is EqualUnmodifiableListView) return _items;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_items);
}
/// Create a copy of GetAppUsersResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetAppUsersResponseModelCopyWith<_GetAppUsersResponseModel> get copyWith => __$GetAppUsersResponseModelCopyWithImpl<_GetAppUsersResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetAppUsersResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAppUsersResponseModel&&const DeepCollectionEquality().equals(other._items, _items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items));
@override
String toString() {
return 'GetAppUsersResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class _$GetAppUsersResponseModelCopyWith<$Res> implements $GetAppUsersResponseModelCopyWith<$Res> {
factory _$GetAppUsersResponseModelCopyWith(_GetAppUsersResponseModel value, $Res Function(_GetAppUsersResponseModel) _then) = __$GetAppUsersResponseModelCopyWithImpl;
@override @useResult
$Res call({
List<GetAppUsersItemResponseModel> items
});
}
/// @nodoc
class __$GetAppUsersResponseModelCopyWithImpl<$Res>
implements _$GetAppUsersResponseModelCopyWith<$Res> {
__$GetAppUsersResponseModelCopyWithImpl(this._self, this._then);
final _GetAppUsersResponseModel _self;
final $Res Function(_GetAppUsersResponseModel) _then;
/// Create a copy of GetAppUsersResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) {
return _then(_GetAppUsersResponseModel(
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
as List<GetAppUsersItemResponseModel>,
));
}
}
/// @nodoc
mixin _$GetAppUsersItemResponseModel {
String get id; String get delegationId; String get email; String get createdAt; String get updatedAt; String get status; String get role; String get lastLogin; String get currentLogin; String get language; String get firstName; String get lastName; String get hasApiKey; String get phone;
/// Create a copy of GetAppUsersItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetAppUsersItemResponseModelCopyWith<GetAppUsersItemResponseModel> get copyWith => _$GetAppUsersItemResponseModelCopyWithImpl<GetAppUsersItemResponseModel>(this as GetAppUsersItemResponseModel, _$identity);
/// Serializes this GetAppUsersItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetAppUsersItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'GetAppUsersItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class $GetAppUsersItemResponseModelCopyWith<$Res> {
factory $GetAppUsersItemResponseModelCopyWith(GetAppUsersItemResponseModel value, $Res Function(GetAppUsersItemResponseModel) _then) = _$GetAppUsersItemResponseModelCopyWithImpl;
@useResult
$Res call({
String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone
});
}
/// @nodoc
class _$GetAppUsersItemResponseModelCopyWithImpl<$Res>
implements $GetAppUsersItemResponseModelCopyWith<$Res> {
_$GetAppUsersItemResponseModelCopyWithImpl(this._self, this._then);
final GetAppUsersItemResponseModel _self;
final $Res Function(GetAppUsersItemResponseModel) _then;
/// Create a copy of GetAppUsersItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [GetAppUsersItemResponseModel].
extension GetAppUsersItemResponseModelPatterns on GetAppUsersItemResponseModel {
/// 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( _GetAppUsersItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel() 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( _GetAppUsersItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel():
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( _GetAppUsersItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel() 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return 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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone) $default,) {final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel():
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
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 delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone)? $default,) {final _that = this;
switch (_that) {
case _GetAppUsersItemResponseModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetAppUsersItemResponseModel implements GetAppUsersItemResponseModel {
const _GetAppUsersItemResponseModel({required this.id, required this.delegationId, required this.email, required this.createdAt, required this.updatedAt, required this.status, required this.role, required this.lastLogin, required this.currentLogin, required this.language, required this.firstName, required this.lastName, required this.hasApiKey, required this.phone});
factory _GetAppUsersItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetAppUsersItemResponseModelFromJson(json);
@override final String id;
@override final String delegationId;
@override final String email;
@override final String createdAt;
@override final String updatedAt;
@override final String status;
@override final String role;
@override final String lastLogin;
@override final String currentLogin;
@override final String language;
@override final String firstName;
@override final String lastName;
@override final String hasApiKey;
@override final String phone;
/// Create a copy of GetAppUsersItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetAppUsersItemResponseModelCopyWith<_GetAppUsersItemResponseModel> get copyWith => __$GetAppUsersItemResponseModelCopyWithImpl<_GetAppUsersItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetAppUsersItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetAppUsersItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'GetAppUsersItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class _$GetAppUsersItemResponseModelCopyWith<$Res> implements $GetAppUsersItemResponseModelCopyWith<$Res> {
factory _$GetAppUsersItemResponseModelCopyWith(_GetAppUsersItemResponseModel value, $Res Function(_GetAppUsersItemResponseModel) _then) = __$GetAppUsersItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String id, String delegationId, String email, String createdAt, String updatedAt, String status, String role, String lastLogin, String currentLogin, String language, String firstName, String lastName, String hasApiKey, String phone
});
}
/// @nodoc
class __$GetAppUsersItemResponseModelCopyWithImpl<$Res>
implements _$GetAppUsersItemResponseModelCopyWith<$Res> {
__$GetAppUsersItemResponseModelCopyWithImpl(this._self, this._then);
final _GetAppUsersItemResponseModel _self;
final $Res Function(_GetAppUsersItemResponseModel) _then;
/// Create a copy of GetAppUsersItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = null,Object? email = null,Object? createdAt = null,Object? updatedAt = null,Object? status = null,Object? role = null,Object? lastLogin = null,Object? currentLogin = null,Object? language = null,Object? firstName = null,Object? lastName = null,Object? hasApiKey = null,Object? phone = null,}) {
return _then(_GetAppUsersItemResponseModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: null == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,createdAt: null == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String,updatedAt: null == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String,status: null == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String,role: null == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String,lastLogin: null == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String,currentLogin: null == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String,language: null == language ? _self.language : language // 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,hasApiKey: null == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String,phone: null == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,59 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_app_users_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetAppUsersResponseModel _$GetAppUsersResponseModelFromJson(
Map<String, dynamic> json,
) => _GetAppUsersResponseModel(
items: (json['items'] as List<dynamic>)
.map(
(e) => GetAppUsersItemResponseModel.fromJson(e as Map<String, dynamic>),
)
.toList(),
);
Map<String, dynamic> _$GetAppUsersResponseModelToJson(
_GetAppUsersResponseModel instance,
) => <String, dynamic>{'items': instance.items};
_GetAppUsersItemResponseModel _$GetAppUsersItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetAppUsersItemResponseModel(
id: json['id'] as String,
delegationId: json['delegationId'] as String,
email: json['email'] as String,
createdAt: json['createdAt'] as String,
updatedAt: json['updatedAt'] as String,
status: json['status'] as String,
role: json['role'] as String,
lastLogin: json['lastLogin'] as String,
currentLogin: json['currentLogin'] as String,
language: json['language'] as String,
firstName: json['firstName'] as String,
lastName: json['lastName'] as String,
hasApiKey: json['hasApiKey'] as String,
phone: json['phone'] as String,
);
Map<String, dynamic> _$GetAppUsersItemResponseModelToJson(
_GetAppUsersItemResponseModel instance,
) => <String, dynamic>{
'id': instance.id,
'delegationId': instance.delegationId,
'email': instance.email,
'createdAt': instance.createdAt,
'updatedAt': instance.updatedAt,
'status': instance.status,
'role': instance.role,
'lastLogin': instance.lastLogin,
'currentLogin': instance.currentLogin,
'language': instance.language,
'firstName': instance.firstName,
'lastName': instance.lastName,
'hasApiKey': instance.hasApiKey,
'phone': instance.phone,
};

View File

@@ -0,0 +1,38 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_linked_devices_response_model.freezed.dart';
part 'get_linked_devices_response_model.g.dart';
@freezed
abstract class GetLinkedDevicesResponseModel with _$GetLinkedDevicesResponseModel {
const factory GetLinkedDevicesResponseModel({
required List<GetLinkedDevicesItemResponseModel> items,
}) = _GetLinkedDevicesResponseModel;
factory GetLinkedDevicesResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesResponseModelFromJson(json);
}
@freezed
abstract class GetLinkedDevicesItemResponseModel with _$GetLinkedDevicesItemResponseModel {
const factory GetLinkedDevicesItemResponseModel({
required String identificator,
required String name,
required String number,
}) =
_GetLinkedDevicesItemResponseModel;
factory GetLinkedDevicesItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLinkedDevicesItemResponseModelFromJson(json);
}
extension GetDevicesResponseModelMapper on GetLinkedDevicesResponseModel {
List<DeviceEntity> toEntity() {
return items.map((GetLinkedDevicesItemResponseModel item) => DeviceEntity(
identificator: item.identificator,
name: item.name,
number: item.number
)).toList();
}
}

View File

@@ -0,0 +1,552 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'get_linked_devices_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetLinkedDevicesResponseModel {
List<GetLinkedDevicesItemResponseModel> get items;
/// Create a copy of GetLinkedDevicesResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLinkedDevicesResponseModelCopyWith<GetLinkedDevicesResponseModel> get copyWith => _$GetLinkedDevicesResponseModelCopyWithImpl<GetLinkedDevicesResponseModel>(this as GetLinkedDevicesResponseModel, _$identity);
/// Serializes this GetLinkedDevicesResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesResponseModel&&const DeepCollectionEquality().equals(other.items, items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(items));
@override
String toString() {
return 'GetLinkedDevicesResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class $GetLinkedDevicesResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesResponseModelCopyWith(GetLinkedDevicesResponseModel value, $Res Function(GetLinkedDevicesResponseModel) _then) = _$GetLinkedDevicesResponseModelCopyWithImpl;
@useResult
$Res call({
List<GetLinkedDevicesItemResponseModel> items
});
}
/// @nodoc
class _$GetLinkedDevicesResponseModelCopyWithImpl<$Res>
implements $GetLinkedDevicesResponseModelCopyWith<$Res> {
_$GetLinkedDevicesResponseModelCopyWithImpl(this._self, this._then);
final GetLinkedDevicesResponseModel _self;
final $Res Function(GetLinkedDevicesResponseModel) _then;
/// Create a copy of GetLinkedDevicesResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? items = null,}) {
return _then(_self.copyWith(
items: null == items ? _self.items : items // ignore: cast_nullable_to_non_nullable
as List<GetLinkedDevicesItemResponseModel>,
));
}
}
/// Adds pattern-matching-related methods to [GetLinkedDevicesResponseModel].
extension GetLinkedDevicesResponseModelPatterns on GetLinkedDevicesResponseModel {
/// 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( _GetLinkedDevicesResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel() 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( _GetLinkedDevicesResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel():
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( _GetLinkedDevicesResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel() 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<GetLinkedDevicesItemResponseModel> items)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel() when $default != null:
return $default(_that.items);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( List<GetLinkedDevicesItemResponseModel> items) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel():
return $default(_that.items);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( List<GetLinkedDevicesItemResponseModel> items)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesResponseModel() when $default != null:
return $default(_that.items);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLinkedDevicesResponseModel implements GetLinkedDevicesResponseModel {
const _GetLinkedDevicesResponseModel({required final List<GetLinkedDevicesItemResponseModel> items}): _items = items;
factory _GetLinkedDevicesResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesResponseModelFromJson(json);
final List<GetLinkedDevicesItemResponseModel> _items;
@override List<GetLinkedDevicesItemResponseModel> get items {
if (_items is EqualUnmodifiableListView) return _items;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_items);
}
/// Create a copy of GetLinkedDevicesResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLinkedDevicesResponseModelCopyWith<_GetLinkedDevicesResponseModel> get copyWith => __$GetLinkedDevicesResponseModelCopyWithImpl<_GetLinkedDevicesResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLinkedDevicesResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesResponseModel&&const DeepCollectionEquality().equals(other._items, _items));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,const DeepCollectionEquality().hash(_items));
@override
String toString() {
return 'GetLinkedDevicesResponseModel(items: $items)';
}
}
/// @nodoc
abstract mixin class _$GetLinkedDevicesResponseModelCopyWith<$Res> implements $GetLinkedDevicesResponseModelCopyWith<$Res> {
factory _$GetLinkedDevicesResponseModelCopyWith(_GetLinkedDevicesResponseModel value, $Res Function(_GetLinkedDevicesResponseModel) _then) = __$GetLinkedDevicesResponseModelCopyWithImpl;
@override @useResult
$Res call({
List<GetLinkedDevicesItemResponseModel> items
});
}
/// @nodoc
class __$GetLinkedDevicesResponseModelCopyWithImpl<$Res>
implements _$GetLinkedDevicesResponseModelCopyWith<$Res> {
__$GetLinkedDevicesResponseModelCopyWithImpl(this._self, this._then);
final _GetLinkedDevicesResponseModel _self;
final $Res Function(_GetLinkedDevicesResponseModel) _then;
/// Create a copy of GetLinkedDevicesResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? items = null,}) {
return _then(_GetLinkedDevicesResponseModel(
items: null == items ? _self._items : items // ignore: cast_nullable_to_non_nullable
as List<GetLinkedDevicesItemResponseModel>,
));
}
}
/// @nodoc
mixin _$GetLinkedDevicesItemResponseModel {
String get identificator; String get name; String get number;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLinkedDevicesItemResponseModelCopyWith<GetLinkedDevicesItemResponseModel> get copyWith => _$GetLinkedDevicesItemResponseModelCopyWithImpl<GetLinkedDevicesItemResponseModel>(this as GetLinkedDevicesItemResponseModel, _$identity);
/// Serializes this GetLinkedDevicesItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class $GetLinkedDevicesItemResponseModelCopyWith<$Res> {
factory $GetLinkedDevicesItemResponseModelCopyWith(GetLinkedDevicesItemResponseModel value, $Res Function(GetLinkedDevicesItemResponseModel) _then) = _$GetLinkedDevicesItemResponseModelCopyWithImpl;
@useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class _$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res>
implements $GetLinkedDevicesItemResponseModelCopyWith<$Res> {
_$GetLinkedDevicesItemResponseModelCopyWithImpl(this._self, this._then);
final GetLinkedDevicesItemResponseModel _self;
final $Res Function(GetLinkedDevicesItemResponseModel) _then;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_self.copyWith(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [GetLinkedDevicesItemResponseModel].
extension GetLinkedDevicesItemResponseModelPatterns on GetLinkedDevicesItemResponseModel {
/// 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( _GetLinkedDevicesItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() 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( _GetLinkedDevicesItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel():
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( _GetLinkedDevicesItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String name, String number) $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel():
return $default(_that.identificator,_that.name,_that.number);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String name, String number)? $default,) {final _that = this;
switch (_that) {
case _GetLinkedDevicesItemResponseModel() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLinkedDevicesItemResponseModel implements GetLinkedDevicesItemResponseModel {
const _GetLinkedDevicesItemResponseModel({required this.identificator, required this.name, required this.number});
factory _GetLinkedDevicesItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetLinkedDevicesItemResponseModelFromJson(json);
@override final String identificator;
@override final String name;
@override final String number;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLinkedDevicesItemResponseModelCopyWith<_GetLinkedDevicesItemResponseModel> get copyWith => __$GetLinkedDevicesItemResponseModelCopyWithImpl<_GetLinkedDevicesItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLinkedDevicesItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLinkedDevicesItemResponseModel&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'GetLinkedDevicesItemResponseModel(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class _$GetLinkedDevicesItemResponseModelCopyWith<$Res> implements $GetLinkedDevicesItemResponseModelCopyWith<$Res> {
factory _$GetLinkedDevicesItemResponseModelCopyWith(_GetLinkedDevicesItemResponseModel value, $Res Function(_GetLinkedDevicesItemResponseModel) _then) = __$GetLinkedDevicesItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class __$GetLinkedDevicesItemResponseModelCopyWithImpl<$Res>
implements _$GetLinkedDevicesItemResponseModelCopyWith<$Res> {
__$GetLinkedDevicesItemResponseModelCopyWithImpl(this._self, this._then);
final _GetLinkedDevicesItemResponseModel _self;
final $Res Function(_GetLinkedDevicesItemResponseModel) _then;
/// Create a copy of GetLinkedDevicesItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_GetLinkedDevicesItemResponseModel(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,39 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_linked_devices_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetLinkedDevicesResponseModel _$GetLinkedDevicesResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLinkedDevicesResponseModel(
items: (json['items'] as List<dynamic>)
.map(
(e) => GetLinkedDevicesItemResponseModel.fromJson(
e as Map<String, dynamic>,
),
)
.toList(),
);
Map<String, dynamic> _$GetLinkedDevicesResponseModelToJson(
_GetLinkedDevicesResponseModel instance,
) => <String, dynamic>{'items': instance.items};
_GetLinkedDevicesItemResponseModel _$GetLinkedDevicesItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLinkedDevicesItemResponseModel(
identificator: json['identificator'] as String,
name: json['name'] as String,
number: json['number'] as String,
);
Map<String, dynamic> _$GetLinkedDevicesItemResponseModelToJson(
_GetLinkedDevicesItemResponseModel instance,
) => <String, dynamic>{
'identificator': instance.identificator,
'name': instance.name,
'number': instance.number,
};

View File

@@ -0,0 +1,60 @@
import 'package:legacy_shared/legacy_shared.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'get_logged_user_response_model.freezed.dart';
part 'get_logged_user_response_model.g.dart';
@freezed
abstract class GetLoggedUserResponseModel with _$GetLoggedUserResponseModel {
const factory GetLoggedUserResponseModel({
required GetLoggedUserItemResponseModel item,
}) = _GetLoggedUserResponseModel;
factory GetLoggedUserResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLoggedUserResponseModelFromJson(json);
}
@freezed
abstract class GetLoggedUserItemResponseModel with _$GetLoggedUserItemResponseModel {
const factory GetLoggedUserItemResponseModel({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) =
_GetLoggedUserItemResponseModel;
factory GetLoggedUserItemResponseModel.fromJson(Map<String, dynamic> json) =>
_$GetLoggedUserItemResponseModelFromJson(json);
}
extension GetLoggedUserResponseModelMapper on GetLoggedUserResponseModel {
UserEntity toEntity() {
return UserEntity(
id: item.id,
delegationId: item.delegationId ?? '',
email: item.email ?? '',
createdAt: item.createdAt ?? '',
updatedAt: item.updatedAt ?? '',
status: item.status ?? '',
role: item.role ?? '',
lastLogin: item.lastLogin ?? '',
currentLogin: item.currentLogin ?? '',
language: item.language ?? '',
firstName: item.firstName ?? '',
lastName: item.lastName ?? '',
hasApiKey: item.hasApiKey ?? '',
phone: item.phone ?? ''
);
}
}

View File

@@ -0,0 +1,597 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'get_logged_user_response_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$GetLoggedUserResponseModel {
GetLoggedUserItemResponseModel get item;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLoggedUserResponseModelCopyWith<GetLoggedUserResponseModel> get copyWith => _$GetLoggedUserResponseModelCopyWithImpl<GetLoggedUserResponseModel>(this as GetLoggedUserResponseModel, _$identity);
/// Serializes this GetLoggedUserResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,item);
@override
String toString() {
return 'GetLoggedUserResponseModel(item: $item)';
}
}
/// @nodoc
abstract mixin class $GetLoggedUserResponseModelCopyWith<$Res> {
factory $GetLoggedUserResponseModelCopyWith(GetLoggedUserResponseModel value, $Res Function(GetLoggedUserResponseModel) _then) = _$GetLoggedUserResponseModelCopyWithImpl;
@useResult
$Res call({
GetLoggedUserItemResponseModel item
});
$GetLoggedUserItemResponseModelCopyWith<$Res> get item;
}
/// @nodoc
class _$GetLoggedUserResponseModelCopyWithImpl<$Res>
implements $GetLoggedUserResponseModelCopyWith<$Res> {
_$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then);
final GetLoggedUserResponseModel _self;
final $Res Function(GetLoggedUserResponseModel) _then;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? item = null,}) {
return _then(_self.copyWith(
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
as GetLoggedUserItemResponseModel,
));
}
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<$Res> get item {
return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) {
return _then(_self.copyWith(item: value));
});
}
}
/// Adds pattern-matching-related methods to [GetLoggedUserResponseModel].
extension GetLoggedUserResponseModelPatterns on GetLoggedUserResponseModel {
/// 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( _GetLoggedUserResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() 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( _GetLoggedUserResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel():
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( _GetLoggedUserResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() 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( GetLoggedUserItemResponseModel item)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() when $default != null:
return $default(_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( GetLoggedUserItemResponseModel item) $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel():
return $default(_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( GetLoggedUserItemResponseModel item)? $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserResponseModel() when $default != null:
return $default(_that.item);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLoggedUserResponseModel implements GetLoggedUserResponseModel {
const _GetLoggedUserResponseModel({required this.item});
factory _GetLoggedUserResponseModel.fromJson(Map<String, dynamic> json) => _$GetLoggedUserResponseModelFromJson(json);
@override final GetLoggedUserItemResponseModel item;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLoggedUserResponseModelCopyWith<_GetLoggedUserResponseModel> get copyWith => __$GetLoggedUserResponseModelCopyWithImpl<_GetLoggedUserResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLoggedUserResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserResponseModel&&(identical(other.item, item) || other.item == item));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,item);
@override
String toString() {
return 'GetLoggedUserResponseModel(item: $item)';
}
}
/// @nodoc
abstract mixin class _$GetLoggedUserResponseModelCopyWith<$Res> implements $GetLoggedUserResponseModelCopyWith<$Res> {
factory _$GetLoggedUserResponseModelCopyWith(_GetLoggedUserResponseModel value, $Res Function(_GetLoggedUserResponseModel) _then) = __$GetLoggedUserResponseModelCopyWithImpl;
@override @useResult
$Res call({
GetLoggedUserItemResponseModel item
});
@override $GetLoggedUserItemResponseModelCopyWith<$Res> get item;
}
/// @nodoc
class __$GetLoggedUserResponseModelCopyWithImpl<$Res>
implements _$GetLoggedUserResponseModelCopyWith<$Res> {
__$GetLoggedUserResponseModelCopyWithImpl(this._self, this._then);
final _GetLoggedUserResponseModel _self;
final $Res Function(_GetLoggedUserResponseModel) _then;
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? item = null,}) {
return _then(_GetLoggedUserResponseModel(
item: null == item ? _self.item : item // ignore: cast_nullable_to_non_nullable
as GetLoggedUserItemResponseModel,
));
}
/// Create a copy of GetLoggedUserResponseModel
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<$Res> get item {
return $GetLoggedUserItemResponseModelCopyWith<$Res>(_self.item, (value) {
return _then(_self.copyWith(item: value));
});
}
}
/// @nodoc
mixin _$GetLoggedUserItemResponseModel {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$GetLoggedUserItemResponseModelCopyWith<GetLoggedUserItemResponseModel> get copyWith => _$GetLoggedUserItemResponseModelCopyWithImpl<GetLoggedUserItemResponseModel>(this as GetLoggedUserItemResponseModel, _$identity);
/// Serializes this GetLoggedUserItemResponseModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class $GetLoggedUserItemResponseModelCopyWith<$Res> {
factory $GetLoggedUserItemResponseModelCopyWith(GetLoggedUserItemResponseModel value, $Res Function(GetLoggedUserItemResponseModel) _then) = _$GetLoggedUserItemResponseModelCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$GetLoggedUserItemResponseModelCopyWithImpl<$Res>
implements $GetLoggedUserItemResponseModelCopyWith<$Res> {
_$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then);
final GetLoggedUserItemResponseModel _self;
final $Res Function(GetLoggedUserItemResponseModel) _then;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [GetLoggedUserItemResponseModel].
extension GetLoggedUserItemResponseModelPatterns on GetLoggedUserItemResponseModel {
/// 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( _GetLoggedUserItemResponseModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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( _GetLoggedUserItemResponseModel value) $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel():
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( _GetLoggedUserItemResponseModel value)? $default,){
final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel():
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _GetLoggedUserItemResponseModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _GetLoggedUserItemResponseModel implements GetLoggedUserItemResponseModel {
const _GetLoggedUserItemResponseModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
factory _GetLoggedUserItemResponseModel.fromJson(Map<String, dynamic> json) => _$GetLoggedUserItemResponseModelFromJson(json);
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$GetLoggedUserItemResponseModelCopyWith<_GetLoggedUserItemResponseModel> get copyWith => __$GetLoggedUserItemResponseModelCopyWithImpl<_GetLoggedUserItemResponseModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$GetLoggedUserItemResponseModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _GetLoggedUserItemResponseModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'GetLoggedUserItemResponseModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class _$GetLoggedUserItemResponseModelCopyWith<$Res> implements $GetLoggedUserItemResponseModelCopyWith<$Res> {
factory _$GetLoggedUserItemResponseModelCopyWith(_GetLoggedUserItemResponseModel value, $Res Function(_GetLoggedUserItemResponseModel) _then) = __$GetLoggedUserItemResponseModelCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$GetLoggedUserItemResponseModelCopyWithImpl<$Res>
implements _$GetLoggedUserItemResponseModelCopyWith<$Res> {
__$GetLoggedUserItemResponseModelCopyWithImpl(this._self, this._then);
final _GetLoggedUserItemResponseModel _self;
final $Res Function(_GetLoggedUserItemResponseModel) _then;
/// Create a copy of GetLoggedUserItemResponseModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_GetLoggedUserItemResponseModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,57 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'get_logged_user_response_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_GetLoggedUserResponseModel _$GetLoggedUserResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLoggedUserResponseModel(
item: GetLoggedUserItemResponseModel.fromJson(
json['item'] as Map<String, dynamic>,
),
);
Map<String, dynamic> _$GetLoggedUserResponseModelToJson(
_GetLoggedUserResponseModel instance,
) => <String, dynamic>{'item': instance.item};
_GetLoggedUserItemResponseModel _$GetLoggedUserItemResponseModelFromJson(
Map<String, dynamic> json,
) => _GetLoggedUserItemResponseModel(
id: json['id'] as String,
delegationId: json['delegationId'] as String?,
email: json['email'] as String?,
createdAt: json['createdAt'] as String?,
updatedAt: json['updatedAt'] as String?,
status: json['status'] as String?,
role: json['role'] as String?,
lastLogin: json['lastLogin'] as String?,
currentLogin: json['currentLogin'] as String?,
language: json['language'] as String?,
firstName: json['firstName'] as String?,
lastName: json['lastName'] as String?,
hasApiKey: json['hasApiKey'] as String?,
phone: json['phone'] as String?,
);
Map<String, dynamic> _$GetLoggedUserItemResponseModelToJson(
_GetLoggedUserItemResponseModel instance,
) => <String, dynamic>{
'id': instance.id,
'delegationId': instance.delegationId,
'email': instance.email,
'createdAt': instance.createdAt,
'updatedAt': instance.updatedAt,
'status': instance.status,
'role': instance.role,
'lastLogin': instance.lastLogin,
'currentLogin': instance.currentLogin,
'language': instance.language,
'firstName': instance.firstName,
'lastName': instance.lastName,
'hasApiKey': instance.hasApiKey,
'phone': instance.phone,
};

View File

@@ -0,0 +1,23 @@
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_device_request_model.freezed.dart';
part 'update_device_request_model.g.dart';
@freezed
abstract class UpdateDeviceRequestModel with _$UpdateDeviceRequestModel {
const factory UpdateDeviceRequestModel({
required String identificator,
required String name,
}) = _UpdateDeviceRequestModel;
factory UpdateDeviceRequestModel.fromJson(Map<String, dynamic> json) =>
_$UpdateDeviceRequestModelFromJson(json);
}
extension UpdateDeviceRequestModelMapper on UpdateDeviceRequestEntity {
UpdateDeviceRequestModel toModel() => UpdateDeviceRequestModel(
identificator: identificator,
name: name,
);
}

View File

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

View File

@@ -0,0 +1,21 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_device_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_UpdateDeviceRequestModel _$UpdateDeviceRequestModelFromJson(
Map<String, dynamic> json,
) => _UpdateDeviceRequestModel(
identificator: json['identificator'] as String,
name: json['name'] as String,
);
Map<String, dynamic> _$UpdateDeviceRequestModelToJson(
_UpdateDeviceRequestModel instance,
) => <String, dynamic>{
'identificator': instance.identificator,
'name': instance.name,
};

View File

@@ -0,0 +1,47 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_user_request_model.freezed.dart';
part 'update_user_request_model.g.dart';
@freezed
abstract class UpdateUserRequestModel with _$UpdateUserRequestModel {
const factory UpdateUserRequestModel({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) = _UpdateUserRequestModel;
factory UpdateUserRequestModel.fromJson(Map<String, dynamic> json) =>
_$UpdateUserRequestModelFromJson(json);
}
extension UpdateUserRequestModelMapper on UpdateUserRequestEntity {
UpdateUserRequestModel toModel() => UpdateUserRequestModel(
id: id,
delegationId: delegationId,
email: email,
createdAt: createdAt,
updatedAt: updatedAt,
status: status,
role: role,
lastLogin: lastLogin,
currentLogin: currentLogin,
language: language,
firstName: firstName,
lastName: lastName,
hasApiKey: hasApiKey,
phone: phone,
);
}

View File

@@ -0,0 +1,316 @@
// 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_user_request_model.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UpdateUserRequestModel {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UpdateUserRequestModelCopyWith<UpdateUserRequestModel> get copyWith => _$UpdateUserRequestModelCopyWithImpl<UpdateUserRequestModel>(this as UpdateUserRequestModel, _$identity);
/// Serializes this UpdateUserRequestModel to a JSON map.
Map<String, dynamic> toJson();
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'UpdateUserRequestModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class $UpdateUserRequestModelCopyWith<$Res> {
factory $UpdateUserRequestModelCopyWith(UpdateUserRequestModel value, $Res Function(UpdateUserRequestModel) _then) = _$UpdateUserRequestModelCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$UpdateUserRequestModelCopyWithImpl<$Res>
implements $UpdateUserRequestModelCopyWith<$Res> {
_$UpdateUserRequestModelCopyWithImpl(this._self, this._then);
final UpdateUserRequestModel _self;
final $Res Function(UpdateUserRequestModel) _then;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [UpdateUserRequestModel].
extension UpdateUserRequestModelPatterns on UpdateUserRequestModel {
/// 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( _UpdateUserRequestModel value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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( _UpdateUserRequestModel value) $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel():
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( _UpdateUserRequestModel value)? $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestModel() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel():
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestModel() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return null;
}
}
}
/// @nodoc
@JsonSerializable()
class _UpdateUserRequestModel implements UpdateUserRequestModel {
const _UpdateUserRequestModel({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
factory _UpdateUserRequestModel.fromJson(Map<String, dynamic> json) => _$UpdateUserRequestModelFromJson(json);
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UpdateUserRequestModelCopyWith<_UpdateUserRequestModel> get copyWith => __$UpdateUserRequestModelCopyWithImpl<_UpdateUserRequestModel>(this, _$identity);
@override
Map<String, dynamic> toJson() {
return _$UpdateUserRequestModelToJson(this, );
}
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestModel&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@JsonKey(includeFromJson: false, includeToJson: false)
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'UpdateUserRequestModel(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class _$UpdateUserRequestModelCopyWith<$Res> implements $UpdateUserRequestModelCopyWith<$Res> {
factory _$UpdateUserRequestModelCopyWith(_UpdateUserRequestModel value, $Res Function(_UpdateUserRequestModel) _then) = __$UpdateUserRequestModelCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$UpdateUserRequestModelCopyWithImpl<$Res>
implements _$UpdateUserRequestModelCopyWith<$Res> {
__$UpdateUserRequestModelCopyWithImpl(this._self, this._then);
final _UpdateUserRequestModel _self;
final $Res Function(_UpdateUserRequestModel) _then;
/// Create a copy of UpdateUserRequestModel
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_UpdateUserRequestModel(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,45 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'update_user_request_model.dart';
// **************************************************************************
// JsonSerializableGenerator
// **************************************************************************
_UpdateUserRequestModel _$UpdateUserRequestModelFromJson(
Map<String, dynamic> json,
) => _UpdateUserRequestModel(
id: json['id'] as String,
delegationId: json['delegationId'] as String?,
email: json['email'] as String?,
createdAt: json['createdAt'] as String?,
updatedAt: json['updatedAt'] as String?,
status: json['status'] as String?,
role: json['role'] as String?,
lastLogin: json['lastLogin'] as String?,
currentLogin: json['currentLogin'] as String?,
language: json['language'] as String?,
firstName: json['firstName'] as String?,
lastName: json['lastName'] as String?,
hasApiKey: json['hasApiKey'] as String?,
phone: json['phone'] as String?,
);
Map<String, dynamic> _$UpdateUserRequestModelToJson(
_UpdateUserRequestModel instance,
) => <String, dynamic>{
'id': instance.id,
'delegationId': instance.delegationId,
'email': instance.email,
'createdAt': instance.createdAt,
'updatedAt': instance.updatedAt,
'status': instance.status,
'role': instance.role,
'lastLogin': instance.lastLogin,
'currentLogin': instance.currentLogin,
'language': instance.language,
'firstName': instance.firstName,
'lastName': instance.lastName,
'hasApiKey': instance.hasApiKey,
'phone': instance.phone,
};

View File

@@ -0,0 +1,42 @@
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
class AccountRepositoryImpl implements AccountRepository {
const AccountRepositoryImpl(this._remote);
final AccountRemoteDatasource _remote;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) {
return _remote.getLinkedDevices(userId: userId);
}
@override
Future<void> deleteDevice({required String userId, required String deviceId}) {
return _remote.deleteDevice(userId: userId, deviceId: deviceId);
}
@override
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) {
return _remote.updateDevice(userId: userId, deviceId: deviceId, request: request);
}
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _remote.updateUser(userId: userId, request: request);
}
@override
Future<List<UserEntity>> getAppUsers({required String userId}) {
return _remote.getAppUsers(userId: userId);
}
@override
Future<void> deleteAppUser({required String userId}) {
return _remote.deleteAppUser(userId: userId);
}
}

View File

@@ -0,0 +1,18 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:legacy_shared/legacy_shared.dart';
abstract class AccountRepository {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
Future<void> deleteDevice({required String userId, required String deviceId});
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request});
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
Future<List<UserEntity>> getAppUsers({required String userId});
Future<void> deleteAppUser({required String userId});
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/data/datasource/account_remote_datasource.dart';
import 'package:account/src/core/data/datasource/account_remote_datasource_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:sf_infrastructure/sf_infrastructure.dart';
final accountRemoteDatasourceProvider = Provider<AccountRemoteDatasource>((ref) {
final questiaRepository = getIt<QuestiaRepository>();
return AccountRemoteDatasourceImpl(questiaRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/data/repositories/account_repository_impl.dart';
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/core/providers/account_remote_datasource_provider.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final accountRepositoryProvider = Provider<AccountRepository>((ref) {
final remote = ref.read(accountRemoteDatasourceProvider);
return AccountRepositoryImpl(remote);
});

View File

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

View File

@@ -0,0 +1,146 @@
// import 'package:account/src/features/linked_devices/presentation/app_users_screen.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class AccountSettingsScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const AccountSettingsScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.accountSettings),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 30, big: 28)),
SingleChildScrollView(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Column(
children: [
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.personalData);},
icon: SFIcons.account,
text: I18n.legacyPersonalData
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: Icons.add_circle_outline,
text: I18n.legacyAddNewSF
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.linkedDevices);},
icon: Icons.account_circle_outlined,
text: I18n.legacyLinkedDevices
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){navigationContract.pushTo(AppRoutes.appUsers);},
icon: Icons.groups_outlined,
text: I18n.legacyAppUsers
),
SizedBox(height: SizeUtils.getByScreen(small: 16, big: 15)),
AppSectionButton(
onPressed: (){},
icon: SFIcons.privacy,
text: I18n.legacyPrivacyPolicy
),
SizedBox(height: SizeUtils.getByScreen(small: 48, big: 47)),
PrimaryButton(text: context.translate(I18n.legacyLogOut), color: Color(0xFF588EA5))
],
),
)),
],
)
),
);
}
}
class AppSectionButton extends ConsumerWidget {
final GestureTapCallback onPressed;
final IconData icon;
final String text;
const AppSectionButton({
required this.onPressed,
required this.icon,
required this.text,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
return GestureDetector(
onTap: onPressed,
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 20),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 18)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
child: Icon(icon,
size: SizeUtils.getByScreen(small: 40, big: 44),
color: Color(0xFF588EA5),
weight: 30,
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Text(context.translate(text),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
)
)
],
),
)
);
}
}

View File

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

View File

@@ -0,0 +1,4 @@
abstract class DeleteAppUserUseCase {
Future<void> deleteAppUser({required String userId});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart';
class DeleteAppUserUseCaseImpl implements DeleteAppUserUseCase {
DeleteAppUserUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> deleteAppUser({required String userId}) {
return _repository.deleteAppUser(userId: userId);
}
}

View File

@@ -0,0 +1,5 @@
import 'package:legacy_shared/legacy_shared.dart';
abstract class GetAppUsersUseCase {
Future<List<UserEntity>> getAppUsers({required String userId});
}

View File

@@ -0,0 +1,14 @@
import 'package:legacy_shared/legacy_shared.dart';
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart';
class GetAppUsersUseCaseImpl implements GetAppUsersUseCase {
GetAppUsersUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<List<UserEntity>> getAppUsers({required String userId}) {
return _repository.getAppUsers(userId: userId);
}
}

View File

@@ -0,0 +1,223 @@
import 'package:account/src/features/app_users/presentation/state/app_users_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class AppUsersScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const AppUsersScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(appUsersViewModelProvider.notifier);
final state = ref.watch(appUsersViewModelProvider);
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
if (!state.isEditing) ...[
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
child: IconButton(onPressed: vm.toggleIsEditing,
icon: Icon(Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 30, big: 28),
)
),
)
]
],
),
Center(
child: Text(context.translate(I18n.legacyAppUsers),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded( child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>AppUserCard(
user: state.appUsers[index],
isEditing: state.isEditing,
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.appUsers.length
),
)),
if (state.isEditing) ...[
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 26, vertical: 14),
big: EdgeInsets.symmetric(horizontal: 24, vertical: 12)
),
child: PrimaryButton(
onPressed: vm.toggleIsEditing,
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 44, big: 42),
),
),
]
],
)
),
);
}
}
class AppUserCard extends ConsumerWidget {
final UserEntity user;
final bool isEditing;
const AppUserCard({
required this.user,
required this.isEditing,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
return Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
child: Icon(SFIcons.account,
size: SizeUtils.getByScreen(small: 40, big: 44),
color: Color(0xFF588EA5),
weight: 30,
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(user.firstName,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
),
Text(context.translate(I18n.legacyUserAccount, args: {'email': user.email}),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 14, big: 13),
)
),
Text(context.translate(I18n.legacyUserRole, args: {'role': user.role}),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 14, big: 13),
)
)
],
)
),
if (isEditing) ...[
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFFFF5D52),
borderRadius: BorderRadius.all(Radius.circular(12)),
),
child: IconButton(
onPressed: (){showDialog(context: context, builder: (context)=>Dialog(
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 32, vertical: 30),
big: EdgeInsets.symmetric(horizontal: 30, vertical: 28)
),
width: SizeUtils.getByScreen(small: 360, big: 350),
height: SizeUtils.getByScreen(small: 195, big: 185),
child: Column(
children: [
Text(context.translate(I18n.legacyDeleteUserDialog),
textAlign: TextAlign.center,
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)),
),
SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: PrimaryButton(
onPressed: (){Navigator.pop(context);},
text: context.translate(I18n.legacyCancel),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 38, big: 36),
radius: SizeUtils.getByScreen(small: 32, big: 34),
)),
SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)),
Expanded(child: PrimaryButton(
onPressed: (){
Navigator.pop(context);
},
text: context.translate(I18n.legacyDelete),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 38, big: 36),
radius: SizeUtils.getByScreen(small: 32, big: 34),
))
],
)
],
),
),
));},
icon: Icon(
Icons.close,
color: Colors.white,
),
),
),
]
],
),
);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart';
import 'package:account/src/features/app_users/domain/delete_app_user_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final deleteAppUserUseCaseProvider = Provider.autoDispose<DeleteAppUserUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return DeleteAppUserUseCaseImpl(authRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart';
import 'package:account/src/features/app_users/domain/get_app_users_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final getAppUsersUseCaseProvider = Provider.autoDispose<GetAppUsersUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return GetAppUsersUseCaseImpl(authRepository);
});

View File

@@ -0,0 +1,51 @@
import 'package:legacy_shared/legacy_shared.dart';
import 'package:account/src/features/app_users/domain/delete_app_user_use_case.dart';
import 'package:account/src/features/app_users/domain/get_app_users_use_case.dart';
import 'package:account/src/features/app_users/presentation/providers/delete_app_user_use_case_provider.dart';
import 'package:account/src/features/app_users/presentation/providers/get_app_users_use_case_provider.dart';
import 'package:account/src/features/app_users/presentation/state/app_users_view_state.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final appUsersViewModelProvider =
NotifierProvider.autoDispose<AppUsersViewModel, AppUsersViewState>(
AppUsersViewModel.new,
);
class AppUsersViewModel extends Notifier<AppUsersViewState> {
late final GetAppUsersUseCase _getAppUsersUseCase;
late final DeleteAppUserUseCase _deleteAppUserUseCase;
@override
AppUsersViewState build() {
_getAppUsersUseCase = ref.read(getAppUsersUseCaseProvider);
_deleteAppUserUseCase = ref.read(deleteAppUserUseCaseProvider);
ref.watch(loggedUserProvider.future)
.then((user){
setUser(user);
return _getAppUsersUseCase.getAppUsers(userId: user.id);
}).then(setAppUsers);
return const AppUsersViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(loggedUser: user);
}
void setAppUsers(List<UserEntity> appUsers) {
state = state.copyWith(
appUsers: appUsers,
isLoading: false,
);
}
void toggleIsEditing() {
state = state.copyWith(isEditing: !state.isEditing);
}
void deleteAppUser() {
_deleteAppUserUseCase.deleteAppUser(userId: state.loggedUser!.id);
}
}

View File

@@ -0,0 +1,15 @@
import 'package:legacy_shared/legacy_shared.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'app_users_view_state.freezed.dart';
@freezed
abstract class AppUsersViewState with _$AppUsersViewState {
const factory AppUsersViewState({
@Default(false) bool isLoading,
@Default(null) UserEntity? loggedUser,
@Default([]) List<UserEntity> appUsers,
@Default(false) bool isEditing,
@Default('') String errorMessage
}) = _AppUsersViewState;
}

View File

@@ -0,0 +1,313 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'app_users_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$AppUsersViewState {
bool get isLoading; UserEntity? get loggedUser; List<UserEntity> get appUsers; bool get isEditing; String get errorMessage;
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$AppUsersViewStateCopyWith<AppUsersViewState> get copyWith => _$AppUsersViewStateCopyWithImpl<AppUsersViewState>(this as AppUsersViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other.appUsers, appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(appUsers),isEditing,errorMessage);
@override
String toString() {
return 'AppUsersViewState(isLoading: $isLoading, loggedUser: $loggedUser, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $AppUsersViewStateCopyWith<$Res> {
factory $AppUsersViewStateCopyWith(AppUsersViewState value, $Res Function(AppUsersViewState) _then) = _$AppUsersViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, UserEntity? loggedUser, List<UserEntity> appUsers, bool isEditing, String errorMessage
});
$UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class _$AppUsersViewStateCopyWithImpl<$Res>
implements $AppUsersViewStateCopyWith<$Res> {
_$AppUsersViewStateCopyWithImpl(this._self, this._then);
final AppUsersViewState _self;
final $Res Function(AppUsersViewState) _then;
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,appUsers: null == appUsers ? _self.appUsers : appUsers // ignore: cast_nullable_to_non_nullable
as List<UserEntity>,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,
));
}
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
/// Adds pattern-matching-related methods to [AppUsersViewState].
extension AppUsersViewStatePatterns on AppUsersViewState {
/// 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( _AppUsersViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _AppUsersViewState() 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( _AppUsersViewState value) $default,){
final _that = this;
switch (_that) {
case _AppUsersViewState():
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( _AppUsersViewState value)? $default,){
final _that = this;
switch (_that) {
case _AppUsersViewState() 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, UserEntity? loggedUser, List<UserEntity> appUsers, bool isEditing, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _AppUsersViewState() when $default != null:
return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, UserEntity? loggedUser, List<UserEntity> appUsers, bool isEditing, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _AppUsersViewState():
return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, UserEntity? loggedUser, List<UserEntity> appUsers, bool isEditing, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _AppUsersViewState() when $default != null:
return $default(_that.isLoading,_that.loggedUser,_that.appUsers,_that.isEditing,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _AppUsersViewState implements AppUsersViewState {
const _AppUsersViewState({this.isLoading = false, this.loggedUser = null, final List<UserEntity> appUsers = const [], this.isEditing = false, this.errorMessage = ''}): _appUsers = appUsers;
@override@JsonKey() final bool isLoading;
@override@JsonKey() final UserEntity? loggedUser;
final List<UserEntity> _appUsers;
@override@JsonKey() List<UserEntity> get appUsers {
if (_appUsers is EqualUnmodifiableListView) return _appUsers;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_appUsers);
}
@override@JsonKey() final bool isEditing;
@override@JsonKey() final String errorMessage;
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$AppUsersViewStateCopyWith<_AppUsersViewState> get copyWith => __$AppUsersViewStateCopyWithImpl<_AppUsersViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _AppUsersViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.loggedUser, loggedUser) || other.loggedUser == loggedUser)&&const DeepCollectionEquality().equals(other._appUsers, _appUsers)&&(identical(other.isEditing, isEditing) || other.isEditing == isEditing)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,loggedUser,const DeepCollectionEquality().hash(_appUsers),isEditing,errorMessage);
@override
String toString() {
return 'AppUsersViewState(isLoading: $isLoading, loggedUser: $loggedUser, appUsers: $appUsers, isEditing: $isEditing, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$AppUsersViewStateCopyWith<$Res> implements $AppUsersViewStateCopyWith<$Res> {
factory _$AppUsersViewStateCopyWith(_AppUsersViewState value, $Res Function(_AppUsersViewState) _then) = __$AppUsersViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, UserEntity? loggedUser, List<UserEntity> appUsers, bool isEditing, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get loggedUser;
}
/// @nodoc
class __$AppUsersViewStateCopyWithImpl<$Res>
implements _$AppUsersViewStateCopyWith<$Res> {
__$AppUsersViewStateCopyWithImpl(this._self, this._then);
final _AppUsersViewState _self;
final $Res Function(_AppUsersViewState) _then;
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? isLoading = null,Object? loggedUser = freezed,Object? appUsers = null,Object? isEditing = null,Object? errorMessage = null,}) {
return _then(_AppUsersViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,loggedUser: freezed == loggedUser ? _self.loggedUser : loggedUser // ignore: cast_nullable_to_non_nullable
as UserEntity?,appUsers: null == appUsers ? _self._appUsers : appUsers // ignore: cast_nullable_to_non_nullable
as List<UserEntity>,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,
));
}
/// Create a copy of AppUsersViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get loggedUser {
if (_self.loggedUser == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.loggedUser!, (value) {
return _then(_self.copyWith(loggedUser: value));
});
}
}
// dart format on

View File

@@ -0,0 +1,4 @@
abstract class DeleteDeviceUseCase {
Future<void> deleteDevice({required String userId, required String deviceId});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart';
class DeleteDeviceUseCaseImpl implements DeleteDeviceUseCase {
DeleteDeviceUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> deleteDevice({required String userId, required String deviceId}) async {
return _repository.deleteDevice(userId: userId, deviceId: deviceId);
}
}

View File

@@ -0,0 +1,12 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'device_entity.freezed.dart';
@freezed
abstract class DeviceEntity with _$DeviceEntity {
const factory DeviceEntity({
required String identificator,
required String name,
required String number,
}) = _DeviceEntity;
}

View File

@@ -0,0 +1,277 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'device_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$DeviceEntity {
String get identificator; String get name; String get number;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$DeviceEntityCopyWith<DeviceEntity> get copyWith => _$DeviceEntityCopyWithImpl<DeviceEntity>(this as DeviceEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class $DeviceEntityCopyWith<$Res> {
factory $DeviceEntityCopyWith(DeviceEntity value, $Res Function(DeviceEntity) _then) = _$DeviceEntityCopyWithImpl;
@useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class _$DeviceEntityCopyWithImpl<$Res>
implements $DeviceEntityCopyWith<$Res> {
_$DeviceEntityCopyWithImpl(this._self, this._then);
final DeviceEntity _self;
final $Res Function(DeviceEntity) _then;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_self.copyWith(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [DeviceEntity].
extension DeviceEntityPatterns on DeviceEntity {
/// A variant of `map` that fallback to returning `orElse`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeMap<TResult extends Object?>(TResult Function( _DeviceEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// Callbacks receives the raw object, upcasted.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case final Subclass2 value:
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult map<TResult extends Object?>(TResult Function( _DeviceEntity value) $default,){
final _that = this;
switch (_that) {
case _DeviceEntity():
return $default(_that);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `map` that fallback to returning `null`.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case final Subclass value:
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? mapOrNull<TResult extends Object?>(TResult? Function( _DeviceEntity value)? $default,){
final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that);case _:
return null;
}
}
/// A variant of `when` that fallback to an `orElse` callback.
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return orElse();
/// }
/// ```
@optionalTypeArgs TResult maybeWhen<TResult extends Object?>(TResult Function( String identificator, String name, String number)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( String identificator, String name, String number) $default,) {final _that = this;
switch (_that) {
case _DeviceEntity():
return $default(_that.identificator,_that.name,_that.number);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( String identificator, String name, String number)? $default,) {final _that = this;
switch (_that) {
case _DeviceEntity() when $default != null:
return $default(_that.identificator,_that.name,_that.number);case _:
return null;
}
}
}
/// @nodoc
class _DeviceEntity implements DeviceEntity {
const _DeviceEntity({required this.identificator, required this.name, required this.number});
@override final String identificator;
@override final String name;
@override final String number;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$DeviceEntityCopyWith<_DeviceEntity> get copyWith => __$DeviceEntityCopyWithImpl<_DeviceEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _DeviceEntity&&(identical(other.identificator, identificator) || other.identificator == identificator)&&(identical(other.name, name) || other.name == name)&&(identical(other.number, number) || other.number == number));
}
@override
int get hashCode => Object.hash(runtimeType,identificator,name,number);
@override
String toString() {
return 'DeviceEntity(identificator: $identificator, name: $name, number: $number)';
}
}
/// @nodoc
abstract mixin class _$DeviceEntityCopyWith<$Res> implements $DeviceEntityCopyWith<$Res> {
factory _$DeviceEntityCopyWith(_DeviceEntity value, $Res Function(_DeviceEntity) _then) = __$DeviceEntityCopyWithImpl;
@override @useResult
$Res call({
String identificator, String name, String number
});
}
/// @nodoc
class __$DeviceEntityCopyWithImpl<$Res>
implements _$DeviceEntityCopyWith<$Res> {
__$DeviceEntityCopyWithImpl(this._self, this._then);
final _DeviceEntity _self;
final $Res Function(_DeviceEntity) _then;
/// Create a copy of DeviceEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? identificator = null,Object? name = null,Object? number = null,}) {
return _then(_DeviceEntity(
identificator: null == identificator ? _self.identificator : identificator // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,number: null == number ? _self.number : number // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,11 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_device_request_entity.freezed.dart';
@freezed
abstract class UpdateDeviceRequestEntity with _$UpdateDeviceRequestEntity {
const factory UpdateDeviceRequestEntity({
required String identificator,
required String name,
}) = _UpdateDeviceRequestEntity;
}

View File

@@ -0,0 +1 @@
part of 'update_device_request_entity.dart';

View File

@@ -0,0 +1,5 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
abstract class GetLinkedDevicesUseCase {
Future<List<DeviceEntity>> getLinkedDevices({required String userId});
}

View File

@@ -0,0 +1,14 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
class GetLinkedDevicesUseCaseImpl implements GetLinkedDevicesUseCase {
GetLinkedDevicesUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<List<DeviceEntity>> getLinkedDevices({required String userId}) {
return _repository.getLinkedDevices(userId: userId);
}
}

View File

@@ -0,0 +1,6 @@
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
abstract class UpdateDeviceUseCase {
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request});
}

View File

@@ -0,0 +1,16 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
// import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
// import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
class UpdateDeviceUseCaseImpl implements UpdateDeviceUseCase {
UpdateDeviceUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> updateDevice({required String userId, required String deviceId, required UpdateDeviceRequestEntity request}) async {
return _repository.updateDevice(userId: userId, deviceId: deviceId, request: request);
}
}

View File

@@ -0,0 +1,19 @@
// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart';
import 'package:account/src/features/linked_devices/presentation/linked_devices_screen.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart';
class LinkedDevicesBuilder {
const LinkedDevicesBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: LinkedDevicesScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -0,0 +1,107 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
// import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class EditLinkedDeviceScreen extends ConsumerWidget {
//final NavigationContract navigationContract;
final DeviceEntity device;
const EditLinkedDeviceScreen({super.key, required this.device /*required this.navigationContract*/});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(linkedDevicesViewModelProvider.notifier);
// final state = ref.watch(linkedDevicesViewModelProvider);
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.legacyEditDeviceTitle),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.deviceNameController,
hint: device.name,
label: context.translate(I18n.legacyName),
)
],
),
PrimaryButton(
onPressed: (){vm.updateDevice(device);},
text: context.translate(I18n.legacySave),
color: Color(0xFF588EA5)
)
],
))
),
],
)
),
);
}
}

View File

@@ -0,0 +1,228 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/presentation/edit_linked_device_screen.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class LinkedDevicesScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const LinkedDevicesScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(linkedDevicesViewModelProvider.notifier);
final state = ref.watch(linkedDevicesViewModelProvider);
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
shape: BoxShape.circle
),
child: IconButton(onPressed: vm.toggleIsEditing,
icon: Icon(Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 30, big: 28),
)
),
)
],
),
Center(
child: Text(context.translate(I18n.legacyLinkedDevices),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded( child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: ListView.separated(
itemBuilder: (BuildContext context, int index)=>LinkedDeviceCard(
device: state.linkedDevices[index],
isEditing: state.isEditing,
onDelete: ()=>vm.deleteDevice(state.linkedDevices[index]),
),
separatorBuilder: (BuildContext context, int index)=>SizedBox(
height: SizeUtils.getByScreen(small: 18, big: 17)
),
itemCount: state.linkedDevices.length
),
)),
],
)
),
);
}
}
class LinkedDeviceCard extends ConsumerWidget {
final DeviceEntity device;
final bool isEditing;
final Function onDelete;
const LinkedDeviceCard({
required this.device,
required this.isEditing,
required this.onDelete,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
return Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
padding: EdgeInsets.all(SizeUtils.getByScreen(small: 4, big: 12)),
child: Icon(SFIcons.watch,
size: SizeUtils.getByScreen(small: 40, big: 44),
color: Color(0xFF588EA5),
weight: 30,
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(device.name,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
),
Text(device.number,
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 14, big: 13),
)
)
],
)
),
if (isEditing) ...[
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFFFF5D52),
borderRadius: BorderRadius.all(Radius.circular(12)),
),
child: IconButton(
onPressed: (){showDialog(context: context, builder: (context)=>Dialog(
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 32, vertical: 30),
big: EdgeInsets.symmetric(horizontal: 30, vertical: 28)
),
width: SizeUtils.getByScreen(small: 360, big: 350),
height: SizeUtils.getByScreen(small: 195, big: 185),
child: Column(
children: [
Text(context.translate(I18n.legacyDeleteDeviceDialog),
textAlign: TextAlign.center,
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 19, big: 18)),
),
SizedBox(height: SizeUtils.getByScreen(small: 28, big: 27)),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: PrimaryButton(
onPressed: (){Navigator.pop(context);},
text: context.translate(I18n.legacyCancel),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 38, big: 36),
radius: SizeUtils.getByScreen(small: 32, big: 34),
)),
SizedBox(width: SizeUtils.getByScreen(small: 4, big: 16)),
Expanded(child: PrimaryButton(
onPressed: () async {
await onDelete();
Navigator.pop(context);
},
text: context.translate(I18n.legacyDelete),
color: Color(0xFF588EA5),
height: SizeUtils.getByScreen(small: 38, big: 36),
radius: SizeUtils.getByScreen(small: 32, big: 34),
))
],
)
],
),
),
));},
icon: Icon(
Icons.close,
color: Colors.white,
),
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 14)),
DecoratedBox(
decoration: BoxDecoration(
color: Color(0xFF588EA5),
borderRadius: BorderRadius.all(Radius.circular(12)),
),
child:
IconButton(
onPressed: (){Navigator.push(
context,
MaterialPageRoute(builder: (_) => EditLinkedDeviceScreen(
device: device,
/*navigationContract: navigationContract*/
)),
);},
icon: Icon(
Icons.edit_outlined,
color: Colors.white,
),
),
),
]
],
),
);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart';
import 'package:account/src/features/linked_devices/domain/delete_device_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final deleteDeviceUseCaseProvider = Provider.autoDispose<DeleteDeviceUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return DeleteDeviceUseCaseImpl(accountRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final getLinkedDevicesUseCaseProvider = Provider.autoDispose<GetLinkedDevicesUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return GetLinkedDevicesUseCaseImpl(accountRepository);
});

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final updateDeviceUseCaseProvider = Provider.autoDispose<UpdateDeviceUseCase>((ref) {
final accountRepository = ref.read(accountRepositoryProvider);
return UpdateDeviceUseCaseImpl(accountRepository);
});

View File

@@ -0,0 +1,115 @@
import 'package:account/src/features/linked_devices/domain/delete_device_use_case.dart';
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:account/src/features/linked_devices/domain/entities/update_device_request_entity.dart';
import 'package:account/src/features/linked_devices/domain/get_linked_devices_use_case.dart';
import 'package:account/src/features/linked_devices/domain/update_device_use_case.dart';
import 'package:account/src/features/linked_devices/presentation/providers/delete_device_use_case_provider.dart';
import 'package:account/src/features/linked_devices/presentation/providers/get_linked_devices_use_case_provider.dart';
import 'package:account/src/features/linked_devices/presentation/providers/update_device_use_case_provider.dart';
import 'package:account/src/features/linked_devices/presentation/state/linked_devices_view_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final linkedDevicesViewModelProvider =
NotifierProvider.autoDispose<LinkedDevicesViewModel, LinkedDevicesViewState>(
LinkedDevicesViewModel.new,
);
class LinkedDevicesViewModel extends Notifier<LinkedDevicesViewState> {
late final GetLinkedDevicesUseCase _getLinkedDevicesUseCase;
late final UpdateDeviceUseCase _updateDeviceUseCase;
late final DeleteDeviceUseCase _deleteDeviceUseCase;
late final TextEditingController deviceNameController;
@override
LinkedDevicesViewState build() {
_getLinkedDevicesUseCase = ref.read(getLinkedDevicesUseCaseProvider);
_updateDeviceUseCase = ref.read(updateDeviceUseCaseProvider);
_deleteDeviceUseCase = ref.read(deleteDeviceUseCaseProvider);
deviceNameController = TextEditingController();
deviceNameController.addListener(_onDeviceNameChanged);
ref.watch(loggedUserProvider.future)
.then((user){
setUser(user);
return _getLinkedDevicesUseCase.getLinkedDevices(userId: user.id);
}).then(setLinkedDevices);
ref.onDispose(disposeControllers);
return const LinkedDevicesViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(loggedUser: user);
}
void setLinkedDevices(List<DeviceEntity> linkedDevices) {
state = state.copyWith(linkedDevices: linkedDevices);
}
void toggleIsEditing() {
state = state.copyWith(isEditing: !state.isEditing);
}
void _onDeviceNameChanged() {
final value = deviceNameController.text;
if (value == state.deviceName) return;
state = state.copyWith(
deviceName: value,
);
}
Future<bool> deleteDevice(DeviceEntity device) async {
try {
await _deleteDeviceUseCase.deleteDevice(userId: state.loggedUser!.id, deviceId: device.identificator);
List<DeviceEntity> newList = state.linkedDevices;
newList.remove(device);
state = state.copyWith(
linkedDevices: newList
);
return true;
} catch (e) {
return false;
}
}
UpdateDeviceRequestEntity _toRequest(DeviceEntity device) {
return UpdateDeviceRequestEntity(
identificator: device.identificator,
name: state.deviceName.trim(),
// phone: /*state.dialCode.trim() + */state.phoneNumber.trim(),
);
}
void updateDevice(DeviceEntity device) {
final deviceName = state.deviceName;
if (deviceName.isEmpty) {
state = state.copyWith(
errorMessage: ''
);
return;
}
final userId = 'test';
_updateDeviceUseCase.updateDevice(
userId: userId,
deviceId: device.identificator,
request: _toRequest(device));
}
void disposeControllers() {
deviceNameController.removeListener(_onDeviceNameChanged);
deviceNameController.dispose();
}
}

View File

@@ -0,0 +1,17 @@
import 'package:account/src/features/linked_devices/domain/entities/device_entity.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'linked_devices_view_state.freezed.dart';
@freezed
abstract class LinkedDevicesViewState with _$LinkedDevicesViewState {
const factory LinkedDevicesViewState({
@Default(false) bool isLoading,
@Default(null) UserEntity? loggedUser,
@Default([]) List<DeviceEntity> linkedDevices,
@Default(false) bool isEditing,
@Default('') String deviceName,
@Default('') String errorMessage
}) = _LinkedDevicesViewState;
}

View File

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

View File

@@ -0,0 +1,23 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'update_user_request_entity.freezed.dart';
@freezed
abstract class UpdateUserRequestEntity with _$UpdateUserRequestEntity {
const factory UpdateUserRequestEntity({
required String id,
String? delegationId,
String? email,
String? createdAt,
String? updatedAt,
String? status,
String? role,
String? lastLogin,
String? currentLogin,
String? language,
String? firstName,
String? lastName,
String? hasApiKey,
String? phone,
}) = _UpdateUserRequestEntity;
}

View File

@@ -0,0 +1,310 @@
// 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_user_request_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$UpdateUserRequestEntity {
String get id; String? get delegationId; String? get email; String? get createdAt; String? get updatedAt; String? get status; String? get role; String? get lastLogin; String? get currentLogin; String? get language; String? get firstName; String? get lastName; String? get hasApiKey; String? get phone;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$UpdateUserRequestEntityCopyWith<UpdateUserRequestEntity> get copyWith => _$UpdateUserRequestEntityCopyWithImpl<UpdateUserRequestEntity>(this as UpdateUserRequestEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class $UpdateUserRequestEntityCopyWith<$Res> {
factory $UpdateUserRequestEntityCopyWith(UpdateUserRequestEntity value, $Res Function(UpdateUserRequestEntity) _then) = _$UpdateUserRequestEntityCopyWithImpl;
@useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class _$UpdateUserRequestEntityCopyWithImpl<$Res>
implements $UpdateUserRequestEntityCopyWith<$Res> {
_$UpdateUserRequestEntityCopyWithImpl(this._self, this._then);
final UpdateUserRequestEntity _self;
final $Res Function(UpdateUserRequestEntity) _then;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_self.copyWith(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
/// Adds pattern-matching-related methods to [UpdateUserRequestEntity].
extension UpdateUserRequestEntityPatterns on UpdateUserRequestEntity {
/// 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( _UpdateUserRequestEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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( _UpdateUserRequestEntity value) $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity():
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( _UpdateUserRequestEntity value)? $default,){
final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return 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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone) $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity():
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
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? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone)? $default,) {final _that = this;
switch (_that) {
case _UpdateUserRequestEntity() when $default != null:
return $default(_that.id,_that.delegationId,_that.email,_that.createdAt,_that.updatedAt,_that.status,_that.role,_that.lastLogin,_that.currentLogin,_that.language,_that.firstName,_that.lastName,_that.hasApiKey,_that.phone);case _:
return null;
}
}
}
/// @nodoc
class _UpdateUserRequestEntity implements UpdateUserRequestEntity {
const _UpdateUserRequestEntity({required this.id, this.delegationId, this.email, this.createdAt, this.updatedAt, this.status, this.role, this.lastLogin, this.currentLogin, this.language, this.firstName, this.lastName, this.hasApiKey, this.phone});
@override final String id;
@override final String? delegationId;
@override final String? email;
@override final String? createdAt;
@override final String? updatedAt;
@override final String? status;
@override final String? role;
@override final String? lastLogin;
@override final String? currentLogin;
@override final String? language;
@override final String? firstName;
@override final String? lastName;
@override final String? hasApiKey;
@override final String? phone;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$UpdateUserRequestEntityCopyWith<_UpdateUserRequestEntity> get copyWith => __$UpdateUserRequestEntityCopyWithImpl<_UpdateUserRequestEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _UpdateUserRequestEntity&&(identical(other.id, id) || other.id == id)&&(identical(other.delegationId, delegationId) || other.delegationId == delegationId)&&(identical(other.email, email) || other.email == email)&&(identical(other.createdAt, createdAt) || other.createdAt == createdAt)&&(identical(other.updatedAt, updatedAt) || other.updatedAt == updatedAt)&&(identical(other.status, status) || other.status == status)&&(identical(other.role, role) || other.role == role)&&(identical(other.lastLogin, lastLogin) || other.lastLogin == lastLogin)&&(identical(other.currentLogin, currentLogin) || other.currentLogin == currentLogin)&&(identical(other.language, language) || other.language == language)&&(identical(other.firstName, firstName) || other.firstName == firstName)&&(identical(other.lastName, lastName) || other.lastName == lastName)&&(identical(other.hasApiKey, hasApiKey) || other.hasApiKey == hasApiKey)&&(identical(other.phone, phone) || other.phone == phone));
}
@override
int get hashCode => Object.hash(runtimeType,id,delegationId,email,createdAt,updatedAt,status,role,lastLogin,currentLogin,language,firstName,lastName,hasApiKey,phone);
@override
String toString() {
return 'UpdateUserRequestEntity(id: $id, delegationId: $delegationId, email: $email, createdAt: $createdAt, updatedAt: $updatedAt, status: $status, role: $role, lastLogin: $lastLogin, currentLogin: $currentLogin, language: $language, firstName: $firstName, lastName: $lastName, hasApiKey: $hasApiKey, phone: $phone)';
}
}
/// @nodoc
abstract mixin class _$UpdateUserRequestEntityCopyWith<$Res> implements $UpdateUserRequestEntityCopyWith<$Res> {
factory _$UpdateUserRequestEntityCopyWith(_UpdateUserRequestEntity value, $Res Function(_UpdateUserRequestEntity) _then) = __$UpdateUserRequestEntityCopyWithImpl;
@override @useResult
$Res call({
String id, String? delegationId, String? email, String? createdAt, String? updatedAt, String? status, String? role, String? lastLogin, String? currentLogin, String? language, String? firstName, String? lastName, String? hasApiKey, String? phone
});
}
/// @nodoc
class __$UpdateUserRequestEntityCopyWithImpl<$Res>
implements _$UpdateUserRequestEntityCopyWith<$Res> {
__$UpdateUserRequestEntityCopyWithImpl(this._self, this._then);
final _UpdateUserRequestEntity _self;
final $Res Function(_UpdateUserRequestEntity) _then;
/// Create a copy of UpdateUserRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? id = null,Object? delegationId = freezed,Object? email = freezed,Object? createdAt = freezed,Object? updatedAt = freezed,Object? status = freezed,Object? role = freezed,Object? lastLogin = freezed,Object? currentLogin = freezed,Object? language = freezed,Object? firstName = freezed,Object? lastName = freezed,Object? hasApiKey = freezed,Object? phone = freezed,}) {
return _then(_UpdateUserRequestEntity(
id: null == id ? _self.id : id // ignore: cast_nullable_to_non_nullable
as String,delegationId: freezed == delegationId ? _self.delegationId : delegationId // ignore: cast_nullable_to_non_nullable
as String?,email: freezed == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String?,createdAt: freezed == createdAt ? _self.createdAt : createdAt // ignore: cast_nullable_to_non_nullable
as String?,updatedAt: freezed == updatedAt ? _self.updatedAt : updatedAt // ignore: cast_nullable_to_non_nullable
as String?,status: freezed == status ? _self.status : status // ignore: cast_nullable_to_non_nullable
as String?,role: freezed == role ? _self.role : role // ignore: cast_nullable_to_non_nullable
as String?,lastLogin: freezed == lastLogin ? _self.lastLogin : lastLogin // ignore: cast_nullable_to_non_nullable
as String?,currentLogin: freezed == currentLogin ? _self.currentLogin : currentLogin // ignore: cast_nullable_to_non_nullable
as String?,language: freezed == language ? _self.language : language // ignore: cast_nullable_to_non_nullable
as String?,firstName: freezed == firstName ? _self.firstName : firstName // ignore: cast_nullable_to_non_nullable
as String?,lastName: freezed == lastName ? _self.lastName : lastName // ignore: cast_nullable_to_non_nullable
as String?,hasApiKey: freezed == hasApiKey ? _self.hasApiKey : hasApiKey // ignore: cast_nullable_to_non_nullable
as String?,phone: freezed == phone ? _self.phone : phone // ignore: cast_nullable_to_non_nullable
as String?,
));
}
}
// dart format on

View File

@@ -0,0 +1,5 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
abstract class UpdateUserUseCase {
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request});
}

View File

@@ -0,0 +1,13 @@
import 'package:account/src/core/domain/repositories/account_repository.dart';
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
class UpdateUserUseCaseImpl implements UpdateUserUseCase {
UpdateUserUseCaseImpl(this._repository);
final AccountRepository _repository;
@override
Future<void> updateUser({required String userId, required UpdateUserRequestEntity request}) {
return _repository.updateUser(userId: userId, request: request);
}
}

View File

@@ -0,0 +1,19 @@
// import 'package:account/src/features/account_settings/presentation/account_settings_screen.dart';
import 'package:account/src/features/personal_data/presentation/personal_data_screen.dart';
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:get_it/get_it.dart';
import 'package:navigation/navigation.dart';
class PersonalDataBuilder {
const PersonalDataBuilder();
Page<void> buildPage(BuildContext context, GoRouterState state) {
final NavigationContract navigationContract = GetIt.I<NavigationContract>();
return MaterialPage<void>(
key: state.pageKey,
child: PersonalDataScreen(navigationContract: navigationContract),
);
}
}

View File

@@ -0,0 +1,132 @@
import 'package:account/src/features/personal_data/presentation/state/personal_data_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class PersonalDataScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const PersonalDataScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final vm = ref.read(personalDataViewModelProvider.notifier);
final state = ref.watch(personalDataViewModelProvider);
final theme = ref.watch(themePortProvider);
return Scaffold(
backgroundColor: theme.getColorFor(ThemeCode.backgroundPrimary),
body: SafeArea(
child: Column(
children: [
Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 8)
),
child: Stack(
children: [
IconButton(onPressed: () {Navigator.pop(context);},
icon: Icon(Icons.arrow_back)),
Center(
child: Text(context.translate(I18n.legacyPersonalData),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 28, big: 27)
),
)
)
],
),
),
SizedBox(height: SizeUtils.getByScreen(small: 20, big: 18)),
Expanded(child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 48, vertical: 10),
big: EdgeInsets.symmetric(horizontal: 47, vertical: 8)
),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Expanded(child: SingleChildScrollView(child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Stack(
children: [
Center(child: SvgPicture.asset('assets/images/ui/profile.svg')),
Center(child: SizedBox(
width: 160,
height: 160,
child: Align(alignment: Alignment.bottomRight,
child: IconButton(
onPressed: (){},
icon: Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: Color(0xFFCAC9C9)
),
padding: EdgeInsets.all(8),
child: Icon(
Icons.edit_outlined,
color: Colors.white,
size: SizeUtils.getByScreen(small: 32, big: 30),
),
),
)
)
))
],
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 16)),
Text(context.translate(I18n.legacyLoginEmail),
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 14, big: 13))
),
Text(state.user?.email ?? '',
style: TextStyle(fontSize: SizeUtils.getByScreen(small: 18, big: 17))
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.nameController,
hint: state.user?.firstName ?? '',
label: context.translate(I18n.legacyUserNameLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.phoneController,
hint: state.user?.phone ?? '',
label: context.translate(I18n.legacyUserPhoneLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.emailController,
hint: state.user?.email ?? '',
label: context.translate(I18n.legacyContactEmailLabel),
),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
CustomTextField(
controller: vm.passwordController,
showPassword: state.showPassword,
hint: '********',
label: context.translate(I18n.passwordLabel),
),
],
))),
SizedBox(height: SizeUtils.getByScreen(small: 24, big: 22)),
PrimaryButton(
onPressed: vm.updateUser,
text: context.translate(I18n.legacySubmit),
color: Color(0xFF588EA5)
)
],
))
),
],
)
),
);
}
}

View File

@@ -0,0 +1,9 @@
import 'package:account/src/core/providers/account_repository_provider.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case_impl.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
final updateUserUseCaseProvider = Provider.autoDispose<UpdateUserUseCase>((ref) {
final authRepository = ref.read(accountRepositoryProvider);
return UpdateUserUseCaseImpl(authRepository);
});

View File

@@ -0,0 +1,151 @@
import 'package:account/src/features/personal_data/domain/entities/update_user_request_entity.dart';
import 'package:account/src/features/personal_data/domain/update_user_use_case.dart';
import 'package:account/src/features/personal_data/presentation/providers/update_user_use_case_provider.dart';
import 'package:account/src/features/personal_data/presentation/state/personal_data_view_state.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
// import 'package:sf_localizations/sf_localizations.dart';
final personalDataViewModelProvider =
NotifierProvider.autoDispose<PersonalDataViewModel, PersonalDataViewState>(
PersonalDataViewModel.new,
);
class PersonalDataViewModel extends Notifier<PersonalDataViewState> {
late final UpdateUserUseCase _updateUserUseCase;
late final TextEditingController nameController;
late final TextEditingController emailController;
late final TextEditingController phoneController;
late final TextEditingController passwordController;
@override
PersonalDataViewState build() {
_updateUserUseCase = ref.read(updateUserUseCaseProvider);
nameController = TextEditingController();
nameController.addListener(_onNameChanged);
emailController = TextEditingController();
emailController.addListener(_onEmailChanged);
phoneController = TextEditingController();
phoneController.addListener(_onPhoneChanged);
passwordController = TextEditingController();
passwordController.addListener(_onPasswordChanged);
ref.watch(loggedUserProvider.future)
.then(setUser);
ref.onDispose(disposeControllers);
return const PersonalDataViewState();
}
void setUser(UserEntity user) {
state = state.copyWith(user: user);
}
void _onNameChanged() {
final value = nameController.text;
if (value == state.name) return;
state = state.copyWith(
name: value,
);
}
void _onEmailChanged() {
final value = emailController.text;
if (value == state.email) return;
state = state.copyWith(
email: value,
);
}
void _onPhoneChanged() {
final value = phoneController.text;
if (value == state.phoneNumber) return;
state = state.copyWith(
phoneNumber: value,
);
}
void _onPasswordChanged() {
final value = passwordController.text;
if (value == state.password) return;
state = state.copyWith(
password: value,
);
}
bool _validateForm() {
if (state.name.trim().isEmpty &&
state.email.trim().isEmpty &&
state.phoneNumber.trim().isEmpty &&
state.password.trim().isEmpty) {
state = state.copyWith(errorMessage: 'errorMessageAllFieldsAreEmpty');
return false;
}
return true;
}
UpdateUserRequestEntity _toRequest() {
return UpdateUserRequestEntity(
id: state.user!.id,
//name: state.name.trim(),
email: state.email.trim(),
phone: /*state.dialCode.trim() + */state.phoneNumber.trim(),
);
}
Future<bool> updateUser() async {
if (state.isLoading) return false;
if (!_validateForm()) return false;
try {
final request = _toRequest();
_updateUserUseCase.updateUser(userId: state.user!.id, request: request);
return true;
} catch (e) {
if (!ref.mounted) return false;
_finishWithError(message: e.toString());
return false;
}
}
void _finishWithError({required String message}) {
state = state.copyWith(
isLoading: false,
errorMessage: message,
);
}
void disposeControllers() {
nameController.removeListener(_onNameChanged);
nameController.dispose();
emailController.removeListener(_onEmailChanged);
emailController.dispose();
phoneController.removeListener(_onPhoneChanged);
phoneController.dispose();
passwordController.removeListener(_onPasswordChanged);
passwordController.dispose();
}
}

View File

@@ -0,0 +1,19 @@
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:legacy_shared/legacy_shared.dart';
part 'personal_data_view_state.freezed.dart';
@freezed
abstract class PersonalDataViewState with _$PersonalDataViewState {
const factory PersonalDataViewState({
@Default(true) bool isLoading,
@Default(null) UserEntity? user,
@Default('') String name,
@Default('') String phoneNumber,
@Default('') String email,
@Default('') String password,
@Default(false) bool showPassword,
@Default('') String errorMessage
}) = _PersonalDataViewState;
}

View File

@@ -0,0 +1,316 @@
// 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 'personal_data_view_state.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$PersonalDataViewState {
bool get isLoading; UserEntity? get user; String get name; String get phoneNumber; String get email; String get password; bool get showPassword; String get errorMessage;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$PersonalDataViewStateCopyWith<PersonalDataViewState> get copyWith => _$PersonalDataViewStateCopyWithImpl<PersonalDataViewState>(this as PersonalDataViewState, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage);
@override
String toString() {
return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class $PersonalDataViewStateCopyWith<$Res> {
factory $PersonalDataViewStateCopyWith(PersonalDataViewState value, $Res Function(PersonalDataViewState) _then) = _$PersonalDataViewStateCopyWithImpl;
@useResult
$Res call({
bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
});
$UserEntityCopyWith<$Res>? get user;
}
/// @nodoc
class _$PersonalDataViewStateCopyWithImpl<$Res>
implements $PersonalDataViewStateCopyWith<$Res> {
_$PersonalDataViewStateCopyWithImpl(this._self, this._then);
final PersonalDataViewState _self;
final $Res Function(PersonalDataViewState) _then;
/// 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? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
return _then(_self.copyWith(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
/// Adds pattern-matching-related methods to [PersonalDataViewState].
extension PersonalDataViewStatePatterns on PersonalDataViewState {
/// 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( _PersonalDataViewState value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _PersonalDataViewState() 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( _PersonalDataViewState value) $default,){
final _that = this;
switch (_that) {
case _PersonalDataViewState():
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( _PersonalDataViewState value)? $default,){
final _that = this;
switch (_that) {
case _PersonalDataViewState() 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, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _PersonalDataViewState() when $default != null:
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
return orElse();
}
}
/// A `switch`-like method, using callbacks.
///
/// As opposed to `map`, this offers destructuring.
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case Subclass2(:final field2):
/// return ...;
/// }
/// ```
@optionalTypeArgs TResult when<TResult extends Object?>(TResult Function( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage) $default,) {final _that = this;
switch (_that) {
case _PersonalDataViewState():
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
throw StateError('Unexpected subclass');
}
}
/// A variant of `when` that fallback to returning `null`
///
/// It is equivalent to doing:
/// ```dart
/// switch (sealedClass) {
/// case Subclass(:final field):
/// return ...;
/// case _:
/// return null;
/// }
/// ```
@optionalTypeArgs TResult? whenOrNull<TResult extends Object?>(TResult? Function( bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage)? $default,) {final _that = this;
switch (_that) {
case _PersonalDataViewState() when $default != null:
return $default(_that.isLoading,_that.user,_that.name,_that.phoneNumber,_that.email,_that.password,_that.showPassword,_that.errorMessage);case _:
return null;
}
}
}
/// @nodoc
class _PersonalDataViewState implements PersonalDataViewState {
const _PersonalDataViewState({this.isLoading = true, this.user = null, this.name = '', this.phoneNumber = '', this.email = '', this.password = '', this.showPassword = false, this.errorMessage = ''});
@override@JsonKey() final bool isLoading;
@override@JsonKey() final UserEntity? user;
@override@JsonKey() final String name;
@override@JsonKey() final String phoneNumber;
@override@JsonKey() final String email;
@override@JsonKey() final String password;
@override@JsonKey() final bool showPassword;
@override@JsonKey() final String errorMessage;
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$PersonalDataViewStateCopyWith<_PersonalDataViewState> get copyWith => __$PersonalDataViewStateCopyWithImpl<_PersonalDataViewState>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _PersonalDataViewState&&(identical(other.isLoading, isLoading) || other.isLoading == isLoading)&&(identical(other.user, user) || other.user == user)&&(identical(other.name, name) || other.name == name)&&(identical(other.phoneNumber, phoneNumber) || other.phoneNumber == phoneNumber)&&(identical(other.email, email) || other.email == email)&&(identical(other.password, password) || other.password == password)&&(identical(other.showPassword, showPassword) || other.showPassword == showPassword)&&(identical(other.errorMessage, errorMessage) || other.errorMessage == errorMessage));
}
@override
int get hashCode => Object.hash(runtimeType,isLoading,user,name,phoneNumber,email,password,showPassword,errorMessage);
@override
String toString() {
return 'PersonalDataViewState(isLoading: $isLoading, user: $user, name: $name, phoneNumber: $phoneNumber, email: $email, password: $password, showPassword: $showPassword, errorMessage: $errorMessage)';
}
}
/// @nodoc
abstract mixin class _$PersonalDataViewStateCopyWith<$Res> implements $PersonalDataViewStateCopyWith<$Res> {
factory _$PersonalDataViewStateCopyWith(_PersonalDataViewState value, $Res Function(_PersonalDataViewState) _then) = __$PersonalDataViewStateCopyWithImpl;
@override @useResult
$Res call({
bool isLoading, UserEntity? user, String name, String phoneNumber, String email, String password, bool showPassword, String errorMessage
});
@override $UserEntityCopyWith<$Res>? get user;
}
/// @nodoc
class __$PersonalDataViewStateCopyWithImpl<$Res>
implements _$PersonalDataViewStateCopyWith<$Res> {
__$PersonalDataViewStateCopyWithImpl(this._self, this._then);
final _PersonalDataViewState _self;
final $Res Function(_PersonalDataViewState) _then;
/// 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? user = freezed,Object? name = null,Object? phoneNumber = null,Object? email = null,Object? password = null,Object? showPassword = null,Object? errorMessage = null,}) {
return _then(_PersonalDataViewState(
isLoading: null == isLoading ? _self.isLoading : isLoading // ignore: cast_nullable_to_non_nullable
as bool,user: freezed == user ? _self.user : user // ignore: cast_nullable_to_non_nullable
as UserEntity?,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,phoneNumber: null == phoneNumber ? _self.phoneNumber : phoneNumber // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,password: null == password ? _self.password : password // ignore: cast_nullable_to_non_nullable
as String,showPassword: null == showPassword ? _self.showPassword : showPassword // ignore: cast_nullable_to_non_nullable
as bool,errorMessage: null == errorMessage ? _self.errorMessage : errorMessage // ignore: cast_nullable_to_non_nullable
as String,
));
}
/// Create a copy of PersonalDataViewState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$UserEntityCopyWith<$Res>? get user {
if (_self.user == null) {
return null;
}
return $UserEntityCopyWith<$Res>(_self.user!, (value) {
return _then(_self.copyWith(user: value));
});
}
}
// dart format on

View File

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

View File

@@ -0,0 +1,15 @@
import 'package:freezed_annotation/freezed_annotation.dart';
part 'send_email_request_entity.freezed.dart';
@freezed
abstract class SendEmailRequestEntity with _$SendEmailRequestEntity{
const factory SendEmailRequestEntity({
required String country,
required String channel,
required String name,
required String email,
required String subject,
required String body,
}) = _SendEmailRequestEntity;
}

View File

@@ -0,0 +1,286 @@
// GENERATED CODE - DO NOT MODIFY BY HAND
// coverage:ignore-file
// ignore_for_file: type=lint
// ignore_for_file: unused_element, deprecated_member_use, deprecated_member_use_from_same_package, use_function_type_syntax_for_parameters, unnecessary_const, avoid_init_to_null, invalid_override_different_default_values_named, prefer_expression_function_bodies, annotate_overrides, invalid_annotation_target, unnecessary_question_mark
part of 'send_email_request_entity.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
// dart format off
T _$identity<T>(T value) => value;
/// @nodoc
mixin _$SendEmailRequestEntity {
String get country; String get channel; String get name; String get email; String get subject; String get body;
/// Create a copy of SendEmailRequestEntity
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
$SendEmailRequestEntityCopyWith<SendEmailRequestEntity> get copyWith => _$SendEmailRequestEntityCopyWithImpl<SendEmailRequestEntity>(this as SendEmailRequestEntity, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body));
}
@override
int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body);
@override
String toString() {
return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)';
}
}
/// @nodoc
abstract mixin class $SendEmailRequestEntityCopyWith<$Res> {
factory $SendEmailRequestEntityCopyWith(SendEmailRequestEntity value, $Res Function(SendEmailRequestEntity) _then) = _$SendEmailRequestEntityCopyWithImpl;
@useResult
$Res call({
String country, String channel, String name, String email, String subject, String body
});
}
/// @nodoc
class _$SendEmailRequestEntityCopyWithImpl<$Res>
implements $SendEmailRequestEntityCopyWith<$Res> {
_$SendEmailRequestEntityCopyWithImpl(this._self, this._then);
final SendEmailRequestEntity _self;
final $Res Function(SendEmailRequestEntity) _then;
/// Create a copy of SendEmailRequestEntity
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline') @override $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) {
return _then(_self.copyWith(
country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable
as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
/// Adds pattern-matching-related methods to [SendEmailRequestEntity].
extension SendEmailRequestEntityPatterns on SendEmailRequestEntity {
/// 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( _SendEmailRequestEntity value)? $default,{required TResult orElse(),}){
final _that = this;
switch (_that) {
case _SendEmailRequestEntity() 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( _SendEmailRequestEntity value) $default,){
final _that = this;
switch (_that) {
case _SendEmailRequestEntity():
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( _SendEmailRequestEntity value)? $default,){
final _that = this;
switch (_that) {
case _SendEmailRequestEntity() 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 country, String channel, String name, String email, String subject, String body)? $default,{required TResult orElse(),}) {final _that = this;
switch (_that) {
case _SendEmailRequestEntity() when $default != null:
return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body) $default,) {final _that = this;
switch (_that) {
case _SendEmailRequestEntity():
return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);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 country, String channel, String name, String email, String subject, String body)? $default,) {final _that = this;
switch (_that) {
case _SendEmailRequestEntity() when $default != null:
return $default(_that.country,_that.channel,_that.name,_that.email,_that.subject,_that.body);case _:
return null;
}
}
}
/// @nodoc
class _SendEmailRequestEntity implements SendEmailRequestEntity {
const _SendEmailRequestEntity({required this.country, required this.channel, required this.name, required this.email, required this.subject, required this.body});
@override final String country;
@override final String channel;
@override final String name;
@override final String email;
@override final String subject;
@override final String body;
/// Create a copy of SendEmailRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @JsonKey(includeFromJson: false, includeToJson: false)
@pragma('vm:prefer-inline')
_$SendEmailRequestEntityCopyWith<_SendEmailRequestEntity> get copyWith => __$SendEmailRequestEntityCopyWithImpl<_SendEmailRequestEntity>(this, _$identity);
@override
bool operator ==(Object other) {
return identical(this, other) || (other.runtimeType == runtimeType&&other is _SendEmailRequestEntity&&(identical(other.country, country) || other.country == country)&&(identical(other.channel, channel) || other.channel == channel)&&(identical(other.name, name) || other.name == name)&&(identical(other.email, email) || other.email == email)&&(identical(other.subject, subject) || other.subject == subject)&&(identical(other.body, body) || other.body == body));
}
@override
int get hashCode => Object.hash(runtimeType,country,channel,name,email,subject,body);
@override
String toString() {
return 'SendEmailRequestEntity(country: $country, channel: $channel, name: $name, email: $email, subject: $subject, body: $body)';
}
}
/// @nodoc
abstract mixin class _$SendEmailRequestEntityCopyWith<$Res> implements $SendEmailRequestEntityCopyWith<$Res> {
factory _$SendEmailRequestEntityCopyWith(_SendEmailRequestEntity value, $Res Function(_SendEmailRequestEntity) _then) = __$SendEmailRequestEntityCopyWithImpl;
@override @useResult
$Res call({
String country, String channel, String name, String email, String subject, String body
});
}
/// @nodoc
class __$SendEmailRequestEntityCopyWithImpl<$Res>
implements _$SendEmailRequestEntityCopyWith<$Res> {
__$SendEmailRequestEntityCopyWithImpl(this._self, this._then);
final _SendEmailRequestEntity _self;
final $Res Function(_SendEmailRequestEntity) _then;
/// Create a copy of SendEmailRequestEntity
/// with the given fields replaced by the non-null parameter values.
@override @pragma('vm:prefer-inline') $Res call({Object? country = null,Object? channel = null,Object? name = null,Object? email = null,Object? subject = null,Object? body = null,}) {
return _then(_SendEmailRequestEntity(
country: null == country ? _self.country : country // ignore: cast_nullable_to_non_nullable
as String,channel: null == channel ? _self.channel : channel // ignore: cast_nullable_to_non_nullable
as String,name: null == name ? _self.name : name // ignore: cast_nullable_to_non_nullable
as String,email: null == email ? _self.email : email // ignore: cast_nullable_to_non_nullable
as String,subject: null == subject ? _self.subject : subject // ignore: cast_nullable_to_non_nullable
as String,body: null == body ? _self.body : body // ignore: cast_nullable_to_non_nullable
as String,
));
}
}
// dart format on

View File

@@ -0,0 +1,5 @@
import 'package:customer_service/src/domain/entities/send_email_request_entity.dart';
abstract class SendEmailUseCase {
Future<void> sendEmail({required SendEmailRequestEntity request});
}

View File

@@ -0,0 +1,13 @@
import 'package:customer_service/src/domain/entities/send_email_request_entity.dart';
import 'package:customer_service/src/domain/send_email_use_case.dart';
class SendEmailUseCaseImpl implements SendEmailUseCase {
//SignUpUseCaseImpl(this._repository);
//final AuthRepository _repository;
@override
Future<void> sendEmail({required SendEmailRequestEntity request}) async {
//return _repository.signUp(request: request);
}
}

View File

@@ -0,0 +1,108 @@
import 'package:customer_service/src/presentation/state/contact_view_model.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
class ContactScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const ContactScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.watch(themePortProvider);
final vm = ref.read(contactViewModelProvider.notifier);
final viewState = ref.watch(contactViewModelProvider);
final List<String> country = [
'España',
'Portugal',
'France',
'Italia',
'Deutschland',
context.translate(I18n.other),
];
final List<String> channel = [
context.translate(I18n.channelOnline),
context.translate(I18n.channelAmazon),
context.translate(I18n.channelStore),
context.translate(I18n.other),
];
return PageLayout(
title: context.translate(I18n.contactTitle),
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38),
big: EdgeInsets.symmetric(horizontal: 36)
),
child: SingleChildScrollView(child: Column(
children: [
CustomDropdown(
items: country.map(Text.new).toList(growable: false),
onChanged: (x){vm.setCountry(x);},
hint: context.translate(I18n.selectCountry)
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)),
CustomDropdown(
items: channel.map(Text.new).toList(growable: false),
onChanged: (x){vm.setChannel(x);},
hint: context.translate(I18n.selectChannel)
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)),
CustomTextField(
controller: vm.nameController,
hint: context.translate(I18n.enterName),
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)),
CustomTextField(
controller: vm.emailController,
keyboardType: TextInputType.emailAddress,
hint: context.translate(I18n.enterEmail),
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)),
CustomTextField(
controller: vm.subjectController,
hint: context.translate(I18n.enterSubject),
),
SizedBox(height: SizeUtils.getByScreen(small: 18, big: 17)),
CustomTextField(
controller: vm.bodyController,
keyboardType: TextInputType.multiline,
hint: context.translate(I18n.enterMessage),
lines: 8,
),
if (viewState.errorMessage.isNotEmpty) ...[
const SizedBox(height: 4),
Text(
viewState.errorMessage,
textAlign: TextAlign.center,
style: const TextStyle(
color: Color.fromRGBO(239, 17, 17, 1),
fontSize: 12,
),
),
],
],
)),
),
footer: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 38, vertical: 14),
big: EdgeInsets.symmetric(horizontal: 36, vertical: 12)
),
child: PrimaryButton(
onPressed: vm.sendEmail,
text: context.translate(I18n.sendEmail),
color: theme.getColorFor(ThemeCode.buttonPrimary)
)
),
);
}
}

View File

@@ -0,0 +1,131 @@
import 'package:customer_service/src/presentation/contact_screen.dart';
import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:legacy_shared/legacy_shared.dart';
import 'package:navigation/navigation.dart';
import 'package:sf_localizations/sf_localizations.dart';
import 'package:utils/utils.dart';
import 'package:url_launcher/url_launcher.dart';
class CustomerServiceScreen extends ConsumerWidget {
final NavigationContract navigationContract;
const CustomerServiceScreen({super.key, required this.navigationContract});
@override
Widget build(BuildContext context, WidgetRef ref) {
// final theme = ref.watch(themePortProvider);
return PageLayout(
title: context.translate(I18n.customerService),
body: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 18),
big: EdgeInsets.symmetric(horizontal: 16)
),
child: Column(
children: [
SectionButton(
onPressed: () async {
final Uri url = Uri.parse('https://www.savefamilygps.com/');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
image: 'assets/images/ui/iso_sf.png',
text: context.translate(I18n.supportWebsite)
),
SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)),
SectionButton(
onPressed: () async {
final Uri url = Uri.parse('https://savefamilygpshelp.zendesk.com/hc/es');
if (!await launchUrl(url)) {
throw Exception('Could not launch $url');
}
},
icon: SFIcons.handshake,
text: context.translate(I18n.supportHelp)
),
SizedBox(height: SizeUtils.getByScreen(small: 10, big: 9)),
SectionButton(
onPressed: (){Navigator.push(context,
MaterialPageRoute(
builder: (_) => ContactScreen(navigationContract: navigationContract),
));},
icon: Icons.email_outlined,
text: context.translate(I18n.contactTitle)
),
],
)
)
);
}
}
class SectionButton extends ConsumerWidget {
final GestureTapCallback onPressed;
final IconData? icon;
final String? image;
final String text;
const SectionButton({
required this.onPressed,
this.icon,
this.image,
required this.text,
});
@override
Widget build(BuildContext context, WidgetRef ref) {
final theme = ref.read(themePortProvider);
return GestureDetector(
onTap: onPressed,
child: Container(
padding: SizeUtils.getByScreen(
small: EdgeInsets.symmetric(horizontal: 22, vertical: 16),
big: EdgeInsets.symmetric(horizontal: 21, vertical: 12)
),
decoration: BoxDecoration(
borderRadius: BorderRadius.all(
Radius.circular(SizeUtils.getByScreen(small: 12, big: 18))),
color: theme.getColorFor(ThemeCode.backgroundSecondary),
),
child: Row(
children: [
Container(
decoration: BoxDecoration(
shape: BoxShape.circle,
color: theme.getColorFor(ThemeCode.backgroundPrimary),
),
padding: EdgeInsets.all(
SizeUtils.getByScreen(small: 12, big: 16)),
child: icon != null
?Icon(icon,
size: SizeUtils.getByScreen(small: 44, big: 48),
color: Color(0xFF588EA5),
weight: 30,
)
: Image.asset(image!,
width: SizeUtils.getByScreen(small: 44, big: 48),
height: SizeUtils.getByScreen(small: 44, big: 48),
),
),
SizedBox(width: SizeUtils.getByScreen(small: 16, big: 15)),
Expanded(
child: Text(context.translate(text),
style: TextStyle(
fontSize: SizeUtils.getByScreen(small: 18, big: 19),
fontWeight: FontWeight.w500
)
)
),
],
),
)
);
}
}

Some files were not shown because too many files have changed in this diff Show More