Code Monkey home page Code Monkey logo

flutter_stories's Introduction

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 pacakges 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 executed for each moment
onFlashForward () => void true gets executed when user taps the right portion of the screen on the last moment in story or when story finishes playing
onFlashBack () => void true gets executed when user taps the left portion of the screen on the first moment in story
startAt int false sets the index of the first moment that will be displayed. defaults to 0
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. builder for each progress segment. defaults to Instagram-like minimalistic segment builder
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

flutter_stories's People

Contributors

vanelizarov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.