This file contains hidden or 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
| onPageChanged: (int index) { | |
| setState(() => _index = index); | |
| indexMarker = Tools.markersList[index].id; | |
| if (Tools.markersList[index].latitude != null && | |
| Tools.markersList[index].longitude != null) { | |
| newPosition = LatLng( | |
| double.tryParse( | |
| Tools.markersList[index].latitude), | |
| double.tryParse( | |
| Tools.markersList[index].longitude)); |
This file contains hidden or 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
| Positioned.fill( | |
| child: ValueListenableBuilder( | |
| valueListenable: valueNotifier, | |
| builder: (context, value, child) { | |
| return GoogleMap( | |
| zoomControlsEnabled: false, | |
| markers: markers, | |
| myLocationEnabled: true, | |
| myLocationButtonEnabled: false, | |
| onMapCreated: _onMapCreated, |
This file contains hidden or 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
| int _index = 0; | |
| int indexMarker; | |
| ValueNotifier valueNotifier = ValueNotifier(indexMarker); |
This file contains hidden or 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
| //******* getMarkers */ | |
| Future<Uint8List> getBytesFromAsset(String path, int width) async { | |
| ByteData data = await rootBundle.load(path); | |
| ui.Codec codec = await ui.instantiateImageCodec(data.buffer.asUint8List(), | |
| targetWidth: width); | |
| ui.FrameInfo fi = await codec.getNextFrame(); | |
| return (await fi.image.toByteData(format: ui.ImageByteFormat.png)) | |
| .buffer | |
| .asUint8List(); | |
| } |
This file contains hidden or 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 'dart:typed_data'; | |
| import 'dart:async'; | |
| import "package:flutter/material.dart"; | |
| import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
| import 'package:flutter/services.dart'; | |
| import 'dart:ui' as ui; | |
| import 'package:flutter/widgets.dart'; | |
| import '../tools/tools.dart'; |
This file contains hidden or 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 '../models/markerModel.dart'; | |
| class Tools { | |
| static List<MarkersModel> markersList = List(); | |
| } |
This file contains hidden or 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
| class MarkersModel { | |
| int id; | |
| String name; | |
| String description; | |
| String latitude; | |
| String longitude; | |
| String image; | |
| MarkersModel( | |
| this.id, | |
| this.name, |
This file contains hidden or 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
| Align( | |
| alignment: Alignment.bottomCenter, | |
| child: Padding( | |
| padding: const EdgeInsets.only(bottom: 78.0), | |
| child: SizedBox( | |
| height: 116, // card height | |
| child: PageView.builder( | |
| itemCount: 3, // how many items do we have | |
| controller: PageController(viewportFraction: 0.9), | |
| onPageChanged: (int index) { |
This file contains hidden or 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 'dart:async'; | |
| import 'package:flutter/material.dart'; | |
| import 'package:google_maps_flutter/google_maps_flutter.dart'; | |
| //Global Variables | |
| const LatLng _center = const LatLng(36.737232, 3.086472); | |
| Set<Marker> markers = {}; | |
| class MainMapScreen extends StatefulWidget { |
This file contains hidden or 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
| <manifest ... | |
| <application ... | |
| <meta-data android:name="com.google.android.geo.API_KEY" | |
| android:value="YOUR ANDROID API KEY HERE"/> |