Compare commits
1 Commits
Author | SHA1 | Date |
---|---|---|
Nghia | b0333b0d9c |
|
@ -1,2 +1 @@
|
||||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig"
|
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig"
|
|
||||||
#include "Generated.xcconfig"
|
#include "Generated.xcconfig"
|
||||||
|
|
41
ios/Podfile
41
ios/Podfile
|
@ -1,41 +0,0 @@
|
||||||
# Uncomment this line to define a global platform for your project
|
|
||||||
# platform :ios, '9.0'
|
|
||||||
|
|
||||||
# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
|
|
||||||
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
|
|
||||||
|
|
||||||
project 'Runner', {
|
|
||||||
'Debug' => :debug,
|
|
||||||
'Profile' => :release,
|
|
||||||
'Release' => :release,
|
|
||||||
}
|
|
||||||
|
|
||||||
def flutter_root
|
|
||||||
generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
|
|
||||||
unless File.exist?(generated_xcode_build_settings_path)
|
|
||||||
raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
|
|
||||||
end
|
|
||||||
|
|
||||||
File.foreach(generated_xcode_build_settings_path) do |line|
|
|
||||||
matches = line.match(/FLUTTER_ROOT\=(.*)/)
|
|
||||||
return matches[1].strip if matches
|
|
||||||
end
|
|
||||||
raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
|
|
||||||
end
|
|
||||||
|
|
||||||
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
|
|
||||||
|
|
||||||
flutter_ios_podfile_setup
|
|
||||||
|
|
||||||
target 'Runner' do
|
|
||||||
use_frameworks!
|
|
||||||
use_modular_headers!
|
|
||||||
|
|
||||||
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
|
|
||||||
end
|
|
||||||
|
|
||||||
post_install do |installer|
|
|
||||||
installer.pods_project.targets.each do |target|
|
|
||||||
flutter_additional_ios_build_settings(target)
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -1,22 +0,0 @@
|
||||||
PODS:
|
|
||||||
- Flutter (1.0.0)
|
|
||||||
- path_provider (0.0.1):
|
|
||||||
- Flutter
|
|
||||||
|
|
||||||
DEPENDENCIES:
|
|
||||||
- Flutter (from `Flutter`)
|
|
||||||
- path_provider (from `.symlinks/plugins/path_provider/ios`)
|
|
||||||
|
|
||||||
EXTERNAL SOURCES:
|
|
||||||
Flutter:
|
|
||||||
:path: Flutter
|
|
||||||
path_provider:
|
|
||||||
:path: ".symlinks/plugins/path_provider/ios"
|
|
||||||
|
|
||||||
SPEC CHECKSUMS:
|
|
||||||
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
|
|
||||||
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
|
|
||||||
|
|
||||||
PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c
|
|
||||||
|
|
||||||
COCOAPODS: 1.10.1
|
|
|
@ -9,7 +9,6 @@
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
|
||||||
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
|
||||||
43F100E74DF9EE5392ECBC04 /* Pods_Runner.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D5B53B5E0EFECB7FF9E2C8E5 /* Pods_Runner.framework */; };
|
|
||||||
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
74858FAF1ED2DC5600515810 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74858FAE1ED2DC5600515810 /* AppDelegate.swift */; };
|
||||||
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; };
|
||||||
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; };
|
||||||
|
@ -30,15 +29,12 @@
|
||||||
/* End PBXCopyFilesBuildPhase section */
|
/* End PBXCopyFilesBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
013E1FB17FFCABBA6E6EF7D4 /* 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>"; };
|
|
||||||
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; 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>"; };
|
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = "<group>"; };
|
||||||
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = "<group>"; };
|
||||||
463816E249964AE719E9B486 /* 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>"; };
|
|
||||||
74858FAD1ED2DC5600515810 /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; 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>"; };
|
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>"; };
|
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = "<group>"; };
|
||||||
82C7ABB995EA8D111F2C8790 /* 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>"; };
|
|
||||||
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.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>"; };
|
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; };
|
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||||
|
@ -46,7 +42,6 @@
|
||||||
97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
|
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>"; };
|
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>"; };
|
97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||||
D5B53B5E0EFECB7FF9E2C8E5 /* Pods_Runner.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Runner.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
/* Begin PBXFrameworksBuildPhase section */
|
/* Begin PBXFrameworksBuildPhase section */
|
||||||
|
@ -54,24 +49,12 @@
|
||||||
isa = PBXFrameworksBuildPhase;
|
isa = PBXFrameworksBuildPhase;
|
||||||
buildActionMask = 2147483647;
|
buildActionMask = 2147483647;
|
||||||
files = (
|
files = (
|
||||||
43F100E74DF9EE5392ECBC04 /* Pods_Runner.framework in Frameworks */,
|
|
||||||
);
|
);
|
||||||
runOnlyForDeploymentPostprocessing = 0;
|
runOnlyForDeploymentPostprocessing = 0;
|
||||||
};
|
};
|
||||||
/* End PBXFrameworksBuildPhase section */
|
/* End PBXFrameworksBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXGroup section */
|
/* Begin PBXGroup section */
|
||||||
66069B8D710F5A145EBF4AF8 /* Pods */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
013E1FB17FFCABBA6E6EF7D4 /* Pods-Runner.debug.xcconfig */,
|
|
||||||
82C7ABB995EA8D111F2C8790 /* Pods-Runner.release.xcconfig */,
|
|
||||||
463816E249964AE719E9B486 /* Pods-Runner.profile.xcconfig */,
|
|
||||||
);
|
|
||||||
name = Pods;
|
|
||||||
path = Pods;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
9740EEB11CF90186004384FC /* Flutter */ = {
|
9740EEB11CF90186004384FC /* Flutter */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
@ -89,8 +72,6 @@
|
||||||
9740EEB11CF90186004384FC /* Flutter */,
|
9740EEB11CF90186004384FC /* Flutter */,
|
||||||
97C146F01CF9000F007C117D /* Runner */,
|
97C146F01CF9000F007C117D /* Runner */,
|
||||||
97C146EF1CF9000F007C117D /* Products */,
|
97C146EF1CF9000F007C117D /* Products */,
|
||||||
66069B8D710F5A145EBF4AF8 /* Pods */,
|
|
||||||
C3F189B13157C4F9111FF2D6 /* Frameworks */,
|
|
||||||
);
|
);
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
@ -117,14 +98,6 @@
|
||||||
path = Runner;
|
path = Runner;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
C3F189B13157C4F9111FF2D6 /* Frameworks */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
D5B53B5E0EFECB7FF9E2C8E5 /* Pods_Runner.framework */,
|
|
||||||
);
|
|
||||||
name = Frameworks;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
/* End PBXGroup section */
|
/* End PBXGroup section */
|
||||||
|
|
||||||
/* Begin PBXNativeTarget section */
|
/* Begin PBXNativeTarget section */
|
||||||
|
@ -132,14 +105,12 @@
|
||||||
isa = PBXNativeTarget;
|
isa = PBXNativeTarget;
|
||||||
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
|
||||||
buildPhases = (
|
buildPhases = (
|
||||||
E99029EFDA4A8C7DBA1FE23F /* [CP] Check Pods Manifest.lock */,
|
|
||||||
9740EEB61CF901F6004384FC /* Run Script */,
|
9740EEB61CF901F6004384FC /* Run Script */,
|
||||||
97C146EA1CF9000F007C117D /* Sources */,
|
97C146EA1CF9000F007C117D /* Sources */,
|
||||||
97C146EB1CF9000F007C117D /* Frameworks */,
|
97C146EB1CF9000F007C117D /* Frameworks */,
|
||||||
97C146EC1CF9000F007C117D /* Resources */,
|
97C146EC1CF9000F007C117D /* Resources */,
|
||||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||||
C147A0DB71008B5B1253BD90 /* [CP] Embed Pods Frameworks */,
|
|
||||||
);
|
);
|
||||||
buildRules = (
|
buildRules = (
|
||||||
);
|
);
|
||||||
|
@ -226,45 +197,6 @@
|
||||||
shellPath = /bin/sh;
|
shellPath = /bin/sh;
|
||||||
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
|
||||||
};
|
};
|
||||||
C147A0DB71008B5B1253BD90 /* [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;
|
|
||||||
};
|
|
||||||
E99029EFDA4A8C7DBA1FE23F /* [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;
|
|
||||||
};
|
|
||||||
/* End PBXShellScriptBuildPhase section */
|
/* End PBXShellScriptBuildPhase section */
|
||||||
|
|
||||||
/* Begin PBXSourcesBuildPhase section */
|
/* Begin PBXSourcesBuildPhase section */
|
||||||
|
|
|
@ -4,7 +4,4 @@
|
||||||
<FileRef
|
<FileRef
|
||||||
location = "group:Runner.xcodeproj">
|
location = "group:Runner.xcodeproj">
|
||||||
</FileRef>
|
</FileRef>
|
||||||
<FileRef
|
|
||||||
location = "group:Pods/Pods.xcodeproj">
|
|
||||||
</FileRef>
|
|
||||||
</Workspace>
|
</Workspace>
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import 'dart:developer';
|
|
||||||
|
|
||||||
import 'package:bloc/bloc.dart';
|
import 'package:bloc/bloc.dart';
|
||||||
import 'package:demo_hive/bloc/reminder_event.dart';
|
import 'package:demo_hive/bloc/reminder_event.dart';
|
||||||
import 'package:demo_hive/bloc/reminder_state.dart';
|
import 'package:demo_hive/bloc/reminder_state.dart';
|
||||||
|
@ -8,63 +6,55 @@ import 'package:demo_hive/domain/use_case/reminders_use_case.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
|
|
||||||
class ReminderBloc extends Bloc<ReminderEvent, ReminderState> {
|
class ReminderBloc extends Bloc<ReminderEvent, ReminderState> {
|
||||||
|
|
||||||
final RemindersUseCase remindersUseCase;
|
final RemindersUseCase remindersUseCase;
|
||||||
|
|
||||||
ReminderBloc({@required this.remindersUseCase});
|
ReminderBloc({@required this.remindersUseCase});
|
||||||
|
|
||||||
List<ReminderEntity> reminders = [];
|
List<ReminderEntity> reminders = [];
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Stream<ReminderState> mapEventToState(ReminderEvent event) async* {
|
Stream<ReminderState> mapEventToState(ReminderEvent event) async* {
|
||||||
if (event is InitialEvent) {
|
if (event is InitialEvent) {
|
||||||
yield* _mapInitialEventToState();
|
yield* _mapInitialEventToState();
|
||||||
}
|
} else if (event is AddTitleEvent) {
|
||||||
if (event is AddTitleEvent) {
|
|
||||||
yield* _mapAddTitleEventToState(event);
|
yield* _mapAddTitleEventToState(event);
|
||||||
}
|
} else if (event is GetValueTitleEvent) {
|
||||||
if (event is GetValueTitleEvent) {
|
|
||||||
yield* _mapGetValueTitleEventToState(event);
|
yield* _mapGetValueTitleEventToState(event);
|
||||||
}
|
} else if (event is RemoveEvent) {
|
||||||
if (event is RemoveEvent) {
|
|
||||||
yield* _mapRemoveEventToState();
|
yield* _mapRemoveEventToState();
|
||||||
}
|
} else if (event is RemoveReminderEvent) {
|
||||||
if (event is RemoveReminderEvent) {
|
|
||||||
yield* _mapRemoveReminderEventState();
|
yield* _mapRemoveReminderEventState();
|
||||||
}
|
} else if (event is RemoveTitle) {
|
||||||
if (event is RemoveTitle) {
|
|
||||||
yield* _mapRemoveTitleEventToState(event);
|
yield* _mapRemoveTitleEventToState(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapInitialEventToState() async* {
|
Stream<ReminderState> _mapInitialEventToState() async* {
|
||||||
yield state.update(isLoading: true);
|
yield state.update(isLoading: true);
|
||||||
reminders = await remindersUseCase.getFull();
|
List<ReminderEntity> check = await remindersUseCase.getFull();
|
||||||
yield state.update(list: reminders, isLoading: false);
|
yield state.update(list: check,isLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapAddTitleEventToState(AddTitleEvent event) async* {
|
Stream<ReminderState> _mapAddTitleEventToState(AddTitleEvent event) async* {
|
||||||
yield state.update(isLoading: true);
|
yield state.update(isLoading: true);
|
||||||
ReminderEntity reminderEntity = ReminderEntity(title: event.title);
|
ReminderEntity reminderEntity = ReminderEntity(title: event.title);
|
||||||
reminders.add(reminderEntity);
|
|
||||||
await remindersUseCase.addNote(reminderEntity);
|
await remindersUseCase.addNote(reminderEntity);
|
||||||
log('AddTitleEvent: ${reminderEntity.title}');
|
yield state.update(list: reminders,isLoading:false);
|
||||||
yield state.update(list: reminders, isLoading: false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapGetValueTitleEventToState(
|
Stream<ReminderState> _mapGetValueTitleEventToState(
|
||||||
GetValueTitleEvent event) async* {
|
GetValueTitleEvent event) async* {
|
||||||
yield state.update(isLoading: true);
|
yield state.update(isLoading: true);
|
||||||
yield state.update(isEmpty: event.title.isEmpty, isLoading: false);
|
yield state.update(isEmpty: event.title.isEmpty,isLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapRemoveEventToState() async* {
|
Stream<ReminderState> _mapRemoveEventToState() async* {
|
||||||
yield state.update(isLoading: true);
|
yield state.update(isLoading: true);
|
||||||
yield state.update(isEmpty: true, isLoading: false);
|
yield state.update(isEmpty: true,isLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapRemoveReminderEventState() async* {
|
Stream<ReminderState> _mapRemoveReminderEventState() async* {
|
||||||
yield state.update(isLoading: true);
|
yield state.update(isLoading: true);
|
||||||
yield state.update(isEmpty: true, isLoading: false);
|
yield state.update(isEmpty: true,isLoading: false);
|
||||||
}
|
}
|
||||||
|
|
||||||
Stream<ReminderState> _mapRemoveTitleEventToState(RemoveTitle event) async* {
|
Stream<ReminderState> _mapRemoveTitleEventToState(RemoveTitle event) async* {
|
||||||
|
|
|
@ -7,16 +7,18 @@ class ReminderState extends Equatable {
|
||||||
final String title;
|
final String title;
|
||||||
final bool isLoading;
|
final bool isLoading;
|
||||||
|
|
||||||
ReminderState({this.isEmpty, this.list, this.title, this.isLoading});
|
ReminderState({this.isEmpty, this.list, this.title,this.isLoading});
|
||||||
|
|
||||||
ReminderState update(
|
ReminderState update(
|
||||||
{bool isEmpty, List<ReminderEntity> list, String title, bool isLoading}) {
|
{bool isEmpty, List<ReminderEntity> list, String title,bool isLoading}) {
|
||||||
return ReminderState(
|
return ReminderState(
|
||||||
isLoading: isLoading ?? this.isLoading,
|
|
||||||
isEmpty: isEmpty ?? this.isEmpty,
|
isEmpty: isEmpty ?? this.isEmpty,
|
||||||
list: list ?? this.list,
|
list: list ?? this.list,
|
||||||
title: title ?? this.title);
|
title: title ?? this.title);
|
||||||
}
|
}
|
||||||
|
|
||||||
List<Object> get props => [isEmpty, list, this.isLoading, this.title];
|
List<Object> get props => [isEmpty, list];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@ import 'package:demo_hive/service_locator.dart';
|
||||||
import 'package:demo_hive/widget/reminder_widget.dart';
|
import 'package:demo_hive/widget/reminder_widget.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'bloc/reminder_event.dart';
|
|
||||||
import 'data/data_source/local/local_init.dart';
|
import 'data/data_source/local/local_init.dart';
|
||||||
import 'domain/use_case/reminders_use_case.dart';
|
import 'domain/use_case/reminders_use_case.dart';
|
||||||
|
|
||||||
|
@ -41,7 +40,7 @@ class MyApp extends StatelessWidget {
|
||||||
visualDensity: VisualDensity.adaptivePlatformDensity,
|
visualDensity: VisualDensity.adaptivePlatformDensity,
|
||||||
),
|
),
|
||||||
home: BlocProvider(
|
home: BlocProvider(
|
||||||
create: (_) => locator<ReminderBloc>()..add(InitialEvent()),
|
create: (_) => locator<ReminderBloc>(),
|
||||||
child: ReminderWidget()),
|
child: ReminderWidget()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -108,7 +108,7 @@ class _ReminderWidgetState extends State<ReminderWidget> {
|
||||||
style: TextStyle(fontSize: 18),
|
style: TextStyle(fontSize: 18),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
if (state.isLoading == true) {
|
if(state.isLoading == true){
|
||||||
return CircularProgressIndicator();
|
return CircularProgressIndicator();
|
||||||
}
|
}
|
||||||
return ListView.builder(
|
return ListView.builder(
|
||||||
|
|
Loading…
Reference in New Issue