Slidable open Not effective ?

Đang mở
#455 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
dart
Lĩnh vực
mobile

Hướng nghiên cứu

The reporter's snippet wraps Slidable in a GestureDetector, so the context in onLongPress sits above the Slidable subtree and Slidable.of(context) returns null. Start by reading how Slidable.of looks up its ancestor in the package source, then reproduce with a minimal ListView like the one in the issue. Done means either a documented pattern for opening a pane from outside the item, such as a Builder inside child, or a clearer failure than a silent null. The issue is over 1,000 days old with no comments, and the desired behaviour is not settled, so confirm the scope with a maintainer first.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

When I can't open ActionPanel for a long time.

Here is my main code:

ListView.builder(
                itemCount: myPositions.length,
                padding: EdgeInsets.zero,
                itemBuilder: (ctx, index) {
                  return GestureDetector(
                    onLongPress: () {
                       Slidable.of(context)?.openEndActionPane();
                    },
                    child: Slidable(
                      groupTag: MyPositionView.routeName,
                      key: ValueKey(index),
                      direction: Axis.horizontal,
                      endActionPane: ActionPane(
                        extentRatio: 0.2,
                        motion: const ScrollMotion(),
                        children: [
                          Builder(builder: (context) {
                            return Container(
                              margin: EdgeInsets.symmetric(vertical: 6.w),
                              child: Column(
                                children: [
                             
                                  Expanded(
                                    child: TextButton(
                                      onPressed: () => deletePosition(index, context),
                                      style: TextButton.styleFrom(
                                        backgroundColor: const Color(0xff4077DE),
                                        foregroundColor: Colors.white,
                                      ),
                                      child: const Icon(Icons.delete_forever),
                                    ),
                                  ),
                                ],
                              ),
                            );
                          }),
                        ],
                      ),
                      child: MyWidget(),
                    ),
                  );
                },
              )

It is very unreasonable to ensure that the context can only be used with Slidable. of (context).

Ngôn ngữ chính
Dart
Star
2.9k
Fork
646
Merge trung bình
5 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của letsar/flutter_slidable

Tất cả issue của letsar/flutter_slidable

Issue tương tự

Thêm issue về Dart

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.