搜索插件、代码仓与 APP 分类

GitHub 代码仓vanelizarov/flutter_stories

flutter_stories

为您的应用带来故事机制的 Flutter 小部件

flutter_stories 项目封面
星标
35
复刻
26
最近推送(UTC)
2024年6月21日
项目状态
未归档

原始 README

以下为英文项目原文快照,最新内容请访问 GitHub。

flutter_stories

example

Widget that brings stories mechanism to your apps

Advantages:

  • Simple to use and intuitive API
  • Lightweight (~200 lines of code)
  • Feels familiar if you've used Instagram or Snapchat stories before
  • Can be used with Cupertino and Material packages independently

Usage

Add flutter_stories to your pubspec.yaml

Example

Full version can be found in example dir

showcase

Supported gestures

  • Tap the right portion of the screen to switch to the next moment. You can specify onFlashForward callback to control app behavior in this case or when story finishes
  • Tap the left portion of the screen to switch to the previous moment. Similar to right tap, but uses onFlashBack
  • Long press (hold) the screen to hide the progress segments and pause story, release to show controls and unpause

API

property type required description
momentCount int true Sets the number of moments in story
momentDurationGetter (int index) => Duration true Function that must return Duration for each moment
momentBuilder (BuildContext context, int index) => Widget true Builder that gets executed for each moment
onFlashForward () => void false Gets executed when user taps the right portion of the screen on the last moment in story or when story finishes playing
onFlashBack () => void false Gets executed when user taps the left portion of the screen on the first moment in story
startAt int false Defaults to 0. Sets the index of the first moment that will be displayed
momentSwitcherFraction double false Defaults to 0.33. `sets the ratio of left and right tappable portions of the screen: left for switching back, right for switching forward
progressSegmentBuilder (BuildContext context, double progress, double gap) => Widget false Defaults to Story.instagramProgressSegmentBuilder - Instagram-like minimalistic segment builder. Builder for each progress segment
progressSegmentGap double false Defaults to 2.0. Sets the gap between each progress segment
progressOpacityDuration Duration false Defaults to Duration(milliseconds: 300). Sets the duration for the progress bar show/hide animation
topOffset double false Defaults to MediaQuery.of(context).padding.top. Sets the top offset of progress container
fullscreen bool false Defaults to true. If true hides the status bar via SystemChrome service
Ivan Elizarov GitHub avatar
GitHub 作者

Ivan Elizarov ↗

@MobileTeleSystemsMoscow, Russia
语言DartRubySwiftKotlinObjective-C

此仓库发布的插件

使用的依赖

依赖清单 2 项

  • flutter{"sdk":"flutter"}
  • flutter_test开发依赖{"sdk":"flutter"}

如何选择适合项目的代码仓?

先按使用场景筛选,再比较项目活跃情况,最后到原始仓库核对使用要求。

  1. 通过仓库名、作者或描述搜索,再按技术分类缩小范围。
  2. 结合星标、复刻与最近推送比较项目;星标反映社区关注,不代表质量保证。
  3. 使用前在 GitHub 核对 README、许可证与 Issues。

来源与维护

“A repository is the most basic element of GitHub.”

GitHub Docs — About repositories ↗