Stories like in Instagram, each story can include multiple images and videos. Package supports video, titles, preliminary caching.

Overview

flutter_instagram_stories Pub

A Flutter package for displaying stories just like Whatsapp & Instagram. Built-in groups (multiple stories with one icon), cache, video, gifs.

The package can be used in any app for displaying news, educational content and etc. Look the sample app here.

Note: This package is under active development, and there are some known bugs and a lot of features to implement. Please, add issues or feature requests here: issue

The project was initially copied from https://github.com/blackmann/story_view - great thanks for this excellent package. In case, you need more flexible functionality, you can check the original repository.

Showcase|100x100, 10%

Important notes:

  1. For now, the package works with Firebase only.
  2. This is a first beta version, please add all issues and feature requests here: issue

Features

  • Only one line of code to implement this package to the app.
  • Display images, gifs, videos.
  • Adjustable titles on icons.
  • Preliminary caching after app started.
  • Multilanguage support.
  • Callback when a user closed stories - helps to implement subscriptions after first launch and etc.

Installing

Look how to install here https://pub.dev/packages/flutter_instagram_stories#-installing-tab-

Now in your Dart code, you can use:

import 'package:flutter_instagram_stories/flutter_instagram_stories.dart';

iOS

For playing video, the package uses official video_player https://pub.dev/packages/video_player

From documentation:

  1. Warning: The video_player plugin doesn’t work on iOS simulators. You must test videos on real iOS devices.

  2. For iOS, add the following to the Info.plist file found at /ios/Runner/Info.plist.

''' NSAppTransportSecurity NSAllowsArbitraryLoads '''

Usage

You can find a complete working example here https://github.com/awaik/flutter_instagram_stories/tree/master/example

Dart code

Connect to the collection where you keep stories

    static String collectionDbName = 'instagram_stories_db';
    CollectionReference dbInstance =
      Firestore.instance.collection(collectionDbName);

And add stories full functionality to your app.

    FlutterInstagramStories(
        collectionDbName: collectionDbName,
        showTitleOnIcon: true,
        backFromStories: () {
          _backFromStoriesAlert();
        },
        iconTextStyle: TextStyle(
          fontSize: 14.0,
          color: Colors.white,
        ),
        iconImageBorderRadius: BorderRadius.circular(15.0),
        iconBoxDecoration: BoxDecoration(
          borderRadius: BorderRadius.all(Radius.circular(15.0)),
          color: Color(0xFFffffff),
          boxShadow: [
            BoxShadow(
              color: Color(0xff333333),
              blurRadius: 10.0,
              offset: Offset(
                0.0,
                4.0,
              ),
            ),
          ],
        ),
        iconWidth: 150.0,
        iconHeight: 150.0,
        textInIconPadding:
            EdgeInsets.only(left: 8.0, right: 8.0, bottom: 12.0),
        //how long story lasts in seconds
        imageStoryDuration: 7,
        progressPosition: ProgressPosition.top,
        repeat: true,
        inline: false,
        languageCode: 'en',
        backgroundColorBetweenStories: Colors.black,
        closeButtonIcon: Icon(
          Icons.close,
          color: Colors.white,
          size: 28.0,
        ),
        closeButtonBackgroundColor: Color(0x11000000),
        sortingOrderDesc: true,
        lastIconHighlight: true,
        lastIconHighlightColor: Colors.deepOrange,
        lastIconHighlightRadius: const Radius.circular(15.0),
        captionTextStyle: TextStyle(
          fontSize: 22,
          color: Colors.white,
        ),
        captionMargin: EdgeInsets.only(
          bottom: 50,
        ),
        captionPadding: EdgeInsets.symmetric(
          horizontal: 24,
          vertical: 8,
        ),
      ),

Firestore database

The package works with Firestore database and package https://pub.dev/packages/cloud_firestore already included into the package.

You can use example with the sample database in the example folder, or, create your own database.

Steps to create:

  1. Add Firebase to your app
  1. Create Firestore database
  • Create a collection with any name. After you will use this name in dart code only once.
  • Create documents inside the collection with exact structure, like on the image below

Showcase|100x100, 10%

That's it! Now your app has instagram stories with caching and other powerful features.

Use cases in real apps

App for Android and iOS - https://lifext.app/

Lifext app

You might also like...

Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your device and upload them to Firebase.

Flutter Tutorial - Upload Files To Firebase Storage Upload Files To Firebase Storage with Flutter. Pick images, videos, or other files from your devic

Dec 28, 2022

Flutter plugin that saves images and videos to devices gallery

Gallery Saver for Flutter Saves images and videos from network or temporary file to external storage. Both images and videos will be visible in Androi

Nov 25, 2022

Dart package for Async Data Loading and Caching. Combine local (DB, cache) and network data simply and safely.

Dart package for Async Data Loading and Caching. Combine local (DB, cache) and network data simply and safely.

Stock is a dart package for loading data from both remote and local sources. It is inspired by the Store Kotlin library.

Dec 24, 2022

Flutter tableview - A flutter widget like iOS UITableview. let listView with section header and each section header will hover at the top.

Flutter tableview - A flutter widget like iOS UITableview. let listView with section header and each section header will hover at the top.

中文 flutter_tableview A flutter widget like iOS UITableview. let listView with section header and each section header will hover at the top. Installing

Jul 22, 2022

This repo provides a starter kit thats include Getx package.

This repo provides a starter kit thats include Getx package.

Getx_Starter This repo provides a starter kit thats include Getx package. It includes key-value databases, sample pages, and components which they are

Apr 27, 2022

A beautiful, secure and simple authenticator app that supports multiple protocols and services. Free and open source. Written in Flutter and Dart.

A beautiful, secure and simple authenticator app that supports multiple protocols and services. Free and open source. Written in Flutter and Dart.

OpenAuth A beautiful, secure and simple authenticator app that supports multiple protocols and services. Free and open source. Written in Flutter and

Oct 5, 2022

Package to get details of the Instagram user and download reels video.

Package to get details of the Instagram user and download reels video.

Flutter package to get Instagram user details and download reels videos. How to Use To use flutter_insta, first start by importing the package. import

Nov 12, 2022

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.

Flutter package to render html as widgets that supports hyperlink, image, audio, video, iframe and many other tags.

HtmlWidget monorepo This repo contains the source code for everything HtmlWidget-related. Name Link flutter_widget_from_html_core flutter_widget_from_

Jan 6, 2023

Flutter shareable package of object-oriented classes for local caching of user data in json

Flutter shareable package of object-oriented classes for local caching of user data in json

json_cache Json Cache is an object-oriented package to serve as a layer on top of local storage packages - packages that persist data locally on the u

Dec 19, 2022
Comments
  • Flexible ontap/gesture event

    Flexible ontap/gesture event

    I can't get why you are using pushAndRemoveUntil for showing stories while it could be made by push. It will be better and less laggy as with removing all the pages now.

    opened by JSBmanD 4
  • Missing license

    Missing license

    This library should include my license since it makes use of most of my original codebase.

    As good practice, your library should make use of story_view package rather than copying the source over verbatim. Your implementation is great and builds upon the base functionality of story_view. It will be better if you rather made that separation and whatever improvements made to the story_view part can be shared with the original library.

    I find it that this library still has the same core limitations identified in the original story_view. And I am skeptical of the fact that, fixes I may author in future will also just be copied over verbatim like this.

    Let's do good!

    opened by blackmann 3
  • _CastError (type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'List<dynamic>?' in type cast)

    _CastError (type '_InternalLinkedHashMap' is not a subtype of type 'List?' in type cast)

    Stories _$StoriesFromJson(Map<String, dynamic> json) { return Stories( storyId: json['storyId'] as String?, date: json['date'] == null ? null : DateTime.parse(json['date'] as String), file: (json['file'] as List<dynamic>?)?.map((e) => StoryData.fromJson(e as Map<String, dynamic>)).toList(), previewImage: json['previewImage'] as String?, previewTitle: (json['previewTitle'] as Map<String, dynamic>?)?.map( (k, e) => MapEntry(k, e as String), ), ); }

    opened by Cengizhan00 7
  • _TypeError was thrown building RawGestureDetector(state: RawGestureDetectorState#1ad0d(gestures: [vertical drag])): type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse'

    _TypeError was thrown building RawGestureDetector(state: RawGestureDetectorState#1ad0d(gestures: [vertical drag])): type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse'

    I have been having an issue trying to use the packages when upon on click the story, it will crash straight away. I wondering if you have faced similar issues in the past or anyone of the community have the same issue. @awaik

    The error I have been getting:
    ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
    The following _TypeError was thrown building   @@RawGestureDetector(state:
    RawGestureDetectorState#1ad0d(gestures: [vertical drag])):
    type '() => Null' is not a subtype of type '(() => StoryItem)?' of 'orElse'
    
    The relevant error-causing widget was:
      GestureDetector
      file:///Users/edwin/Development/flutter/.pub-cache/git/flutter_instagram_stories-eb421e9e12c7a9e6956036e0503158fe55f7b29d/lib/grouped_stories_view.dart:160:26
    
    When the exception was thrown, this was the stack:
    #0      ListMixin.firstWhere (dart:collection/list.dart)
    #1      StoryViewState.initState (package:flutter_instagram_stories/story_view.dart:337:41)
    #2      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:4711:57)
    #3      ComponentElement.mount (package:flutter/src/widgets/framework.dart:4548:5)
    ...     Normal element mounting (32 frames)
    #35     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
    #36     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6221:36)
    #37     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6232:32)
    ...     Normal element mounting (29 frames)
    #66     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3611:14)
    #67     Element.updateChild (package:flutter/src/widgets/framework.dart:3360:20)
    #68     ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4599:16)
    #69     StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:4746:11)
    #70     Element.rebuild (package:flutter/src/widgets/framework.dart:4267:5)
    #71     BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2582:33)
    #72     WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:875:21)
    #73     RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:328:5)
    #74     SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1144:15)
    #75     SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1082:9)
    #76     SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:998:5)
    #80     _invoke (dart:ui/hooks.dart:163:10)
    #81     PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:259:5)
    #82     _drawFrame (dart:ui/hooks.dart:126:31)
    (elided 3 frames from dart:async)
    
    20211112-173512 20211112-173519 20211112-173519
    opened by 0xDesolution 18
Owner
Alex Awaik
Android & iOS developer - Dart, Flutter, Swift
Alex Awaik
Memebaaz is a video/images sharing app, Anyone can share short videos and images through app, the media will go through admin's approval.

MemeBaaz - Memes & Short Videos App Memebaaz is a Video/images Sharing App, Anyone can share short videos and images through app, the media will go th

Rakesh K. 18 Nov 14, 2022
Flutter video compress - Generate a new file by compressed video, and provide metadata. Get video thumbnail from a video path, supports JPEG/GIF. To reduce app size not using FFmpeg in IOS.

flutter_video_compress Generate a new path by compressed video, Choose to keep the source video or delete it by a parameter. Get video thumbnail from

天海るり 179 Dec 8, 2022
A Video Player For Vimeo Videos in Flutter. This plugin allows us to play video from Vimeo and it supports Android and iOS platforms.

vimeo_video_player A Video Player For Vimeo Videos in Flutter. This plugin allow us to play video from vimeo and it's supports Android and iOS platfor

MindInventory 26 Dec 8, 2022
dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on background

dosdownloader Dos downloader app is developed for downloading video. You can download video from YouTube and Facebook. You can also play video on back

Md Abir Ahsan Tahmim 1 Dec 8, 2021
Flutter page widget that is dismissed by swipe gestures, with Hero style animations, Inspired by Facebook and Instagram stories.

dismissible_page ?? ?? Creates page that is dismissed by swipe gestures, with Hero style animations, Inspired by FB, IG stories. Live Demo Contents Su

Tornike 76 Dec 22, 2022
A simple way to share Instagram stories as an embedded feature within the Flutter application

Loopi Share A simple way to share Instagram stories as an embedded feature within the Flutter application. Introduction Words on both platforms Androi

Loopi 5 Sep 24, 2022
A flutter library for loading images from network, resizing as per container size and caching while being memory sensitive.

Optimized Cached Image A flutter library for loading images from network, resizing and caching them for memory sensitivity. This resizes and stores th

Anvith Bhat 76 Dec 20, 2022
Imagepickerweb - A picker with which you can pick images and videos from your Flutter web app

ImagePickerWeb This Web-Plugin allows Flutter Web to pick images (as File, Widget or Uint8List) and videos (as File or Uint8List). Many thanks goes to

Rebar Ahmad 40 Sep 26, 2022
Image editing using Paints, Text, Filters, Emoji and Sticker like stories, Built With Flutter

ImageEditorPro Image Editor Plugin with simple, easy support for image editing u

Kaushikkumar Godhani 4 Nov 13, 2022
Download files from Firebase Storage with Flutter. List all images, videos, or other files from Firebase and download them.

Flutter Tutorial - Download Files From Firebase Storage Download files from Firebase Storage with Flutter. List all images, videos, or other files fro

Johannes Milke 28 Dec 4, 2022