Buscar pacotes, repositórios e categorias de apps

Detalhes do pacotev0.5.3

follow_the_leader

Widgets que seguem outros widgets.

AndroidiOS
Downloads em 30 dias
40,1 mil
Curtidas
37
Pontos Pub
150

Instalar pacote

flutter pub add follow_the_leader

Visão geral do pacote

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

Um pacote Flutter que permite que widgets sigam dinamicamente a posição de outros widgets na tela. É ideal para criar elementos de interface interativos como dicas de ferramentas, indicadores flutuantes ou sobreposições animadas que rastreiam o movimento de um widget-alvo. Desenvolvido com foco em desempenho e simplicidade, funciona perfeitamente em plataformas Android e iOS. O pacote utiliza eficientemente o pipeline de renderização do Flutter para garantir animações suaves sem travamentos. Perfeito para desenvolvedores que buscam aprimorar a experiência do usuário com feedback visual responsivo.

Casos de uso

  • Criando dicas dinâmicas
  • Construindo botões de ação flutuantes que rastreiam o conteúdo
  • Criando sobreposições animadas
  • Implementando tours guiados
  • Visualizando caminhos do cursor ou seleção

Principais recursos

  • Rastreamento em tempo real de widget
  • Integração de animação suave
  • Compatibilidade multiplataforma
  • Boilerplate mínimo
  • Renderização eficiente com sobrecarga mínima

Indicado para

  • Designers de UI/UX procurando elementos interativos
  • Desenvolvedores criando fluxos guiados de onboarding
  • Aplicativos que exigem feedback visual dinâmico
  • Equipes focadas em experiências móveis refinadas

Considerações

  • Pode afetar o desempenho com muitos widgets rastreados
  • Requer posicionamento cuidadoso para evitar sobreposição
  • Não adequado para layouts estáticos
  • Necessita testes em dispositivos de baixa capacidade
  • Melhor usado com widgets-alvo leves

README original

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

Follow the Leader - Widgets following widgets

Built by the Flutter Bounty Hunters


Getting Started

Select a widget that you want to follow and wrap it with a Leader widget. Give the Leader widget a LeaderLink, to share with Followers.

Leader(
  link: _leaderLink,
  child: YourLeaderWidget(),
);

Add a widget that you want to follow your Leader, and wrap it with a Follower widget.

// Follower appears 20px above the Leader.
Follower.withOffset(
  link: _leaderLink,
  offset: const Offset(0, -20),
  leaderAnchor: Alignment.topCenter,
  followerAnchor: Alignment.bottomCenter,
  child: YourFollowerWidget(),
);

Follower's can position themselves with a constant distance from a Leader using .withOffset(), as shown above. Or, Follower's can choose their exact location on every frame by using .withAligner().

// Follower appears where the aligner says it should.
Follower.withAligner(
  link: _leaderLink,
  aligner: _aligner,
  child: YourFollowerWidget(),
);

To constrain where your Follower is allowed to appear, pass a boundary to your Follower.

// Follower is constrained by the given boundary.
Follower.withAligner(
  link: _leaderLink,
  aligner: _aligner,
  boundary: _boundary,
  child: YourFollowerWidget(),
);

Building multiple widgets without layouts

Building follower widgets is a bit unusual with Flutter. Typically, whenever we build multiple widgets in Flutter, we place them in a layout container, such as Column, Row, or Stack. But follower widgets don't respect ancestor layout rules. That's the whole point.

follow_the_leader introduces a new container widget, which builds children, but doesn't attempt to apply any particular layout rules. The primary purpose of this widget is to make it clear to readers that you aren't trying to layout the children.

BuildInOrder(
  children: [
    MyContentWithALeader(),
    Follower.withOffset(),
    Follower.withDynamics(),
  ],
);

The BuildInOrder widget builds each child widget in the order that it's provided. This fact is important because Leader widgets must be built before their Followers. But BuildInOrder does not impose any Offset on its children. BuildInOrder passes its parent's constraints down to the children.

Categorias

Dependências

Lista de dependências 3 itens

Repositório-fonte

Projetos que usam este pacote