v_story_viewer 2.0.2 copy "v_story_viewer: ^2.0.2" to clipboard
v_story_viewer: ^2.0.2 copied to clipboard

A high-performance Flutter story viewer like WhatsApp/Instagram. Supports image, video, text, voice stories with 3D cube transitions.

2.0.2 #

New Features #

  • Built-in Text Parser - Lightweight regex-based text parsing for VTextStory:
    • Markdown-style formatting: Bold (**text**, __text__), Italic (*text*, _text_), Inline code (`code`)
    • Auto-detected links: URLs (http/https/www), Emails, Phone numbers
    • Social patterns: @mentions, #hashtags
    • Markdown links: [text](url) syntax
  • Tap Callbacks - Handle user interactions with parsed elements:
    • onUrlTap(String url) - URL/link taps
    • onPhoneTap(String phone) - Phone number taps
    • onEmailTap(String email) - Email taps
    • onMentionTap(String mention) - @mention taps (without @)
    • onHashtagTap(String hashtag) - #hashtag taps (without #)
  • Custom Styling - Override default styles for each parsed element type
  • Zero Dependencies - No external markdown or parsing packages required

Usage #

VTextStory(
  text: 'Hello **World**! Contact @john at john@email.com #flutter',
  enableParsing: true,
  parserConfig: VTextParserConfig(
    onMentionTap: (mention) => openProfile(mention),
    onHashtagTap: (tag) => searchHashtag(tag),
    onUrlTap: (url) => launchUrl(url),
    onPhoneTap: (phone) => launchDialer(phone),
    onEmailTap: (email) => launchEmail(email),
    // Optional custom styles
    boldStyle: TextStyle(fontWeight: FontWeight.w900),
    mentionStyle: TextStyle(color: Colors.blue),
  ),
  backgroundColor: Colors.purple,
  createdAt: DateTime.now(),
  isSeen: false,
)

2.0.1 #

Breaking Changes #

  • Enhanced Error Handling: onError callback now receives VStoryError instead of Object
    • Enables pattern matching for specific error handling
    • Includes original exception, stack trace, and structured error data

New Features #

  • Added VStoryError sealed class with 6 error types:
    • VStoryLoadError - General content loading failure
    • VStoryNetworkError - Network connectivity issues
    • VStoryTimeoutError - Request timeout with duration info
    • VStoryCacheError - Cache read/write failures
    • VStoryFormatError - Unsupported media format
    • VStoryPermissionError - Storage/network permission denied
  • Auto-classification of errors based on exception type and message
  • All errors include message, originalError, and stackTrace fields
  • Preset Configurations for cleaner API:
    • VStoryConfig.forOwner() - Optimized for viewing own stories (no reply, menu visible)
    • VStoryConfig.forViewer() - Optimized for viewing others' stories (reply + emoji visible)
    • VStoryConfig.minimal() - Clean, distraction-free viewing experience
  • Added VStoryConfig.copyWith() method for easy config customization
  • Story copyWith() Methods for immutable updates:
    • VImageStory.copyWith() - Create modified image story copies
    • VVideoStory.copyWith() - Create modified video story copies
    • VTextStory.copyWith() - Create modified text story copies
    • VVoiceStory.copyWith() - Create modified voice story copies
    • VCustomStory.copyWith() - Create modified custom story copies
  • VStoryGroup Helpers for easier story management:
    • unseenStories - List of unseen stories
    • seenStories - List of seen stories
    • firstUnseenStory - First unseen story or null
    • latestStory - Most recently created story
    • oldestStory - Oldest story in the group

Migration Guide #

Error Handling

// Before (2.0.0)
onError: (group, item, error) {
  print('Error: $error');
}

// After (2.0.1)
onError: (group, item, error) {
  switch (error) {
    case VStoryNetworkError():
      showSnackBar('Check internet connection');
    case VStoryTimeoutError():
      showSnackBar('Request timed out');
    case VStoryCacheError():
      clearCache();
    case VStoryFormatError():
      log('Unsupported: ${error.format}');
    case VStoryPermissionError():
      requestPermission();
    case VStoryLoadError():
      log('Failed: ${error.message}');
  }
}

Preset Configurations

// Before (2.0.0) - Manual conditional configuration
VStoryViewer(
  config: VStoryConfig(
    showReplyField: !isMe,
    showEmojiButton: !isMe,
    showMenuButton: true,
  ),
  onMenuTap: isMe ? handleOwnerMenu : handleViewerMenu,
)

// After (2.0.1) - Clean preset configs
VStoryViewer(
  config: isMe ? VStoryConfig.forOwner() : VStoryConfig.forViewer(),
  onMenuTap: isMe ? handleOwnerMenu : handleViewerMenu,
)

// With customization
VStoryViewer(
  config: VStoryConfig.forViewer().copyWith(
    progressColor: Colors.blue,
    showEmojiButton: false,
  ),
)

Story copyWith

// Mark a story as seen
final seenStory = imageStory.copyWith(isSeen: true);

// Update caption
final updatedStory = videoStory.copyWith(caption: 'New caption!');

VStoryGroup Helpers

// Get unseen stories only
final unseen = group.unseenStories;

// Get the first unread story
final startAt = group.firstUnseenStory;

// Get the most recent story
final latest = group.latestStory;

2.0.0 #

  • Complete rewrite with sealed classes for story types
  • Added VImageStory, VVideoStory, VTextStory, VVoiceStory, VCustomStory
  • 3D cube transitions between user stories
  • Segmented progress bar with gradient ring indicator
  • RTL support for Arabic/Hebrew layouts
  • Keyboard navigation for desktop/web (arrow keys, space, escape)
  • Custom overlay support via overlayBuilder
  • Rich text support via richText and textBuilder
  • Exponential backoff retry for failed media (5 attempts)
  • 24-hour story expiry filtering
  • Comprehensive callbacks: onStoryViewed, onReply, onSwipeUp, onMenuTap, etc.
  • Custom header/footer builders via VStoryConfig
  • i18n support via VStoryTexts
  • Memory optimized: immediate dispose of video/audio controllers

1.0.0 #

  • Initial release
4
likes
150
points
178
downloads

Publisher

verified publishervchatsdk.com

Weekly Downloads

A high-performance Flutter story viewer like WhatsApp/Instagram. Supports image, video, text, voice stories with 3D cube transitions.

Repository (GitHub)
View/report issues

Topics

#story-viewer #instagram-stories #whatsapp-stories #story #v-story-viewer

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

audioplayers, emoji_picker_flutter, extended_image, flutter, flutter_cache_manager, timeago, video_player

More

Packages that depend on v_story_viewer