luckysmg/flutter_swipe_action_cell

Delete animation problem

Opened this issue · 0 comments

Hey!
Thank you for the package.
It seems there is a bug with the animations — when I touch the screen during the delete animation the cell loses its red color and some visual artifacts appear after it :-)
Please take a look.


Demo

Simulator.Screen.Recording.-.iPhone.11.Pro.Max.-.2023-03-08.at.15.33.04.mp4

Repro

import 'package:flutter/cupertino.dart';
import 'package:flutter_swipe_action_cell/flutter_swipe_action_cell.dart';

class X extends StatefulWidget {
  @override
  State<X> createState() => _XState();
}

class _XState extends State<X> {
  var items = List<String>.empty();

  @override
  void initState() {
    super.initState();
    items = List.generate(10, (index) => 'Item $index');
  }

  @override
  Widget build(BuildContext context) {
    return CupertinoApp(
      home: CupertinoPageScaffold(
        child: SafeArea(
          child: CustomScrollView(
            slivers: [
              SliverList(
                delegate: SliverChildBuilderDelegate(
                  childCount: items.length,
                  (_, index) {
                    return SwipeActionCell(
                      deleteAnimationDuration: 10000,
                      key: ValueKey(items[index]),
                      trailingActions: <SwipeAction>[
                        SwipeAction(
                          title: "delete",
                          onTap: (CompletionHandler handler) async {
                            await handler(true);
                            items.removeAt(index);
                            setState(() {});
                          },
                          color: CupertinoColors.destructiveRed,
                        ),
                      ],
                      child: Container(
                        height: 30,
                        child: Text(items[index]),
                        color: CupertinoColors.white,
                      ),
                    );
                  },
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

void main() {
  runApp(X());
}

I use the latest 3.1.0 version