29 lines
813 B
Dart
29 lines
813 B
Dart
import 'package:flutter/material.dart';
|
|
|
|
import '../model/flood_station.dart';
|
|
import '../pages/flood_station_page.dart';
|
|
|
|
class FloodStationListView extends StatelessWidget {
|
|
const FloodStationListView({super.key, required List<FloodStation> stations})
|
|
: _stations = stations;
|
|
|
|
final List<FloodStation> _stations;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ListView.builder(
|
|
itemBuilder: (context, index) {
|
|
final item = _stations.elementAt(index);
|
|
return ListTile(
|
|
onTap: () => Navigator.of(context).push(MaterialPageRoute(
|
|
builder: (context) => FloodStationPage(floodStation: item),
|
|
)),
|
|
title: Text(item.label),
|
|
subtitle: Text(item.town),
|
|
);
|
|
},
|
|
itemCount: _stations.length,
|
|
);
|
|
}
|
|
}
|