letsar / flutter_slidable

A Flutter implementation of slidable list item with directional slide actions.
MIT License
2.7k stars 581 forks source link

Can't create SlidableController according to documentation #487

Open kwarnkham opened 2 months ago

kwarnkham commented 2 months ago

Here, the docs said

final controller = SlidableController();

// ...

Slidable(
  controller: controller,
  // ...
);

// ...

// Open the actions
void _handleOpen() {
  controller.openEndActionPane();
  // OR
  //controller.openStartActionPane();
}

void _handleOpen() {
  controller.close();
}

But thie SlidableController() got error 1 positional argument expected by 'SlidableController.new', but 0 found.

Sunghee2 commented 2 months ago

I have same problem.

image
froccawork commented 1 month ago

For me work this

In definition of class: class _MyAppState extends State with SingleTickerProviderStateMixin

and late final slidableController = SlidableController(this);

MasatoKaneko0124 commented 1 month ago

Thanks, @froccawork . It worked for me.

The widget has to be a Stateful(StatefulWidget / ConsumerStatefulWidget).