Skip to content

Commit

Permalink
Merge pull request #7 from moha-b/map
Browse files Browse the repository at this point in the history
map
  • Loading branch information
moha-b authored Jan 25, 2024
2 parents 9a0fe75 + d13e435 commit e72f1e1
Show file tree
Hide file tree
Showing 3 changed files with 179 additions and 3 deletions.
161 changes: 161 additions & 0 deletions assets/map/map_dark_theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
[
{
"elementType": "geometry",
"stylers": [
{
"color": "#242f3e"
}
]
},
{
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#746855"
}
]
},
{
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#242f3e"
}
]
},
{
"featureType": "administrative.locality",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#d59563"
}
]
},
{
"featureType": "poi",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#d59563"
}
]
},
{
"featureType": "poi.park",
"elementType": "geometry",
"stylers": [
{
"color": "#263c3f"
}
]
},
{
"featureType": "poi.park",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#6b9a76"
}
]
},
{
"featureType": "road",
"elementType": "geometry",
"stylers": [
{
"color": "#38414e"
}
]
},
{
"featureType": "road",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#212a37"
}
]
},
{
"featureType": "road",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#9ca5b3"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry",
"stylers": [
{
"color": "#746855"
}
]
},
{
"featureType": "road.highway",
"elementType": "geometry.stroke",
"stylers": [
{
"color": "#1f2835"
}
]
},
{
"featureType": "road.highway",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#f3d19c"
}
]
},
{
"featureType": "transit",
"elementType": "geometry",
"stylers": [
{
"color": "#2f3948"
}
]
},
{
"featureType": "transit.station",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#d59563"
}
]
},
{
"featureType": "water",
"elementType": "geometry",
"stylers": [
{
"color": "#17263c"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.fill",
"stylers": [
{
"color": "#515c6d"
}
]
},
{
"featureType": "water",
"elementType": "labels.text.stroke",
"stylers": [
{
"color": "#17263c"
}
]
}
]
20 changes: 17 additions & 3 deletions lib/features/map/screens/map_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ class Map extends StatefulWidget {
}

class _MapState extends State<Map> {
Completer<GoogleMapController> _controller = Completer();
final Completer<GoogleMapController> _controller = Completer();
final Set<Marker> _markers = Set<Marker>();
String mapTheme = '';
static final LatLng _center = LatLng(Location.instance.position!.latitude,
Location.instance.position!.longitude);

void _onMapCreated(GoogleMapController controller) {
controller.setMapStyle(mapTheme);
_controller.complete(controller);
}

Expand All @@ -35,7 +37,11 @@ class _MapState extends State<Map> {
@override
void initState() {
super.initState();

DefaultAssetBundle.of(context)
.loadString('assets/map/map_dark_theme.json')
.then((value) {
mapTheme = value;
});
_setMarker(_center);
}

Expand All @@ -46,9 +52,17 @@ class _MapState extends State<Map> {
GoogleMap(
onMapCreated: _onMapCreated,
markers: _markers,
circles: {
Circle(
circleId: const CircleId("1"),
center: _center,
fillColor: Colors.blueAccent.withOpacity(0.1),
strokeWidth: 2,
radius: 600),
},
initialCameraPosition: CameraPosition(
target: _center,
zoom: 17.0,
zoom: 16.0,
),
),
],
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ flutter:
- assets/images/weather/sun.svg
- assets/images/weather/wind.svg
- assets/lottie/
- assets/map/map_dark_theme.json

# To add custom fonts to your application, add a fonts section here,
# example:
Expand Down

0 comments on commit e72f1e1

Please sign in to comment.