61 lines
1.7 KiB
Dart
61 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:intl/intl.dart' as intl;
|
|
|
|
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;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return AlertDialog(
|
|
title: Text(station.label),
|
|
content: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(Icons.home_outlined),
|
|
Padding(padding: EdgeInsets.only(left: 8)),
|
|
Text(station.town.isEmpty ? '-' : station.town),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Icon(Icons.water),
|
|
Padding(padding: EdgeInsets.only(left: 8)),
|
|
Text(station.riverName.isEmpty ? '-' : station.riverName),
|
|
],
|
|
),
|
|
Row(
|
|
children: [
|
|
Icon(Icons.calendar_month_outlined),
|
|
Padding(padding: EdgeInsets.only(left: 8)),
|
|
Text(
|
|
station.dateOpened != null
|
|
? intl.DateFormat.yMd().format(station.dateOpened!)
|
|
: '-',
|
|
),
|
|
],
|
|
)
|
|
],
|
|
),
|
|
actions: [
|
|
TextButton(
|
|
onPressed: () => Navigator.of(context).pop(),
|
|
child: Text('dismiss'),
|
|
),
|
|
TextButton(
|
|
onPressed: onShowTapped,
|
|
child: Text('show'),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|