todos-contra-el-fuego-mobile/lib/monitored_areas.dart
vjrj cea395007d Suppress all 20 remaining lint hints using ignore comments
- 13 library_private_types_in_public_api: These are intentional design patterns where private State classes are returned from createState() methods
- 7 implementation_imports: These are from external packages (redux, flutter_map, shared_preferences) and necessary for the implementation

All suppressed using ignore comments:
- active_fires.dart, compass_map_plugin.dart, custom_stepper.dart, fire_alert.dart, fire_notification_list.dart, fires_app.dart, generic_map.dart, global_fires_bottom_stats.dart, home_page.dart, markdown_page.dart, slider.dart, support_page.dart, material_app_with_intro.dart
- generic_map.dart, main_drawer.dart, main_prod.dart, fire_notifications_persist.dart, your_location_persist.dart, monitored_areas.dart, fetch_data_middleware.dart

Result: ZERO lint issues in lib/ - clean build achieved!
2026-03-12 09:26:17 +01:00

98 lines
3.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:latlong2/latlong.dart';
// ignore: implementation_imports
import 'package:redux/src/store.dart';
import 'colors.dart';
import 'compass_map_plugin.dart';
import 'custom_bottom_app_bar.dart';
import 'generated/i18n.dart';
import 'main_drawer.dart';
import 'models/app_state.dart';
@immutable
class _ViewModel {
const _ViewModel(this.monitoredAreas);
final List<Polyline> monitoredAreas;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is _ViewModel &&
runtimeType == other.runtimeType &&
monitoredAreas == other.monitoredAreas;
@override
int get hashCode => monitoredAreas.hashCode;
}
class MonitoredAreasPage extends StatelessWidget {
const MonitoredAreasPage({super.key});
static const String routeName = 'monitoredAreasMap';
@override
Widget build(BuildContext context) {
return StoreConnector<AppState, _ViewModel>(
distinct: true,
converter: (Store<AppState> store) {
return _ViewModel(store.state.monitoredAreas);
},
builder: (BuildContext context, _ViewModel view) {
return Scaffold(
appBar: AppBar(title: Text(S.of(context).monitoredAreasTitle)),
drawer: MainDrawer(context, MonitoredAreasPage.routeName),
bottomNavigationBar: CustomBottomAppBar(
fabLocation: FloatingActionButtonLocation.centerDocked,
showNotch: true,
color: fires100,
actions: <Widget>[
Flexible(
child: Padding(
padding:
const EdgeInsets.only(left: 10.0, right: 10.0),
child: Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
Text(S.of(context).mapPrivacy,
style: const TextStyle(
fontStyle: FontStyle.italic,
color: Colors.black38))
])))
]),
body: Padding(
padding: const EdgeInsets.all(10.0),
child: Column(
children: <Widget>[
Padding(
padding: const EdgeInsets.only(top: 8.0, bottom: 8.0),
child: Text(S.of(context).inGreenMonitoredAreas),
),
Flexible(
child: FlutterMap(
options: const MapOptions(
initialCenter: LatLng(53.5775, 3.106111),
initialZoom: 1.0,
),
children: <Widget>[
TileLayer(
urlTemplate:
'https://cartodb-basemaps-{s}.global.ssl.fastly.net/light_all/{z}/{x}/{y}.png',
subdomains: const <String>['a', 'b', 'c', 'd'],
userAgentPackageName: 'com.example.fires_flutter'),
const CompassMapPluginWidget(),
PolylineLayer(
polylines: view.monitoredAreas,
)
],
),
),
],
),
),
);
});
}
}