grouped_list icon indicating copy to clipboard operation
grouped_list copied to clipboard

Duplicate groupHeader

Open yusriltakeuchi opened this issue 1 year ago • 1 comments

Describe the bug I tried it, but there's always a bug where duplicate headers occur. The items are sorted correctly, but the bottommost header is always the same as the first header. This is a mistake.

Expected behavior The group header should appear correctly, not as a duplicate.

Information:

  • Dart version: Dart SDK version: 3.5.4
  • Flutter version: stable, 3.24.5,
  • Platform: MacOS
  • Package version: grouped_list 6.0.0

This is the error: Screenshot_1733712079

This is my code:

Widget _transactionsWidget() {
    return Expanded(
      child: BlocBuilder<TransactionBloc, TransactionState>(
        builder: (context, state) {
          if (state is GetTransactionLoadingState) {
            return const LoadingListView();
          } else if (state is GetTransactionErrorState) {
            return const IdleNoItemCenter(title: "Transaksi tidak ditemukan");
          } else if (state is GetTransactionLoadedState) {
            return SizedBox(
              height: double.infinity,
              child: GroupedListView<TransactionEntity, String>(
                elements: state.transactions,
                order: GroupedListOrder.DESC,
                sort: true,
                floatingHeader: true,
                useStickyGroupSeparators: true,
                groupComparator: (element1, element2) => element1 == element2 ? 0 : 1,
                groupBy: (TransactionEntity element) => DateFormat('yyyy-MM-dd').format(DateTime.parse(element.date!)),
                groupHeaderBuilder: (value) {
                  return Align(
                    alignment: Alignment.topLeft,
                    child: Padding(
                      padding: EdgeInsets.symmetric(
                        horizontal: AppSetting.setWidth(40),
                        vertical: AppSetting.setHeight(20),
                      ),
                      child: Text(
                        formatterDateNormal.format(DateTime.parse(value.date!)),
                        style: MyTheme.style.title.copyWith(
                          fontSize: AppSetting.setFontSize(40),
                        ),
                      ),
                    ),
                  );
                },
                itemBuilder: (context, TransactionEntity element) =>
                    TransactionItem(transaction: element),
              ),
            );
          }
          return const SizedBox();
        },
      ),
    );
  }

yusriltakeuchi avatar Dec 09 '24 02:12 yusriltakeuchi

I got same issue

cindyha avatar Dec 11 '24 12:12 cindyha