flutter_map_gl 0.1.1 copy "flutter_map_gl: ^0.1.1" to clipboard
flutter_map_gl: ^0.1.1 copied to clipboard

Flutter paketi ile mobil uygulamalarda (iOS ve Android) haritaları kullanmanıza olanak tanıyan bir paket.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_map_gl/flutter_map_gl.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(title: 'Flutter Map GL Örneği', theme: ThemeData(primarySwatch: Colors.blue, useMaterial3: true), home: const MapScreen());
  }
}

class MapScreen extends StatefulWidget {
  const MapScreen({Key? key}) : super(key: key);

  @override
  State<MapScreen> createState() => _MapScreenState();
}

class _MapScreenState extends State<MapScreen> {
  final MapController _controller = MapController();

  // Klokantech temel harita URL'i ve parametreleri
  final String _mapUrl = "https://inovision.tech/styles/klokantech-basic/#16.96/37.872351/32.492013/-36.9/60";
  late MapOptions _mapOptions;

  @override
  void initState() {
    super.initState();
    // URL'den harita seçeneklerini oluştur
    _mapOptions = MapOptions.fromUrl(_mapUrl);
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Flutter Map GL Demo'),
        actions: [
          IconButton(
            icon: const Icon(Icons.refresh),
            onPressed: () {
              setState(() {
                // Harita seçeneklerini yeniden yükle
                _mapOptions = MapOptions.fromUrl(_mapUrl);
              });
            },
          ),
        ],
      ),
      body: Column(
        children: [
          Expanded(
            child: FlutterMapGL(
              options: _mapOptions,
              controller: _controller,
              onMapCreated: () {
                print('Harita oluşturuldu!');
              },
              onMapClick: (latLng) {
                print('Haritada tıklandı: $latLng');
              },
            ),
          ),
          Padding(
            padding: const EdgeInsets.all(16.0),
            child: Column(
              children: [
                Text(
                  'Konum: ${_mapOptions.center.latitude.toStringAsFixed(6)}, ${_mapOptions.center.longitude.toStringAsFixed(6)}',
                  style: Theme.of(context).textTheme.bodyLarge,
                  textAlign: TextAlign.center,
                ),
                const SizedBox(height: 4),
                Text(
                  'Zoom: ${_mapOptions.zoom.toStringAsFixed(2)} | Bearing: ${_mapOptions.bearing.toStringAsFixed(1)}° | Tilt: ${_mapOptions.pitch.toStringAsFixed(1)}°',
                  style: Theme.of(context).textTheme.bodySmall,
                  textAlign: TextAlign.center,
                ),
              ],
            ),
          ),
        ],
      ),
      floatingActionButton: Column(
        mainAxisAlignment: MainAxisAlignment.end,
        children: [
          FloatingActionButton(
            heroTag: 'zoom_in',
            onPressed: () {
              _controller.setZoom(_mapOptions.zoom + 1);
              setState(() {});
            },
            child: const Icon(Icons.add),
          ),
          const SizedBox(height: 16),
          FloatingActionButton(
            heroTag: 'zoom_out',
            onPressed: () {
              _controller.setZoom(_mapOptions.zoom - 1);
              setState(() {});
            },
            child: const Icon(Icons.remove),
          ),
        ],
      ),
    );
  }
}
1
likes
0
points
36
downloads

Publisher

verified publishermuhammedfurkansahin.com.tr

Weekly Downloads

Flutter paketi ile mobil uygulamalarda (iOS ve Android) haritaları kullanmanıza olanak tanıyan bir paket.

Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

Dependencies

flutter, webview_flutter, webview_flutter_android, webview_flutter_wkwebview

More

Packages that depend on flutter_map_gl