From bed533a4e6dcad034e265137d24a20a90488edd2 Mon Sep 17 00:00:00 2001 From: krishnakumarcn Date: Sat, 20 Apr 2024 00:54:20 +0200 Subject: [PATCH 1/5] dependency upgrade and DateTime --- .fvm/fvm_config.json | 4 + CHANGELOG.md | 10 +- example/ios/Flutter/AppFrameworkInfo.plist | 2 +- example/ios/Podfile | 2 +- example/ios/Podfile.lock | 8 +- example/ios/Runner.xcodeproj/project.pbxproj | 37 ++-- .../contents.xcworkspacedata | 2 +- .../xcshareddata/xcschemes/Runner.xcscheme | 2 +- example/ios/Runner/Info.plist | 4 + example/lib/main.dart | 10 +- example/pubspec.lock | 184 ++++++++++-------- example/pubspec.yaml | 2 +- lib/src/faded.dart | 86 ++++++-- pubspec.lock | 141 +++++++++----- pubspec.yaml | 8 +- test/faded_test.dart | 25 ++- 16 files changed, 344 insertions(+), 183 deletions(-) create mode 100644 .fvm/fvm_config.json diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json new file mode 100644 index 0000000..0b54542 --- /dev/null +++ b/.fvm/fvm_config.json @@ -0,0 +1,4 @@ +{ + "flutterSdkVersion": "3.19.6", + "flavors": {} +} \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index a60bdc3..6ea52c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ +## [2.0.0] - Dependency upgrade. Breaking change for DueDate + +- Dart version upgraded to >=3.0.0 +- `dueDate` changed to a `DateTime` from `String` (it was a noobie library on inception🙂, now evolved into yet another + noobie library with `DateTime` 🤓 ) + ## [1.1.1] - Minor formatting changes + ## [1.1.0] - Support null safety. ## [1.0.2] - Minor changes to documentation. + ## [1.0.0] - Initial release. -Get. set. Go.. + diff --git a/example/ios/Flutter/AppFrameworkInfo.plist b/example/ios/Flutter/AppFrameworkInfo.plist index 9367d48..7c56964 100644 --- a/example/ios/Flutter/AppFrameworkInfo.plist +++ b/example/ios/Flutter/AppFrameworkInfo.plist @@ -21,6 +21,6 @@ CFBundleVersion 1.0 MinimumOSVersion - 8.0 + 12.0 diff --git a/example/ios/Podfile b/example/ios/Podfile index 1e8c3c9..279576f 100644 --- a/example/ios/Podfile +++ b/example/ios/Podfile @@ -1,5 +1,5 @@ # Uncomment this line to define a global platform for your project -# platform :ios, '9.0' +# platform :ios, '12.0' # CocoaPods analytics sends network stats synchronously affecting flutter build latency. ENV['COCOAPODS_DISABLE_STATS'] = 'true' diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index 26a9d06..bf5155c 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -14,9 +14,9 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/integration_test/ios" SPEC CHECKSUMS: - Flutter: 434fef37c0980e73bb6479ef766c45957d4b510c - integration_test: 5ed24a436eb7ec17b6a13046e9bf7ca4a404e59e + Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 + integration_test: 13825b8a9334a850581300559b8839134b124670 -PODFILE CHECKSUM: aafe91acc616949ddb318b77800a7f51bffa2a4c +PODFILE CHECKSUM: c4c93c5f6502fe2754f48404d3594bf779584011 -COCOAPODS: 1.9.3 +COCOAPODS: 1.13.0 diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj index b7ce200..9dbfd70 100644 --- a/example/ios/Runner.xcodeproj/project.pbxproj +++ b/example/ios/Runner.xcodeproj/project.pbxproj @@ -3,7 +3,7 @@ archiveVersion = 1; classes = { }; - objectVersion = 46; + objectVersion = 54; objects = { /* Begin PBXBuildFile section */ @@ -156,7 +156,7 @@ 97C146E61CF9000F007C117D /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 1020; + LastUpgradeCheck = 1510; ORGANIZATIONNAME = ""; TargetAttributes = { 97C146ED1CF9000F007C117D = { @@ -203,13 +203,12 @@ buildActionMask = 2147483647; files = ( ); - inputPaths = ( - "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh", - "${BUILT_PRODUCTS_DIR}/integration_test/integration_test.framework", + inputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist", ); name = "[CP] Embed Pods Frameworks"; - outputPaths = ( - "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/integration_test.framework", + outputFileListPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist", ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; @@ -240,10 +239,12 @@ }; 3B06AD1E1E4923F5004D2608 /* Thin Binary */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); inputPaths = ( + "${TARGET_BUILD_DIR}/${INFOPLIST_PATH}", ); name = "Thin Binary"; outputPaths = ( @@ -254,6 +255,7 @@ }; 9740EEB61CF901F6004384FC /* Run Script */ = { isa = PBXShellScriptBuildPhase; + alwaysOutOfDate = 1; buildActionMask = 2147483647; files = ( ); @@ -341,7 +343,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -359,7 +361,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -415,7 +420,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -464,7 +469,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 9.0; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SUPPORTED_PLATFORMS = iphoneos; @@ -483,7 +488,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -502,7 +510,10 @@ CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)"; ENABLE_BITCODE = NO; INFOPLIST_FILE = Runner/Info.plist; - LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + ); PRODUCT_BUNDLE_IDENTIFIER = com.example.example; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; diff --git a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata index 1d526a1..919434a 100644 --- a/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ b/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -2,6 +2,6 @@ + location = "self:"> diff --git a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index a28140c..e67b280 100644 --- a/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -1,6 +1,6 @@ UIViewControllerBasedStatusBarAppearance + CADisableMinimumFrameDurationOnPhone + + UIApplicationSupportsIndirectInputEvents + diff --git a/example/lib/main.dart b/example/lib/main.dart index 08c4169..a0aba23 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -3,9 +3,8 @@ import 'package:flutter/material.dart'; void main() { runApp(Faded( - // Due date should be in yyyy-mm-dd format - dueDate: '2022-01-15', - daysDeadline: 12, + dueDate: DateTime(2024, 04, 21), + daysDeadline: 2, child: MyApp(), )); } @@ -15,6 +14,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( home: Scaffold( + backgroundColor: Colors.white, appBar: AppBar( title: Text('Faded!'), ), @@ -25,8 +25,8 @@ class MyApp extends StatelessWidget { "Fade.. fade away...", style: Theme.of(context) .textTheme - .bodyText1 - .copyWith(color: Colors.white), + .bodyLarge + ?.copyWith(color: Colors.white), ), ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 2bb5352..7fc4085 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -1,67 +1,52 @@ # Generated by pub # See https://dart.dev/tools/pub/glossary#lockfile packages: - archive: - dependency: transitive - description: - name: archive - url: "https://pub.dartlang.org" - source: hosted - version: "3.1.2" async: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.1" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" - crypto: - dependency: transitive - description: - name: crypto - url: "https://pub.dartlang.org" - source: hosted - version: "3.0.1" + version: "1.18.0" cupertino_icons: dependency: "direct main" description: name: cupertino_icons - url: "https://pub.dartlang.org" + sha256: caac504f942f41dfadcf45229ce8c47065b93919a12739f20d6173a883c5ec73 + url: "https://pub.dev" source: hosted version: "1.0.2" faded: @@ -70,21 +55,23 @@ packages: path: ".." relative: true source: path - version: "1.1.1" + version: "2.0.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" file: dependency: transitive description: name: file - url: "https://pub.dartlang.org" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" + url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "7.0.0" flutter: dependency: "direct main" description: flutter @@ -114,44 +101,82 @@ packages: dependency: transitive description: name: intl - url: "https://pub.dartlang.org" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.11.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.0" platform: dependency: transitive description: name: platform - url: "https://pub.dartlang.org" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.1.4" process: dependency: transitive description: name: process - url: "https://pub.dartlang.org" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" + url: "https://pub.dev" source: hosted - version: "4.2.3" + version: "5.0.2" sky_engine: dependency: transitive description: flutter @@ -161,79 +186,82 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" sync_http: dependency: transitive description: name: sync_http - url: "https://pub.dartlang.org" + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961" + url: "https://pub.dev" source: hosted - version: "0.3.0" + version: "0.3.1" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.2" - typed_data: - dependency: transitive - description: - name: typed_data - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.0" + version: "0.6.1" vector_math: dependency: transitive description: name: vector_math - url: "https://pub.dartlang.org" + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.4" vm_service: dependency: transitive description: name: vm_service - url: "https://pub.dartlang.org" + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" source: hosted - version: "7.1.1" + version: "13.0.0" webdriver: dependency: transitive description: name: webdriver - url: "https://pub.dartlang.org" + sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e" + url: "https://pub.dev" source: hosted - version: "3.0.0" + version: "3.0.3" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=2.10.5" diff --git a/example/pubspec.yaml b/example/pubspec.yaml index 9e60de7..49e6cd2 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -18,7 +18,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev version: 1.0.0+1 environment: - sdk: ">=2.7.0 <3.0.0" + sdk: ">=3.0.0" dependencies: flutter: diff --git a/lib/src/faded.dart b/lib/src/faded.dart index 1de6ea5..3b3a8a0 100644 --- a/lib/src/faded.dart +++ b/lib/src/faded.dart @@ -1,16 +1,38 @@ import 'package:flutter/material.dart'; -/// Creates a widget that can be faded in and out. +/// ** Faded: A Tale of Revenge ** /// +/// A widget that fades in and out based on due dates, +/// to be used sparingly and with caution +/// due to its hidden agenda against your client. /// -/// [dueDate] is the date you want the widget to fade in and out. +/// **Usage:** +/// Faded( +/// dueDate: DateTime(2024, 04, 30), +/// daysDeadline: 3, +/// child: MyContent(), +/// ) /// -/// [daysDeadline] is the number of days you want the widget to fade in and out. -/// It must also equate with the due date you are setting +/// - [dueDate] : The date when the widget starts its revenge. +/// - [daysDeadline] : How many days after the due date the revenge completes. +/// The widget will sharpen its blades and blur them day-by-day +/// after the [dueDate] until the [daysDeadline], and go dark +/// after [daysDeadline] +/// - [child] : The content shown, controlled by the widget's secret agenda. /// -/// [child] is the widget to display as the content of this widget. +/// **Example:** +/// ```dart +/// Faded( +/// dueDate: DateTime(2024, 04, 30), +/// daysDeadline: 3, +/// child: Text("I'm an innocent app, don't doubt me ever!"), +/// ) +/// ``` +/// +/// **Note:** +/// Be careful! This widget looks innocent but holds a grudge against its creator. class Faded extends StatefulWidget { - final String dueDate; + final DateTime? dueDate; final int daysDeadline; final Widget child; @@ -21,35 +43,57 @@ class Faded extends StatefulWidget { }); @override - State createState() => _FadedState(); + State createState() => _FadedState(); } class _FadedState extends State { + final shadowFader = ShadowFader(); + @override Widget build(BuildContext context) { - double opacity = getOpacity(widget.dueDate, widget.daysDeadline); + final now = DateTime.now(); + final opacity = shadowFader.hauntingOpacity( + now, + widget.dueDate, + widget.daysDeadline, + ); + print(opacity); return Opacity( opacity: opacity, child: widget.child, ); } +} - /// Returns the opacity based on current date, due date and dead line - double getOpacity(String dueDate, int deadline) { - final _dueDate = DateTime.tryParse(dueDate); - if (_dueDate == null) return 1.0; +const smile = 1.0; +const fadeAway = 0.0; - double opacity = 1.0; - final now = DateTime.now(); - if (now.isAfter(_dueDate)) { - int differenceInDays = DateTime.now().difference(_dueDate).inDays; - if (differenceInDays > deadline) { - opacity = 0.0; +/// A class designed to manage opacity fading effects with the stealth +/// and precision of a shadowy assassin. Internally using it to seamlessly +/// control the visibility of widgets. +class ShadowFader { + double hauntingOpacity(DateTime now, DateTime? dueDate, int deadline) { + if (dueDate == null) return smile; + + final isDueDatePassed = now.isAfter(dueDate); + + if (isDueDatePassed) { + final howManyDaysPassed = DateTime.now().difference(dueDate).inDays; + final moreThanDeadLineDaysPassed = + howManyDaysPassed > deadline || deadline == 0; + if (moreThanDeadLineDaysPassed) { + /// into the oblivion + return fadeAway; } else { - double finishValue = (differenceInDays / deadline); - opacity = 1.0 - finishValue; + final ourToleranceValue = (howManyDaysPassed / deadline); + final blurTheirSight = smile - ourToleranceValue; + + /// Beware human, be-very-aware! + return blurTheirSight; } } - return opacity; + + /// I'll see you tomorrow! + return smile; } } diff --git a/pubspec.lock b/pubspec.lock index 0e870d3..a8c280e 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -5,51 +5,50 @@ packages: dependency: transitive description: name: async - url: "https://pub.dartlang.org" + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" source: hosted - version: "2.8.1" + version: "2.11.0" boolean_selector: dependency: transitive description: name: boolean_selector - url: "https://pub.dartlang.org" + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.1" characters: dependency: transitive description: name: characters - url: "https://pub.dartlang.org" + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" source: hosted - version: "1.1.0" - charcode: - dependency: transitive - description: - name: charcode - url: "https://pub.dartlang.org" - source: hosted - version: "1.3.1" + version: "1.3.0" clock: dependency: transitive description: name: clock - url: "https://pub.dartlang.org" + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.1.1" collection: dependency: transitive description: name: collection - url: "https://pub.dartlang.org" + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.18.0" fake_async: dependency: transitive description: name: fake_async - url: "https://pub.dartlang.org" + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.3.1" flutter: dependency: "direct main" description: flutter @@ -64,30 +63,66 @@ packages: dependency: "direct main" description: name: intl - url: "https://pub.dartlang.org" + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" source: hosted - version: "0.17.0" + version: "2.0.1" matcher: dependency: transitive description: name: matcher - url: "https://pub.dartlang.org" + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" source: hosted - version: "0.12.10" + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" meta: dependency: transitive description: name: meta - url: "https://pub.dartlang.org" + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" source: hosted - version: "1.7.0" + version: "1.11.0" path: dependency: transitive description: name: path - url: "https://pub.dartlang.org" + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" source: hosted - version: "1.8.0" + version: "1.9.0" sky_engine: dependency: transitive description: flutter @@ -97,58 +132,66 @@ packages: dependency: transitive description: name: source_span - url: "https://pub.dartlang.org" + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" source: hosted - version: "1.8.1" + version: "1.10.0" stack_trace: dependency: transitive description: name: stack_trace - url: "https://pub.dartlang.org" + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" source: hosted - version: "1.10.0" + version: "1.11.1" stream_channel: dependency: transitive description: name: stream_channel - url: "https://pub.dartlang.org" + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" string_scanner: dependency: transitive description: name: string_scanner - url: "https://pub.dartlang.org" + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.2.0" term_glyph: dependency: transitive description: name: term_glyph - url: "https://pub.dartlang.org" + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" source: hosted - version: "1.2.0" + version: "1.2.1" test_api: dependency: transitive description: name: test_api - url: "https://pub.dartlang.org" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" source: hosted - version: "0.4.2" - typed_data: + version: "0.6.1" + vector_math: dependency: transitive description: - name: typed_data - url: "https://pub.dartlang.org" + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" source: hosted - version: "1.3.0" - vector_math: + version: "2.1.4" + vm_service: dependency: transitive description: - name: vector_math - url: "https://pub.dartlang.org" + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "13.0.0" sdks: - dart: ">=2.12.0 <3.0.0" - flutter: ">=1.17.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=2.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index a3b7236..fcc01c3 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,16 +1,16 @@ name: faded description: Client did not pay? Add decreasing opacity to UI components until their app fades away. Set a due date, and no. of days you offer them until the app is fully vanished. -version: 1.1.1 +version: 2.0.0 repository: https://github.com/krishnakumarcn/faded environment: - sdk: '>=2.12.0 <3.0.0' - flutter: ">=1.17.0" + sdk: '>=3.0.0' + flutter: ">=2.10.5" dependencies: flutter: sdk: flutter - intl: ^0.17.0 + intl: ^0.19.0 dev_dependencies: flutter_test: diff --git a/test/faded_test.dart b/test/faded_test.dart index 18070de..6cfa6fe 100644 --- a/test/faded_test.dart +++ b/test/faded_test.dart @@ -1,8 +1,27 @@ +import 'package:faded/faded.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { - test('op check', () { - // double op = getOpacity('2021-01-18', 40); - // expect(op, 0.0); + ShadowFader shadowFader = ShadowFader(); + final now = DateTime(2024, 04, 20); + final dueDateDeadlineVsResultMap = { + (DateTime(2024, 04, 18), 2): 0.0, + (DateTime(2024, 04, 17), 2): 0.0, + (DateTime(2024, 04, 19), 2): 0.5, + (DateTime(2024, 04, 20), 2): 1.0, + (DateTime(2024, 04, 21), 2): 1.0, + (DateTime(2212, 04, 21), 2): 1.0, + (DateTime(2000, 04, 21), 2): 0.0, + }; + + dueDateDeadlineVsResultMap.forEach((testCase, expected) { + final dueDate = testCase.$1; + final deadline = testCase.$2; + test( + 'now: $now, due: $dueDate, deadline: $deadline ==> $expected', + () { + expect(shadowFader.hauntingOpacity(now, dueDate, deadline), expected); + }, + ); }); } From 9b207befe0d3e4257fab6a51d69f15e591f9e19d Mon Sep 17 00:00:00 2001 From: krishnakumarcn Date: Sat, 20 Apr 2024 00:54:40 +0200 Subject: [PATCH 2/5] update gitignore --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 0e8c2f9..b8b1726 100644 --- a/.gitignore +++ b/.gitignore @@ -114,4 +114,5 @@ app.*.symbols !**/ios/**/default.pbxuser !**/ios/**/default.perspectivev3 !/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages -!/dev/ci/**/Gemfile.lock \ No newline at end of file +!/dev/ci/**/Gemfile.lock +/.fvm/flutter_sdk/ From 933719ac8c2cb431ea348bd4905036ff2442d932 Mon Sep 17 00:00:00 2001 From: krishnakumarcn Date: Sat, 20 Apr 2024 01:03:11 +0200 Subject: [PATCH 3/5] update Readme --- README.md | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 55006f2..4499d3e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,35 @@ -# Faded! +# Faded: A Tale of Revenge -## Client did not pay? +### Client did not pay? Add opacity to your widgets and decrease it every day until their app completely fades away. Set a due date and customize the number of days you offer them until the app is fully vanished. +--- + + +Faded is a simple widget that fades in and out based on due dates, +to be used sparingly and with caution +due to its hidden agenda against your client. + +**Usage:** + ```dart - Faded( - // Due date should be in yyyy-mm-dd format - dueDate: '2021-01-15', - daysDeadline: 12, - child: MyApp(), - ) +Faded( + dueDate: DateTime(2024, 04, 30), + daysDeadline: 3, + child: MyContent(), +) ``` -And.... Faded! the app is all gone now.. + +- [dueDate] : The date when the widget starts its revenge. +- [daysDeadline] : How many days after the due date the revenge completes. + The widget will sharpen its blades and blur them day-by-day + after the [dueDate] until the [daysDeadline], and go dark + after [daysDeadline] +- [child] : The content shown, controlled by the widget's secret agenda. + + + +**Note:** +Be careful! This widget looks innocent but holds a grudge against its creator. \ No newline at end of file From 9539be6a98b6cb99d4fa984e9a41f610d4f64965 Mon Sep 17 00:00:00 2001 From: krishnakumarcn Date: Sat, 20 Apr 2024 01:08:39 +0200 Subject: [PATCH 4/5] update gitignore and lock --- .gitignore | 1 - pubspec.lock | 66 +++++++++++++++++----------------------------------- pubspec.yaml | 2 +- 3 files changed, 22 insertions(+), 47 deletions(-) diff --git a/.gitignore b/.gitignore index b8b1726..e614142 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ # Miscellaneous *.class -*.lock *.log *.pyc *.swp diff --git a/pubspec.lock b/pubspec.lock index a8c280e..f888f81 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,10 +37,10 @@ packages: dependency: transitive description: name: collection - sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + sha256: f092b211a4319e98e5ff58223576de6c2803db36221657b46c82574721240687 url: "https://pub.dev" source: hosted - version: "1.18.0" + version: "1.17.2" fake_async: dependency: transitive description: @@ -67,62 +67,38 @@ packages: url: "https://pub.dev" source: hosted version: "0.19.0" - leak_tracker: - dependency: transitive - description: - name: leak_tracker - sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" - url: "https://pub.dev" - source: hosted - version: "10.0.0" - leak_tracker_flutter_testing: - dependency: transitive - description: - name: leak_tracker_flutter_testing - sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 - url: "https://pub.dev" - source: hosted - version: "2.0.1" - leak_tracker_testing: - dependency: transitive - description: - name: leak_tracker_testing - sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 - url: "https://pub.dev" - source: hosted - version: "2.0.1" matcher: dependency: transitive description: name: matcher - sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + sha256: "1803e76e6653768d64ed8ff2e1e67bea3ad4b923eb5c56a295c3e634bad5960e" url: "https://pub.dev" source: hosted - version: "0.12.16+1" + version: "0.12.16" material_color_utilities: dependency: transitive description: name: material_color_utilities - sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + sha256: "9528f2f296073ff54cb9fee677df673ace1218163c3bc7628093e7eed5203d41" url: "https://pub.dev" source: hosted - version: "0.8.0" + version: "0.5.0" meta: dependency: transitive description: name: meta - sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + sha256: "3c74dbf8763d36539f114c799d8a2d87343b5067e9d796ca22b5eb8437090ee3" url: "https://pub.dev" source: hosted - version: "1.11.0" + version: "1.9.1" path: dependency: transitive description: name: path - sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + sha256: "8829d8a55c13fc0e37127c29fedf290c102f4e40ae94ada574091fe0ff96c917" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.8.3" sky_engine: dependency: transitive description: flutter @@ -140,18 +116,18 @@ packages: dependency: transitive description: name: stack_trace - sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + sha256: c3c7d8edb15bee7f0f74debd4b9c5f3c2ea86766fe4178eb2a18eb30a0bdaed5 url: "https://pub.dev" source: hosted - version: "1.11.1" + version: "1.11.0" stream_channel: dependency: transitive description: name: stream_channel - sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + sha256: "83615bee9045c1d322bbbd1ba209b7a749c2cbcdcb3fdd1df8eb488b3279c1c8" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" string_scanner: dependency: transitive description: @@ -172,10 +148,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + sha256: "75760ffd7786fffdfb9597c35c5b27eaeec82be8edfb6d71d32651128ed7aab8" url: "https://pub.dev" source: hosted - version: "0.6.1" + version: "0.6.0" vector_math: dependency: transitive description: @@ -184,14 +160,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.4" - vm_service: + web: dependency: transitive description: - name: vm_service - sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + name: web + sha256: dc8ccd225a2005c1be616fe02951e2e342092edf968cf0844220383757ef8f10 url: "https://pub.dev" source: hosted - version: "13.0.0" + version: "0.1.4-beta" sdks: - dart: ">=3.2.0-0 <4.0.0" + dart: ">=3.1.0-185.0.dev <4.0.0" flutter: ">=2.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index fcc01c3..2f5f2fd 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.0.0 repository: https://github.com/krishnakumarcn/faded environment: - sdk: '>=3.0.0' + sdk: '>=3.0.0 <=4.0.0' flutter: ">=2.10.5" dependencies: From 3faf06cd93b944ef07fdcddb2d956f85c88c0d46 Mon Sep 17 00:00:00 2001 From: krishnakumarcn Date: Sat, 20 Apr 2024 01:14:23 +0200 Subject: [PATCH 5/5] update gitignore and lock --- example/pubspec.lock | 2 +- pubspec.lock | 2 +- pubspec.yaml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/example/pubspec.lock b/example/pubspec.lock index 7fc4085..f691298 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -263,5 +263,5 @@ packages: source: hosted version: "3.0.3" sdks: - dart: ">=3.2.0-0 <4.0.0" + dart: ">=3.2.0-0 <=3.4.0" flutter: ">=2.10.5" diff --git a/pubspec.lock b/pubspec.lock index f888f81..e13aaf9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -169,5 +169,5 @@ packages: source: hosted version: "0.1.4-beta" sdks: - dart: ">=3.1.0-185.0.dev <4.0.0" + dart: ">=3.1.0-185.0.dev <=3.4.0" flutter: ">=2.10.5" diff --git a/pubspec.yaml b/pubspec.yaml index 2f5f2fd..cf8b1e1 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,7 +4,7 @@ version: 2.0.0 repository: https://github.com/krishnakumarcn/faded environment: - sdk: '>=3.0.0 <=4.0.0' + sdk: '>=3.0.0 <=3.4.0' flutter: ">=2.10.5" dependencies: