mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Consolidate frontend scanner, pagination, and tick-timer duplication
Collapse the five scanner status models into two shared shapes, ActiveScannerStatus and PassiveScannerStatus, mirroring the backend's active/passive vocabulary. Replace the five near-identical per-scanner detail card files with a single scanner_status_cards.dart (two shared resolvers plus a config list), and rebuild the combined home card to iterate a list of scanners with two shape resolvers instead of five copy-pasted resolve methods. Extract two reusable mixins: - PeriodicRebuild: the shared once-a-second "rebuild to refresh elapsed text" timer used by the scanner cards and the stale indicator. - PaginatedListState: the shared pagination state, page-size/page-count getters, cancel-token-aware fetch orchestration, and disposal used by the device and notification lists. No behaviour change; ~900 lines removed. Tests and analyzer pass.
This commit is contained in:
@@ -1,30 +1,22 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../theme/dimens.dart';
|
||||
import '../widgets/arp_scanner_card.dart';
|
||||
import '../widgets/dhcp_scanner_card.dart';
|
||||
import '../widgets/mdns_scanner_card.dart';
|
||||
import '../widgets/snmp_scanner_card.dart';
|
||||
import '../widgets/ssdp_scanner_card.dart';
|
||||
import '../widgets/scanner_status_cards.dart';
|
||||
|
||||
class StatusScreen extends StatelessWidget {
|
||||
const StatusScreen({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final cards = scannerStatusCards();
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
const ArpScannerCard(),
|
||||
const SizedBox(height: Insets.sm),
|
||||
const MdnsScannerCard(),
|
||||
const SizedBox(height: Insets.sm),
|
||||
const SsdpScannerCard(),
|
||||
const SizedBox(height: Insets.sm),
|
||||
const DhcpScannerCard(),
|
||||
const SizedBox(height: Insets.sm),
|
||||
const SnmpScannerCard(),
|
||||
for (var i = 0; i < cards.length; i++) ...[
|
||||
if (i > 0) const SizedBox(height: Insets.sm),
|
||||
cards[i],
|
||||
],
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user