搜尋套件、儲存庫與 APP 分類

story_view 封面
套件詳情v0.16.6

story_view

像 WhatsApp 與 Instagram 一樣顯示故事。可內聯/在 ListView 或 Column 中使用,就像 Google 新聞應用一樣。附帶手勢來暫停、快進與跳轉到上一頁。

AndroidiOSmacOS
近 30 天下載
2.2萬
喜歡數
822
Pub 分數
150

安裝套件

flutter pub add story_view

套件介紹

根據套件公開資料產生的選型評估,僅供參考。

StoryView 是一個 Flutter 套件,讓開發者能夠顯示類似 WhatsApp 和 Instagram 的互動式、可滑動故事。它支援在列表或欄位中內嵌整合,非常適合新聞訊息或社群媒體應用。該套件內建暫停、前進以及在故事頁面之間導航的手勢。專為跨平台流暢效能設計,可在 Android、iOS 和 macOS 上順暢運作。透過 pub add 進行最少設定,StoryView 即可提供類似原生的故事體驗,並支援自訂控制項與動畫。

適用情境

  • 社交媒體故事動態
  • 新聞應用內容顯示
  • 應用內故事功能
  • 用戶參與活動
  • 互動式產品導覽

主要特色

  • 滑動瀏覽故事
  • 暫停和恢復功能
  • 基於手勢的控制
  • ListView/Column 中的內聯放置
  • 跨平台支援(Android、iOS、macOS)

適合對象

  • 需要Instagram風格故事UI的應用
  • 內容密集型應用
  • 以參與度驅動的移動體驗
  • 尋求簡單故事實現的開發者
  • 需要豐富手勢互動的專案

使用建議

  • 可能需要針對長故事序列進行優化
  • 故事卡片設計的自定義選項有限
  • 依賴外部圖像/影片載入才能實現完整功能
  • 不適合用於超出基本轉換的複雜動畫
  • 使用高解析度媒體時效能可能會有所差異

原始 README

以下為關聯原始碼儲存庫的 README 原文快照,最新內容請造訪原始碼儲存庫。

story_view Pub

Story view for apps with stories.

story_view

🍟 Watch video demo here: story_view demo

👨‍🚀 Demo project here: storyexample

This a Flutter widget to display stories just like Whatsapp and Instagram. Can also be used inline/inside ListView or Column just like Google News app. Comes with gestures to pause, forward and go to previous page.

Features

🕹 Still image, GIF and video support (with caching enabled)

📍 Gesture for pause, rewind and forward

⚜️ Caption for each story item

🎈 Animated progress indicator for each story item

📱 Fullscreen or inline

And useful callback to perform meta functionalities including vertical swipe gestures.

Installation

To use this plugin, add story_view as a dependency in your pubspec.yaml file.

Usage

Import the package into your code

import "package:story_view/story_view.dart";

Look inside examples/example.dart on how to use this library. You can copy and paste the code into your main.dart and run to have a quick look.

Basics

Use StoryView to add stories to screen or view heirarchy. StoryView requires a list of StoryItem, each of which describes the view to be displayed on each story page, duration and so forth. This gives you the freedom to customize each page of the story.

There are shorthands provided to create common pages.

StoryItem.text is a shorthand to create a story page that displays only text.

StoryItem.pageImage creates a story item to display images with a caption.

StoryItem.inlineImage creates a story item that is intended to be displayed in a linear view hierarchy like List or Column

🍭 Both .inlineImage and pageImage support animated GIFs.

StoryItem.pageVideo creates a page story item with video media. Just provide your video url and get going.

Story controller, loaders and GIF support

While images load, it'll be a better experience to pause the stories until it's done. To achieve this effect, create a global instance of StoryController and use the shorthand StoryItem.pageImage or StoryItem.inlineImage while passing the same controller instance to it.

...
final controller = StoryController();

@override
Widget build(context) {
  List<StoryItem> storyItems = [
    StoryItem.text(...),
    StoryItem.pageImage(...),
    StoryItem.pageImage(...),
    StoryItem.pageVideo(
      ...,
      controller: controller,
    )
  ]; // your list of stories

  return StoryView(
    storyItems,
    controller: controller, // pass controller here too
    repeat: true, // should the stories be slid forever
    onStoryShow: (s) {notifyServer(s)},
    onComplete: () {},
    onVerticalSwipeComplete: (direction) {
      if (direction == Direction.down) {
        Navigator.pop(context);
      }
    } // To disable vertical swipe gestures, ignore this parameter.
      // Preferrably for inline story view.
  )
}

🍭 Now, tell your users some stories.

Docs

Find docs from here: pub.dev/story_view

所屬分類

依賴

依賴清單 4 項

原始碼儲存庫

使用此套件的專案