Skip to content

Close on slide action tap and on scroll#8

Merged
letsar merged 3 commits intomasterfrom
feature/4_close_on_tap
Jul 23, 2018
Merged

Close on slide action tap and on scroll#8
letsar merged 3 commits intomasterfrom
feature/4_close_on_tap

Conversation

@letsar
Copy link
Owner

@letsar letsar commented Jul 23, 2018

Resolves #4 #6 #7

@letsar letsar merged commit 071a798 into master Jul 23, 2018
@letsar letsar deleted the feature/4_close_on_tap branch July 23, 2018 20:43
@hjJunior
Copy link

Hey, how could I use this feature? I'm think I'm got something wrong with my code, I was thout that is because my context wasn't created the component, so let me show you

  @override
  Widget build(BuildContext context) => Slidable(
    delegate: new SlidableDrawerDelegate(),
    actionExtentRatio: 0.25,
    closeOnScroll: false,
    controller: slidableController,
    child: buildChild(context),
    actions: <Widget>[
      new IconSlideAction(
        caption: 'Archive',
        color: Colors.blue,
        icon: Icons.archive,
        onTap: () => print('Archive'),
      ),
      new IconSlideAction(
        caption: 'Share',
        color: Colors.indigo,
        icon: Icons.share,
        onTap: () => print('Share'),
      ),
    ]
  );


  Widget buildChild (BuildContext context) {
    return ListTile(
      onTap: () {
        slidableController.activeState?.open();
         Slidable.of(context)?.close();
      },
      title: Text('${_quantidade.toString()}x $_produto'),
      subtitle: Text(_descricao),
      trailing: Text(_valor.toStringAsFixed(2)),
    );
  }

I tried these two types, but all of this give me null

        slidableController.activeState?.open();
        Slidable.of(context)?.close();

So because of this I'm using the operator ?

Should I use key?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants