flutter_slidable_list_view 1.2.8

  • Readme
  • Changelog
  • Example
  • Installing
  • 87

flutter_slidable_list_view #

a item slidable listView, the slide item is learn from flutter_slidable, i need some effect that like IOS's list or QQ mobile client's chat list,so this package burn.

Getting Started #

The usage of this Widget is similar to that of ListView.

          itemBuilder: (bc, index) {
            // return your item widget here,no need to consider the click event
          actionWidgetBuilder: ActionWidgetDelegate( $action_count, (index) {
            // return your action widget
          }, (int indexInList, int index, BaseSlideItem item) {
            // deal the action click event here,you can use item.close(),item.remove() to close or remove this item after click action 
          }, [$action_colors]),// action_colors.len need equal to action_count
          dataList: $data_list,

Preview #

Parameter Description #


parametertypedescriptiondefault value
dataListListthe list datano default,required
slideProportiondoublethis value determine the action width0.25
itemBackgroundColorColorthe list item background color,don't use Transparentwhite
supportElasticSlidingboolhas elasticsliding effict when slidetrue
animationDurationDurationthe animation duration200 ms
refreshCallbackFutureif null,list dont support swip refreshnull
itemBuilderWidget Function(BuildContext context, int index)build the list itemrequired
separatorBuilderWidget Function(BuildContext context, int index)build the list separatorDivider(height: 1)
actionWidgetDelegateActionWidgetDelegatebuild the action widgetrequired
refreshWidgetBuilderWidget Function( Widget content, RefreshCallback refreshCallback)you can use your custom refresh indicatorRefreshIndicator
onGestureEndvoid Function(DragEndDetails detail, double itemWidth,double translateValue, Function openF, Function closeF)determine when to close or open action on gesture endnull


parametertypedescriptiondefault value
actionCountintthe actionButton's countrequired
actionBuilderWidget Function(int actionIndex, int indexInList)build the action buttonrequired
clickCallbackFunction(int indexInList, int index, BaseSlideItem item)handle click actionnull
actionBackgroundColorsListgiven the action button background color(this list's length must same with actionCount)null

[0.0.1] - finish the main function. #

[0.0.2] - change description for this project #

[1.0.0] - change description #

[1.0.1] - update description #

[1.2.0] - finish the description of it,did't change main code #

[1.2.1] - add itemCount param,you can set the item count by yourself #

[1.2.2] - fix v1.2.1 item count bug #

[1.2.3] - fix crash when remove item #

[1.2.4] - add UnSlidableWidget to make some item not slide when touch #

[1.2.5] - when dataList'length change, list will jump to top <-- bug fixed #

[1.2.6] - support listView padding #

[1.2.7] - add ScrollController support #

[1.2.8] - support custom action for each item;support custom open or close on gesture end #


import 'package:flutter/material.dart';
import 'package:flutter_slidable_list_view/flutter_slidable_list_view.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        // This is the theme of your application.
        // Try running your application with "flutter run". You'll see the
        // application has a blue toolbar. Then, without quitting the app, try
        // changing the primarySwatch below to Colors.green and then invoke
        // "hot reload" (press "r" in the console where you ran "flutter run",
        // or simply save your changes to "hot reload" in a Flutter IDE).
        // Notice that the counter didn't reset back to zero; the application
        // is not restarted.
        primarySwatch: Colors.blue,
      home: MyHomePage(title: 'Flutter Demo Home Page'),

class MyHomePage extends StatefulWidget {
  MyHomePage({Key key, this.title}) : super(key: key);

  // This widget is the home page of your application. It is stateful, meaning
  // that it has a State object (defined below) that contains fields that affect
  // how it looks.

  // This class is the configuration for the state. It holds the values (in this
  // case the title) provided by the parent (in this case the App widget) and
  // used by the build method of the State. Fields in a Widget subclass are
  // always marked "final".

  final String title;

  _MyHomePageState createState() => _MyHomePageState();

class _MyHomePageState extends State<MyHomePage> {
  int _counter = 0;

  void _incrementCounter() {
    setState(() {

  List<int> data = List();

  void initState() {
    data = List.generate(20, (index) {
      return index;

  Widget build(BuildContext context) {
    // This method is rerun every time setState is called, for instance as done
    // by the _incrementCounter method above.
    // The Flutter framework has been optimized to make rerunning build methods
    // fast, so that you can just rebuild anything that needs updating rather
    // than having to individually change instances of widgets.
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(widget.title),
      body: Container(
        child: SlideListView(
          itemBuilder: (bc, index) {
            return GestureDetector(
              child: Container(
                padding: EdgeInsets.all(10),
                child: Row(
                  children: <Widget>[
                    Text('child ${data[index]}'),
                      child: Text('button ${data[index]}'),
                      onPressed: () {
                        print('button click ${data[index]}');
              onTap: () {
                print('tap ${data[index]}');
              behavior: HitTestBehavior.translucent,
              ActionWidgetDelegate(2, (actionIndex, listIndex) {
            if (actionIndex == 0) {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[Icon(Icons.delete), Text('delete')],
            } else {
              return Column(
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  listIndex > 5 ? Icon(Icons.close) : Icon(Icons.adjust),
          }, (int indexInList, int index, BaseSlideItem item) {
            if (index == 0) {
            } else {
          }, [Colors.redAccent, Colors.blueAccent]),
          dataList: data,
          refreshCallback: () async {
            await Future.delayed(Duration(seconds: 2));
      floatingActionButton: FloatingActionButton(
        onPressed: _incrementCounter,
        tooltip: 'Increment',
        child: Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  flutter_slidable_list_view: ^1.2.8

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:flutter_slidable_list_view/flutter_slidable_list_view.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jul 2, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.13
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

because of import path [flutter_slidable_list_view] that is in a package requiring null.

Health suggestions

Fix lib/widgets/inherited_widgets.dart. (-0.50 points)

Analysis of lib/widgets/inherited_widgets.dart reported 1 hint:

line 14 col 20: 'inheritFromWidgetOfExactType' is deprecated and shouldn't be used. Use dependOnInheritedWidgetOfExactType instead. This feature was deprecated after v1.12.1..


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.12 1.14.13
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6 1.2.0
vector_math 2.0.8
Dev dependencies