Implemented proper map popup with navigation

This commit is contained in:
2025-01-28 19:21:17 +01:00
parent 89743886af
commit 8f3b3fe05e
2 changed files with 74 additions and 16 deletions

View File

@@ -0,0 +1,60 @@
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'),
),
],
);
}
}