Buscar pacotes, repositórios e categorias de apps

Capa de animated_size_and_fade
Detalhes do pacotev5.1.3

animated_size_and_fade

Realiza uma transição de desvanecimento e tamanho entre widgets de alturas diferentes. Também é usado para mostrar/esconder um widget.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
17,2 mil
Curtidas
245
Pontos Pub
160

Instalar pacote

flutter pub add animated_size_and_fade

Visão geral do pacote

Orientação gerada a partir de informações públicas. Apenas para referência.

Um pacote Flutter que anima suavemente as transições entre widgets com alturas diferentes usando tanto desvanecimento quanto mudanças de tamanho. É ideal para mostrar ou ocultar conteúdo dinamicamente, como expandir/colapsar seções ou revelar/esconder elementos da interface. A animação garante continuidade visual interpolando tanto a opacidade quanto as dimensões. Suporta todas as principais plataformas, incluindo móvel, web e desktop. O pacote é leve e se integra facilmente em aplicativos Flutter existentes.

Casos de uso

  • Mostrar/esconder conteúdo colapsável
  • Animando itens de lista dinâmicos
  • Criando transições de interface suaves
  • Revelando painéis ocultos
  • Gerenciamento de trocas de widgets com altura variável
  • Melhorar a experiência do usuário em layouts responsivos

Principais recursos

  • Transição suave de desvanecimento e tamanho
  • Suporta widgets de altura variável
  • API simples para lógica de exibição/escondimento
  • Compatibilidade multiplataforma
  • Leve e eficiente
  • Controle de animação embutido

Indicado para

  • Desenvolvedores que precisam de transições de UI fluidas
  • Aplicativos com visibilidade dinâmica de conteúdo
  • Formulários interativos ou acordeões
  • Designs responsivos que exigem animação
  • Equipes que priorizam código limpo e sustentável

Considerações

  • Pode não ser adequado para animações muito complexas
  • O desempenho depende da complexidade do widget
  • Não ideal para atualizações de alta frequência
  • Requer um tratamento cuidadoso das restrições de layout
  • Personalização limitada além do desvanecimento/basico tamanho
  • Melhor usado com mudanças de altura previsíveis

README original

Snapshot do README original do repositório-fonte vinculado. Consulte o repositório para o conteúdo mais recente.

Pub popularity Pub Version GitHub stars Code Climate issues GitHub closed issues GitHub repo size GitHub forks PRs Welcome Developed by Marcelo Glasberg Glasberg.dev on pub.dev Platforms

Sponsor

animated_size_and_fade

The AnimatedSizeAndFade widget allows you to:

  1. Do a fade and size transition between two widgets.
  2. Show and hide a widget, by resizing it vertically while fading.
Size and Fade

To do a fade and size transition when you change the child widget, the "old" and the "new" child must have the same width, but can have different heights, and you don't need to know their sizes in advance.

You can also define a duration and curve for both the fade and the size, separately.

Important: If the "new" child is the same widget type as the "old" child, but with different parameters, then AnimatedSizeAndFade will NOT do a transition between them, since as far as the framework is concerned, they are the same widget, and the existing widget can be updated with the new parameters. To force the transition to occur, set a Key (typically a ValueKey taking any widget data that would change the visual appearance of the widget) on each child widget that you wish to be considered unique.

Example:

bool toggle=true;
Widget widget1 = ...;
Widget widget2 = ...;

AnimatedSizeAndFade(
   child: toggle ? widget1 : widget2
);
Show and Hide

The AnimatedSizeAndFade.showHide constructor may be used to show/hide a widget, by resizing it vertically while fading.

Example:

bool toggle=true;
Widget widget = ...;    

AnimatedSizeAndFade.showHide(
   show: toggle,
   child: widget,
);

How does it compare to other similar widgets?

  • With AnimatedCrossFade you must provide both the firstChild and secondChild at the same time, but with AnimatedSizeAndFade you may simply change its child.

  • With AnimatedSwitcher you may simply change its child, but then it only animates the fade, not the size.

  • AnimatedContainer only works if you know the size of the children in advance.


Note: See the StackOverflow question that prompted this widget development.


By Marcelo Glasberg

glasberg.dev
github.com/marcglasberg
linkedin.com/in/marcglasberg/
twitter.com/glasbergmarcelo
stackoverflow.com/users/3411681/marcg
medium.com/@marcglasberg

My article in the official Flutter documentation:

The Flutter packages I've authored:

My Medium Articles:

Categorias

Repositório-fonte

Projetos que usam este pacote