mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Shrink notification and device list page sizes on phones
On phone-width layouts (< Breakpoints.medium) the notification and device lists now request fewer items per page so the list and its pagination bar fit on screen together on common current phones. Notifications use 4 items and devices 6 on phones; wider layouts keep 5 and 10 respectively. The initial fetch is deferred to didChangeDependencies so the page size can read the screen width from MediaQuery. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
8b8fa5ce89
commit
0a899b7890
@@ -62,19 +62,21 @@ void main() {
|
||||
tester.view.devicePixelRatio = 1.0;
|
||||
addTearDown(tester.view.resetPhysicalSize);
|
||||
|
||||
// The 400px-wide viewport above is a phone, so the list uses the smaller
|
||||
// phone page size of 4 (requesting page_limit 5 to detect a next page).
|
||||
List<Map<String, dynamic>> page(int firstId) => List.generate(
|
||||
6,
|
||||
5,
|
||||
(i) => notificationJson(id: firstId + i, title: 'Item ${firstId + i}'),
|
||||
);
|
||||
adapter.onGet(
|
||||
'/notifications',
|
||||
(server) => server.reply(200, page(1)),
|
||||
queryParameters: {'is_new': true, 'page_offset': 0, 'page_limit': 6},
|
||||
queryParameters: {'is_new': true, 'page_offset': 0, 'page_limit': 5},
|
||||
);
|
||||
adapter.onGet(
|
||||
'/notifications',
|
||||
(server) => server.reply(200, page(7)),
|
||||
queryParameters: {'is_new': true, 'page_offset': 5, 'page_limit': 6},
|
||||
(server) => server.reply(200, page(6)),
|
||||
queryParameters: {'is_new': true, 'page_offset': 4, 'page_limit': 5},
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
@@ -119,7 +121,7 @@ void main() {
|
||||
adapter.onGet(
|
||||
'/notifications',
|
||||
(server) => server.reply(200, items),
|
||||
queryParameters: {'is_new': true, 'page_offset': 0, 'page_limit': 6},
|
||||
queryParameters: {'is_new': true, 'page_offset': 0, 'page_limit': 5},
|
||||
);
|
||||
|
||||
await tester.pumpWidget(
|
||||
|
||||
Reference in New Issue
Block a user