yu_file_preview 0.1.1
yu_file_preview: ^0.1.1 copied to clipboard
Full-screen media preview for Flutter. Integrates yuni_photo_view, yu_ni_image_widget, and yu_ni_player. Supports image, video, multi-platform UI.
Changelog #
All notable changes to the yu_file_preview project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.1.0 - 2024-04-20 #
Added #
Core Features
- FilePreview Entry Class: Unified
FilePreview.show()method for opening media previews - FilePreviewItem Abstract Class: Data model abstraction for external business models
- FilePreviewSource: Support for both URL and local file sources with custom headers
- Multi-Platform Support: Automatic platform detection (phone/tablet/desktop) with adaptive UI
Renderers
- DefaultImageRenderer: Image rendering with thumbnail-to-original loading
- DefaultVideoRenderer: Video playback with player pool management
- DefaultUnknownRenderer: Placeholder for unsupported file types
- Custom Renderer Support: Register custom renderers for PDF, documents, etc.
UI Components
- DefaultTopBar: Mobile top bar with back button and menu
- DefaultBottomBar: Mobile bottom bar with action buttons
- DefaultDesktopChrome: Desktop/tablet chrome with navigation arrows and thumbnail navigator
- DefaultOverlayBuilder: Page overlay with Live Photo badge and like button
Independent Components
- OriginalImageButton: Reusable button for loading original images with progress
- LivePhotoBadge: Live Photo badge with long-press video playback
- VideoPlayButton: Reusable video play button
- ZoomButtons: Desktop zoom in/out buttons
Platform Adaptation
- FpPlatformDetector: Automatic platform detection based on screen size
- createDefaultViewerConfig(): Platform-specific interaction configurations
- Phone: Mobile UI with swipe gestures
- Tablet: Desktop UI with swipe gestures enabled
- Desktop: Desktop UI with keyboard/mouse navigation only
Features
- Hero Animation: Smooth transition from thumbnail to full-screen
- Original Image Loading: Download and display high-resolution images
- Live Photo Support: Display badge and play video on long-press
- Custom Menu Actions: Inject business-specific menu items
- Info Panel: Swipe-up info panel (bottom on mobile/tablet, right drawer on desktop)
- Video Player Pool: Efficient video player resource management
- App Lifecycle Handling: Pause video when app goes to background
Documentation #
- Comprehensive README with quick start guide
- Example app with 6 demo pages:
- Main preview (aligned with main project)
- Image preview with Hero animation
- Video preview with playback controls
- Custom renderer example (PDF placeholder)
- Custom menu example
- Custom chrome example
Testing #
- Property-based tests for core logic:
- Property 1: Renderer dispatch correctness
- Property 2: Menu completeness
- Property 3: Platform detection consistency
- Property 4: Platform detection rules
- Property 5: Config mapping correctness
- Test data generators for random input generation
- 100 iterations per property test
Dependencies #
yuni_photo_view: Full-screen viewer frameworkyu_ni_image_widget: Image rendering componentyu_ni_player: Video playback componentyuni_widget: Theme token systemflutter_cache_manager: Image caching (via imlib)
[Unreleased] #
Planned #
- Additional property-based tests for UI components
- Integration tests for complete workflows
- Performance optimization for large media lists
- Accessibility improvements
- More example pages demonstrating advanced usage
Version History #
- 0.1.0 (2024-04-20): Initial release with core features, multi-platform support, and comprehensive documentation