smart_refresher 1.0.1
smart_refresher: ^1.0.1 copied to clipboard
A powerful Flutter widget providing pull-to-refresh and infinite loading for scrollable content.
1.0.1 #
Security & Maintenance #
- Vulnerability Patches: Resolved several high-severity security vulnerabilities in the documentation project (
doc/) by updating transitive dependencies (defu,picomatch,h3,smol-toml). - Dependency Updates: Updated
iconify_sdkto1.0.0andflutter_lintsto6.0.0in the example application. - CI/CD Reliability: Fixed integration failures in the example project by adding missing
flutter_driverdependencies and suppressing internal lint warnings for the test extension.
Added #
- WaterDropHeader Showcase: Added a dedicated screen in the example application to demonstrate the
WaterDropHeaderin action. - Improved Authentic Droplet Effect: Enhanced the
WaterDropHeaderto accurately replicate the original "dropping" animation. The droplet now stretches, "breaks" away from the base, and falls during the refresh trigger, providing a more polished and nostalgic experience.
Refactoring & Quality #
- Accessibility Fix: Resolved a regression in
WaterDropHeaderby consolidatingSemanticswidgets, ensuring screen readers correctly announce status changes. - Code Formatting: Applied global
dart formatacross the entire library and example projects. - Test Verification: Confirmed 100% pass rate for the full test suite (174/174 tests).
1.0.0 #
Added #
- ElasticHeader: A new physics-based stretch header that provides an elastic visual effect, common in premium iOS apps. Includes real-time stretch factor calculation and integration with lazy construction.
- Example App Update: Added
ElasticHeaderScreento the example app, showcasing the ElasticHeader with a hero image.
Security & Compliance #
- Input Validation: Added robust
AssertionErrorguards torequestRefresh,requestTwoLevel, andrequestLoadinginRefreshControllerfor safer API usage. - Exception Surfacing: Refactored internal callback execution to ensure
onRefreshFailedandonLoadingFailedrobustly catch and surface both synchronous and asynchronous exceptions. - Typed API: Hardened internal logic to eliminate
dynamictype usage in callback execution paths. - Sensitive Data Guard: Added a security note to
SmartRefresher's API documentation advising against using callbacks for sensitive data handling. SECURITY.mdPolicy: Published a formal security policy with private reporting channels, acknowledgment SLAs, and an incident response process.- Static Analysis Hardening: Enabled
always_use_package_importsandno_runtimeType_toStringlints, converting all relative imports to package imports and fixing violations. - Secret Scanning: Configured
gitleakswith.gitleaks.tomland documented pre-commit hook usage for automated credential detection. - Supply Chain Security: Pinned all GitHub Action workflows (
ci.yml,publish.yml,stale.yml) to full commit SHAs for enhanced protection against tag mutation attacks. - Automated Updates: Configured Dependabot (
.github/dependabot.yml) for weekly dependency and GitHub Actions updates. - SBOM Generation: Integrated
cyclonedx-dartinto the release pipeline (publish.yml) and added a dry-run toci.ymlfor generating Software Bill of Materials. - Dependency Audit: Removed
iconify_sdkfrom rootpubspec.yamltoexample/pubspec.yamlas it was only used in the demo app.
Refactoring & Code Quality #
- Removed all blanket
ignore_for_filesuppressions from core library files, replacing them with surgical line-level// ignore:comments where accessing Flutter internals is necessary. - Replaced protected
setState()calls inRefreshControllerwith the publicupdate()method fromIndicatorStateMixin. - Removed unnecessary
ignore_for_file: camel_case_typesfromios17_indicator.dart.
Performance & Code Cleanup #
- Rebuild Minimisation: Wrapped indicator content (
buildContent) within bothRefreshIndicatorStateandLoadIndicatorStatewithRepaintBoundaryto isolate repaints during drag gestures. - Lazy Header Construction: Implemented lazy header construction; the header's child widget tree is now deferred until the first pull gesture, improving initial mount performance.
- Jank Profiling Baseline: Established a performance baseline with a new
integration_testmacrobenchmark script in/benchmarks, recording timeline traces for scroll and refresh interactions. - Animation Curve Audit: Ensured all
AnimationControllerinstances use appropriate hardware-accelerated curves and have explicit durations, confirming compliance with Flutter's 16ms frame budget. - Memory Leak Scan: Verified proper disposal of all
AnimationControllerandScrollControllerinstances throughflutter test --track-widget-creationand code audit. constPropagation: Achieved 100% compliance withprefer_const_constructorslint rule across indicator widgets.- Dead Code Removal: Removed unused imports (
slivers.dart) and addressed boilerplate TODOs. - Consistent Naming: Refactored cryptic or single-letter variables (e.g.,
etoelement,utoshouldUpdate) to descriptive names in line with Dart's style guide. - Magic Constants Extraction: Centralized hardcoded numeric and string literals (e.g., animation durations, spring physics, icon sizes, spacing) into
SmartRefresherConstantsinenums.dart. - Standardized Async Patterns: Replaced ad-hoc
Future.delayedworkarounds withWidgetsBinding.instance.addPostFrameCallbackfor single-frame waits andendRefreshWithTimerfor timed delays.
API Modernisation & Developer Experience #
RefreshController.stream: Added a.streamgetter toRefreshControlleras an alias for.headerStream, providing a reactive entry point for refresh status.ValueNotifierState Exposure: EnhancedRefreshControllerwithValueNotifier-based state exposure (contentStatus,headerMode,footerMode), enabling easier integration with state management solutions.onRefreshFailedCallback: Introduced a dedicatedonRefreshFailedcallback forSmartRefresher, allowing indicators to show distinct error states without manual consumer management.- Haptic Feedback Opt-in: Implemented optional haptic feedback (
HapticFeedback.mediumImpact()) at the pull threshold, disabled by default viaRefreshConfiguration. - Integration Examples: Added comprehensive examples for Riverpod, Provider, and BLoC state management patterns in the example app.
SmartRefresher.builderConstructor: IntroducedSmartRefresher.builderfor declarative UI composition, providing dedicated slots forempty,error, andloadingstates.- English Comments: Ensured 100% of source code comments are in English, translating all legacy Chinese comments.
- Comprehensive API Docs: Significantly improved and added rich
///documentation for all public members, includingSmartRefresher.builder,SmartRefresher.slivers,RefreshNotifier, andIndicatorStateMixin. - Migration Guide: Published
MIGRATING.mdto guide users transitioning from the upstreampull_to_refreshpackage.
0.2.0 #
New Indicators & Theming #
- Material 3 Header: Added
Material3Header, a floating pull-to-refresh indicator using the 2024 circular progress design with theme-aware colors and dedicated completion/error states. - iOS 17 Header: Added
iOS17Header, featuring native iOS 17 tick geometry, threshold scale pop, haptic feedback (iOS only), and optional last-updated text. - Skeleton Footer: Added
SkeletonFooterwith four built-in bone styles (listTile,card,textBlock,imageRow) and a shared shimmer engine for modern pagination placeholders. - Advanced Theming: Introduced
SmartRefresherThemeData(ThemeData extension) andSmartRefresherTheme(InheritedWidget) for app-wide or subtree indicator styling. - Color Resolution: Implemented
IndicatorThemeDatato automatically resolve indicator colors fromColorSchemewith safe Cupertino fallbacks.
Accessibility #
- Semantic Labels: Added
semanticsLabelandsemanticsHintto all built-in indicators. - Localized Defaults: Proper localized labels (e.g., "Pull down Refresh", "Refreshing…") are now announced by screen readers out of the box.
Layout & Compatibility #
- Multi-Sliver Support: Added
centerproperty toSmartRefresherandSmartRefresher.sliversto support bidirectional scrolling and complex sliver layouts. - Sliver Geometry Fixes: Improved
SliverRefreshto correctly respectconstraints.overlapfrom pinned slivers, preventing headers from being hidden under app bars. - ScrollBar Compatibility: Fixed scrollbar thumb jitter by implementing correct scroll offset correction during indicator layout transitions.
- WASM Compatible: Audited and confirmed full compatibility with Flutter's WASM web target.
- Smart Insertion: Updated
SmartRefresher.sliversto detect if indicators are manually placed in the sliver list, avoiding redundant auto-insertion.
Bug Fixes & Maintenance #
- CI Stability: Resolved a GitHub Actions failure by removing incorrectly checked-in temporary files (
.flutter-plugins-dependencies). - Web Assets: Added missing
cupertino_iconsdependency to the example app to ensure correct font rendering on web/WASM targets. - Code Quality: Resolved several analyzer warnings related to deprecated members (
withOpacity->withValues) and unused imports.
Infrastructure & Testing #
- New Test Suites: Added
test/accessibility_test.dart,test/complex_slivers_test.dart, andtest/scrollbar_test.dartcovering edge cases in complex layouts. - Dependency Update: Raised minimum Flutter SDK to 3.27.0 to support modern Material 3 color roles.
0.1.0 #
- Initial Fork Release: Rebranded package as
smart_refresherand initialized maintained fork release line. - Documentation & Localization:
- Added comprehensive English documentation comments to all public members.
- Translated all source code comments and header timestamps from Chinese to English.
- Fully localized the example application UI and developer comments into English.
- Bug Fixes:
- Resolved a state transition bug in "Two-Level" (Second Floor) mode.
- Fixed a compilation error caused by an invalid
constinstance field.
- Infrastructure:
- Updated CI configuration.
- Added
SECURITY.mdand Mintlify-style documentation indoc/.