Compare commits

...
9 Commits
Author SHA1 Message Date
efrilm 0c8ca3c51b git push 2026-05-15 12:53:04 +07:00
Efril 96526c1972 update 2026-05-14 15:05:04 +07:00
Efril c4618bbc1b update pesanan 2026-05-14 14:55:49 +07:00
Efril 9f2097a268 add all outlet 2026-05-14 14:11:42 +07:00
efrilm 6fda0f5636 fix home 2026-05-13 15:31:14 +07:00
efrilm d7cd84e130 fix ios 2026-05-13 13:22:06 +07:00
efrilm ba2f0cd265 selected outlet 2026-05-12 17:09:50 +07:00
efrilm 3541fc725c outlet list 2026-05-12 16:47:36 +07:00
efrilm c2727a0995 update outlet card 2026-05-12 16:31:00 +07:00
41 changed files with 3363 additions and 461 deletions
+1 -1
View File
@@ -26,7 +26,7 @@ android {
applicationId = "com.apskel.enaklo_owner"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = 21
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
+1 -1
View File
@@ -1,5 +1,5 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '12.0'
platform :ios, '14.0'
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
+181
View File
@@ -0,0 +1,181 @@
PODS:
- connectivity_plus (0.0.1):
- Flutter
- device_info_plus (0.0.1):
- Flutter
- Firebase/CoreOnly (10.25.0):
- FirebaseCore (= 10.25.0)
- Firebase/Messaging (10.25.0):
- Firebase/CoreOnly
- FirebaseMessaging (~> 10.25.0)
- firebase_core (2.32.0):
- Firebase/CoreOnly (= 10.25.0)
- Flutter
- firebase_messaging (14.7.10):
- Firebase/Messaging (= 10.25.0)
- firebase_core
- Flutter
- FirebaseCore (10.25.0):
- FirebaseCoreInternal (~> 10.0)
- GoogleUtilities/Environment (~> 7.12)
- GoogleUtilities/Logger (~> 7.12)
- FirebaseCoreInternal (10.29.0):
- "GoogleUtilities/NSData+zlib (~> 7.8)"
- FirebaseInstallations (10.29.0):
- FirebaseCore (~> 10.0)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- PromisesObjC (~> 2.1)
- FirebaseMessaging (10.25.0):
- FirebaseCore (~> 10.0)
- FirebaseInstallations (~> 10.0)
- GoogleDataTransport (~> 9.3)
- GoogleUtilities/AppDelegateSwizzler (~> 7.8)
- GoogleUtilities/Environment (~> 7.8)
- GoogleUtilities/Reachability (~> 7.8)
- GoogleUtilities/UserDefaults (~> 7.8)
- nanopb (< 2.30911.0, >= 2.30908.0)
- Flutter (1.0.0)
- flutter_local_notifications (0.0.1):
- Flutter
- GoogleDataTransport (9.4.1):
- GoogleUtilities/Environment (~> 7.7)
- nanopb (< 2.30911.0, >= 2.30908.0)
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/AppDelegateSwizzler (7.13.3):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Privacy
- GoogleUtilities/Environment (7.13.3):
- GoogleUtilities/Privacy
- PromisesObjC (< 3.0, >= 1.2)
- GoogleUtilities/Logger (7.13.3):
- GoogleUtilities/Environment
- GoogleUtilities/Privacy
- GoogleUtilities/Network (7.13.3):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Privacy
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.13.3)":
- GoogleUtilities/Privacy
- GoogleUtilities/Privacy (7.13.3)
- GoogleUtilities/Reachability (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- GoogleUtilities/UserDefaults (7.13.3):
- GoogleUtilities/Logger
- GoogleUtilities/Privacy
- image_picker_ios (0.0.1):
- Flutter
- nanopb (2.30910.0):
- nanopb/decode (= 2.30910.0)
- nanopb/encode (= 2.30910.0)
- nanopb/decode (2.30910.0)
- nanopb/encode (2.30910.0)
- open_file_ios (0.0.1):
- Flutter
- package_info_plus (0.4.5):
- Flutter
- path_provider_foundation (0.0.1):
- Flutter
- FlutterMacOS
- permission_handler_apple (9.3.0):
- Flutter
- PromisesObjC (2.4.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
- sqflite_darwin (0.0.4):
- Flutter
- FlutterMacOS
- url_launcher_ios (0.0.1):
- Flutter
DEPENDENCIES:
- connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- firebase_messaging (from `.symlinks/plugins/firebase_messaging/ios`)
- Flutter (from `Flutter`)
- flutter_local_notifications (from `.symlinks/plugins/flutter_local_notifications/ios`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- open_file_ios (from `.symlinks/plugins/open_file_ios/ios`)
- package_info_plus (from `.symlinks/plugins/package_info_plus/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)
- permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
- sqflite_darwin (from `.symlinks/plugins/sqflite_darwin/darwin`)
- url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`)
SPEC REPOS:
trunk:
- Firebase
- FirebaseCore
- FirebaseCoreInternal
- FirebaseInstallations
- FirebaseMessaging
- GoogleDataTransport
- GoogleUtilities
- nanopb
- PromisesObjC
EXTERNAL SOURCES:
connectivity_plus:
:path: ".symlinks/plugins/connectivity_plus/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
firebase_core:
:path: ".symlinks/plugins/firebase_core/ios"
firebase_messaging:
:path: ".symlinks/plugins/firebase_messaging/ios"
Flutter:
:path: Flutter
flutter_local_notifications:
:path: ".symlinks/plugins/flutter_local_notifications/ios"
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
open_file_ios:
:path: ".symlinks/plugins/open_file_ios/ios"
package_info_plus:
:path: ".symlinks/plugins/package_info_plus/ios"
path_provider_foundation:
:path: ".symlinks/plugins/path_provider_foundation/darwin"
permission_handler_apple:
:path: ".symlinks/plugins/permission_handler_apple/ios"
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
sqflite_darwin:
:path: ".symlinks/plugins/sqflite_darwin/darwin"
url_launcher_ios:
:path: ".symlinks/plugins/url_launcher_ios/ios"
SPEC CHECKSUMS:
connectivity_plus: 2a701ffec2c0ae28a48cf7540e279787e77c447d
device_info_plus: bf2e3232933866d73fe290f2942f2156cdd10342
Firebase: 0312a2352584f782ea56f66d91606891d4607f06
firebase_core: a626d00494efa398e7c54f25f1454a64c8abf197
firebase_messaging: 1541105e2a2a6ef8bd869bcc44157d31e82f3a50
FirebaseCore: 7ec4d0484817f12c3373955bc87762d96842d483
FirebaseCoreInternal: df84dd300b561c27d5571684f389bf60b0a5c934
FirebaseInstallations: 913cf60d0400ebd5d6b63a28b290372ab44590dd
FirebaseMessaging: 88950ba9485052891ebe26f6c43a52bb62248952
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
flutter_local_notifications: df98d66e515e1ca797af436137b4459b160ad8c9
GoogleDataTransport: 6c09b596d841063d76d4288cc2d2f42cc36e1e2a
GoogleUtilities: ea963c370a38a8069cc5f7ba4ca849a60b6d7d15
image_picker_ios: c560581cceedb403a6ff17f2f816d7fea1421fc1
nanopb: 438bc412db1928dac798aa6fd75726007be04262
open_file_ios: 461db5853723763573e140de3193656f91990d9e
package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4
path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46
permission_handler_apple: 9878588469a2b0d0fc1e048d9f43605f92e6cec2
PromisesObjC: f5707f49cb48b9636751c5b2e7d227e43fba9f47
shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78
sqflite_darwin: 5a7236e3b501866c1c9befc6771dfd73ffb8702d
url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe
PODFILE CHECKSUM: e30f02f9d1c72c47bb6344a0a748c9d268180865
COCOAPODS: 1.16.2
+135
View File
@@ -15,6 +15,8 @@
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; };
989F8AA016A730C566E93749 /* Pods_RunnerTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */; };
F18848A41F5DE1108211F920 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -41,15 +43,22 @@
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.profile.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.profile.xcconfig"; sourceTree = "<group>"; };
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = "<group>"; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
159A415F4811E2794AA4092B /* Pods-Runner.profile.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.profile.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.profile.xcconfig"; sourceTree = "<group>"; };
1CE6759F37E82B0362B2E241 /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.release.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"; sourceTree = "<group>"; };
227E95442FB25185003AAE6C /* GoogleService-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "GoogleService-Info.plist"; sourceTree = "<group>"; };
331C807B294A618700263BE5 /* RunnerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RunnerTests.swift; sourceTree = "<group>"; };
331C8081294A63A400263BE5 /* RunnerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RunnerTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_RunnerTests.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3C70A9D33D5F6D7EAE05A508 /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Runner.debug.xcconfig"; path = "Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"; sourceTree = "<group>"; };
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = "<group>"; };
74858FAE1ED2DC5600515810 /* AppDelegate.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.release.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.release.xcconfig"; sourceTree = "<group>"; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = "<group>"; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = "<group>"; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
@@ -57,13 +66,23 @@
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RunnerTests.debug.xcconfig"; path = "Target Support Files/Pods-RunnerTests/Pods-RunnerTests.debug.xcconfig"; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
6BBDF52C0DFCF2DFA69EB9C3 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
989F8AA016A730C566E93749 /* Pods_RunnerTests.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
97C146EB1CF9000F007C117D /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
F18848A41F5DE1108211F920 /* Pods_Runner.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -78,6 +97,15 @@
path = RunnerTests;
sourceTree = "<group>";
};
4DBA9259FD070A034AF146BB /* Frameworks */ = {
isa = PBXGroup;
children = (
3B7ABC3D9AD3883EDD2E44FB /* Pods_Runner.framework */,
3A6F295F1D6E4BB0819A8681 /* Pods_RunnerTests.framework */,
);
name = Frameworks;
sourceTree = "<group>";
};
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
@@ -96,6 +124,8 @@
97C146F01CF9000F007C117D /* Runner */,
97C146EF1CF9000F007C117D /* Products */,
331C8082294A63A400263BE5 /* RunnerTests */,
F771B77E516695BE7A4B0AEA /* Pods */,
4DBA9259FD070A034AF146BB /* Frameworks */,
);
sourceTree = "<group>";
};
@@ -124,6 +154,19 @@
path = Runner;
sourceTree = "<group>";
};
F771B77E516695BE7A4B0AEA /* Pods */ = {
isa = PBXGroup;
children = (
3C70A9D33D5F6D7EAE05A508 /* Pods-Runner.debug.xcconfig */,
1CE6759F37E82B0362B2E241 /* Pods-Runner.release.xcconfig */,
159A415F4811E2794AA4092B /* Pods-Runner.profile.xcconfig */,
E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */,
7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */,
0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */,
);
path = Pods;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -131,8 +174,10 @@
isa = PBXNativeTarget;
buildConfigurationList = 331C8087294A63A400263BE5 /* Build configuration list for PBXNativeTarget "RunnerTests" */;
buildPhases = (
81D20024DBE321C19417AE73 /* [CP] Check Pods Manifest.lock */,
331C807D294A63A400263BE5 /* Sources */,
331C807F294A63A400263BE5 /* Resources */,
6BBDF52C0DFCF2DFA69EB9C3 /* Frameworks */,
);
buildRules = (
);
@@ -148,12 +193,15 @@
isa = PBXNativeTarget;
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
buildPhases = (
ACC8E6F2D63F11FFC05DF00A /* [CP] Check Pods Manifest.lock */,
9740EEB61CF901F6004384FC /* Run Script */,
97C146EA1CF9000F007C117D /* Sources */,
97C146EB1CF9000F007C117D /* Frameworks */,
97C146EC1CF9000F007C117D /* Resources */,
9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
77740562F72074B1BD58B4C5 /* [CP] Embed Pods Frameworks */,
E2768009FD8B9B6235B4E16A /* [CP] Copy Pods Resources */,
);
buildRules = (
);
@@ -242,6 +290,45 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
77740562F72074B1BD58B4C5 /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
81D20024DBE321C19417AE73 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-RunnerTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
alwaysOutOfDate = 1;
@@ -257,6 +344,45 @@
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
};
ACC8E6F2D63F11FFC05DF00A /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputFileListPaths = (
);
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-Runner-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
E2768009FD8B9B6235B4E16A /* [CP] Copy Pods Resources */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
@@ -366,8 +492,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5TRC3M8UZG;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -382,6 +510,7 @@
};
331C8088294A63A400263BE5 /* Debug */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = E6E423C7625C032FDEFB6799 /* Pods-RunnerTests.debug.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -399,6 +528,7 @@
};
331C8089294A63A400263BE5 /* Release */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 7F8F2B65C01EDDD64346C756 /* Pods-RunnerTests.release.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -414,6 +544,7 @@
};
331C808A294A63A400263BE5 /* Profile */ = {
isa = XCBuildConfiguration;
baseConfigurationReference = 0B9C91DAD8EC48930CF79A70 /* Pods-RunnerTests.profile.xcconfig */;
buildSettings = {
BUNDLE_LOADER = "$(TEST_HOST)";
CODE_SIGN_STYLE = Automatic;
@@ -545,8 +676,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5TRC3M8UZG;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
@@ -567,8 +700,10 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
CLANG_ENABLE_MODULES = YES;
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
DEVELOPMENT_TEAM = 5TRC3M8UZG;
ENABLE_BITCODE = NO;
INFOPLIST_FILE = Runner/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 14.0;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
+3
View File
@@ -4,4 +4,7 @@
<FileRef
location = "group:Runner.xcodeproj">
</FileRef>
<FileRef
location = "group:Pods/Pods.xcodeproj">
</FileRef>
</Workspace>
@@ -14,7 +14,7 @@ class DashboardAnalyticLoaderState with _$DashboardAnalyticLoaderState {
DashboardAnalyticLoaderState(
dashboardAnalytic: DashboardAnalytic.empty(),
failureOptionDashboardAnalytic: none(),
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
dateFrom: DateTime.now(),
dateTo: DateTime.now(),
);
}
@@ -30,6 +30,9 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
searchChanged: (e) async {
emit(state.copyWith(search: e.search));
},
outletChanged: (e) async {
emit(state.copyWith(outletId: e.outletId));
},
fetched: (e) async {
var newState = state;
@@ -69,6 +72,7 @@ class OrderLoaderBloc extends Bloc<OrderLoaderEvent, OrderLoaderState> {
status: state.status == 'all' ? null : state.status,
page: state.page,
search: state.search,
outletId: state.outletId,
dateFrom: state.dateFrom,
dateTo: state.dateTo,
);
@@ -23,6 +23,7 @@ mixin _$OrderLoaderEvent {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -30,6 +31,7 @@ mixin _$OrderLoaderEvent {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -37,6 +39,7 @@ mixin _$OrderLoaderEvent {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -45,6 +48,7 @@ mixin _$OrderLoaderEvent {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -52,6 +56,7 @@ mixin _$OrderLoaderEvent {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
@@ -59,6 +64,7 @@ mixin _$OrderLoaderEvent {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@@ -171,6 +177,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return rangeDateChanged(dateFrom, dateTo);
@@ -182,6 +189,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return rangeDateChanged?.call(dateFrom, dateTo);
@@ -193,6 +201,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -208,6 +217,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return rangeDateChanged(this);
@@ -219,6 +229,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return rangeDateChanged?.call(this);
@@ -230,6 +241,7 @@ class _$RangeDateChangedImpl implements _RangeDateChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -330,6 +342,7 @@ class _$StatusChangedImpl implements _StatusChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return statusChanged(status);
@@ -341,6 +354,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return statusChanged?.call(status);
@@ -352,6 +366,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -367,6 +382,7 @@ class _$StatusChangedImpl implements _StatusChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return statusChanged(this);
@@ -378,6 +394,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return statusChanged?.call(this);
@@ -389,6 +406,7 @@ class _$StatusChangedImpl implements _StatusChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -485,6 +503,7 @@ class _$SearchChangedImpl implements _SearchChanged {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return searchChanged(search);
@@ -496,6 +515,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return searchChanged?.call(search);
@@ -507,6 +527,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -522,6 +543,7 @@ class _$SearchChangedImpl implements _SearchChanged {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return searchChanged(this);
@@ -533,6 +555,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return searchChanged?.call(this);
@@ -544,6 +567,7 @@ class _$SearchChangedImpl implements _SearchChanged {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -566,6 +590,168 @@ abstract class _SearchChanged implements OrderLoaderEvent {
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$OutletChangedImplCopyWith<$Res> {
factory _$$OutletChangedImplCopyWith(
_$OutletChangedImpl value,
$Res Function(_$OutletChangedImpl) then,
) = __$$OutletChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String? outletId});
}
/// @nodoc
class __$$OutletChangedImplCopyWithImpl<$Res>
extends _$OrderLoaderEventCopyWithImpl<$Res, _$OutletChangedImpl>
implements _$$OutletChangedImplCopyWith<$Res> {
__$$OutletChangedImplCopyWithImpl(
_$OutletChangedImpl _value,
$Res Function(_$OutletChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? outletId = freezed}) {
return _then(
_$OutletChangedImpl(
freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
class _$OutletChangedImpl implements _OutletChanged {
const _$OutletChangedImpl(this.outletId);
@override
final String? outletId;
@override
String toString() {
return 'OrderLoaderEvent.outletChanged(outletId: $outletId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OutletChangedImpl &&
(identical(other.outletId, outletId) ||
other.outletId == outletId));
}
@override
int get hashCode => Object.hash(runtimeType, outletId);
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OutletChangedImplCopyWith<_$OutletChangedImpl> get copyWith =>
__$$OutletChangedImplCopyWithImpl<_$OutletChangedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(DateTime dateFrom, DateTime dateTo)
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return outletChanged(outletId);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return outletChanged?.call(outletId);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
if (outletChanged != null) {
return outletChanged(outletId);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return outletChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return outletChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (outletChanged != null) {
return outletChanged(this);
}
return orElse();
}
}
abstract class _OutletChanged implements OrderLoaderEvent {
const factory _OutletChanged(final String? outletId) = _$OutletChangedImpl;
String? get outletId;
/// Create a copy of OrderLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OutletChangedImplCopyWith<_$OutletChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$FetchedImplCopyWith<$Res> {
factory _$$FetchedImplCopyWith(
@@ -642,6 +828,7 @@ class _$FetchedImpl implements _Fetched {
rangeDateChanged,
required TResult Function(String status) statusChanged,
required TResult Function(String search) searchChanged,
required TResult Function(String? outletId) outletChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return fetched(isRefresh);
@@ -653,6 +840,7 @@ class _$FetchedImpl implements _Fetched {
TResult? Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult? Function(String status)? statusChanged,
TResult? Function(String search)? searchChanged,
TResult? Function(String? outletId)? outletChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return fetched?.call(isRefresh);
@@ -664,6 +852,7 @@ class _$FetchedImpl implements _Fetched {
TResult Function(DateTime dateFrom, DateTime dateTo)? rangeDateChanged,
TResult Function(String status)? statusChanged,
TResult Function(String search)? searchChanged,
TResult Function(String? outletId)? outletChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
@@ -679,6 +868,7 @@ class _$FetchedImpl implements _Fetched {
required TResult Function(_RangeDateChanged value) rangeDateChanged,
required TResult Function(_StatusChanged value) statusChanged,
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_OutletChanged value) outletChanged,
required TResult Function(_Fetched value) fetched,
}) {
return fetched(this);
@@ -690,6 +880,7 @@ class _$FetchedImpl implements _Fetched {
TResult? Function(_RangeDateChanged value)? rangeDateChanged,
TResult? Function(_StatusChanged value)? statusChanged,
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_OutletChanged value)? outletChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return fetched?.call(this);
@@ -701,6 +892,7 @@ class _$FetchedImpl implements _Fetched {
TResult Function(_RangeDateChanged value)? rangeDateChanged,
TResult Function(_StatusChanged value)? statusChanged,
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_OutletChanged value)? outletChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
@@ -730,6 +922,7 @@ mixin _$OrderLoaderState {
throw _privateConstructorUsedError;
String get status => throw _privateConstructorUsedError;
String? get search => throw _privateConstructorUsedError;
String? get outletId => throw _privateConstructorUsedError;
bool get isFetching => throw _privateConstructorUsedError;
bool get hasReachedMax => throw _privateConstructorUsedError;
int get page => throw _privateConstructorUsedError;
@@ -755,6 +948,7 @@ abstract class $OrderLoaderStateCopyWith<$Res> {
Option<OrderFailure> failureOptionOrder,
String status,
String? search,
String? outletId,
bool isFetching,
bool hasReachedMax,
int page,
@@ -782,6 +976,7 @@ class _$OrderLoaderStateCopyWithImpl<$Res, $Val extends OrderLoaderState>
Object? failureOptionOrder = null,
Object? status = null,
Object? search = freezed,
Object? outletId = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
@@ -806,6 +1001,10 @@ class _$OrderLoaderStateCopyWithImpl<$Res, $Val extends OrderLoaderState>
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
outletId: freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
@@ -846,6 +1045,7 @@ abstract class _$$OrderLoaderStateImplCopyWith<$Res>
Option<OrderFailure> failureOptionOrder,
String status,
String? search,
String? outletId,
bool isFetching,
bool hasReachedMax,
int page,
@@ -872,6 +1072,7 @@ class __$$OrderLoaderStateImplCopyWithImpl<$Res>
Object? failureOptionOrder = null,
Object? status = null,
Object? search = freezed,
Object? outletId = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
@@ -896,6 +1097,10 @@ class __$$OrderLoaderStateImplCopyWithImpl<$Res>
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
outletId: freezed == outletId
? _value.outletId
: outletId // ignore: cast_nullable_to_non_nullable
as String?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
@@ -929,6 +1134,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
required this.failureOptionOrder,
required this.status,
this.search,
this.outletId,
this.isFetching = false,
this.hasReachedMax = false,
this.page = 1,
@@ -951,6 +1157,8 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
@override
final String? search;
@override
final String? outletId;
@override
@JsonKey()
final bool isFetching;
@override
@@ -966,7 +1174,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
@override
String toString() {
return 'OrderLoaderState(orders: $orders, failureOptionOrder: $failureOptionOrder, status: $status, search: $search, isFetching: $isFetching, hasReachedMax: $hasReachedMax, page: $page, dateFrom: $dateFrom, dateTo: $dateTo)';
return 'OrderLoaderState(orders: $orders, failureOptionOrder: $failureOptionOrder, status: $status, search: $search, outletId: $outletId, isFetching: $isFetching, hasReachedMax: $hasReachedMax, page: $page, dateFrom: $dateFrom, dateTo: $dateTo)';
}
@override
@@ -979,6 +1187,8 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
other.failureOptionOrder == failureOptionOrder) &&
(identical(other.status, status) || other.status == status) &&
(identical(other.search, search) || other.search == search) &&
(identical(other.outletId, outletId) ||
other.outletId == outletId) &&
(identical(other.isFetching, isFetching) ||
other.isFetching == isFetching) &&
(identical(other.hasReachedMax, hasReachedMax) ||
@@ -996,6 +1206,7 @@ class _$OrderLoaderStateImpl implements _OrderLoaderState {
failureOptionOrder,
status,
search,
outletId,
isFetching,
hasReachedMax,
page,
@@ -1021,6 +1232,7 @@ abstract class _OrderLoaderState implements OrderLoaderState {
required final Option<OrderFailure> failureOptionOrder,
required final String status,
final String? search,
final String? outletId,
final bool isFetching,
final bool hasReachedMax,
final int page,
@@ -1037,6 +1249,8 @@ abstract class _OrderLoaderState implements OrderLoaderState {
@override
String? get search;
@override
String? get outletId;
@override
bool get isFetching;
@override
bool get hasReachedMax;
@@ -8,6 +8,8 @@ class OrderLoaderEvent with _$OrderLoaderEvent {
) = _RangeDateChanged;
const factory OrderLoaderEvent.statusChanged(String status) = _StatusChanged;
const factory OrderLoaderEvent.searchChanged(String search) = _SearchChanged;
const factory OrderLoaderEvent.outletChanged(String? outletId) =
_OutletChanged;
const factory OrderLoaderEvent.fetched({@Default(false) bool isRefresh}) =
_Fetched;
}
@@ -7,6 +7,7 @@ class OrderLoaderState with _$OrderLoaderState {
required Option<OrderFailure> failureOptionOrder,
required String status,
String? search,
String? outletId,
@Default(false) bool isFetching,
@Default(false) bool hasReachedMax,
@Default(1) int page,
@@ -17,7 +18,7 @@ class OrderLoaderState with _$OrderLoaderState {
factory OrderLoaderState.initial() => OrderLoaderState(
orders: [],
failureOptionOrder: none(),
dateFrom: DateTime.now().subtract(const Duration(days: 30)),
dateFrom: DateTime.now(),
dateTo: DateTime.now(),
status: 'all',
);
@@ -0,0 +1,92 @@
import 'package:dartz/dartz.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/outlet/outlet.dart';
part 'outlet_list_loader_event.dart';
part 'outlet_list_loader_state.dart';
part 'outlet_list_loader_bloc.freezed.dart';
@injectable
class OutletListLoaderBloc
extends Bloc<OutletListLoaderEvent, OutletListLoaderState> {
final IOutletRepository _outletRepository;
OutletListLoaderBloc(this._outletRepository)
: super(OutletListLoaderState.initial()) {
on<OutletListLoaderEvent>(_onOutletListLoaderEvent);
}
Future<void> _onOutletListLoaderEvent(
OutletListLoaderEvent event,
Emitter<OutletListLoaderState> emit,
) {
return event.map(
searchChanged: (e) async {
emit(state.copyWith(search: e.search));
},
isActiveChanged: (e) async {
emit(state.copyWith(isActive: e.isActive));
},
fetched: (e) async {
var newState = state;
if (e.isRefresh) {
newState = state.copyWith(isFetching: true);
emit(newState);
}
newState = await _mapFetchedToState(state, isRefresh: e.isRefresh);
emit(newState);
},
);
}
Future<OutletListLoaderState> _mapFetchedToState(
OutletListLoaderState state, {
bool isRefresh = false,
}) async {
state = state.copyWith(isFetching: false);
if (state.hasReachedMax && state.outlets.isNotEmpty && !isRefresh) {
return state;
}
if (isRefresh) {
state = state.copyWith(
page: 1,
failureOptionOutlet: none(),
hasReachedMax: false,
outlets: [],
);
}
final failureOrOutlets = await _outletRepository.getList(
page: state.page,
search: state.search,
isActive: state.isActive,
);
state = failureOrOutlets.fold(
(f) {
if (state.outlets.isNotEmpty) {
return state.copyWith(hasReachedMax: true);
}
return state.copyWith(failureOptionOutlet: optionOf(f));
},
(outlets) {
return state.copyWith(
outlets: List.from(state.outlets)..addAll(outlets),
failureOptionOutlet: none(),
page: state.page + 1,
hasReachedMax: outlets.length < 10,
);
},
);
return state;
}
}
@@ -0,0 +1,828 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'outlet_list_loader_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$OutletListLoaderEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String search) searchChanged,
required TResult Function(bool? isActive) isActiveChanged,
required TResult Function(bool isRefresh) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String search)? searchChanged,
TResult? Function(bool? isActive)? isActiveChanged,
TResult? Function(bool isRefresh)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String search)? searchChanged,
TResult Function(bool? isActive)? isActiveChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_IsActiveChanged value) isActiveChanged,
required TResult Function(_Fetched value) fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_IsActiveChanged value)? isActiveChanged,
TResult? Function(_Fetched value)? fetched,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_IsActiveChanged value)? isActiveChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OutletListLoaderEventCopyWith<$Res> {
factory $OutletListLoaderEventCopyWith(
OutletListLoaderEvent value,
$Res Function(OutletListLoaderEvent) then,
) = _$OutletListLoaderEventCopyWithImpl<$Res, OutletListLoaderEvent>;
}
/// @nodoc
class _$OutletListLoaderEventCopyWithImpl<
$Res,
$Val extends OutletListLoaderEvent
>
implements $OutletListLoaderEventCopyWith<$Res> {
_$OutletListLoaderEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$SearchChangedImplCopyWith<$Res> {
factory _$$SearchChangedImplCopyWith(
_$SearchChangedImpl value,
$Res Function(_$SearchChangedImpl) then,
) = __$$SearchChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({String search});
}
/// @nodoc
class __$$SearchChangedImplCopyWithImpl<$Res>
extends _$OutletListLoaderEventCopyWithImpl<$Res, _$SearchChangedImpl>
implements _$$SearchChangedImplCopyWith<$Res> {
__$$SearchChangedImplCopyWithImpl(
_$SearchChangedImpl _value,
$Res Function(_$SearchChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? search = null}) {
return _then(
_$SearchChangedImpl(
null == search
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String,
),
);
}
}
/// @nodoc
class _$SearchChangedImpl implements _SearchChanged {
const _$SearchChangedImpl(this.search);
@override
final String search;
@override
String toString() {
return 'OutletListLoaderEvent.searchChanged(search: $search)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SearchChangedImpl &&
(identical(other.search, search) || other.search == search));
}
@override
int get hashCode => Object.hash(runtimeType, search);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SearchChangedImplCopyWith<_$SearchChangedImpl> get copyWith =>
__$$SearchChangedImplCopyWithImpl<_$SearchChangedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String search) searchChanged,
required TResult Function(bool? isActive) isActiveChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return searchChanged(search);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String search)? searchChanged,
TResult? Function(bool? isActive)? isActiveChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return searchChanged?.call(search);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String search)? searchChanged,
TResult Function(bool? isActive)? isActiveChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
if (searchChanged != null) {
return searchChanged(search);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_IsActiveChanged value) isActiveChanged,
required TResult Function(_Fetched value) fetched,
}) {
return searchChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_IsActiveChanged value)? isActiveChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return searchChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_IsActiveChanged value)? isActiveChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (searchChanged != null) {
return searchChanged(this);
}
return orElse();
}
}
abstract class _SearchChanged implements OutletListLoaderEvent {
const factory _SearchChanged(final String search) = _$SearchChangedImpl;
String get search;
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SearchChangedImplCopyWith<_$SearchChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$IsActiveChangedImplCopyWith<$Res> {
factory _$$IsActiveChangedImplCopyWith(
_$IsActiveChangedImpl value,
$Res Function(_$IsActiveChangedImpl) then,
) = __$$IsActiveChangedImplCopyWithImpl<$Res>;
@useResult
$Res call({bool? isActive});
}
/// @nodoc
class __$$IsActiveChangedImplCopyWithImpl<$Res>
extends _$OutletListLoaderEventCopyWithImpl<$Res, _$IsActiveChangedImpl>
implements _$$IsActiveChangedImplCopyWith<$Res> {
__$$IsActiveChangedImplCopyWithImpl(
_$IsActiveChangedImpl _value,
$Res Function(_$IsActiveChangedImpl) _then,
) : super(_value, _then);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? isActive = freezed}) {
return _then(
_$IsActiveChangedImpl(
freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
),
);
}
}
/// @nodoc
class _$IsActiveChangedImpl implements _IsActiveChanged {
const _$IsActiveChangedImpl(this.isActive);
@override
final bool? isActive;
@override
String toString() {
return 'OutletListLoaderEvent.isActiveChanged(isActive: $isActive)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$IsActiveChangedImpl &&
(identical(other.isActive, isActive) ||
other.isActive == isActive));
}
@override
int get hashCode => Object.hash(runtimeType, isActive);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$IsActiveChangedImplCopyWith<_$IsActiveChangedImpl> get copyWith =>
__$$IsActiveChangedImplCopyWithImpl<_$IsActiveChangedImpl>(
this,
_$identity,
);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String search) searchChanged,
required TResult Function(bool? isActive) isActiveChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return isActiveChanged(isActive);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String search)? searchChanged,
TResult? Function(bool? isActive)? isActiveChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return isActiveChanged?.call(isActive);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String search)? searchChanged,
TResult Function(bool? isActive)? isActiveChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
if (isActiveChanged != null) {
return isActiveChanged(isActive);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_IsActiveChanged value) isActiveChanged,
required TResult Function(_Fetched value) fetched,
}) {
return isActiveChanged(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_IsActiveChanged value)? isActiveChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return isActiveChanged?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_IsActiveChanged value)? isActiveChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (isActiveChanged != null) {
return isActiveChanged(this);
}
return orElse();
}
}
abstract class _IsActiveChanged implements OutletListLoaderEvent {
const factory _IsActiveChanged(final bool? isActive) = _$IsActiveChangedImpl;
bool? get isActive;
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$IsActiveChangedImplCopyWith<_$IsActiveChangedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$FetchedImplCopyWith<$Res> {
factory _$$FetchedImplCopyWith(
_$FetchedImpl value,
$Res Function(_$FetchedImpl) then,
) = __$$FetchedImplCopyWithImpl<$Res>;
@useResult
$Res call({bool isRefresh});
}
/// @nodoc
class __$$FetchedImplCopyWithImpl<$Res>
extends _$OutletListLoaderEventCopyWithImpl<$Res, _$FetchedImpl>
implements _$$FetchedImplCopyWith<$Res> {
__$$FetchedImplCopyWithImpl(
_$FetchedImpl _value,
$Res Function(_$FetchedImpl) _then,
) : super(_value, _then);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? isRefresh = null}) {
return _then(
_$FetchedImpl(
isRefresh: null == isRefresh
? _value.isRefresh
: isRefresh // ignore: cast_nullable_to_non_nullable
as bool,
),
);
}
}
/// @nodoc
class _$FetchedImpl implements _Fetched {
const _$FetchedImpl({this.isRefresh = false});
@override
@JsonKey()
final bool isRefresh;
@override
String toString() {
return 'OutletListLoaderEvent.fetched(isRefresh: $isRefresh)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$FetchedImpl &&
(identical(other.isRefresh, isRefresh) ||
other.isRefresh == isRefresh));
}
@override
int get hashCode => Object.hash(runtimeType, isRefresh);
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
__$$FetchedImplCopyWithImpl<_$FetchedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function(String search) searchChanged,
required TResult Function(bool? isActive) isActiveChanged,
required TResult Function(bool isRefresh) fetched,
}) {
return fetched(isRefresh);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function(String search)? searchChanged,
TResult? Function(bool? isActive)? isActiveChanged,
TResult? Function(bool isRefresh)? fetched,
}) {
return fetched?.call(isRefresh);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function(String search)? searchChanged,
TResult Function(bool? isActive)? isActiveChanged,
TResult Function(bool isRefresh)? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched(isRefresh);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_SearchChanged value) searchChanged,
required TResult Function(_IsActiveChanged value) isActiveChanged,
required TResult Function(_Fetched value) fetched,
}) {
return fetched(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_SearchChanged value)? searchChanged,
TResult? Function(_IsActiveChanged value)? isActiveChanged,
TResult? Function(_Fetched value)? fetched,
}) {
return fetched?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_SearchChanged value)? searchChanged,
TResult Function(_IsActiveChanged value)? isActiveChanged,
TResult Function(_Fetched value)? fetched,
required TResult orElse(),
}) {
if (fetched != null) {
return fetched(this);
}
return orElse();
}
}
abstract class _Fetched implements OutletListLoaderEvent {
const factory _Fetched({final bool isRefresh}) = _$FetchedImpl;
bool get isRefresh;
/// Create a copy of OutletListLoaderEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$FetchedImplCopyWith<_$FetchedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
mixin _$OutletListLoaderState {
List<Outlet> get outlets => throw _privateConstructorUsedError;
Option<OutletFailure> get failureOptionOutlet =>
throw _privateConstructorUsedError;
String? get search => throw _privateConstructorUsedError;
bool? get isActive => throw _privateConstructorUsedError;
bool get isFetching => throw _privateConstructorUsedError;
bool get hasReachedMax => throw _privateConstructorUsedError;
int get page => throw _privateConstructorUsedError;
/// Create a copy of OutletListLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$OutletListLoaderStateCopyWith<OutletListLoaderState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $OutletListLoaderStateCopyWith<$Res> {
factory $OutletListLoaderStateCopyWith(
OutletListLoaderState value,
$Res Function(OutletListLoaderState) then,
) = _$OutletListLoaderStateCopyWithImpl<$Res, OutletListLoaderState>;
@useResult
$Res call({
List<Outlet> outlets,
Option<OutletFailure> failureOptionOutlet,
String? search,
bool? isActive,
bool isFetching,
bool hasReachedMax,
int page,
});
}
/// @nodoc
class _$OutletListLoaderStateCopyWithImpl<
$Res,
$Val extends OutletListLoaderState
>
implements $OutletListLoaderStateCopyWith<$Res> {
_$OutletListLoaderStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of OutletListLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? outlets = null,
Object? failureOptionOutlet = null,
Object? search = freezed,
Object? isActive = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
}) {
return _then(
_value.copyWith(
outlets: null == outlets
? _value.outlets
: outlets // ignore: cast_nullable_to_non_nullable
as List<Outlet>,
failureOptionOutlet: null == failureOptionOutlet
? _value.failureOptionOutlet
: failureOptionOutlet // ignore: cast_nullable_to_non_nullable
as Option<OutletFailure>,
search: freezed == search
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
hasReachedMax: null == hasReachedMax
? _value.hasReachedMax
: hasReachedMax // ignore: cast_nullable_to_non_nullable
as bool,
page: null == page
? _value.page
: page // ignore: cast_nullable_to_non_nullable
as int,
)
as $Val,
);
}
}
/// @nodoc
abstract class _$$OutletListLoaderStateImplCopyWith<$Res>
implements $OutletListLoaderStateCopyWith<$Res> {
factory _$$OutletListLoaderStateImplCopyWith(
_$OutletListLoaderStateImpl value,
$Res Function(_$OutletListLoaderStateImpl) then,
) = __$$OutletListLoaderStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({
List<Outlet> outlets,
Option<OutletFailure> failureOptionOutlet,
String? search,
bool? isActive,
bool isFetching,
bool hasReachedMax,
int page,
});
}
/// @nodoc
class __$$OutletListLoaderStateImplCopyWithImpl<$Res>
extends
_$OutletListLoaderStateCopyWithImpl<$Res, _$OutletListLoaderStateImpl>
implements _$$OutletListLoaderStateImplCopyWith<$Res> {
__$$OutletListLoaderStateImplCopyWithImpl(
_$OutletListLoaderStateImpl _value,
$Res Function(_$OutletListLoaderStateImpl) _then,
) : super(_value, _then);
/// Create a copy of OutletListLoaderState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? outlets = null,
Object? failureOptionOutlet = null,
Object? search = freezed,
Object? isActive = freezed,
Object? isFetching = null,
Object? hasReachedMax = null,
Object? page = null,
}) {
return _then(
_$OutletListLoaderStateImpl(
outlets: null == outlets
? _value._outlets
: outlets // ignore: cast_nullable_to_non_nullable
as List<Outlet>,
failureOptionOutlet: null == failureOptionOutlet
? _value.failureOptionOutlet
: failureOptionOutlet // ignore: cast_nullable_to_non_nullable
as Option<OutletFailure>,
search: freezed == search
? _value.search
: search // ignore: cast_nullable_to_non_nullable
as String?,
isActive: freezed == isActive
? _value.isActive
: isActive // ignore: cast_nullable_to_non_nullable
as bool?,
isFetching: null == isFetching
? _value.isFetching
: isFetching // ignore: cast_nullable_to_non_nullable
as bool,
hasReachedMax: null == hasReachedMax
? _value.hasReachedMax
: hasReachedMax // ignore: cast_nullable_to_non_nullable
as bool,
page: null == page
? _value.page
: page // ignore: cast_nullable_to_non_nullable
as int,
),
);
}
}
/// @nodoc
class _$OutletListLoaderStateImpl implements _OutletListLoaderState {
const _$OutletListLoaderStateImpl({
required final List<Outlet> outlets,
required this.failureOptionOutlet,
this.search,
this.isActive,
this.isFetching = false,
this.hasReachedMax = false,
this.page = 1,
}) : _outlets = outlets;
final List<Outlet> _outlets;
@override
List<Outlet> get outlets {
if (_outlets is EqualUnmodifiableListView) return _outlets;
// ignore: implicit_dynamic_type
return EqualUnmodifiableListView(_outlets);
}
@override
final Option<OutletFailure> failureOptionOutlet;
@override
final String? search;
@override
final bool? isActive;
@override
@JsonKey()
final bool isFetching;
@override
@JsonKey()
final bool hasReachedMax;
@override
@JsonKey()
final int page;
@override
String toString() {
return 'OutletListLoaderState(outlets: $outlets, failureOptionOutlet: $failureOptionOutlet, search: $search, isActive: $isActive, isFetching: $isFetching, hasReachedMax: $hasReachedMax, page: $page)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$OutletListLoaderStateImpl &&
const DeepCollectionEquality().equals(other._outlets, _outlets) &&
(identical(other.failureOptionOutlet, failureOptionOutlet) ||
other.failureOptionOutlet == failureOptionOutlet) &&
(identical(other.search, search) || other.search == search) &&
(identical(other.isActive, isActive) ||
other.isActive == isActive) &&
(identical(other.isFetching, isFetching) ||
other.isFetching == isFetching) &&
(identical(other.hasReachedMax, hasReachedMax) ||
other.hasReachedMax == hasReachedMax) &&
(identical(other.page, page) || other.page == page));
}
@override
int get hashCode => Object.hash(
runtimeType,
const DeepCollectionEquality().hash(_outlets),
failureOptionOutlet,
search,
isActive,
isFetching,
hasReachedMax,
page,
);
/// Create a copy of OutletListLoaderState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$OutletListLoaderStateImplCopyWith<_$OutletListLoaderStateImpl>
get copyWith =>
__$$OutletListLoaderStateImplCopyWithImpl<_$OutletListLoaderStateImpl>(
this,
_$identity,
);
}
abstract class _OutletListLoaderState implements OutletListLoaderState {
const factory _OutletListLoaderState({
required final List<Outlet> outlets,
required final Option<OutletFailure> failureOptionOutlet,
final String? search,
final bool? isActive,
final bool isFetching,
final bool hasReachedMax,
final int page,
}) = _$OutletListLoaderStateImpl;
@override
List<Outlet> get outlets;
@override
Option<OutletFailure> get failureOptionOutlet;
@override
String? get search;
@override
bool? get isActive;
@override
bool get isFetching;
@override
bool get hasReachedMax;
@override
int get page;
/// Create a copy of OutletListLoaderState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$OutletListLoaderStateImplCopyWith<_$OutletListLoaderStateImpl>
get copyWith => throw _privateConstructorUsedError;
}
@@ -0,0 +1,12 @@
part of 'outlet_list_loader_bloc.dart';
@freezed
class OutletListLoaderEvent with _$OutletListLoaderEvent {
const factory OutletListLoaderEvent.searchChanged(String search) =
_SearchChanged;
const factory OutletListLoaderEvent.isActiveChanged(bool? isActive) =
_IsActiveChanged;
const factory OutletListLoaderEvent.fetched({
@Default(false) bool isRefresh,
}) = _Fetched;
}
@@ -0,0 +1,17 @@
part of 'outlet_list_loader_bloc.dart';
@freezed
class OutletListLoaderState with _$OutletListLoaderState {
const factory OutletListLoaderState({
required List<Outlet> outlets,
required Option<OutletFailure> failureOptionOutlet,
String? search,
bool? isActive,
@Default(false) bool isFetching,
@Default(false) bool hasReachedMax,
@Default(1) int page,
}) = _OutletListLoaderState;
factory OutletListLoaderState.initial() =>
OutletListLoaderState(outlets: [], failureOptionOutlet: none());
}
@@ -0,0 +1,46 @@
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
import 'package:injectable/injectable.dart';
import '../../../domain/outlet/outlet.dart';
import '../../../infrastructure/outlet/datasource/local_data_provider.dart';
part 'selected_outlet_event.dart';
part 'selected_outlet_state.dart';
part 'selected_outlet_bloc.freezed.dart';
@injectable
class SelectedOutletBloc
extends Bloc<SelectedOutletEvent, SelectedOutletState> {
final OutletLocalDataProvider _localDataProvider;
SelectedOutletBloc(this._localDataProvider)
: super(SelectedOutletState.initial()) {
on<SelectedOutletEvent>(_onSelectedOutletEvent);
}
Future<void> _onSelectedOutletEvent(
SelectedOutletEvent event,
Emitter<SelectedOutletState> emit,
) {
return event.map(
loaded: (e) async {
final savedId = _localDataProvider.getSelectedOutletId();
emit(state.copyWith(selectedOutletId: savedId));
},
selected: (e) async {
await _localDataProvider.saveSelectedOutletId(e.outlet.id);
emit(
state.copyWith(
selectedOutlet: e.outlet,
selectedOutletId: e.outlet.id,
),
);
},
cleared: (e) async {
await _localDataProvider.deleteSelectedOutletId();
emit(SelectedOutletState.initial());
},
);
}
}
@@ -0,0 +1,649 @@
// coverage:ignore-file
// GENERATED CODE - DO NOT MODIFY BY HAND
// 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 'selected_outlet_bloc.dart';
// **************************************************************************
// FreezedGenerator
// **************************************************************************
T _$identity<T>(T value) => value;
final _privateConstructorUsedError = UnsupportedError(
'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models',
);
/// @nodoc
mixin _$SelectedOutletEvent {
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loaded,
required TResult Function(Outlet outlet) selected,
required TResult Function() cleared,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loaded,
TResult? Function(Outlet outlet)? selected,
TResult? Function()? cleared,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loaded,
TResult Function(Outlet outlet)? selected,
TResult Function()? cleared,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loaded value) loaded,
required TResult Function(_Selected value) selected,
required TResult Function(_Cleared value) cleared,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Selected value)? selected,
TResult? Function(_Cleared value)? cleared,
}) => throw _privateConstructorUsedError;
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Loaded value)? loaded,
TResult Function(_Selected value)? selected,
TResult Function(_Cleared value)? cleared,
required TResult orElse(),
}) => throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SelectedOutletEventCopyWith<$Res> {
factory $SelectedOutletEventCopyWith(
SelectedOutletEvent value,
$Res Function(SelectedOutletEvent) then,
) = _$SelectedOutletEventCopyWithImpl<$Res, SelectedOutletEvent>;
}
/// @nodoc
class _$SelectedOutletEventCopyWithImpl<$Res, $Val extends SelectedOutletEvent>
implements $SelectedOutletEventCopyWith<$Res> {
_$SelectedOutletEventCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
abstract class _$$LoadedImplCopyWith<$Res> {
factory _$$LoadedImplCopyWith(
_$LoadedImpl value,
$Res Function(_$LoadedImpl) then,
) = __$$LoadedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$LoadedImplCopyWithImpl<$Res>
extends _$SelectedOutletEventCopyWithImpl<$Res, _$LoadedImpl>
implements _$$LoadedImplCopyWith<$Res> {
__$$LoadedImplCopyWithImpl(
_$LoadedImpl _value,
$Res Function(_$LoadedImpl) _then,
) : super(_value, _then);
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$LoadedImpl implements _Loaded {
const _$LoadedImpl();
@override
String toString() {
return 'SelectedOutletEvent.loaded()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$LoadedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loaded,
required TResult Function(Outlet outlet) selected,
required TResult Function() cleared,
}) {
return loaded();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loaded,
TResult? Function(Outlet outlet)? selected,
TResult? Function()? cleared,
}) {
return loaded?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loaded,
TResult Function(Outlet outlet)? selected,
TResult Function()? cleared,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loaded value) loaded,
required TResult Function(_Selected value) selected,
required TResult Function(_Cleared value) cleared,
}) {
return loaded(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Selected value)? selected,
TResult? Function(_Cleared value)? cleared,
}) {
return loaded?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Loaded value)? loaded,
TResult Function(_Selected value)? selected,
TResult Function(_Cleared value)? cleared,
required TResult orElse(),
}) {
if (loaded != null) {
return loaded(this);
}
return orElse();
}
}
abstract class _Loaded implements SelectedOutletEvent {
const factory _Loaded() = _$LoadedImpl;
}
/// @nodoc
abstract class _$$SelectedImplCopyWith<$Res> {
factory _$$SelectedImplCopyWith(
_$SelectedImpl value,
$Res Function(_$SelectedImpl) then,
) = __$$SelectedImplCopyWithImpl<$Res>;
@useResult
$Res call({Outlet outlet});
$OutletCopyWith<$Res> get outlet;
}
/// @nodoc
class __$$SelectedImplCopyWithImpl<$Res>
extends _$SelectedOutletEventCopyWithImpl<$Res, _$SelectedImpl>
implements _$$SelectedImplCopyWith<$Res> {
__$$SelectedImplCopyWithImpl(
_$SelectedImpl _value,
$Res Function(_$SelectedImpl) _then,
) : super(_value, _then);
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({Object? outlet = null}) {
return _then(
_$SelectedImpl(
null == outlet
? _value.outlet
: outlet // ignore: cast_nullable_to_non_nullable
as Outlet,
),
);
}
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OutletCopyWith<$Res> get outlet {
return $OutletCopyWith<$Res>(_value.outlet, (value) {
return _then(_value.copyWith(outlet: value));
});
}
}
/// @nodoc
class _$SelectedImpl implements _Selected {
const _$SelectedImpl(this.outlet);
@override
final Outlet outlet;
@override
String toString() {
return 'SelectedOutletEvent.selected(outlet: $outlet)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SelectedImpl &&
(identical(other.outlet, outlet) || other.outlet == outlet));
}
@override
int get hashCode => Object.hash(runtimeType, outlet);
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SelectedImplCopyWith<_$SelectedImpl> get copyWith =>
__$$SelectedImplCopyWithImpl<_$SelectedImpl>(this, _$identity);
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loaded,
required TResult Function(Outlet outlet) selected,
required TResult Function() cleared,
}) {
return selected(outlet);
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loaded,
TResult? Function(Outlet outlet)? selected,
TResult? Function()? cleared,
}) {
return selected?.call(outlet);
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loaded,
TResult Function(Outlet outlet)? selected,
TResult Function()? cleared,
required TResult orElse(),
}) {
if (selected != null) {
return selected(outlet);
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loaded value) loaded,
required TResult Function(_Selected value) selected,
required TResult Function(_Cleared value) cleared,
}) {
return selected(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Selected value)? selected,
TResult? Function(_Cleared value)? cleared,
}) {
return selected?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Loaded value)? loaded,
TResult Function(_Selected value)? selected,
TResult Function(_Cleared value)? cleared,
required TResult orElse(),
}) {
if (selected != null) {
return selected(this);
}
return orElse();
}
}
abstract class _Selected implements SelectedOutletEvent {
const factory _Selected(final Outlet outlet) = _$SelectedImpl;
Outlet get outlet;
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SelectedImplCopyWith<_$SelectedImpl> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class _$$ClearedImplCopyWith<$Res> {
factory _$$ClearedImplCopyWith(
_$ClearedImpl value,
$Res Function(_$ClearedImpl) then,
) = __$$ClearedImplCopyWithImpl<$Res>;
}
/// @nodoc
class __$$ClearedImplCopyWithImpl<$Res>
extends _$SelectedOutletEventCopyWithImpl<$Res, _$ClearedImpl>
implements _$$ClearedImplCopyWith<$Res> {
__$$ClearedImplCopyWithImpl(
_$ClearedImpl _value,
$Res Function(_$ClearedImpl) _then,
) : super(_value, _then);
/// Create a copy of SelectedOutletEvent
/// with the given fields replaced by the non-null parameter values.
}
/// @nodoc
class _$ClearedImpl implements _Cleared {
const _$ClearedImpl();
@override
String toString() {
return 'SelectedOutletEvent.cleared()';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType && other is _$ClearedImpl);
}
@override
int get hashCode => runtimeType.hashCode;
@override
@optionalTypeArgs
TResult when<TResult extends Object?>({
required TResult Function() loaded,
required TResult Function(Outlet outlet) selected,
required TResult Function() cleared,
}) {
return cleared();
}
@override
@optionalTypeArgs
TResult? whenOrNull<TResult extends Object?>({
TResult? Function()? loaded,
TResult? Function(Outlet outlet)? selected,
TResult? Function()? cleared,
}) {
return cleared?.call();
}
@override
@optionalTypeArgs
TResult maybeWhen<TResult extends Object?>({
TResult Function()? loaded,
TResult Function(Outlet outlet)? selected,
TResult Function()? cleared,
required TResult orElse(),
}) {
if (cleared != null) {
return cleared();
}
return orElse();
}
@override
@optionalTypeArgs
TResult map<TResult extends Object?>({
required TResult Function(_Loaded value) loaded,
required TResult Function(_Selected value) selected,
required TResult Function(_Cleared value) cleared,
}) {
return cleared(this);
}
@override
@optionalTypeArgs
TResult? mapOrNull<TResult extends Object?>({
TResult? Function(_Loaded value)? loaded,
TResult? Function(_Selected value)? selected,
TResult? Function(_Cleared value)? cleared,
}) {
return cleared?.call(this);
}
@override
@optionalTypeArgs
TResult maybeMap<TResult extends Object?>({
TResult Function(_Loaded value)? loaded,
TResult Function(_Selected value)? selected,
TResult Function(_Cleared value)? cleared,
required TResult orElse(),
}) {
if (cleared != null) {
return cleared(this);
}
return orElse();
}
}
abstract class _Cleared implements SelectedOutletEvent {
const factory _Cleared() = _$ClearedImpl;
}
/// @nodoc
mixin _$SelectedOutletState {
/// null berarti "Semua Outlet"
Outlet? get selectedOutlet => throw _privateConstructorUsedError;
String? get selectedOutletId => throw _privateConstructorUsedError;
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
$SelectedOutletStateCopyWith<SelectedOutletState> get copyWith =>
throw _privateConstructorUsedError;
}
/// @nodoc
abstract class $SelectedOutletStateCopyWith<$Res> {
factory $SelectedOutletStateCopyWith(
SelectedOutletState value,
$Res Function(SelectedOutletState) then,
) = _$SelectedOutletStateCopyWithImpl<$Res, SelectedOutletState>;
@useResult
$Res call({Outlet? selectedOutlet, String? selectedOutletId});
$OutletCopyWith<$Res>? get selectedOutlet;
}
/// @nodoc
class _$SelectedOutletStateCopyWithImpl<$Res, $Val extends SelectedOutletState>
implements $SelectedOutletStateCopyWith<$Res> {
_$SelectedOutletStateCopyWithImpl(this._value, this._then);
// ignore: unused_field
final $Val _value;
// ignore: unused_field
final $Res Function($Val) _then;
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? selectedOutlet = freezed,
Object? selectedOutletId = freezed,
}) {
return _then(
_value.copyWith(
selectedOutlet: freezed == selectedOutlet
? _value.selectedOutlet
: selectedOutlet // ignore: cast_nullable_to_non_nullable
as Outlet?,
selectedOutletId: freezed == selectedOutletId
? _value.selectedOutletId
: selectedOutletId // ignore: cast_nullable_to_non_nullable
as String?,
)
as $Val,
);
}
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@override
@pragma('vm:prefer-inline')
$OutletCopyWith<$Res>? get selectedOutlet {
if (_value.selectedOutlet == null) {
return null;
}
return $OutletCopyWith<$Res>(_value.selectedOutlet!, (value) {
return _then(_value.copyWith(selectedOutlet: value) as $Val);
});
}
}
/// @nodoc
abstract class _$$SelectedOutletStateImplCopyWith<$Res>
implements $SelectedOutletStateCopyWith<$Res> {
factory _$$SelectedOutletStateImplCopyWith(
_$SelectedOutletStateImpl value,
$Res Function(_$SelectedOutletStateImpl) then,
) = __$$SelectedOutletStateImplCopyWithImpl<$Res>;
@override
@useResult
$Res call({Outlet? selectedOutlet, String? selectedOutletId});
@override
$OutletCopyWith<$Res>? get selectedOutlet;
}
/// @nodoc
class __$$SelectedOutletStateImplCopyWithImpl<$Res>
extends _$SelectedOutletStateCopyWithImpl<$Res, _$SelectedOutletStateImpl>
implements _$$SelectedOutletStateImplCopyWith<$Res> {
__$$SelectedOutletStateImplCopyWithImpl(
_$SelectedOutletStateImpl _value,
$Res Function(_$SelectedOutletStateImpl) _then,
) : super(_value, _then);
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@pragma('vm:prefer-inline')
@override
$Res call({
Object? selectedOutlet = freezed,
Object? selectedOutletId = freezed,
}) {
return _then(
_$SelectedOutletStateImpl(
selectedOutlet: freezed == selectedOutlet
? _value.selectedOutlet
: selectedOutlet // ignore: cast_nullable_to_non_nullable
as Outlet?,
selectedOutletId: freezed == selectedOutletId
? _value.selectedOutletId
: selectedOutletId // ignore: cast_nullable_to_non_nullable
as String?,
),
);
}
}
/// @nodoc
class _$SelectedOutletStateImpl implements _SelectedOutletState {
const _$SelectedOutletStateImpl({this.selectedOutlet, this.selectedOutletId});
/// null berarti "Semua Outlet"
@override
final Outlet? selectedOutlet;
@override
final String? selectedOutletId;
@override
String toString() {
return 'SelectedOutletState(selectedOutlet: $selectedOutlet, selectedOutletId: $selectedOutletId)';
}
@override
bool operator ==(Object other) {
return identical(this, other) ||
(other.runtimeType == runtimeType &&
other is _$SelectedOutletStateImpl &&
(identical(other.selectedOutlet, selectedOutlet) ||
other.selectedOutlet == selectedOutlet) &&
(identical(other.selectedOutletId, selectedOutletId) ||
other.selectedOutletId == selectedOutletId));
}
@override
int get hashCode =>
Object.hash(runtimeType, selectedOutlet, selectedOutletId);
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@JsonKey(includeFromJson: false, includeToJson: false)
@override
@pragma('vm:prefer-inline')
_$$SelectedOutletStateImplCopyWith<_$SelectedOutletStateImpl> get copyWith =>
__$$SelectedOutletStateImplCopyWithImpl<_$SelectedOutletStateImpl>(
this,
_$identity,
);
}
abstract class _SelectedOutletState implements SelectedOutletState {
const factory _SelectedOutletState({
final Outlet? selectedOutlet,
final String? selectedOutletId,
}) = _$SelectedOutletStateImpl;
/// null berarti "Semua Outlet"
@override
Outlet? get selectedOutlet;
@override
String? get selectedOutletId;
/// Create a copy of SelectedOutletState
/// with the given fields replaced by the non-null parameter values.
@override
@JsonKey(includeFromJson: false, includeToJson: false)
_$$SelectedOutletStateImplCopyWith<_$SelectedOutletStateImpl> get copyWith =>
throw _privateConstructorUsedError;
}
@@ -0,0 +1,13 @@
part of 'selected_outlet_bloc.dart';
@freezed
class SelectedOutletEvent with _$SelectedOutletEvent {
/// Load selected outlet id dari shared preferences
const factory SelectedOutletEvent.loaded() = _Loaded;
/// User memilih outlet tertentu
const factory SelectedOutletEvent.selected(Outlet outlet) = _Selected;
/// Reset ke "Semua Outlet"
const factory SelectedOutletEvent.cleared() = _Cleared;
}
@@ -0,0 +1,18 @@
part of 'selected_outlet_bloc.dart';
@freezed
class SelectedOutletState with _$SelectedOutletState {
const factory SelectedOutletState({
/// null berarti "Semua Outlet"
Outlet? selectedOutlet,
String? selectedOutletId,
}) = _SelectedOutletState;
factory SelectedOutletState.initial() => const SelectedOutletState();
}
extension SelectedOutletStateX on SelectedOutletState {
bool get isAllOutlets => selectedOutletId == null;
String get displayName => selectedOutlet?.name ?? 'Semua Outlet';
}
@@ -2,4 +2,5 @@ class LocalStorageKey {
static const String lang = 'lang';
static const String token = 'token';
static const String user = 'user';
static const String selectedOutletId = 'selected_outlet_id';
}
@@ -6,35 +6,42 @@ abstract class IAnalyticRepository {
Future<Either<AnalyticFailure, SalesAnalytic>> getSales({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, ProfitLossAnalytic>> getProfitLoss({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, CategoryAnalytic>> getCategory({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, InventoryAnalytic>> getInventory({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, DashboardAnalytic>> getDashboard({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, ProductAnalytic>> getProduct({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
Future<Either<AnalyticFailure, PaymentMethodAnalytic>> getPaymentMethod({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
});
}
@@ -6,6 +6,7 @@ abstract class IOrderRepository {
int limit = 10,
String? status,
String? search,
String? outletId,
required DateTime dateFrom,
required DateTime dateTo,
});
@@ -2,4 +2,11 @@ part of '../outlet.dart';
abstract class IOutletRepository {
Future<Either<OutletFailure, Outlet>> currentOutlet();
Future<Either<OutletFailure, List<Outlet>>> getList({
int page = 1,
int limit = 10,
String? search,
bool? isActive,
});
}
@@ -21,14 +21,18 @@ class AnalyticRemoteDataProvider {
Future<DC<AnalyticFailure, SalesAnalyticDto>> fetchSales({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.salesAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.salesAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -48,14 +52,18 @@ class AnalyticRemoteDataProvider {
Future<DC<AnalyticFailure, ProfitLossAnalyticDto>> fetchProfitLoss({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.profitLossAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.profitLossAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -75,14 +83,18 @@ class AnalyticRemoteDataProvider {
Future<DC<AnalyticFailure, CategoryAnalyticDto>> fetchCategory({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.categoryAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.categoryAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -128,17 +140,20 @@ class AnalyticRemoteDataProvider {
}
Future<DC<AnalyticFailure, DashboardAnalyticDto>> fetchDashboard({
required String outletId,
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.dashboardAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.dashboardAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -156,17 +171,20 @@ class AnalyticRemoteDataProvider {
}
Future<DC<AnalyticFailure, ProductAnalyticDto>> fetchProduct({
required String outletId,
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.productAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.productAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -184,17 +202,20 @@ class AnalyticRemoteDataProvider {
}
Future<DC<AnalyticFailure, PaymentMethodAnalyticDto>> fetchPaymentMethod({
required String outletId,
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final response = await _apiClient.get(
ApiPath.paymentMethodAnalytic,
params: {
final Map<String, dynamic> params = {
'date_from': dateFrom.toServerDate,
'date_to': dateTo.toServerDate,
},
};
if (outletId != null) params['outlet_id'] = outletId;
final response = await _apiClient.get(
ApiPath.paymentMethodAnalytic,
params: params,
headers: getAuthorizationHeader(),
);
@@ -5,36 +5,43 @@ import 'package:injectable/injectable.dart';
import '../../../domain/analytic/analytic.dart';
import '../../../domain/analytic/repositories/i_analytic_repository.dart';
import '../../../domain/user/user.dart';
import '../../auth/datasources/local_data_provider.dart';
import '../../outlet/datasource/local_data_provider.dart';
import '../datasource/remote_data_provider.dart';
@Injectable(as: IAnalyticRepository)
class AnalyticRepository implements IAnalyticRepository {
final AnalyticRemoteDataProvider _dataProvider;
final AuthLocalDataProvider _authLocalDataProvider;
final OutletLocalDataProvider _outletLocalDataProvider;
final String _logName = 'AnalyticRepository';
AnalyticRepository(this._dataProvider, this._authLocalDataProvider);
AnalyticRepository(
this._dataProvider,
this._authLocalDataProvider,
this._outletLocalDataProvider,
);
/// Resolves outlet_id: pakai param jika ada, fallback ke shared pref
String? _resolveOutletId(String? outletId) {
return outletId ?? _outletLocalDataProvider.getSelectedOutletId();
}
@override
Future<Either<AnalyticFailure, SalesAnalytic>> getSales({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final result = await _dataProvider.fetchSales(
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getSalesError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -45,20 +52,17 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, ProfitLossAnalytic>> getProfitLoss({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final result = await _dataProvider.fetchProfitLoss(
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getProfitLossError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -69,20 +73,17 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, CategoryAnalytic>> getCategory({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
final result = await _dataProvider.fetchCategory(
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getCategoryError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -93,23 +94,20 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, InventoryAnalytic>> getInventory({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
User currentUser = await _authLocalDataProvider.currentUser();
final currentUser = await _authLocalDataProvider.currentUser();
final resolvedId = _resolveOutletId(outletId) ?? currentUser.outletId;
final result = await _dataProvider.fetchInventory(
outletId: currentUser.outletId,
outletId: resolvedId,
dateFrom: dateFrom,
dateTo: dateTo,
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getInventoryError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -120,23 +118,17 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, DashboardAnalytic>> getDashboard({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
User currentUser = await _authLocalDataProvider.currentUser();
final result = await _dataProvider.fetchDashboard(
outletId: currentUser.outletId,
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getDashboardError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -147,23 +139,17 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, ProductAnalytic>> getProduct({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
User currentUser = await _authLocalDataProvider.currentUser();
final result = await _dataProvider.fetchProduct(
outletId: currentUser.outletId,
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getProductError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -174,23 +160,17 @@ class AnalyticRepository implements IAnalyticRepository {
Future<Either<AnalyticFailure, PaymentMethodAnalytic>> getPaymentMethod({
required DateTime dateFrom,
required DateTime dateTo,
String? outletId,
}) async {
try {
User currentUser = await _authLocalDataProvider.currentUser();
final result = await _dataProvider.fetchPaymentMethod(
outletId: currentUser.outletId,
dateFrom: dateFrom,
dateTo: dateTo,
outletId: _resolveOutletId(outletId),
);
if (result.hasError) {
return left(result.error!);
}
final auth = result.data!.toDomain();
return right(auth);
if (result.hasError) return left(result.error!);
return right(result.data!.toDomain());
} catch (e, s) {
log('getPaymentMethodError', name: _logName, error: e, stackTrace: s);
return left(const AnalyticFailure.unexpectedError());
@@ -23,6 +23,7 @@ class OrderRemoteDataProvider {
int limit = 10,
String? status,
String? search,
String? outletId,
required DateTime dateFrom,
required DateTime dateTo,
}) async {
@@ -42,6 +43,10 @@ class OrderRemoteDataProvider {
params['search'] = search;
}
// if (outletId != null) {
// params['outlet_id'] = outletId;
// }
final response = await _apiClient.get(
ApiPath.order,
params: params,
@@ -4,14 +4,16 @@ import 'package:dartz/dartz.dart' hide Order;
import 'package:injectable/injectable.dart' hide Order;
import '../../../domain/order/order.dart';
import '../../outlet/datasource/local_data_provider.dart';
import '../datasource/remote_data_provider.dart';
@Injectable(as: IOrderRepository)
class OrderRepository implements IOrderRepository {
final OrderRemoteDataProvider _dataProvider;
final OutletLocalDataProvider _outletLocalDataProvider;
final String _logName = 'OrderRepository';
OrderRepository(this._dataProvider);
OrderRepository(this._dataProvider, this._outletLocalDataProvider);
@override
Future<Either<OrderFailure, List<Order>>> get({
@@ -19,15 +21,20 @@ class OrderRepository implements IOrderRepository {
int limit = 20,
String? status,
String? search,
String? outletId,
required DateTime dateFrom,
required DateTime dateTo,
}) async {
try {
final resolvedOutletId =
outletId ?? _outletLocalDataProvider.getSelectedOutletId();
final result = await _dataProvider.fetch(
page: page,
limit: limit,
status: status,
search: search,
outletId: resolvedOutletId,
dateFrom: dateFrom,
dateTo: dateTo,
);
@@ -36,9 +43,9 @@ class OrderRepository implements IOrderRepository {
return left(result.error!);
}
final auth = result.data!.map((e) => e.toDomain()).toList();
final orders = result.data!.map((e) => e.toDomain()).toList();
return right(auth);
return right(orders);
} catch (e, s) {
log('getOrderError', name: _logName, error: e, stackTrace: s);
return left(const OrderFailure.unexpectedError());
@@ -0,0 +1,26 @@
import 'package:injectable/injectable.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../common/constant/local_storage_key.dart';
@injectable
class OutletLocalDataProvider {
final SharedPreferences _sharedPreferences;
OutletLocalDataProvider(this._sharedPreferences);
Future<void> saveSelectedOutletId(String outletId) async {
await _sharedPreferences.setString(
LocalStorageKey.selectedOutletId,
outletId,
);
}
String? getSelectedOutletId() {
return _sharedPreferences.getString(LocalStorageKey.selectedOutletId);
}
Future<void> deleteSelectedOutletId() async {
await _sharedPreferences.remove(LocalStorageKey.selectedOutletId);
}
}
@@ -36,4 +36,39 @@ class OutletRemoteDataProvider {
return DC.error(OutletFailure.serverError(e));
}
}
Future<DC<OutletFailure, List<OutletDto>>> fetchList({
int page = 1,
int limit = 10,
String? search,
bool? isActive,
}) async {
try {
final Map<String, dynamic> params = {
'page': page,
'limit': limit,
'search': search ?? 'null',
'is_active': isActive != null ? isActive.toString() : 'null',
};
final response = await _apiClient.get(
'${ApiPath.outlet}/list',
params: params,
headers: getAuthorizationHeader(),
);
if (response.data['data'] == null) {
return DC.error(OutletFailure.empty());
}
final dto = (response.data['data']['outlets'] as List)
.map((item) => OutletDto.fromJson(item))
.toList();
return DC.data(dto);
} on ApiFailure catch (e, s) {
log('fetchOutletListError', name: _logName, error: e, stackTrace: s);
return DC.error(OutletFailure.serverError(e));
}
}
}
@@ -33,4 +33,32 @@ class OutletRepository implements IOutletRepository {
return left(const OutletFailure.unexpectedError());
}
}
@override
Future<Either<OutletFailure, List<Outlet>>> getList({
int page = 1,
int limit = 10,
String? search,
bool? isActive,
}) async {
try {
final result = await _dataProvider.fetchList(
page: page,
limit: limit,
search: search,
isActive: isActive,
);
if (result.hasError) {
return left(result.error!);
}
final outlets = result.data!.map((e) => e.toDomain()).toList();
return right(outlets);
} catch (e, s) {
log('getOutletListError', name: _logName, error: e, stackTrace: s);
return left(const OutletFailure.unexpectedError());
}
}
}
+64 -45
View File
@@ -39,6 +39,10 @@ import 'package:apskel_owner_flutter/application/order/order_loader/order_loader
as _i1058;
import 'package:apskel_owner_flutter/application/outlet/current_outlet_loader/current_outlet_loader_bloc.dart'
as _i337;
import 'package:apskel_owner_flutter/application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart'
as _i877;
import 'package:apskel_owner_flutter/application/outlet/selected_outlet/selected_outlet_bloc.dart'
as _i678;
import 'package:apskel_owner_flutter/application/product/product_loader/product_loader_bloc.dart'
as _i458;
import 'package:apskel_owner_flutter/application/report/inventory_report/inventory_report_bloc.dart'
@@ -94,6 +98,8 @@ import 'package:apskel_owner_flutter/infrastructure/order/datasource/remote_data
as _i130;
import 'package:apskel_owner_flutter/infrastructure/order/repositories/order_repository.dart'
as _i641;
import 'package:apskel_owner_flutter/infrastructure/outlet/datasource/local_data_provider.dart'
as _i850;
import 'package:apskel_owner_flutter/infrastructure/outlet/datasource/remote_data_provider.dart'
as _i27;
import 'package:apskel_owner_flutter/infrastructure/outlet/repositories/outlet_repository.dart'
@@ -128,9 +134,9 @@ extension GetItInjectableX on _i174.GetIt {
final gh = _i526.GetItHelper(this, environment, environmentFilter);
final firebaseDi = _$FirebaseDi();
final sharedPreferencesDi = _$SharedPreferencesDi();
final dioDi = _$DioDi();
final autoRouteDi = _$AutoRouteDi();
final connectivityDi = _$ConnectivityDi();
final dioDi = _$DioDi();
final packageInfoDi = _$PackageInfoDi();
await gh.factoryAsync<_i982.FirebaseApp>(
() => firebaseDi.firebaseApp,
@@ -140,9 +146,9 @@ extension GetItInjectableX on _i174.GetIt {
() => sharedPreferencesDi.prefs,
preResolve: true,
);
gh.lazySingleton<_i361.Dio>(() => dioDi.dio);
gh.lazySingleton<_i258.AppRouter>(() => autoRouteDi.appRouter);
gh.lazySingleton<_i895.Connectivity>(() => connectivityDi.connectivity);
gh.lazySingleton<_i361.Dio>(() => dioDi.dio);
await gh.lazySingletonAsync<_i655.PackageInfo>(
() => packageInfoDi.packageInfo,
preResolve: true,
@@ -159,46 +165,49 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i991.AuthLocalDataProvider>(
() => _i991.AuthLocalDataProvider(gh<_i460.SharedPreferences>()),
);
gh.factory<_i850.OutletLocalDataProvider>(
() => _i850.OutletLocalDataProvider(gh<_i460.SharedPreferences>()),
);
gh.lazySingleton<_i115.ApiClient>(
() => _i115.ApiClient(gh<_i361.Dio>(), gh<_i6.Env>()),
);
gh.factory<_i6.Env>(() => _i6.ProdEnv(), registerFor: {_prod});
gh.factory<_i130.OrderRemoteDataProvider>(
() => _i130.OrderRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i333.CategoryRemoteDataProvider>(
() => _i333.CategoryRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i866.AnalyticRemoteDataProvider>(
() => _i866.AnalyticRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i17.AuthRemoteDataProvider>(
() => _i17.AuthRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i785.UserRemoteDataProvider>(
() => _i785.UserRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i823.ProductRemoteDataProvider>(
() => _i823.ProductRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i27.OutletRemoteDataProvider>(
() => _i27.OutletRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i866.AnalyticRemoteDataProvider>(
() => _i866.AnalyticRemoteDataProvider(gh<_i115.ApiClient>()),
gh.factory<_i333.CategoryRemoteDataProvider>(
() => _i333.CategoryRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i1006.CustomerRemoteDataProvider>(
() => _i1006.CustomerRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i130.OrderRemoteDataProvider>(
() => _i130.OrderRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i27.OutletRemoteDataProvider>(
() => _i27.OutletRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i823.ProductRemoteDataProvider>(
() => _i823.ProductRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i785.UserRemoteDataProvider>(
() => _i785.UserRemoteDataProvider(gh<_i115.ApiClient>()),
);
gh.factory<_i48.ICustomerRepository>(
() => _i550.CustomerRepository(gh<_i1006.CustomerRemoteDataProvider>()),
);
gh.factory<_i219.IOrderRepository>(
() => _i641.OrderRepository(gh<_i130.OrderRemoteDataProvider>()),
);
gh.factory<_i49.IAuthRepository>(
() => _i1035.AuthRepository(
gh<_i991.AuthLocalDataProvider>(),
gh<_i17.AuthRemoteDataProvider>(),
),
);
gh.factory<_i678.SelectedOutletBloc>(
() => _i678.SelectedOutletBloc(gh<_i850.OutletLocalDataProvider>()),
);
gh.factory<_i635.IUserRepository>(
() => _i754.UserRepository(
gh<_i785.UserRemoteDataProvider>(),
@@ -208,15 +217,15 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i419.IProductRepository>(
() => _i121.ProductRepository(gh<_i823.ProductRemoteDataProvider>()),
);
gh.factory<_i219.IOrderRepository>(
() => _i641.OrderRepository(
gh<_i130.OrderRemoteDataProvider>(),
gh<_i850.OutletLocalDataProvider>(),
),
);
gh.factory<_i972.CustomerLoaderBloc>(
() => _i972.CustomerLoaderBloc(gh<_i48.ICustomerRepository>()),
);
gh.factory<_i477.IAnalyticRepository>(
() => _i393.AnalyticRepository(
gh<_i866.AnalyticRemoteDataProvider>(),
gh<_i991.AuthLocalDataProvider>(),
),
);
gh.factory<_i1020.ICategoryRepository>(
() => _i869.CategoryRepository(gh<_i333.CategoryRemoteDataProvider>()),
);
@@ -232,17 +241,30 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i183.CategoryLoaderBloc>(
() => _i183.CategoryLoaderBloc(gh<_i1020.ICategoryRepository>()),
);
gh.factory<_i473.HomeBloc>(
() => _i473.HomeBloc(gh<_i477.IAnalyticRepository>()),
gh.factory<_i477.IAnalyticRepository>(
() => _i393.AnalyticRepository(
gh<_i866.AnalyticRemoteDataProvider>(),
gh<_i991.AuthLocalDataProvider>(),
gh<_i850.OutletLocalDataProvider>(),
),
);
gh.factory<_i889.SalesLoaderBloc>(
() => _i889.SalesLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i473.HomeBloc>(
() => _i473.HomeBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i877.OutletListLoaderBloc>(
() => _i877.OutletListLoaderBloc(gh<_i197.IOutletRepository>()),
);
gh.factory<_i337.CurrentOutletLoaderBloc>(
() => _i337.CurrentOutletLoaderBloc(gh<_i197.IOutletRepository>()),
);
gh.factory<_i221.ProductAnalyticLoaderBloc>(
() => _i221.ProductAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
gh.factory<_i1038.CategoryAnalyticLoaderBloc>(
() => _i1038.CategoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i516.DashboardAnalyticLoaderBloc>(
() => _i516.DashboardAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i785.InventoryAnalyticLoaderBloc>(
() => _i785.InventoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
@@ -252,15 +274,12 @@ extension GetItInjectableX on _i174.GetIt {
gh<_i477.IAnalyticRepository>(),
),
);
gh.factory<_i1038.CategoryAnalyticLoaderBloc>(
() => _i1038.CategoryAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
gh.factory<_i221.ProductAnalyticLoaderBloc>(
() => _i221.ProductAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i11.ProfitLossLoaderBloc>(
() => _i11.ProfitLossLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i516.DashboardAnalyticLoaderBloc>(
() => _i516.DashboardAnalyticLoaderBloc(gh<_i477.IAnalyticRepository>()),
);
gh.factory<_i945.AuthBloc>(
() => _i945.AuthBloc(gh<_i49.IAuthRepository>()),
);
@@ -270,12 +289,12 @@ extension GetItInjectableX on _i174.GetIt {
gh.factory<_i1058.OrderLoaderBloc>(
() => _i1058.OrderLoaderBloc(gh<_i219.IOrderRepository>()),
);
gh.factory<_i147.UserEditFormBloc>(
() => _i147.UserEditFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i1030.ChangePasswordFormBloc>(
() => _i1030.ChangePasswordFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i147.UserEditFormBloc>(
() => _i147.UserEditFormBloc(gh<_i635.IUserRepository>()),
);
gh.factory<_i775.LoginFormBloc>(
() => _i775.LoginFormBloc(
gh<_i49.IAuthRepository>(),
@@ -283,14 +302,14 @@ extension GetItInjectableX on _i174.GetIt {
gh<_i179.FcmService>(),
),
);
gh.factory<_i605.TransactionReportBloc>(
() => _i605.TransactionReportBloc(
gh.factory<_i346.InventoryReportBloc>(
() => _i346.InventoryReportBloc(
gh<_i477.IAnalyticRepository>(),
gh<_i197.IOutletRepository>(),
),
);
gh.factory<_i346.InventoryReportBloc>(
() => _i346.InventoryReportBloc(
gh.factory<_i605.TransactionReportBloc>(
() => _i605.TransactionReportBloc(
gh<_i477.IAnalyticRepository>(),
gh<_i197.IOutletRepository>(),
),
@@ -303,10 +322,10 @@ class _$FirebaseDi extends _i73.FirebaseDi {}
class _$SharedPreferencesDi extends _i402.SharedPreferencesDi {}
class _$DioDi extends _i103.DioDi {}
class _$AutoRouteDi extends _i311.AutoRouteDi {}
class _$ConnectivityDi extends _i586.ConnectivityDi {}
class _$DioDi extends _i103.DioDi {}
class _$PackageInfoDi extends _i227.PackageInfoDi {}
-1
View File
@@ -28,7 +28,6 @@ void main() async {
// Initialize FCM after dependencies are ready
await getIt<FcmService>().initialize(
onMessageTap: (message) {
// TODO: handle navigation when notification is tapped
debugPrint('[FCM] Navigate based on: ${message.data}');
},
);
+31 -5
View File
@@ -4,6 +4,8 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:line_icons/line_icons.dart';
import '../../../application/home/home_bloc.dart';
import '../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../application/outlet/selected_outlet/selected_outlet_bloc.dart';
import '../../../common/constant/app_constant.dart';
import '../../../common/theme/theme.dart';
import '../../../injection.dart';
@@ -22,8 +24,21 @@ class HomePage extends StatefulWidget implements AutoRouteWrapper {
State<HomePage> createState() => _HomePageState();
@override
Widget wrappedRoute(BuildContext context) => BlocProvider(
create: (context) => getIt<HomeBloc>()..add(HomeEvent.fetchedDashboard()),
Widget wrappedRoute(BuildContext context) => MultiBlocProvider(
providers: [
BlocProvider(
create: (context) =>
getIt<HomeBloc>()..add(HomeEvent.fetchedDashboard()),
),
BlocProvider(
create: (context) => getIt<OutletListLoaderBloc>()
..add(const OutletListLoaderEvent.fetched()),
),
BlocProvider(
create: (context) => getIt<SelectedOutletBloc>()
..add(const SelectedOutletEvent.loaded()),
),
],
child: this,
);
}
@@ -63,13 +78,23 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
super.dispose();
}
void _refetchDashboard(BuildContext context) {
context.read<HomeBloc>().add(HomeEvent.fetchedDashboard());
}
@override
Widget build(BuildContext context) {
return Scaffold(
return BlocListener<SelectedOutletBloc, SelectedOutletState>(
listenWhen: (previous, current) =>
previous.selectedOutletId != current.selectedOutletId,
listener: (context, state) => _refetchDashboard(context),
child: Scaffold(
backgroundColor: AppColor.background,
body: RefreshIndicator(
backgroundColor: AppColor.white,
color: AppColor.primary,
onRefresh: () {
context.read<HomeBloc>().add(HomeEvent.fetchedDashboard());
_refetchDashboard(context);
return Future.value();
},
child: BlocBuilder<HomeBloc, HomeState>(
@@ -186,6 +211,7 @@ class _HomePageState extends State<HomePage> with TickerProviderStateMixin {
},
),
),
);
), // Scaffold
); // BlocListener
}
}
@@ -1,6 +1,5 @@
import 'package:auto_route/auto_route.dart';
import 'package:flutter/material.dart';
import 'package:line_icons/line_icons.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
@@ -1,10 +1,12 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:line_icons/line_icon.dart';
import 'package:line_icons/line_icons.dart';
import '../../../../../../common/theme/theme.dart';
import '../../../../application/outlet/selected_outlet/selected_outlet_bloc.dart';
import '../../../../common/extension/extension.dart';
import '../../../../domain/user/user.dart';
import '../../../components/spacer/spacer.dart';
@@ -145,7 +147,7 @@ class _HomeOmsetBalanceState extends State<HomeOmsetBalance> {
? Text(
widget.totalOmset.currencyFormatRp,
key: const ValueKey('visible'),
style: AppStyle.xl.copyWith(
style: AppStyle.xxl.copyWith(
color: AppColor.black,
fontWeight: FontWeight.w900,
letterSpacing: 0.3,
@@ -185,7 +187,9 @@ class _HomeOmsetBalanceState extends State<HomeOmsetBalance> {
GestureDetector _top(BuildContext context) {
return GestureDetector(
onTap: () {},
child: Container(
child: BlocBuilder<SelectedOutletBloc, SelectedOutletState>(
builder: (context, state) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
decoration: BoxDecoration(
gradient: LinearGradient(colors: AppColor.primaryGradient),
@@ -201,12 +205,14 @@ class _HomeOmsetBalanceState extends State<HomeOmsetBalance> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Semua Outlet',
state.displayName,
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w600,
letterSpacing: 0.3,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
],
),
@@ -219,6 +225,8 @@ class _HomeOmsetBalanceState extends State<HomeOmsetBalance> {
),
],
),
);
},
),
);
}
@@ -1,19 +1,30 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import '../../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../../application/outlet/selected_outlet/selected_outlet_bloc.dart';
import '../../../../common/theme/theme.dart';
import '../../../../domain/outlet/outlet.dart';
import '../../../components/spacer/spacer.dart';
import '../../../components/widgets/particle_card.dart';
class HomePromoBanner extends StatelessWidget {
const HomePromoBanner({super.key});
static const _outlets = [
'ENAKLO RAWAMANGUNG',
'ENAKLO WOKU PEDAS\nKELAPA GADING',
];
@override
Widget build(BuildContext context) {
return BlocBuilder<OutletListLoaderBloc, OutletListLoaderState>(
builder: (context, outletListState) {
if (outletListState.isFetching && outletListState.outlets.isEmpty) {
return const _PromoBannerSkeleton();
}
if (outletListState.outlets.isEmpty) {
return const SizedBox.shrink();
}
return BlocBuilder<SelectedOutletBloc, SelectedOutletState>(
builder: (context, selectedState) {
return Padding(
padding: const EdgeInsets.fromLTRB(
AppValue.padding,
@@ -21,43 +32,132 @@ class HomePromoBanner extends StatelessWidget {
AppValue.padding,
0,
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
for (int i = 0; i < _outlets.length; i++) ...[
Expanded(
child: ParticleCard(
height: 100,
padding: const EdgeInsets.symmetric(
horizontal: 12,
vertical: 12,
// Card "Semua Outlet" di posisi pertama
_AllOutletCard(
isSelected: selectedState.isAllOutlets,
onTap: () {
if (!selectedState.isAllOutlets) {
context
.read<SelectedOutletBloc>()
.add(const SelectedOutletEvent.cleared());
}
},
),
const SpaceWidth(12),
for (int i = 0; i < outletListState.outlets.length; i++) ...[
_OutletCard(
outlet: outletListState.outlets[i],
isSelected: selectedState.selectedOutletId ==
outletListState.outlets[i].id,
onTap: () {
final tapped = outletListState.outlets[i];
if (selectedState.selectedOutletId == tapped.id) {
// Tap outlet yang sama → deselect (Semua Outlet)
context
.read<SelectedOutletBloc>()
.add(const SelectedOutletEvent.cleared());
} else {
context
.read<SelectedOutletBloc>()
.add(SelectedOutletEvent.selected(tapped));
}
},
),
if (i < outletListState.outlets.length - 1)
const SpaceWidth(12),
],
],
),
),
);
},
);
},
);
}
}
class _AllOutletCard extends StatelessWidget {
final bool isSelected;
final VoidCallback onTap;
const _AllOutletCard({
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 130,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isSelected ? AppColor.white : Colors.transparent,
width: 2,
),
boxShadow: isSelected
? [
BoxShadow(
color: AppColor.white.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
]
: [],
),
child: Opacity(
opacity: isSelected ? 1.0 : 0.55,
child: ParticleCard(
height: 110,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decorationOpacity: 0.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Spacer(),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 7,
vertical: 2,
),
horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: AppColor.white.withOpacity(0.2),
borderRadius: BorderRadius.circular(20),
color: AppColor.white.withOpacity(0.25),
borderRadius: BorderRadius.circular(12),
),
child: Text(
'OUTLET',
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
Icons.store_rounded,
color: AppColor.white,
size: 12,
),
const SpaceWidth(4),
Text(
'Semua',
style: AppStyle.xs.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w700,
letterSpacing: 1.0,
fontSize: 10,
fontSize: 9,
),
),
],
),
),
],
),
const SpaceHeight(6),
Text(
_outlets[i],
'Semua Outlet',
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w800,
@@ -70,10 +170,155 @@ class HomePromoBanner extends StatelessWidget {
),
),
),
if (i < _outlets.length - 1) const SpaceWidth(12),
),
);
}
}
class _OutletCard extends StatelessWidget {
final Outlet outlet;
final bool isSelected;
final VoidCallback onTap;
const _OutletCard({
required this.outlet,
required this.isSelected,
required this.onTap,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: AnimatedContainer(
duration: const Duration(milliseconds: 200),
width: 130,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: isSelected ? AppColor.white : Colors.transparent,
width: 2,
),
boxShadow: isSelected
? [
BoxShadow(
color: AppColor.white.withOpacity(0.3),
blurRadius: 8,
offset: const Offset(0, 2),
),
]
: [],
),
child: Opacity(
opacity: isSelected ? 1.0 : 0.55,
child: ParticleCard(
height: 110,
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 12),
decorationOpacity: 0.8,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Row(
children: [
const Spacer(),
_buildStatusBadge(outlet.isActive),
],
),
const SpaceHeight(6),
Text(
outlet.name,
style: AppStyle.sm.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w800,
height: 1.25,
),
maxLines: 3,
overflow: TextOverflow.ellipsis,
),
],
),
),
),
),
);
}
Widget _buildStatusBadge(bool isActive) {
return Container(
padding: const EdgeInsets.symmetric(horizontal: 8, vertical: 3),
decoration: BoxDecoration(
color: isActive
? AppColor.success.withOpacity(0.9)
: AppColor.error.withOpacity(0.9),
borderRadius: BorderRadius.circular(12),
boxShadow: [
BoxShadow(
color: (isActive ? AppColor.success : AppColor.error)
.withOpacity(0.3),
blurRadius: 4,
offset: const Offset(0, 2),
),
],
),
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
Icon(
isActive ? Icons.check_circle : Icons.warning_rounded,
color: AppColor.white,
size: 12,
),
const SpaceWidth(4),
Text(
isActive ? 'Sehat' : 'Tidak Sehat',
style: AppStyle.xs.copyWith(
color: AppColor.white,
fontWeight: FontWeight.w700,
fontSize: 9,
),
),
],
),
);
}
}
class _PromoBannerSkeleton extends StatelessWidget {
const _PromoBannerSkeleton();
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.fromLTRB(
AppValue.padding,
24,
AppValue.padding,
0,
),
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: [
_skeletonCard(),
const SpaceWidth(12),
_skeletonCard(),
const SpaceWidth(12),
_skeletonCard(),
],
),
),
);
}
Widget _skeletonCard() {
return Container(
width: 130,
height: 110,
decoration: BoxDecoration(
color: AppColor.border,
borderRadius: BorderRadius.circular(12),
),
);
}
}
@@ -6,6 +6,7 @@ import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:shimmer/shimmer.dart';
import '../../../../application/order/order_loader/order_loader_bloc.dart';
import '../../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../../common/extension/extension.dart';
import '../../../../common/theme/theme.dart';
import '../../../../injection.dart';
@@ -23,10 +24,19 @@ class OrderPage extends StatefulWidget implements AutoRouteWrapper {
State<OrderPage> createState() => _OrderPageState();
@override
Widget wrappedRoute(BuildContext context) => BlocProvider(
Widget wrappedRoute(BuildContext context) => MultiBlocProvider(
providers: [
BlocProvider(
create: (_) =>
getIt<OrderLoaderBloc>()
..add(OrderLoaderEvent.fetched(isRefresh: true)),
),
BlocProvider(
create: (_) =>
getIt<OutletListLoaderBloc>()
..add(const OutletListLoaderEvent.fetched()),
),
],
child: this,
);
}
@@ -179,6 +189,14 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
backgroundColor: AppColor.background,
body: MultiBlocListener(
listeners: [
BlocListener<OrderLoaderBloc, OrderLoaderState>(
listenWhen: (p, c) => p.outletId != c.outletId,
listener: (context, state) {
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.fetched(isRefresh: true),
);
},
),
BlocListener<OrderLoaderBloc, OrderLoaderState>(
listenWhen: (p, c) => p.status != c.status,
listener: (context, state) {
@@ -198,7 +216,9 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
},
),
],
child: BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
child: BlocBuilder<OutletListLoaderBloc, OutletListLoaderState>(
builder: (context, outletListState) {
return BlocBuilder<OrderLoaderBloc, OrderLoaderState>(
builder: (context, state) {
return NotificationListener<ScrollNotification>(
onNotification: (notification) {
@@ -243,6 +263,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
endDate: state.dateTo,
filterOptions: filterOptions,
selectedFilter: state.status,
selectedOutletId: state.outletId,
outletListState: outletListState,
onDateChanged: (startDate, endDate) {
if (startDate != null && endDate != null) {
log('Date changed');
@@ -256,11 +278,15 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
},
onFilterChanged: (filter) {
final status = filter.toLowerCase();
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.statusChanged(status),
);
},
onOutletChanged: (outletId) {
context.read<OrderLoaderBloc>().add(
OrderLoaderEvent.outletChanged(outletId),
);
},
),
),
@@ -276,9 +302,12 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
child: Column(
children: [
// Show filtered transaction count
if (state.status != 'all' && !state.isFetching)
if (state.status != 'all' &&
!state.isFetching)
Padding(
padding: const EdgeInsets.only(bottom: 16),
padding: const EdgeInsets.only(
bottom: 16,
),
child: Row(
children: [
Text(
@@ -298,7 +327,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
else if (state.orders.isEmpty)
EmptyWidget(
title: context.lang.order,
message: context.lang.no_order_with_status(
message:
context.lang.no_order_with_status(
state.status.toLowerCase(),
),
)
@@ -331,6 +361,8 @@ class _OrderPageState extends State<OrderPage> with TickerProviderStateMixin {
),
);
},
);
},
),
),
);
@@ -1,6 +1,9 @@
import 'package:flutter/material.dart';
import '../../../../../application/outlet/outlet_list_loader/outlet_list_loader_bloc.dart';
import '../../../../../common/extension/extension.dart';
import '../../../../../common/theme/theme.dart';
import '../../../../../domain/outlet/outlet.dart';
import '../../../../components/field/date_range_picker_field.dart';
import 'status_tile.dart';
@@ -11,8 +14,11 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
final DateTime? endDate;
final List<String> filterOptions;
final String selectedFilter;
final String? selectedOutletId;
final OutletListLoaderState outletListState;
final Function(DateTime?, DateTime?) onDateChanged;
final Function(String) onFilterChanged;
final Function(String?) onOutletChanged;
FilterHeaderDelegate({
required this.backgroundColor,
@@ -21,15 +27,18 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
required this.endDate,
required this.filterOptions,
required this.selectedFilter,
required this.selectedOutletId,
required this.outletListState,
required this.onDateChanged,
required this.onFilterChanged,
required this.onOutletChanged,
});
@override
double get minExtent => 130;
double get minExtent => 190;
@override
double get maxExtent => 130;
double get maxExtent => 190;
@override
Widget build(
@@ -37,64 +46,314 @@ class FilterHeaderDelegate extends SliverPersistentHeaderDelegate {
double shrinkOffset,
bool overlapsContent,
) {
final selectedOutlet = outletListState.outlets
.where((o) => o.id == selectedOutletId)
.firstOrNull;
return Container(
color: backgroundColor,
padding: padding,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.only(bottom: 8.0),
child: DateRangePickerField(
// Date range picker
DateRangePickerField(
maxDate: DateTime.now(),
startDate: startDate,
endDate: endDate,
onChanged: (start, end) {
onDateChanged(start, end);
},
onChanged: (start, end) => onDateChanged(start, end),
),
const SizedBox(height: 8),
// Outlet selector + status chips
_OutletSelectorField(
selectedOutlet: selectedOutlet,
isLoading: outletListState.isFetching,
onTap: () => _showOutletSheet(context),
),
Expanded(
child: SingleChildScrollView(
const SizedBox(height: 8),
// Status chips
SingleChildScrollView(
scrollDirection: Axis.horizontal,
child: Row(
children: filterOptions.asMap().entries.map((entry) {
final index = entry.key;
final option = entry.value;
return Padding(
padding: EdgeInsets.only(
right: index < filterOptions.length - 1 ? 8 : 0,
),
child: OrderStatusTile(
label: option == "All"
label: option == 'All'
? context.lang.all
: option == "Completed"
: option == 'Completed'
? context.lang.completed
: context.lang.pending,
isSelected: option == selectedFilter,
isSelected: option.toLowerCase() == selectedFilter,
onSelected: (isSelected) {
if (isSelected) {
onFilterChanged(option);
}
if (isSelected) onFilterChanged(option);
},
),
);
}).toList(),
),
),
),
],
),
);
}
void _showOutletSheet(BuildContext context) {
showModalBottomSheet(
context: context,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.vertical(top: Radius.circular(20)),
),
builder: (_) => _OutletBottomSheet(
outlets: outletListState.outlets,
selectedOutletId: selectedOutletId,
onSelected: (outletId) {
Navigator.pop(context);
onOutletChanged(outletId);
},
),
);
}
@override
bool shouldRebuild(covariant FilterHeaderDelegate oldDelegate) {
return oldDelegate.startDate != startDate ||
oldDelegate.endDate != endDate ||
oldDelegate.selectedFilter != selectedFilter ||
oldDelegate.selectedOutletId != selectedOutletId ||
oldDelegate.outletListState.outlets.length !=
outletListState.outlets.length ||
oldDelegate.outletListState.isFetching != outletListState.isFetching ||
oldDelegate.filterOptions.length != filterOptions.length ||
oldDelegate.backgroundColor != backgroundColor;
}
}
// Field outlet — ikut style DateRangePickerField
class _OutletSelectorField extends StatefulWidget {
final Outlet? selectedOutlet;
final bool isLoading;
final VoidCallback onTap;
const _OutletSelectorField({
required this.selectedOutlet,
required this.isLoading,
required this.onTap,
});
@override
State<_OutletSelectorField> createState() => _OutletSelectorFieldState();
}
class _OutletSelectorFieldState extends State<_OutletSelectorField> {
bool _isPressed = false;
@override
Widget build(BuildContext context) {
final hasValue = widget.selectedOutlet != null;
final label = widget.selectedOutlet?.name ?? 'Semua Outlet';
return GestureDetector(
onTap: widget.isLoading ? null : widget.onTap,
onTapDown: (_) => setState(() => _isPressed = true),
onTapUp: (_) => setState(() => _isPressed = false),
onTapCancel: () => setState(() => _isPressed = false),
child: AnimatedContainer(
duration: const Duration(milliseconds: 150),
height: 52,
padding: const EdgeInsets.symmetric(horizontal: 16),
decoration: BoxDecoration(
color: _isPressed ? AppColor.backgroundLight : AppColor.white,
borderRadius: BorderRadius.circular(12),
border: Border.all(
color: _isPressed ? AppColor.primary : AppColor.border,
width: _isPressed ? 2 : 1,
),
boxShadow: _isPressed
? [
BoxShadow(
color: AppColor.primary.withOpacity(0.1),
blurRadius: 8,
offset: const Offset(0, 2),
),
]
: null,
),
child: Row(
children: [
Expanded(
child: Text(
label,
style: TextStyle(
fontSize: 15,
fontWeight: hasValue ? FontWeight.w500 : FontWeight.w400,
color: hasValue
? AppColor.textPrimary
: AppColor.textSecondary,
),
overflow: TextOverflow.ellipsis,
),
),
Container(
padding: const EdgeInsets.all(4),
decoration: BoxDecoration(
color: AppColor.primary.withOpacity(0.1),
borderRadius: BorderRadius.circular(8),
),
child: widget.isLoading
? const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
strokeWidth: 2,
color: AppColor.primary,
),
)
: const Icon(
Icons.store_rounded,
size: 20,
color: AppColor.primary,
),
),
],
),
),
);
}
}
// Bottom sheet pilih outlet
class _OutletBottomSheet extends StatelessWidget {
final List<Outlet> outlets;
final String? selectedOutletId;
final Function(String?) onSelected;
const _OutletBottomSheet({
required this.outlets,
required this.selectedOutletId,
required this.onSelected,
});
@override
Widget build(BuildContext context) {
return SafeArea(
child: Padding(
padding: const EdgeInsets.fromLTRB(20, 16, 20, 20),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Center(
child: Container(
width: 40,
height: 4,
decoration: BoxDecoration(
color: Colors.grey.shade300,
borderRadius: BorderRadius.circular(2),
),
),
),
const SizedBox(height: 16),
Text(
'Pilih Outlet',
style: AppStyle.lg.copyWith(fontWeight: FontWeight.w700),
),
const SizedBox(height: 12),
_OutletItem(
label: 'Semua Outlet',
icon: Icons.store_rounded,
isSelected: selectedOutletId == null,
onTap: () => onSelected(null),
),
const Divider(height: 1),
...outlets.map(
(outlet) => Column(
children: [
_OutletItem(
label: outlet.name,
icon: Icons.storefront_rounded,
isSelected: selectedOutletId == outlet.id,
isActive: outlet.isActive,
onTap: () => onSelected(outlet.id),
),
if (outlet != outlets.last) const Divider(height: 1),
],
),
),
],
),
),
);
}
}
class _OutletItem extends StatelessWidget {
final String label;
final IconData icon;
final bool isSelected;
final bool? isActive;
final VoidCallback onTap;
const _OutletItem({
required this.label,
required this.icon,
required this.isSelected,
required this.onTap,
this.isActive,
});
@override
Widget build(BuildContext context) {
return ListTile(
onTap: onTap,
contentPadding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
leading: Container(
width: 36,
height: 36,
decoration: BoxDecoration(
color: isSelected
? AppColor.primary.withOpacity(0.1)
: AppColor.background,
borderRadius: BorderRadius.circular(10),
),
child: Icon(
icon,
size: 18,
color: isSelected ? AppColor.primary : AppColor.textSecondary,
),
),
title: Text(
label,
style: AppStyle.md.copyWith(
fontWeight: isSelected ? FontWeight.w700 : FontWeight.w500,
color: isSelected ? AppColor.primary : AppColor.textPrimary,
),
),
trailing: Row(
mainAxisSize: MainAxisSize.min,
children: [
if (isActive != null)
Container(
width: 8,
height: 8,
decoration: BoxDecoration(
shape: BoxShape.circle,
color: isActive! ? AppColor.success : AppColor.error,
),
),
if (isActive != null) const SizedBox(width: 8),
if (isSelected)
const Icon(
Icons.check_rounded,
color: AppColor.primary,
size: 20,
),
],
),
);
}
}
@@ -29,38 +29,6 @@ class _PurchasePageState extends State<PurchasePage>
];
final List<Map<String, dynamic>> purchaseData = [
{
'id': 'PO-001',
'supplier': 'PT. Sumber Rezeki',
'date': '15 Aug 2025',
'total': 2500000,
'status': 'Completed',
'items': 15,
},
{
'id': 'PO-002',
'supplier': 'CV. Maju Jaya',
'date': '14 Aug 2025',
'total': 1750000,
'status': 'Pending',
'items': 8,
},
{
'id': 'PO-003',
'supplier': 'PT. Global Supply',
'date': '13 Aug 2025',
'total': 3200000,
'status': 'Completed',
'items': 22,
},
{
'id': 'PO-004',
'supplier': 'UD. Berkah Mandiri',
'date': '12 Aug 2025',
'total': 890000,
'status': 'Cancelled',
'items': 5,
},
];
@override
@@ -107,7 +75,7 @@ class _PurchasePageState extends State<PurchasePage>
Expanded(
child: PurchaseStatCard(
title: context.lang.total_purchase,
value: 'Rp 8.340.000',
value: 'Rp 0',
icon: LineIcons.shoppingCart,
iconColor: AppColor.success,
cardAnimation: cardAnimation,
@@ -117,7 +85,7 @@ class _PurchasePageState extends State<PurchasePage>
Expanded(
child: PurchaseStatCard(
title: context.lang.pending_order,
value: '3 ${context.lang.orders}',
value: '0 ${context.lang.orders}',
icon: LineIcons.clock,
iconColor: AppColor.warning,
cardAnimation: cardAnimation,
+15 -1
View File
@@ -107,7 +107,20 @@ class _ReportPageState extends State<ReportPage> with TickerProviderStateMixin {
DashboardAnalyticLoaderState
>(
builder: (context, state) {
return CustomScrollView(
return RefreshIndicator(
color: AppColor.primary,
onRefresh: () async {
context.read<DashboardAnalyticLoaderBloc>().add(
DashboardAnalyticLoaderEvent.fetched(),
);
// tunggu sampai fetching selesai
await context
.read<DashboardAnalyticLoaderBloc>()
.stream
.firstWhere((s) => !s.isFetching);
},
child: CustomScrollView(
physics: const AlwaysScrollableScrollPhysics(),
slivers: [
SliverAppBar(
expandedHeight: 120,
@@ -197,6 +210,7 @@ class _ReportPageState extends State<ReportPage> with TickerProviderStateMixin {
),
),
],
),
);
},
),
+16 -16
View File
@@ -13,10 +13,10 @@ packages:
dependency: transitive
description:
name: _flutterfire_internals
sha256: ff0a84a2734d9e1089f8aedd5c0af0061b82fb94e95260d943404e0ef2134b11
sha256: "37a42d06068e2fe3deddb2da079a8c4d105f241225ba27b7122b37e9865fd8f7"
url: "https://pub.dev"
source: hosted
version: "1.3.59"
version: "1.3.35"
analyzer:
dependency: transitive
description:
@@ -461,50 +461,50 @@ packages:
dependency: "direct main"
description:
name: firebase_core
sha256: "7be63a3f841fc9663342f7f3a011a42aef6a61066943c90b1c434d79d5c995c5"
sha256: "26de145bb9688a90962faec6f838247377b0b0d32cc0abecd9a4e43525fc856c"
url: "https://pub.dev"
source: hosted
version: "3.15.2"
version: "2.32.0"
firebase_core_platform_interface:
dependency: transitive
description:
name: firebase_core_platform_interface
sha256: "0ecda14c1bfc9ed8cac303dd0f8d04a320811b479362a9a4efb14fd331a473ce"
sha256: "8bcfad6d7033f5ea951d15b867622a824b13812178bfec0c779b9d81de011bbb"
url: "https://pub.dev"
source: hosted
version: "6.0.3"
version: "5.4.2"
firebase_core_web:
dependency: transitive
description:
name: firebase_core_web
sha256: "0ed0dc292e8f9ac50992e2394e9d336a0275b6ae400d64163fdf0a8a8b556c37"
sha256: eb3afccfc452b2b2075acbe0c4b27de62dd596802b4e5e19869c1e926cbb20b3
url: "https://pub.dev"
source: hosted
version: "2.24.1"
version: "2.24.0"
firebase_messaging:
dependency: "direct main"
description:
name: firebase_messaging
sha256: "60be38574f8b5658e2f22b7e311ff2064bea835c248424a383783464e8e02fcc"
sha256: "980259425fa5e2afc03e533f33723335731d21a56fd255611083bceebf4373a8"
url: "https://pub.dev"
source: hosted
version: "15.2.10"
version: "14.7.10"
firebase_messaging_platform_interface:
dependency: transitive
description:
name: firebase_messaging_platform_interface
sha256: "685e1771b3d1f9c8502771ccc9f91485b376ffe16d553533f335b9183ea99754"
sha256: "87c4a922cb6f811cfb7a889bdbb3622702443c52a0271636cbc90d813ceac147"
url: "https://pub.dev"
source: hosted
version: "4.6.10"
version: "4.5.37"
firebase_messaging_web:
dependency: transitive
description:
name: firebase_messaging_web
sha256: "0d1be17bc89ed3ff5001789c92df678b2e963a51b6fa2bdb467532cc9dbed390"
sha256: "90dc7ed885e90a24bb0e56d661d4d2b5f84429697fd2cbb9e5890a0ca370e6f4"
url: "https://pub.dev"
source: hosted
version: "3.10.10"
version: "3.5.18"
fixnum:
dependency: transitive
description:
@@ -841,10 +841,10 @@ packages:
dependency: transitive
description:
name: js
sha256: "53385261521cc4a0c4658fd0ad07a7d14591cf8fc33abbceae306ddb974888dc"
sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3
url: "https://pub.dev"
source: hosted
version: "0.7.2"
version: "0.6.7"
json_annotation:
dependency: "direct main"
description:
+2 -2
View File
@@ -48,8 +48,8 @@ dependencies:
pdf: ^3.11.3
open_file: ^3.5.10
permission_handler: ^12.0.1
firebase_core: ^3.13.1
firebase_messaging: ^15.2.5
firebase_core: 2.32.0
firebase_messaging: 14.7.10
flutter_local_notifications: ^18.0.1
hugeicons: ^1.1.6