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

onboarding 표지
패키지 상세v4.0.2

onboarding

이것은 개발자가 Flutter 애플리케이션용 온보딩 랜딩 페이지를 만들 수 있도록 해주는 위젯입니다.

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
3.7천
좋아요
203
Pub 점수
140

패키지 설치

flutter pub add onboarding

패키지 개요

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

온보딩 패키지는 플러터 애플리케이션에서 온보딩 랜딩 페이지를 생성하기 위한 사용자 정의 가능한 위젯을 제공합니다. 개발자는 앱 기능이나 설정 단계를 사용자가 안내받을 수 있도록 상호작용형이며 스와이프 가능한 튜토리얼을 설계할 수 있습니다. 안드로이드, iOS, 웹, 맥OS, 윈도우, 리눅스 등 여러 플랫폼을 지원하여 일관된 사용자 경험을 보장합니다. 가벼운 크기로 간단한 pub add 명령어를 사용해 기존 플러터 프로젝트에 원활하게 통합 가능하며, 깔끔한 API를 통해 콘텐츠, 스타일 및 탐색 동작을 쉽게 맞춤설정할 수 있습니다.

사용 사례

  • 앱 온보딩 흐름
  • 사용자 튜토리얼 화면
  • 기능 소개 가이드
  • 초기 사용자 경험
  • 제품 안내

주요 기능

  • 스와이프 가능한 캐러셀 인터페이스
  • 슬라이드별 사용자 정의 콘텐츠
  • 내장형 탐색 컨트롤
  • 크로스 플랫폼 호환성
  • pub를 통한 간편한 통합
  • 스타일링 유연성

적합한 대상

  • 새 앱 출시
  • 교육 앱
  • 신규 사용자 온보딩
  • 모바일 우선 애플리케이션
  • 다중 플랫폼 앱

고려 사항

  • 네비게이션 로직을 수동으로 처리해야 합니다
  • 제한된 내장 애니메이션
  • 내장된 진행률 표시기가 없음
  • 사용자 정의 UI 구현에 따라 다릅니다
  • 복잡한 전환에 최적화되지 않음

원본 README

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

onboarding

Onboarding is a sample flutter onboarding plugin you can use to attract first-time users when they land on your page, hence the name onboarding. The widget gives you a header and footer builder along side your swipe-able widget. The widget also gives you a painter base class you can extend to build your own custom indicators.

Environment

sdk: ">=2.12.0 <3.0.0"

flutter: ">=1.17.0"

Getting Started

To get started using this widget, you will need to first import the package inside your project following the installation guide found on peb.dev/packages/onboarding.

  dependencies:
    onboarding: ^4.0.2+

$ flutter pub get

Usage

To use this widget,

  1. import 'package:onboarding/onboarding.dart'; inside your dart file

  2. Utilize the widget as bellow:

Onboarding(
  swipeableBody: ..., //[List<Widget>] - List of swipeable widgets 
  startIndex: ..., //[int] - the starting index of the swipeable widgets
  onPageChanges:(netDragDistance,pagesLength,currentIndex, slideDirection){
    //1) [pagesLength] The drage distance from swipping
    //2) [pagesLength] The length of the swipeable widgets
    //3) [currentIndex] The currect index 
    //4) [slideDirection] The slide direction
  },
  buildHeader:(context, netDragDistance, pagesLength, currentIndex, setIndex, slideDirection){
    //Use this to build a header in your onboarding that will display at all times. (Used to build routing buttons, indicators, etc)
    //This is same as onPageChanges but with [setIndex] added to allow u to change the index from this header
  },
  buildFooter:(context, netDragDistance, pagesLength, currentIndex, setIndex, slideDirection){
    //Use this to build a footer in your onboarding that will display at all times. (Used to build routing buttons, indicators, etc)
  },
  animationInMilliseconds: ..., //[int] - the speed of animations in ms
)
  1. There are 4 built-in indicator painters: LinePainter, CirclePainter, SquarePainter, and TrianglePainter. You can get started right away with these indicators as shown in the UI example demonstrations.

  2. If you want custom indicators to show your page changes, look at the example section bellow showing how to create custom indicators

Examples With Different Indicators

This widget uses the custom painter class to render the page changing indicators used to show the progress of the pages swiped. As such, we've designed this widget to enable you to access the CustomerPainter's functionalities through the ShapePainter class to be able to draw your own custom indicators. By default, the widget comes with 4 simple painters that render commonly used shapes. The 4 default painters are LinePainter, CirclePainter, SquarePainter, and TrianglePainter. All the example UIs shown bellow are using these painters and there are examples in the example folder showing you how to use these indicators.

Examples with default indicators

These examples are using the default indicator painter that come with this widget.

Sample Indicator Usage

Once you have decided to place your indicator in your app, simple pick your indicator painter choice from LinePainter, TrianglePainter, CirclePainter, SquarePainter, or your own custom painter and use it like the example bellow showing LinePainter painter example.

Indicator<LinePainter>(
  painter: LinePainter(
    currentPageIndex: currentIndex,
    pagesLength: pagesLength,
    netDragPercent: dragDistance,
    activePainter: activePainter,
    inactivePainter: inactivePainter,
    lineWidth: 20,
    translate: false,
  ),
)

For a full example, check this out

Creating your own custom indicators

If you want to paint, draw, render, etc your own indicator, you can easily do so using the ShapePainter class as shown bellow. You can also see the 4 default painters we've created here to see how we created the indicators. Its super easy and allows you maximum customization.

Lets look at how we created the default LinePainter painter for example which is shown in one of the examples above:

class MyCustomIndicatorPainter extends ShapePainter {
  final double lineWidth;
  final bool translate;
  LinePainter({
    required final int pagesLength,
    required final double netDragPercent,
    required final int currentPageIndex,
    required final SlideDirection slideDirection,
    final Paint? activePainter,
    final Paint? inactivePainter,
    final bool? showAllActiveIndicators,
    this.lineWidth = 20.0,
    this.translate = false,
  }) : super(
          netDragPercent: netDragPercent,
          pagesLength: pagesLength,
          inactivePainter: inactivePainter,
          activePainter: activePainter,
          currentPageIndex: currentPageIndex,
          showAllActiveIndicators: showAllActiveIndicators,
          slideDirection: slideDirection,
        );

  @override
  bool shouldRepaint(covariant LinePainter oldDelegate) {
    return oldDelegate.lineWidth != this.lineWidth;
  }

  /*This helps to paint anything before the active and inactive indicators are painted,
    this means you can do transformations, translations, animations, etc that will affect 
    the enviroment the indicators will be painted on. In the example bellow, we're transforming the canvas
    the indicators are build on to transform horizontally based on the net drag
  */
  @override
  beforeIndicatorsRender(Canvas canvas, Size size) {
    if (translate) {
      final xTranslation = netDragPercent * pagesLength * (-lineWidth);
      canvas.transform(Matrix4.translationValues(xTranslation, 0, 0).storage);
    }
  }

  /*This will paint the active indicators as the name suggests
  */
  @override
  paintActiveIndicators(Canvas canvas, Size size, Paint paint, Path path) {
    final activeOffset1 = Offset(netDragPercent * lineWidth * pagesLength, 0.0);
    final activeOffset2 = Offset(activeOffset1.dx + lineWidth, 0.0);
    canvas.drawLine(activeOffset1, activeOffset2, paint);
  }

  /*This will paint the in-active indicators
  */
  @override
  paintInactiveIndicators(Canvas canvas, Size size, Paint paint, Path path) {
    final inActiveOffset = Offset(lineWidth * pagesLength, 0.0);
    canvas.drawLine(Offset.zero, inActiveOffset, paint);
  }
}


//Now to use your new painter indicator, wrap it inside the Indicator class and simply call it like a regular widget in your app:
Indicator<MyCustomIndicatorPainter>(
  painter: MyCustomIndicatorPainter(
    currentPageIndex: currentIndex,
    pagesLength: pagesLength,
    netDragPercent: dragDistance,
    activePainter: activePainter,
    inactivePainter: inactivePainter,
    lineWidth: 20,
    translate: false,
  ),
)

카테고리

소스 저장소

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

아직 데이터가 없습니다.