-
-
Save Zverik/d056509e22eeecffdefb3a42a587325f to your computer and use it in GitHub Desktop.
Assertion for the mapController
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:flutter_map/flutter_map.dart'; | |
import 'package:latlong2/latlong.dart' show LatLng; | |
void main() { | |
runApp(const MaterialApp( | |
title: 'Flutter Demo', | |
home: PoiEditorPage(), | |
)); | |
} | |
class PoiEditorPage extends StatefulWidget { | |
const PoiEditorPage({super.key}); | |
@override | |
State createState() => _PoiEditorPageState(); | |
} | |
class _PoiEditorPageState extends State<PoiEditorPage> { | |
final _mapController = MapController(); | |
@override | |
Widget build(BuildContext context) { | |
return Scaffold( | |
appBar: AppBar(title: const Text('Editor')), | |
body: ListView( | |
children: [ | |
SizedBox( | |
height: 100.0, | |
child: FlutterMap( | |
mapController: _mapController, | |
options: const MapOptions( | |
initialCenter: LatLng(50, 30), | |
initialZoom: 17, | |
), | |
children: [ | |
TileLayer( | |
urlTemplate: 'https://tile.openstreetmap.org/{z}/{x}/{y}.png', | |
), | |
], | |
), | |
), | |
for (int i = 1; i < 50; i++) | |
Padding( | |
padding: const EdgeInsets.all(30.0), | |
child: Center( | |
child: Text('Line $i', style: const TextStyle(fontSize: 20))), | |
), | |
], | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment