패키지, 저장소 및 앱 카테고리 검색

story_time 표지
패키지 상세v1.0.6

story_time

story의 포크로, 인스타그램 스토리와 유사한 UI를 제공하며, 풍부한 애니메이션과 원래 패키지보다 더 많은 사용자 정의 기능을 갖추고 있습니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
135
좋아요
51
Pub 점수
150

패키지 설치

flutter pub add story_time

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Story_time은 원본 대응 제품과 비교하여 부드러운 애니메이션과 향상된 사용자 정의 기능을 제공하는 인스타그램 스타일의 스토리 인터페이스를 제공하는 플러터 패키지입니다. 개발자는 스와이프 탐색, 타이머 및 다양한 미디어 지원을 갖춘 상호작용식 전체 화면 스토리 경험을 만들 수 있습니다. 이 패키지는 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스를 지원하며, 매력적인 스토리 형식 콘텐츠 표시가 필요한 크로스플랫폼 애플리케이션에 이상적입니다. 광범위한 사용자 정의 옵션을 통해 다양한 디자인 요구 사항에 맞게 외관과 동작을 세밀하게 조정할 수 있습니다.

사용 사례

  • 인터랙티브 스토리 피드
  • 소셜 미디어 앱 기능
  • 사용자 온보딩 튜토리얼
  • 콘텐츠 하이라이트 리얼
  • 매력적인 마케팅 캠페인

주요 기능

  • 풍부한 애니메이션
  • 스와이프 탐색
  • 크로스 플랫폼 지원
  • 높은 사용자 정의 가능한 UI
  • 타이머 기반 스토리 진행
  • 미디어 풍부한 스토리 카드

적합한 대상

  • 모바일 및 웹 앱
  • 소셜 네트워킹 기능
  • 온보딩 경험
  • 마케팅 및 프로모션
  • 크리에이티브 콘텐츠 플랫폼

고려 사항

  • 상태 관리에 신중한 조치가 필요합니다
  • 무거운 미디어와 함께 성능에 영향을 줄 수 있음
  • 사용자 정의 스타일을 사용하려면 Flutter 위젯에 익숙해야 합니다
  • 기본 설정 외에 문서가 제한적
  • 매우 긴 스토리 시퀀스에 최적화되지 않음

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

story_time

pub package License: MIT

A fork of story. Instagram stories like UI with rich animations and even more customizability than the original package.

final 2

Usage

StoryPageView needs at least three arguments: itemBuilder, pageLength, and storyLength.

/// Minimum example to explain the usage.
return Scaffold(
  body: StoryPageView(
    itemBuilder: (context, pageIndex, storyIndex) {
      return Center(
        child: Text("Index of PageView: $pageIndex Index of story on each page: $storyIndex"),
      );
    },
    storyLength: (pageIndex) {
      return 3;
    },
    pageLength: 4,
  );
  • itemBuilder is necessary to build the content of story. It is called with index of pageView and index of the story on the page.

  • storyLength decides the length of story for each page. The example above always returns 3, but it should depend on the argument pageIndex

  • pageLength is just the length of StoryPageView

The example above just shows 12 stories by 4 pages, which is not practical.

This one is the proper usage, extracted from example.

return Scaffold(
  body: StoryPageView(
    itemBuilder: (context, pageIndex, storyIndex) {
      final user = sampleUsers[pageIndex];
      final story = user.stories[storyIndex];
      return Stack(
        children: [
          Positioned.fill(
            child: Container(color: Colors.black),
          ),
          Positioned.fill(
            child: Image.network(
              story.imageUrl,
              fit: BoxFit.cover,
            ),
          ),
          Padding(
            padding: const EdgeInsets.only(top: 44, left: 8),
            child: Row(
              children: [
                Container(
                  height: 32,
                  width: 32,
                  decoration: BoxDecoration(
                    image: DecorationImage(
                      image: NetworkImage(user.imageUrl),
                      fit: BoxFit.cover,
                    ),
                    shape: BoxShape.circle,
                  ),
                ),
                const SizedBox(
                  width: 8,
                ),
                Text(
                  user.userName,
                  style: TextStyle(
                    fontSize: 17,
                    color: Colors.white,
                    fontWeight: FontWeight.bold,
                  ),
                ),
              ],
            ),
          ),
        ],
      );
    },
    gestureItemBuilder: (context, pageIndex, storyIndex) {
      return Align(
        alignment: Alignment.topRight,
        child: Padding(
          padding: const EdgeInsets.only(top: 32),
          child: IconButton(
            padding: EdgeInsets.zero,
            color: Colors.white,
            icon: Icon(Icons.close),
            onPressed: () {
              Navigator.pop(context);
            },
          ),
        ),
      );
    },
    pageLength: sampleUsers.length,
    storyLength: (int pageIndex) {
      return sampleUsers[pageIndex].stories.length;
    },
    onPageLimitReached: () {
      Navigator.pop(context);
    },
  ),
);
  • gestureItemBuilder is the builder for the widgets which needs gesture actions.

In this case, IconButton to close the page is in the callback.

You CANNOT place the gesture widgets in itemBuilder because it is covered and disabled by default story gestures.

  • onPageLimitReached is called when the very last story is finished.

  • It is recommended to use data model with two layers. In this case, UserModel which has the list of StoryModel

/// Example Data Model
class UserModel {
  UserModel(this.stories, this.userName, this.imageUrl);

  final List<StoryModel> stories;
  final String userName;
  final String imageUrl;
}

class StoryModel {
  StoryModel(this.imageUrl);

  final String imageUrl;
}

Controlling animations

My point of forking the original package was to add the ability to control the duration of a specific index of a story. Look at the example to see how to use it if you are interested.

Callbacks for pausing and unpausing stories

The package also supports adding callbacks for pausing and unpausing a story to the StoryPageView widget. See the example project for more details.

Callbacks for moving to a different page

The package also supports adding callbacks for going a page backwards and for going a page forwards to the StoryPageView widget. See the example project for more details.

Callbacks for moving to a different story

The package also supports adding a callback for whenever the story index changes to the StoryPageView widget. See the example project for more details.

Tips

This package is still under development. If you have any requests or questions, please ask on github

카테고리

의존성

의존성 목록 1 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.