Files
pipelines/app/lib/ui/navigation/chevron_pager.dart
T
alan 9551eceaed Complete Material-only APIs and fixtures
Remove obsolete control-family flags and icon metadata across all callers, dead alternate themes and host helpers, obsolete test setup, and the unused icon-font dependency. Preserve native Material Back transitions. Make navigation fixtures independent of update plugins and answer auxiliary shell snapshots so the complete application suite can run deterministically.
2026-11-11 21:55:39 +00:00

89 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import '../adaptive/glass_bar.dart';
/// Previous and next as chevrons in one row at the bottom right, with the
/// position before them (`2 of 5`). Each chevron is named for assistive
/// technology ([previousLabel], [nextLabel]); an end of the list disables its
/// chevron rather than hiding it, so the row never shifts.
class ChevronPager extends StatelessWidget {
const ChevronPager({
super.key,
required this.index,
required this.count,
required this.previousLabel,
required this.nextLabel,
this.onPrevious,
this.onNext,
this.previousKey,
this.nextKey,
this.positionKey,
});
final int index;
final int count;
final String previousLabel;
final String nextLabel;
final VoidCallback? onPrevious;
final VoidCallback? onNext;
final Key? previousKey;
final Key? nextKey;
final Key? positionKey;
@override
Widget build(BuildContext context) {
Widget chevron({
required Key? key,
required bool previous,
required String label,
required VoidCallback? onPressed,
}) {
return IconButton(
key: key,
tooltip: label,
constraints: GlassBarMetrics.materialConstraints(),
padding: EdgeInsets.zero,
onPressed: onPressed,
icon: Icon(
previous ? Icons.chevron_left : Icons.chevron_right,
size: GlassBarMetrics.iconSize(),
),
);
}
// The surrounding glass bar supplies the edge gap ([GlassBarMetrics]).
// The position keeps an icon's inset on each side, so it sits as far from
// the bar's edge and from the chevrons as an icon would.
final inset = GlassBarMetrics.iconInset();
return Row(
mainAxisAlignment: MainAxisAlignment.end,
children: [
Flexible(
fit: FlexFit.tight,
child: Padding(
padding: EdgeInsets.symmetric(horizontal: inset),
child: Text(
'${index + 1} of $count',
key: positionKey,
style: Theme.of(context).textTheme.labelLarge,
overflow: TextOverflow.ellipsis,
),
),
),
chevron(
key: previousKey,
previous: true,
label: previousLabel,
onPressed: onPrevious,
),
chevron(
key: nextKey,
previous: false,
label: nextLabel,
onPressed: onNext,
),
],
);
}
}