empty_view 2.1.1
empty_view: ^2.1.1 copied to clipboard
A powerful Flutter package for displaying beautiful empty state views with animations, Lottie support, presets, shimmer loading, dark mode, and accessibility features.
Changelog #
All notable changes to this project will be documented in this file.
2.1.0 #
This release adds powerful new features while maintaining full backward compatibility with v2.0.
New Features #
Gradient Background Support
- Added
backgroundGradientproperty toEmptyViewStyle - Added
backgroundColorproperty for solid backgrounds - Added
backgroundBorderRadiusfor rounded background corners - Added
backgroundShadowfor drop shadows - Added
EmptyViewStyle.gradient()factory constructor - Added
hasBackgroundgetter for checking background state
Builder Pattern
- Added
EmptyView.builder()factory constructor for custom layouts - Builder receives
BuildContextand resolvedEmptyViewStyle - Enables complex custom designs while keeping styling system
Animation Completion Callback
- Added
onAnimationCompletecallback - Fires when entrance animation finishes
- Useful for triggering post-animation actions
Custom Error Widget
- Added
errorWidgetproperty - Replaces default error icon with custom widget
- Supports complex error state designs
4 New Presets
permissionDenied- Permission required state (orange lock icon)sessionExpired- Session expired state (red timer icon)emptyTimeline- Empty activity feed statenoPaymentMethods- No payment methods state
Performance Improvements
- Added
RepaintBoundarywrapper for animations - Reduces unnecessary repaints during animations
Code Quality
- Added
@immutableannotation toEmptyViewStyle - Extracted all magic numbers to named constants:
EmptyView.defaultIconSize(80.0)EmptyView.defaultErrorIconSize(60.0)EmptyView.defaultAnimationDuration(600ms)EmptyView.defaultRetryDelay(2 seconds)EmptyView.defaultMaxRetries(3)EmptyView.defaultSlideOffset(0.3)EmptyView.defaultScaleFactor(0.8)EmptyView.defaultBounceScaleFactor(0.5)EmptyView.iconBackgroundMultiplier(1.5)EmptyView.loadingIndicatorSize(24.0)EmptyView.defaultButtonFontSize(16.0)EmptyViewStyle.defaultImageWidthFactor(0.5)EmptyViewStyle.defaultImageHeightFactor(0.3)EmptyViewStyle.defaultHorizontalPadding(24.0)EmptyViewStyle.defaultButtonHeight(50.0)- And more...
Documentation
- Added comprehensive dartdoc comments
- Updated README with v2.1 features
- Added migration guide
Breaking Changes #
None - fully backward compatible with v2.0.x
2.0.0 #
This is a major release with many new features while maintaining backward compatibility with v1.x.
New Features #
Prebuilt Presets
- Added
EmptyViewPresetsclass with 12 ready-to-use empty state configurations:noInternet- No internet connection stateemptyCart- Empty shopping cart statenoSearchResults- No search results state (with searchTerm support)noNotifications- No notifications statenoMessages- No messages statenoFavorites- No favorites/bookmarks stateerror- Error state with custom messagenoData- No data available statelocationRequired- Location permission required statemaintenance- Under maintenance statenoOrders- No orders statenoFiles- No files state
Animations
- Added entrance animations with
enableAnimationparameter - Added
EmptyViewAnimationenum with animation types:none- No animationfadeIn- Fade in effectslideUp- Slide up with fadeslideDown- Slide down with fadescale- Scale up with fadebounce- Bounce effect with elastic curve
- Added
animationDurationparameter for custom timing - Added
animationCurveparameter for custom animation curves
Lottie Animation Support
- Added
lottiePathparameter for Lottie animations - Supports both asset files and network URLs
- Added
lottieRepeatandlottieReverseparameters
Shimmer Skeleton Loading
- Added
showShimmerparameter for shimmer effect - Added
EmptyView.skeleton()factory constructor - Added
shimmerBaseColorandshimmerHighlightColorparameters - Automatic dark mode detection for shimmer colors
Icon Support
- Added
iconparameter for Material icons - Added
iconColorandiconSizeparameters - Added
showIconBackgroundfor circular background container - Added
iconBackgroundColorparameter
Secondary Action Button
- Added
secondaryButtonTextparameter - Added
onSecondaryButtonTapcallback - Added
isSecondaryLoadingparameter
Retry Logic
- Added
onRetryparameter for automatic retry handling - Added
maxRetriesparameter (default: 3) - Added
retryDelayparameter (default: 2 seconds)
Platform Adaptive Styling
- Added
adaptiveparameter for platform-specific styling - Automatic Cupertino buttons on iOS
- Material buttons on Android
Accessibility
- Added
semanticLabelparameter for custom screen reader labels - Automatic semantic labels from title and description
Dark Mode
- Automatic dark mode detection
- Theme-aware default colors
- Added
EmptyViewStyle.dark()factory
EmptyViewStyle Enhancements #
New Properties
secondaryButtonColor- Secondary button colorsecondaryButtonTextColor- Secondary button text colordarkModeBackgroundColor- Dark mode backgrounddarkModeTitleColor- Dark mode title colordarkModeDescriptionColor- Dark mode description colordescriptionBottomSpacing- Spacing below descriptionbuttonSpacing- Spacing between buttonsbuttonBorderColor- Button border colorbuttonBorderWidth- Button border widthbuttonElevation- Button elevationiconSizeFactor- Icon size multipliericonBackgroundColor- Icon container backgroundiconContainerPadding- Icon container padding
New Factory Constructors
EmptyViewStyle.dark()- Dark mode optimized styleEmptyViewStyle.minimal()- Minimal spacing styleEmptyViewStyle.compact()- Compact style for small spacesEmptyViewStyle.spacious()- Spacious style with more paddingEmptyViewStyle.rounded()- Pill-shaped button style
Other Improvements
- Added
==operator andhashCodefor equality comparison
Dependencies #
- Added
lottie: ^3.1.0for Lottie animation support - Added
shimmer: ^3.0.0for shimmer skeleton loading
Breaking Changes #
None - fully backward compatible with v1.x
1.0.0 #
- Initial release
- Smart image source detection (network, file, SVG, asset)
- Customizable styling via
EmptyViewStyle - Action button with loading state support
- Custom widget support for image and button
- Responsive design adapts to screen sizes
- Full documentation and example app