Files
rzuastiandClaude Opus 4.8 a51b9c06dc Display unknown values as a dash and centralise repeated literals
Backend: notifications now show a plain "-" for an absent name, vendor, or
device type (was empty string / "(unknown)" / "Unknown"), via a single
UNKNOWN_PLACEHOLDER constant.

Frontend:
- Empty/unknown values render as an em dash everywhere, centralised in a new
  Placeholders.emptyValue constant (replaces inline '—' and '(unknown)').
- Route paths moved to a new Routes class, used by the router and every
  navigation call site.
- Device event type modelled as a DeviceEventType enum mirroring the backend
  (NewDevice/DeviceSeen) instead of bare string comparisons.
- Hardcoded EdgeInsets/SizedBox spacing replaced with existing Insets tokens.

Tests and formatting updated; all backend and frontend tests pass.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-06 16:07:05 -04:00

71 lines
2.4 KiB
Dart

import 'package:flutter/material.dart';
import '../theme/dimens.dart';
class PaginationBar extends StatelessWidget {
const PaginationBar({
super.key,
required this.currentPage,
required this.totalPages,
required this.isLoading,
required this.onPageChanged,
});
final int currentPage;
final int totalPages;
final bool isLoading;
final ValueChanged<int> onPageChanged;
@override
Widget build(BuildContext context) {
final lastPage = totalPages - 1;
final canGoBack = currentPage > 0 && !isLoading;
final canGoForward = currentPage < lastPage && !isLoading;
// Phones don't have room for the verbose label, so they get the compact
// "X / Y" form; wider layouts spell it out.
final isWide = MediaQuery.sizeOf(context).width >= Breakpoints.medium;
final label = isWide
? 'Page ${currentPage + 1} of $totalPages'
: '${currentPage + 1} / $totalPages';
// While a page change is in flight the buttons disable so the tap reads as
// registered and double-taps are blocked; the progress cue itself is drawn
// by the app shell at the bottom of the page body.
return Padding(
padding: const EdgeInsets.symmetric(vertical: Insets.sm),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton.outlined(
onPressed: canGoBack ? () => onPageChanged(0) : null,
icon: const Icon(Icons.first_page),
tooltip: 'First page',
),
const SizedBox(width: Insets.sm),
IconButton.outlined(
onPressed: canGoBack ? () => onPageChanged(currentPage - 1) : null,
icon: const Icon(Icons.chevron_left),
tooltip: 'Previous page',
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: Insets.lg),
child: Text(label, style: Theme.of(context).textTheme.bodyMedium),
),
IconButton.outlined(
onPressed: canGoForward
? () => onPageChanged(currentPage + 1)
: null,
icon: const Icon(Icons.chevron_right),
tooltip: 'Next page',
),
const SizedBox(width: Insets.sm),
IconButton.outlined(
onPressed: canGoForward ? () => onPageChanged(lastPage) : null,
icon: const Icon(Icons.last_page),
tooltip: 'Last page',
),
],
),
);
}
}