packages.flutter icon indicating copy to clipboard operation
packages.flutter copied to clipboard

LiveList.options not working with NotificationListener

Open jiharal opened this issue 1 year ago • 0 comments

here's the code

NotificationListener<ScrollNotification>(
                  onNotification: (notif) {
                    printInfo(info: notif.metrics.pixels.toString());
                    printInfo(info: notif.metrics.maxScrollExtent.toString());
                    if (notif.metrics.pixels >=
                        notif.metrics.maxScrollExtent - 200) {
                      if (kDebugMode) {
                        print('load more data');
                      }
                      loadItems(memberId: widget.memberId);
                    }
                    return false;
                  },
                  child: dataCtr.items.isEmpty
                      ? const Center(
                          child: AutoSizeText('tidak ada penjualan'),
                        )
                      : Expanded(
                          child: LiveList.options(
                            options: const LiveOptions(
                              // Start animation after (default zero)
                              delay: Duration(microseconds: 300),

                              // Show each item through (default 250)
                              showItemInterval: Duration(milliseconds: 100),

                              // Animation duration (default 250)
                              showItemDuration: Duration(milliseconds: 500),

                              // Animations starts at 0.05 visible
                              // item fraction in sight (default 0.025)
                              visibleFraction: 0.05,
                            ),
                            itemCount: dataCtr.items.length,
                            itemBuilder: (context, index, animation) {
                              var sale = dataCtr.items[index].data()!;
                              return FadeTransition(
                                  opacity: Tween<double>(
                                    begin: 0,
                                    end: 1,
                                  ).animate(animation),
                                  child: detailItems(sale));
                            },
                          ),
                        ),
                ),
                ```

jiharal avatar Feb 06 '24 11:02 jiharal