Buscar pacotes, repositórios e categorias de apps

Capa de flutter_draggable_gridview
Detalhes do pacotev1.0.0

flutter_draggable_gridview

Este pacote ajuda você a adicionar funcionalidade de arrastar e soltar ao GridView.builder existente.

AndroidiOSWebmacOSWindowsLinux
Downloads em 30 dias
5,5 mil
Curtidas
136
Pontos Pub
155

Instalar pacote

flutter pub add flutter_draggable_gridview

Visão geral do pacote

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

Um pacote Flutter que habilita funcionalidade de arrastar e soltar para GridView.builder, permitindo que os usuários reordenem itens em um layout de grade. Integra-se perfeitamente com estruturas de grade existentes sem exigir mudanças significativas no código. Projetado para interações suaves e responsivas em múltiplas plataformas, melhora a experiência do usuário em aplicativos que exigem arranjos de grade personalizáveis ou interativos. O pacote é leve e fácil de implementar, sendo ideal para reordenação de listas em gerenciadores de tarefas, painéis ou galerias de imagens.

Casos de uso

  • Reordenar itens em uma lista de tarefas
  • Layouts de painel personalizáveis
  • Reorganização de itens da galeria de imagens
  • grades de produtos interativas
  • Classificação baseada na preferência do usuário
  • Gerenciamento de conteúdo arrastável

Principais recursos

  • Integração sem interrupções com GridView.builder
  • Suporte multiplataforma (Android, iOS, Web, macOS, Windows, Linux)
  • animações suaves de arrastar e soltar
  • Configuração mínima necessária
  • Suporta alças de arrasto personalizadas
  • Preserva a estrutura de grade durante a reordenação

Indicado para

  • Desenvolvedores criando interfaces de grade interativas
  • Aplicativos que precisam de reordenamento de itens guiado pelo usuário
  • Projetos com layouts de conteúdo dinâmicos
  • aplicações centradas no usuário
  • Equipes que priorizam a consistência entre plataformas

Considerações

  • Pode exigir gerenciamento adicional de estado
  • Impacto no desempenho com grandes conjuntos de dados
  • Personalização limitada para comportamentos de arrasto complexos
  • Não adequado para widgets de rolagem não em grade
  • Requer manipulação cuidadosa das chaves de item
  • Melhor usado com conjuntos de dados pequenos a médios

README original

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

flutter_draggable_gridview

flutter_draggable_gridview version flutter_draggable_gridview Git Stars MIT License

This package supports drag & drop widgets inside the GridView.builder for multiplatform. It provides all the properties which are available in Gridview.builder and easy to implement with the few lines of code.

Draggable GridView.

Draggable GridView

Usage

Example
      DraggableGridViewBuilder(
        gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
          crossAxisCount: 2,
          childAspectRatio: MediaQuery.of(context).size.width / (MediaQuery.of(context).size.height / 3),
        ),
        children: _listOfDraggableGridItem,
        isOnlyLongPress: false,
        dragCompletion: (List<DraggableGridItem> list, int beforeIndex, int afterIndex) {
          print( 'onDragAccept: $beforeIndex -> $afterIndex');
        },
        dragFeedback: (List<DraggableGridItem> list, int index) {
          return Container(
            child: list[index].child,
            width: 200,
            height: 150,
          );
        },
        dragPlaceHolder: (List<DraggableGridItem> list, int index) {
          return PlaceHolderWidget(
            child: Container(
              color: Colors.white,
            ),
          );
        },
      );
Required parameters
gridDelegate:

A delegate that controls the layout of the children within the GridView.

children:

This property contains list of [DraggableGridItem] and it is use to show the widget inside the GridView.builder to provide the drag & drop functionality. Also, it contains isDraggable parameter which manages enable/disable the drag & drop functionality.

dragCompletion:

This callback provides updated list and old and new indexes.

Optional parameters
isOnlyLongPress:

This property contains bool value. If this property is false then it works with simple press draggable or else it works with long press. default value is 'true'.

dragFeedback:

With this callback, you have to return a Widget and we will use this widget in feedback. Learn more about feedback from Draggable class.

dragPlaceHolder:

TWith this callback, you have to return a PlaceHolderWidget and we will use this widget in place holder.

dragChildWhenDragging:

With this callback, you have to return a Widget and we will display this widget instead of child when drags are under way. Learn more about childWhenDragging from Draggable class.

Last But Not Least :heart_eyes:
You can use all the GridView.builder properties with DraggableGridViewBuilder class.

Note:

The result returns in List. so it can be lost later, you are responsible for storing it somewhere permanent (if needed).

Guideline for contributors

Contribution towards our repository is always welcome, we request contributors to create a pull request to the develop branch only.

Guideline to report an issue/feature request

It would be great for us if the reporter can share the below things to understand the root cause of the issue.

  • Library version
  • Code snippet
  • Logs if applicable
  • Device specification like (Manufacturer, OS version, etc)
  • Screenshot/video with steps to reproduce the issue

LICENSE!

Flutter Draggable GridView is MIT-licensed.

Let us know!

We’d be really happy if you send us links to your projects where you use our component. Just send an email to sales@mindinventory.com And do let us know if you have any questions or suggestion regarding our work.

Categorias

Repositório-fonte

Projetos que usam este pacote