bosskmk / pluto_grid

PlutoGrid is a dataGrid for flutter that can be controlled by the keyboard on desktop and web. Of course, it works well on Android and IOS.
https://pluto.weblaze.dev
MIT License
635 stars 288 forks source link

[Bug] #1043

Closed icred-raul closed 1 month ago

icred-raul commented 2 months ago

Steps to reproduce the bug

  1. Set infinite scroll on pluto grid mobile
  2. Try to scroll infinitely

Expected results

Scroll infintely on mobile platform too. I had tested on web and worked very well.

Actual results

https://github.com/bosskmk/pluto_grid/assets/126168272/8d6155ab-92f9-463a-b125-087d21a08d33

Code sample

return PlutoGrid(
    mode: PlutoGridMode.selectWithOneTap,
    createFooter: (stateManager) {
      return PlutoInfinityScrollRows(
        fetch: fetch,
        stateManager: stateManager,
        initialFetch: true,
        fetchWithFiltering: true,
        fetchWithSorting: true,
      );
    },
    onLoaded: (event) {
      store.setListExportStateManager(event.stateManager);
    },
    onSelected: (event) {
      if (event.row?.cells['isFinished']?.value) {
        _showMenu(
          context: context,
          uuid: event.row?.cells['uuid']?.value,
        );
      }
    },
    configuration: const PlutoGridConfiguration(
      localeText: PlutoGridLocaleText.brazilianPortuguese(),
    ),
    columns: GridListExportMobile()._columns,
    rows: GridListExportMobile().rows(
      export: store.listExport,
    ),
  );

  Future<PlutoInfinityScrollRowsResponse> fetch(
  PlutoInfinityScrollRowsRequest request,
) async {
  final store = GetIt.I.get<ListExportsStore>();

  final filterModel = {
    if (store.startDate != null && store.endDate != null)
      "startDate": FilterModelDart(
        filterType: 'dateTime',
        type: 'inRange',
        dateFrom: store.startDate?.startDateFormattedToBack,
        dateTo: store.endDate?.endDateFormattedToBack,
      ).toJson(),
    if (store.startDate != null)
      "startDate": FilterModelDart(
        filterType: 'dateTime',
        type: 'greaterThanOrEqual',
        dateFrom: store.startDate?.startDateFormattedToBack,
      ).toJson(),
    if (store.uuid != null && store.uuid!.isNotEmpty)
      "uuid": FilterModelDart(
        type: 'equals',
        filterType: 'text',
        filter: store.uuid,
      ).toJson(),
    if (store.cpf != null && store.cpf!.isNotEmpty)
      "createPerson.code": FilterModelDart(
        type: 'equals',
        filterType: 'text',
        filter: store.cpf != null
            ? UtilBrasilFields.removeCaracteres(store.cpf!)
            : null,
      ).toJson(),
  };

  final repository = GetIt.I.get<ExportRepository>();

  final result = await repository.exportList({
    "startRow": request.filterRows.length * 10,
    "endRow": request.filterRows.length * 10,
    "sortModel": [
      {"sort": "desc", "colId": "startDate"}
    ],
    "filterModel": filterModel,
  });

  final rows = (result['rowData'] as List)
      .map((e) => ExportModelResponse.fromJson(e))
      .toList();

  return PlutoInfinityScrollRowsResponse(
    isLast: false,
    rows: GridListExportMobile().rows(export: rows),
  );
}

Execution Environment

Flutter version

PlutoGrid version

OS

github-actions[bot] commented 1 month ago

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] commented 1 month ago

This issue was closed because it has been inactive for 14 days since being marked as stale.