Skip to content

Commit 55fbe04

Browse files
committed
Try to migrate one page
1 parent e899d76 commit 55fbe04

File tree

1 file changed

+33
-29
lines changed

1 file changed

+33
-29
lines changed

app/lib/pages/calendar/pending.dart

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,19 @@ class _CalendarPendingViewState extends State<CalendarPendingView> {
3737
super.initState();
3838
_cubit = context.read<FlowCubit>();
3939
_controller = createSourcedPagingController(
40-
_cubit,
41-
);
42-
_controller.addFetchListener((source, service, offset, limit) async =>
43-
service.calendarItem?.getCalendarItems(
44-
status: EventStatus.values
45-
.where(
46-
(element) => !widget.filter.hiddenStatuses.contains(element))
47-
.toList(),
48-
search: widget.search,
49-
pending: true,
50-
offset: offset,
51-
limit: limit,
52-
resourceIds: widget.filter.resources,
53-
));
40+
cubit: _cubit,
41+
fetch: (source, service, offset, limit) async =>
42+
service.calendarItem?.getCalendarItems(
43+
status: EventStatus.values
44+
.where((element) =>
45+
!widget.filter.hiddenStatuses.contains(element))
46+
.toList(),
47+
search: widget.search,
48+
pending: true,
49+
offset: offset,
50+
limit: limit,
51+
resourceIds: widget.filter.resources,
52+
));
5453
}
5554

5655
@override
@@ -82,23 +81,28 @@ class _CalendarPendingViewState extends State<CalendarPendingView> {
8281
const SizedBox(height: 8),
8382
Expanded(
8483
child: LayoutBuilder(
85-
builder: (context, constraints) => PagedListView(
86-
pagingController: _controller,
87-
builderDelegate: buildMaterialPagedDelegate<
88-
SourcedConnectedModel<CalendarItem, Event?>>(
89-
_controller,
90-
(context, item, index) {
91-
return ConstrainedBox(
92-
constraints: const BoxConstraints(maxWidth: 1000),
93-
child: CalendarListTile(
94-
key: ValueKey('${item.source}@${item.main.id}'),
95-
eventItem: item,
96-
onRefresh: _controller.refresh,
84+
builder: (context, constraints) => PagingListener(
85+
controller: _controller,
86+
builder: (context, state, fetchNextPage) {
87+
return PagedListView(
88+
state: state,
89+
fetchNextPage: fetchNextPage,
90+
builderDelegate: buildMaterialPagedDelegate<
91+
SourcedConnectedModel<CalendarItem, Event?>>(
92+
_controller,
93+
(context, item, index) {
94+
return ConstrainedBox(
95+
constraints: const BoxConstraints(maxWidth: 1000),
96+
child: CalendarListTile(
97+
key: ValueKey('${item.source}@${item.main.id}'),
98+
eventItem: item,
99+
onRefresh: _controller.refresh,
100+
),
101+
);
102+
},
97103
),
98104
);
99-
},
100-
),
101-
),
105+
}),
102106
),
103107
),
104108
],

0 commit comments

Comments
 (0)