karvulf / flutter-reorderable-grid-view

BSD 3-Clause "New" or "Revised" License
158 stars 23 forks source link

When wrap ReorderableBuilder in Directionality drag animation and position is not correct. #69

Closed taosimple closed 5 months ago

taosimple commented 1 year ago

Wrap ReorderableBuilder in Directionality with textDirection: TextDirection.rtl drag animation and position is not correct.

Code:

Directionality(
                    textDirection: TextDirection.rtl,
                    child: ReorderableBuilder(
                      enableScrollingWhileDragging: false,
                      children: items,
                      // scrollController: _scrollController,
                      onReorder: (List<OrderUpdateEntity> orderUpdateEntities) {},
                      builder: (children) {
                        return GridView(
                          // key: _gridViewKey,
                          shrinkWrap: true,
                          physics: NeverScrollableScrollPhysics(),
                          // controller: _scrollController,
                          children: children,
                          gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
                            mainAxisSpacing: 3,
                            crossAxisSpacing: 8,
                            crossAxisCount: 3,
                          ),
                        );
                      },
                    ),
                  )
karvulf commented 1 year ago

Hi @taosimple Thank you for opening the issue. I will check this in the next days and come back.

karvulf commented 1 year ago

I couldn't reproduce your issue with the code you gave me. Can you also show me how your items are built? @taosimple

taosimple commented 1 year ago

Just a image list @karvulf

List<Widget> items = imgList.map((path) {
      return ClipRRect(
        borderRadius: BorderRadius.all(Radius.circular(6)),
        child: Image.file(
          File(path),
          width: imageSize,
          height: imageSize,
          fit: BoxFit.cover,
        ),
      );
    }).toList();
karvulf commented 1 year ago

Ah ok I think I know that issue, can you try to add initDelay with a delay of const Duration(milliseconds: 200) and try it again? Possibly that solves your issue. @taosimple

taosimple commented 1 year ago

Sorry, my code is updated, and when I rollback, I couldn't reproduce the issue. It's strange.

karvulf commented 1 year ago

Hmm ok, I will check that again on the weekend, maybe I can find the main issue. I know there is something strange combined with images, but glad to hear that it is working currently @taosimple