Implemented proper map popup with navigation
This commit is contained in:
60
lib/widgets/map_popup.dart
Normal file
60
lib/widgets/map_popup.dart
Normal 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'),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user