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

flutter_villains 표지
패키지 상세v2.0.0

flutter_villains

flutter용 악당. 몇 줄의 코드만으로 페이지 전환을 구현하세요. 악당이 없으면 영웅은 무엇입니까?

AndroidiOSWebmacOSWindowsLinux
30일 다운로드
102
좋아요
83
Pub 점수
135

패키지 설치

flutter pub add flutter_villains

패키지 개요

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

Flutter Villains는 최소한의 코드로 Flutter 앱에서 매력적인 페이지 전환을 쉽게 만들 수 있도록 도와주는 패키지입니다. Flutter의 '히어로' 개념에 영감을 받아, 네비게이션 중에 이동하거나 변형되는 애니메이션 요소인 '빌런'을 도입하여 동적 시각 효과를 추가합니다. Android, iOS, Web, macOS, Windows, Linux 등 모든 주요 플랫폼을 지원합니다. 직관적인 API를 통해 복잡한 구현 없이 부드럽고 표현력 있는 전환을 통해 사용자 경험을 향상시킬 수 있습니다. 정교한 애니메이션으로 차별화하고 싶은 앱에 적합합니다.

사용 사례

  • 애니메이션 페이지 전환 만들기
  • 앱 탐색 시각 효과 향상
  • UI 흐름에 동적 효과 추가
  • 모션을 통한 사용자 참여도 향상
  • 시각적으로 풍부한 모바일 및 웹 앱 구축

주요 기능

  • 전환을 위한 간단한 API
  • 여러 플랫폼을 지원합니다
  • 부드러운 애니메이션 통합
  • 필요한 최소 코드
  • 사용자 정의 효과를 위한 확장 가능

적합한 대상

  • 빠른 전환 효과를 원하는 개발자
  • 시각적 완성도에 집중한 앱
  • 디자인 중심의 Flutter 프로젝트
  • 애니메이션 보일러플레이트를 줄이고자 하는 팀
  • 프론트엔드 중심의 Flutter 개발

고려 사항

  • 패키지 크기가 약간 증가할 수 있습니다
  • Flutter의 애니메이션 시스템에 대한 이해가 필요합니다
  • 성능 인식 설계와 함께 사용하는 것이 가장 좋습니다
  • 매우 간단한 앱에는 적합하지 않음
  • UX와 균형을 이루지 않으면 과도한 사용의 가능성이 있음

원본 README

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

license stars forks Pub GitHub followers Twitter Follow Build Status

flutter_villains

What are heroes without villains?

profile-page

(Profile image from: https://unsplash.com/photos/pAs4IM6OGWI)

Check out the article.

What are villains?

You keep seeing beautiful page transitions but you think to yourself those are too much work?

Fear no more, villains are here to save you!

When doing animations when a page transition occurs you'd usally define an AnimationController in the initState() and start it there. You'd also have to wrap your widgets in AnimatedWidgets to react to the AnimationController. Besides this being a lot of boilerplate code which clogs up you precious widgets, animating on exit isn't as trivial.

Using this library you just wrap your widget you'd like to be animated when a page transition occurs in a Villain and everything is handled automatically.

Installation

dependencies:
  flutter_villains: "^1.2.1"

Run packages get and import:

import 'package:flutter_villains/villain.dart';
Assembling pages with style

Define animations to play when a page is opened.

Easy to use
      Villain(
        villainAnimation: VillainAnimation.fromBottom(
          relativeOffset: 0.4,
          from: Duration(milliseconds: 100),
          to: Duration(seconds: 1),
        ),
        animateExit: false,
        secondaryVillainAnimation: VillainAnimation.fade(),
        child: Divider(
          color: Colors.black,
          height: 32.0,
        ),
      ),

That's it. No TickerProviders, no AnimationControllers, no boilerplate, no worries. Remember the StaggeredAnimation tutorial? This is using SequenceAnimation internally and there is therefore no need to specify durations as portions of a time-frame. It just works.

With this basic setup the Divider fades in and moves up when a page transition occures (don't forget the VillainTransitionObserver more on that under Code).

Flexible

The animation you'd like to use is not premade? Make it yourself with a few lines of code!

  static VillainAnimation fade(
          {double fadeFrom = 0.0,
          double fadeTo = 1.0,
          Duration from = Duration.zero,
          Duration to: _kMaterialRouteTransitionLength,
          Curve curve: Curves.linear}) =>
      VillainAnimation(
          from: from,
          curve: curve,
          to: to,
          animatable: Tween<double>(begin: fadeFrom, end: fadeTo),
          animatedWidgetBuilder: (animation, child) {
            return FadeTransition(
              opacity: animation,
              child: child,
            );
          });

Every VillainAnimation needs an Animatable (most of the time it's a Tween) and an AnimatedWidget. Everything else is handled automatically.

Code

There are two way of playing your villains.

  1. If you want them to automatically play when a page transition occurs (you probably want that) then add this to your MaterialApp
    return new MaterialApp(
      navigatorObservers: [new VillainTransitionObserver()],
  1. Play villains in a given context manually.
    VillainController.playAllVillains(context);
Secondary Animation

You can play up to two animations per Villain. You can always wrap Villains inside each other for infinite animations!

    Villain(
      villainAnimation: VillainAnimation.fromBottomToTop(0.4, to: Duration(milliseconds: 150)),
      animateExit: false,
      secondaryVillainAnimation: VillainAnimation.fade,
      child: Text(
        "Hi",
        style: Theme.of(context).textTheme.body1,
      ),
    ),
Extras

Define whether the villain should play on entrance/ exit.

    animateEntrance: true,
    animateExit: true,

When using the VillainController manually, it checks this bool to determine whether it should animate.

  static Future playAllVillains(BuildContext context, {bool entrance = true})

Villains entering the page are decoupled from the page transition, meaning they can be as long as they want. On the other hand, if a villain leaves the page, the animation is driven by the page transition. This means:

  • The exit animation is always as long a the exit page transition
  • Setting the duration doesn't change anything

Examples

Take a look at the example folder for three nice examples.

Features:

The villain framework takes care of:

  • managing page transition callbacks
  • supplying animations
  • providing premade common animations

In contrast to real world villains, these villains are very easy to handle.

Controller

Currenty there are no controllers implemented to play individual villains by themselves. If you'd like to have that implemented I opened an issue discussing it. Check it out!

Icon from https://icons8.com/

Getting Started

For help getting started with Flutter, view our online documentation.

For help on editing package code, view the documentation.

카테고리

의존성

의존성 목록 1 개

소스 저장소

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

아직 데이터가 없습니다.