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

flutter_instagram_stories 封面
套件詳情v1.0.3+4

flutter_instagram_stories

顯示故事(影片和圖片),類似於 WhatsApp 與 Instagram。

近 30 天下載
69
喜歡數
176
Pub 分數
80

安裝套件

flutter pub add flutter_instagram_stories

套件介紹

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

一個 Flutter 套件,讓開發者能夠顯示支援圖片和影片的故事,模擬 Instagram 與 WhatsApp 的外觀與感覺。它提供一個乾淨、可自訂的介面,用於以全螢幕滑動格式呈現連續媒體內容。此套件設計簡單,易於整合至現有應用程式中。支援故事之間的自動進展,並允許自訂外觀與行為。非常適合社交應用、訊息平台,或任何需要類似故事體驗的應用。

適用情境

  • 社群媒體應用
  • 訊息應用程式
  • 內容分享平台
  • 使用者資料亮點
  • 互動敘事功能

主要特色

  • 圖像和影片故事支援
  • 滑動導航
  • 自動切換故事
  • 可自定義的使用者介面
  • 全螢幕簡報
  • 透過 pub.dev 的簡單整合

適合對象

  • 開發社交功能的開發者
  • 需要類似故事介面的應用程式
  • 包含豐富媒體內容的項目
  • 行動優先的設計實作
  • 快速原型設計互動式資訊流

使用建議

  • 有限的平台特定優化
  • 無內建分析追蹤
  • 需要手動處理故事完成事件
  • 最基本的使用之外的最小文件
  • 不支援故事回覆或反應

原始 README

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

flutter_instagram_stories Pub

If you need a help to implement stories in your app, contact me https://github.com/awaik

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.

<key>NSAppTransportSecurity</key>
  <dict>
    <key>NSAllowsArbitraryLoads</key>
    <true/>
  </dict>

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
  • Android https://firebase.google.com/docs/flutter/setup?platform=android
  • iOS https://firebase.google.com/docs/flutter/setup?platform=ios
  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%

Important! Pay attention to array, map types. Otherwise you will have a null error https://github.com/awaik/flutter_instagram_stories/issues/20

Data structure

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

所屬分類

依賴

原始碼儲存庫

使用此套件的專案

暫無相關資料。