added comments and refactored code
This commit is contained in:
@@ -5,14 +5,19 @@ import '../model/flood_station.dart';
|
||||
|
||||
class MapPopup extends StatelessWidget {
|
||||
const MapPopup(
|
||||
{super.key, required this.station, required this.onShowTapped});
|
||||
final FloodStation station;
|
||||
final Function() onShowTapped;
|
||||
{super.key,
|
||||
required FloodStation station,
|
||||
required dynamic Function() onShowTapped})
|
||||
: _onShowTapped = onShowTapped,
|
||||
_station = station;
|
||||
|
||||
final FloodStation _station;
|
||||
final Function() _onShowTapped;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AlertDialog(
|
||||
title: Text(station.label),
|
||||
title: Text(_station.label),
|
||||
content: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
@@ -22,14 +27,14 @@ class MapPopup extends StatelessWidget {
|
||||
children: [
|
||||
Icon(Icons.home_outlined),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Text(station.town.isEmpty ? '-' : station.town),
|
||||
Text(_station.town.isEmpty ? '-' : _station.town),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
children: [
|
||||
Icon(Icons.water),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Text(station.riverName.isEmpty ? '-' : station.riverName),
|
||||
Text(_station.riverName.isEmpty ? '-' : _station.riverName),
|
||||
],
|
||||
),
|
||||
Row(
|
||||
@@ -37,8 +42,8 @@ class MapPopup extends StatelessWidget {
|
||||
Icon(Icons.calendar_month_outlined),
|
||||
Padding(padding: EdgeInsets.only(left: 8)),
|
||||
Text(
|
||||
station.dateOpened != null
|
||||
? intl.DateFormat.yMd().format(station.dateOpened!)
|
||||
_station.dateOpened != null
|
||||
? intl.DateFormat.yMd().format(_station.dateOpened!)
|
||||
: '-',
|
||||
),
|
||||
],
|
||||
@@ -51,7 +56,7 @@ class MapPopup extends StatelessWidget {
|
||||
child: Text('dismiss'),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: onShowTapped,
|
||||
onPressed: _onShowTapped,
|
||||
child: Text('show'),
|
||||
),
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user