left_scroll_actions 1.5.3

  • Readme
  • Changelog
  • Example
  • Installing
  • 91

left_scroll_actions #

A useful left scroll actions widget like WeChat.

一款仿微信效果的 Flutter 左滑菜单插件。

preview

Install #

Add this to your package's pubspec.yaml file: 把如下字段加入你的pubspec.yaml文件:

dependencies:
  flutter:
    sdk: flutter
  // 添加下面这一行。 Add this row.
  left_scroll_actions: any

然后运行flutter packages get即可

Usage #

CupertinoLeftScroll (1.4.0) #

  CupertinoLeftScroll(
    // important, each Row must have different key.
    // DO NOT use '$index' as Key! Use id or title.
    key: Key('TODO: your key'),
    // left scroll widget will auto close while the other widget is opened and has same closeTag.
    // 当另一个有相同closeTag的组件打开时,其他有着相同closeTag的组件会自动关闭.
    closeTag: LeftScrollCloseTag('TODO: your tag'),
    buttonWidth: 80,
    child: Container(
      height: 60,
      color: Colors.white,
      alignment: Alignment.center,
      child: Text('👈 Try Scroll Left'),
    ),
    buttons: <Widget>[
      LeftScrollItem(
        text: 'edit',
        color: Colors.orange,
        onTap: () {
          print('edit');
        },
      ),
      LeftScrollItem(
        text: 'delete',
        color: Colors.red,
        onTap: () {
          print('delete');
        },
      ),
    ],
    onTap: () {
      print('tap row');
    },
  );

LeftScroll #

You can use this widget as same as CupertinoLeftScroll. Custom define you slide animation by implements onScroll function.

弹性 (1.5.0) #

  1. 设置CupertinoLeftScrollbounce参数为true,即可获得弹性效果
  2. 通过CupertinoLeftScrollbounceStyle参数控制弹性效果

左滑联动列表(1.3.0) #

  1. 对于提供同一个LeftScrollCloseTag的LeftScroll组件,可以在一个打开时,关闭其他组件
  2. 想要关闭特定的行,只需使用以下代码
// 找到对应tag与key的row状态,改变状态即可
LeftScrollGlobalListener.instance.targetStatus(tag,key) = false;

左滑列表(1.2.0新增)(已过期) #

/// 已过期
LeftScrollList.builder(
  /// Deprecated! Do not use this widget anymore.
  /// Instead, you can add [LeftScrollCloseTag] property to [LeftScroll] or [CupertinoLeftScroll] widget.
);

See:

Getting Started #

This project is a starting point for a Dart package, a library module containing code that can be shared easily across multiple Flutter or Dart projects.

For help getting started with Flutter, view our online documentation, which offers tutorials, samples, guidance on mobile development, and a full API reference.

1.5.3 Improve bounce style. #

  1. Change default k to 0.8.
  2. Avaliable hot reload when adding bounce style.

1.5.2 Add Bounce Style #

  1. Fix other row close timing.Now other row will close when you start open target row.

1.5.1 Add Bounce Style #

  1. Fix bug of throw error when use opacity and bounce same time.
  2. Fix BounceStyle builder function.

1.5.0 Add Bounce Style #

  1. Add bounce argument to class CupertinoLeftScroll to enable bounce style.
  2. Use bounceStyle argument to control bounce style.

1.4.4 Fix bug #

  1. Fix LeftScroll can't open without onScroll argument.

1.4.3 Fix bug #

  1. Fix use LeftScrollGlobalListener.instance.targetStatus(tag, key)=true; fail at first time.

1.4.2 Fix bug, update readme #

  1. Fix bug.

1.4.0 Add CupertinoLeftScroll #

  1. Add CupertinoLeftScroll widget,buttons will expand with iOS style.
  2. To fetch this style, just simple replace LeftScroll with CupertinoLeftScroll.
  3. Update example, remove deprecated demo.

1.3.0 Add LeftScrollCloseTag,deprecated old list #

  1. If you add same LeftScrollCloseTag tag to LeftScroll widget, widget will autoclose when other widget with same tag open;
  2. If you want close target row,just use such code:
// 找到对应tag与key的row状态,改变状态即可
LeftScrollGlobalListener.instance.targetStatus(tag,key) = false;

[1.2.1] - Fix bug. #

Fix demo bug.

[1.2.0] - Add LeftScrollList. #

Add LeftScrollList,if you open a row in LeftScrollList, other row will auto close.

[1.1.0] - Fix bug, Improve demo. #

Add paramater to control pop event. Add usage in listview on demo. Add textColor paramater with LeftScrollItem. Now use key but not GlobalKey.

[1.0.0] - Init. #

  • init

example/lib/main.dart

import 'package:example/list.dart';
import 'package:example/row.dart';
import 'package:flutter/material.dart';
import 'package:left_scroll_actions/cupertinoLeftScroll.dart';
import 'package:left_scroll_actions/left_scroll_actions.dart';


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

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
      ),
      home: HomePage(),
    );
  }
}

class HomePage extends StatefulWidget {
  @override
  _HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(
          title: Text('Left Scroll Actions'),
        ),
        backgroundColor: Color(0xFFf5f5f4),
        body: ListView(
          children: <Widget>[
            Container(
              padding: EdgeInsets.all(12),
              child: MaterialButton(
                color: Colors.blue,
                child: Text(
                  'ListView Usage Demo',
                  style: TextStyle(color: Colors.white),
                ),
                onPressed: () {
                  Navigator.of(context).push(MaterialPageRoute(
                    builder: (context) => ListPage(),
                  ));
                },
              ),
            ),
            // Container(
            //   padding: EdgeInsets.all(12),
            //   child: MaterialButton(
            //     color: Colors.blue,
            //     child: Text(
            //       'ClosableListView Usage Demo',
            //       style: TextStyle(color: Colors.white),
            //     ),
            //     onPressed: () {
            //       Navigator.of(context).push(MaterialPageRoute(
            //         builder: (context) => ClosableListPage(),
            //       ));
            //     },
            //   ),
            // ),
            Container(height: 50),
            Container(
              padding: EdgeInsets.only(top: 12, left: 8, bottom: 8),
              child: Text('These widget can scroll to actions.'),
            ),
            LeftScroll(
              buttonWidth: 80,
              child: Container(
                height: 60,
                color: Colors.white,
                alignment: Alignment.center,
                child: Text('👈 Try Scroll Left'),
              ),
              buttons: <Widget>[
                LeftScrollItem(
                  text: 'delete',
                  color: Colors.red,
                  onTap: () {
                    print('delete');
                  },
                ),
                LeftScrollItem(
                  text: 'Edit',
                  color: Colors.orange,
                  onTap: () {
                    print('edit');
                  },
                ),
              ],
              onTap: () {
                print('tap row');
              },
            ),

            LeftScroll(
              child: Container(
                height: 60,
                color: Colors.white.withOpacity(0.8),
                alignment: Alignment.center,
                child: Text('If opacity is not 1.0,may cause problem.'),
              ),
              buttons: <Widget>[
                LeftScrollItem(
                  text: 'delete',
                  color: Colors.red,
                ),
                LeftScrollItem(
                  text: 'Edit',
                  color: Colors.orange,
                ),
              ],
            ),
            Container(
              padding: EdgeInsets.only(top: 12, left: 8, bottom: 8),
              child: Text('CupertinoLeftScrollRow'),
            ),
            CupertinoLeftScroll(
              buttonWidth: 60,
              child: Container(
                height: 60,
                color: Colors.white,
                alignment: Alignment.center,
                child: Text('👈 Try Scroll Left(iOS style)'),
              ),
              buttons: <Widget>[
                LeftScrollItem(
                  text: 'Delete',
                  color: Colors.red,
                  onTap: () {
                    print('delete');
                  },
                ),
                LeftScrollItem(
                  text: 'Edit',
                  color: Colors.orange,
                  onTap: () {
                    print('edit');
                  },
                ),
              ],
              onTap: () {
                print('tap row');
              },
            ),
            CupertinoLeftScroll(
              buttonWidth: 60,
              bounce: true,
              child: Container(
                height: 60,
                color: Colors.white,
                alignment: Alignment.center,
                child: Text('👈 Try Scroll Left(iOS style with bounce)'),
              ),
              buttons: <Widget>[
                LeftScrollItem(
                  text: 'Delete',
                  color: Colors.red,
                  onTap: () {
                    print('delete');
                  },
                ),
                LeftScrollItem(
                  text: 'Edit',
                  color: Colors.orange,
                  onTap: () {
                    print('edit');
                  },
                ),
              ],
              onTap: () {
                print('tap row');
              },
            ),
            CupertinoLeftScroll(
              opacityChange: true,
              buttonWidth: 80,
              child: Container(
                height: 60,
                color: Colors.white,
                alignment: Alignment.center,
                child: Text('👈 Try iOS style with opa change'),
              ),
              buttons: <Widget>[
                LeftScrollItem(
                  text: 'delete',
                  textColor: Colors.red,
                  color: Colors.red.withOpacity(0),
                  onTap: () {
                    print('delete');
                  },
                ),
                LeftScrollItem(
                  text: 'Edit',
                  textColor: Colors.orange,
                  color: Colors.orange.withOpacity(0),
                  onTap: () {
                    print('edit');
                  },
                ),
              ],
              onTap: () {
                print('tap row');
              },
            ),
            Container(height: 50),
            Container(
              padding: EdgeInsets.only(top: 12, left: 8, bottom: 8),
              child:
                  Text('You can build widget like this if opacity is not 1.0.'),
            ),
            ExampleRow(
              onDelete: () {
                print('delete');
              },
              onTap: () {
                print('tap');
              },
              onEdit: () {
                print('edit');
              },
            ),
          ],
        ));
  }
}

Use this package as a library

1. Depend on it

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


dependencies:
  left_scroll_actions: ^1.5.3

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:left_scroll_actions/left_scroll_actions.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
82
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
91
Learn more about scoring.

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

  • Dart: 2.8.1
  • pana: 0.13.8-dev
  • Flutter: 1.17.0

Health suggestions

Fix lib/global/actionListener.dart. (-0.50 points)

Analysis of lib/global/actionListener.dart reported 1 hint:

line 1 col 8: Unused import: 'package:flutter/gestures.dart'.

Dependencies

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