Pagination
Pagination gives a long set of results stable page boundaries. Keep the chosen page visible while its results change.
Browse result pages
#Move between three pages of notes. Each page contains a different title, shown with its page number.
components/pagination/appliance/browse_results.dart
import 'package:flutter/widgets.dart';
import 'package:appliance_ui/appliance_ui.dart';
class BrowseResults extends StatefulWidget {
const BrowseResults({super.key});
@override
State<BrowseResults> createState() => _BrowseResultsState();
}
class _BrowseResultsState extends State<BrowseResults> {
int page = 1;
static const titles = ['Field notes', 'Reading list', 'Trip plan'];
@override
Widget build(BuildContext context) => ConstrainedBox(
constraints: const BoxConstraints(maxWidth: 600),
child: Column(
mainAxisSize: MainAxisSize.min,
children: [
AppliancePagination(
pageCount: titles.length,
page: page,
onChanged: (next) => setState(() => page = next),
),
const SizedBox(height: 12),
Text('Page $page · ${titles[page - 1]}'),
],
),
);
}
Parameters
AppliancePagination API ↗pageCount- Total number of result pages.
page- Current page, counted from 1.
onChanged- Receives the requested page.
Shared behaviour
- Keyboard and focus. Tab through the available page actions and activate another page. At either end, inspect which controls remain available.
- Screen readers. Read the available page numbers, current selection and result title.
- Direction and type. Compare the previous and next controls in RTL. Increase the text size to see how the page labels fit.