Query: Smooth DismissiblePane Implementation within ActionPane?

Aperta
#476 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
15/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
flutter
Ambito
mobile

Direzione di ricerca

The report concerns how ActionPane, DismissiblePane and SlidableAction interact inside a Slidable with DrawerMotion on the start pane, so start with the code that handles the start pane's dismissible and its children. Reproduce with the snippet in the issue, swiping past the dismissThreshold with no children acting, and see where the drag stops. Done means a pane with only a DismissiblePane can be dismissed in one smooth swipe, with confirmDismiss returning false still closing the pane.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Hello,

Firstly, a huge thank you for this incredible package!

In my application, I have a list of products. I aim for users to validate a product by swiping from left to right, or be able to edit/delete it by swiping from right to left.

However, I'm encountering difficulty implementing just the DismissiblePane for the validation functionality. It seems ActionPane requires children, and therefore, the motion from the user is not smooth to validate the product. When a user swipes, they're initially obstructed by the ActionPaneAction, and only then can they dismiss the tile.

Do you know if it's possible to exclusively employ a DismissiblePane within an ActionPane?
Thank you!

Here is my minimal code :

Slidable(
    key: ValueKey(index),
    groupTag: '0',
    startActionPane: ActionPane(
      motion: const DrawerMotion(),
      dismissible: DismissiblePane(
          key: const ValueKey(0),
          closeOnCancel: true,
          dismissThreshold: 0.8,
          confirmDismiss: () async {
            doSth();
            return false;
          },
          onDismissed: () {
            print("Panel dismiss called");
          }),
      children: [
        SlidableAction(
          onPressed: (_) {}, // I don't want to perform any action here, but the motion do a stop here
          backgroundColor: Colors.green,
          foregroundColor: Colors.white,
          icon: Icons.done,
        ),
      ],
    ),
    endActionPane: ActionPane(
      extentRatio: 0.4,
      motion: const ScrollMotion(),
      children: [
        SlidableAction(
          onPressed: (_) {},
          backgroundColor: Colors.blue,
          foregroundColor: Colors.white,
          icon: Icons.edit,
        ),
        SlidableAction(
          onPressed: (_) {
            product.isVisible = false;
            setState(() {});
            _deleteSelectedItems();
          },
          backgroundColor: Colors.red,
          foregroundColor: Colors.white,
          icon: Icons.delete,
        ),
      ],
    ),
    child: ChildProduct(product),
  );
Lingua principale
Dart
Stelle
2.9k
Fork
646
Merge medio
5m
PR unite (30g)
9

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di letsar/flutter_slidable

Tutte le issue di letsar/flutter_slidable

Issue simili

Altre issue su Dart

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.