Skip to content

Commit

Permalink
added permissions and fixed map rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnnyNguyen01 committed Aug 16, 2020
1 parent 29d7748 commit 8c96a93
Show file tree
Hide file tree
Showing 8 changed files with 141 additions and 47 deletions.
18 changes: 18 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ PODS:
- Flutter (1.0.0)
- flutter_plugin_android_lifecycle (0.0.1):
- Flutter
- "geolocator (5.3.2+2)":
- Flutter
- google_api_availability (2.0.4):
- Flutter
- google_maps_flutter (0.0.1):
- Flutter
- GoogleMaps (< 3.10)
Expand All @@ -10,6 +14,8 @@ PODS:
- GoogleMaps/Base (2.7.0)
- GoogleMaps/Maps (2.7.0):
- GoogleMaps/Base
- "location_permissions (3.0.0+1)":
- Flutter
- path_provider (0.0.1):
- Flutter
- path_provider_linux (0.0.1):
Expand All @@ -22,7 +28,10 @@ PODS:
DEPENDENCIES:
- Flutter (from `Flutter`)
- flutter_plugin_android_lifecycle (from `.symlinks/plugins/flutter_plugin_android_lifecycle/ios`)
- geolocator (from `.symlinks/plugins/geolocator/ios`)
- google_api_availability (from `.symlinks/plugins/google_api_availability/ios`)
- google_maps_flutter (from `.symlinks/plugins/google_maps_flutter/ios`)
- location_permissions (from `.symlinks/plugins/location_permissions/ios`)
- path_provider (from `.symlinks/plugins/path_provider/ios`)
- path_provider_linux (from `.symlinks/plugins/path_provider_linux/ios`)
- path_provider_macos (from `.symlinks/plugins/path_provider_macos/ios`)
Expand All @@ -37,8 +46,14 @@ EXTERNAL SOURCES:
:path: Flutter
flutter_plugin_android_lifecycle:
:path: ".symlinks/plugins/flutter_plugin_android_lifecycle/ios"
geolocator:
:path: ".symlinks/plugins/geolocator/ios"
google_api_availability:
:path: ".symlinks/plugins/google_api_availability/ios"
google_maps_flutter:
:path: ".symlinks/plugins/google_maps_flutter/ios"
location_permissions:
:path: ".symlinks/plugins/location_permissions/ios"
path_provider:
:path: ".symlinks/plugins/path_provider/ios"
path_provider_linux:
Expand All @@ -51,8 +66,11 @@ EXTERNAL SOURCES:
SPEC CHECKSUMS:
Flutter: 0e3d915762c693b495b44d77113d4970485de6ec
flutter_plugin_android_lifecycle: dc0b544e129eebb77a6bfb1239d4d1c673a60a35
geolocator: f7622e0e7e2a24718285b73916d60c4a54b9f5b6
google_api_availability: 15fa42a8cd83c0a6738507ffe6e87096f12abcb8
google_maps_flutter: c7f9c73576de1fbe152a227bfd6e6c4ae8088619
GoogleMaps: f79af95cb24d869457b1f961c93d3ce8b2f3b848
location_permissions: 7e0f9aa0f60deb8ff93ddf0e2a164c7e8197bc94
path_provider: abfe2b5c733d04e238b0d8691db0cfd63a27a93c
path_provider_linux: 4d630dc393e1f20364f3e3b4a2ff41d9674a84e4
path_provider_macos: f760a3c5b04357c380e2fddb6f9db6f3015897e0
Expand Down
4 changes: 4 additions & 0 deletions ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -262,13 +262,17 @@
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh",
"${PODS_ROOT}/../Flutter/Flutter.framework",
"${BUILT_PRODUCTS_DIR}/flutter_plugin_android_lifecycle/flutter_plugin_android_lifecycle.framework",
"${BUILT_PRODUCTS_DIR}/geolocator/geolocator.framework",
"${BUILT_PRODUCTS_DIR}/google_api_availability/google_api_availability.framework",
"${BUILT_PRODUCTS_DIR}/path_provider/path_provider.framework",
"${BUILT_PRODUCTS_DIR}/xs_progress_hud/xs_progress_hud.framework",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Flutter.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/flutter_plugin_android_lifecycle.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/geolocator.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/google_api_availability.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/path_provider.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/xs_progress_hud.framework",
);
Expand Down
8 changes: 7 additions & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,11 @@
<false/>
<key>io.flutter.embedded_views_preview</key>
<string>YES </string>
</dict>
<key>NSLocationWhenInUseUsageDescription</key>
<string>needed for map</string>
<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>
<key>NSMicrophoneUsageDescription</key>
<string>Can I use the mic please?</string>
</dict>
</plist>
12 changes: 6 additions & 6 deletions lib/components/bottom_sheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ class CustomBottomSheet extends StatelessWidget {
List<Widget> areaUpdateCardsList;

CustomBottomSheet({
this.imageURL,
this.reports,
this.location,
this.isSafe,
this.rfsResponse,
this.areaUpdateCardsList,
@required this.imageURL,
@required this.reports,
@required this.location,
@required this.isSafe,
@required this.rfsResponse,
@required this.areaUpdateCardsList,
});

@override
Expand Down
17 changes: 17 additions & 0 deletions lib/data/area_update_card_lists.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,20 @@ final sydney = [
color: Colors.red.shade700,
),
];

final gundabrookaUpdateCardList = [
AreaUpdateCard(
title: "Area now declared DANGEROUS",
color: Colors.red.shade700,
textOne: "RFS has been dispatched to outbreak",
textTwo: "evacuate as soon as possible",
icon: FontAwesomeIcons.bell,
),
AreaUpdateCard(
title: "Caution is advises",
textOne: "Hot and dry weather upwards",
textTwo: "of 48 degrees",
icon: FontAwesomeIcons.info,
color: Colors.orange.shade400,
),
];
100 changes: 60 additions & 40 deletions lib/screens/home_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import 'package:modal_bottom_sheet/modal_bottom_sheet.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:signal_flutter_v2/components/bottom_sheet.dart';
import 'package:signal_flutter_v2/data/area_update_card_lists.dart';

//REMOVE THIS GOOGLE_MAPS_API_KEY = 'AIzaSyAr31utYalU_q4_Lh1GtqZrCDgg0VBlcHI'
import 'package:geolocator/geolocator.dart';

class HomeScreen extends StatefulWidget {
@override
Expand All @@ -17,7 +16,7 @@ class _HomeScreenState extends State<HomeScreen> {
GoogleMapController _mapController;
Set<Marker> _markers = HashSet<Marker>();
BitmapDescriptor _customIcon;

Position _position;
// @override
// void initState() {
// super.initState();
Expand All @@ -28,39 +27,51 @@ class _HomeScreenState extends State<HomeScreen> {
// });
// }

@override
void initState() {
// TODO: implement initState
super.initState();
getPosition();
}

void getPosition() async {
_position = await Geolocator()
.getCurrentPosition(desiredAccuracy: LocationAccuracy.high);
}

//The initial method that runs everytime Google Maps Opens
void _onMapCreated(GoogleMapController controller) {
_mapController = controller;
setState(() {
_markers.add(
Marker(
//todo change marker id -> unique
markerId: MarkerId("0"),
position: LatLng(-33.8688, 151.2093),
onTap: () {
showCupertinoModalBottomSheet(
context: context,
builder: (context, scrollController) {
return Opacity(
opacity: 0.8,
child: Scaffold(
body: CustomBottomSheet(
location: "Sydney",
reports: "124",
isSafe: true,
rfsResponse: "none",
areaUpdateCardsList: sydney,
imageURL:
"https://www.nationalparks.nsw.gov.au/-/media/npws/images/parks/gundabooka-national-park/little-mountain-walking-track/little-mountain-track-01.jpg"),
),
);
});
},
infoWindow: InfoWindow(
title: "Sydney",
snippet: "No Fire",
)),
);
// _markers.add(
// Marker(
// //todo change marker id -> unique
// markerId: MarkerId("0"),
// position: LatLng(-33.8688, 151.2093),
// onTap: () {
// showCupertinoModalBottomSheet(
// context: context,
// builder: (context, scrollController) {
// return Opacity(
// opacity: 0.8,
// child: Scaffold(
// body: CustomBottomSheet(
// location: "Sydney",
// reports: "124",
// isSafe: true,
// rfsResponse: "none",
// areaUpdateCardsList: sydney,
// imageURL:
// "https://www.nationalparks.nsw.gov.au/-/media/npws/images/parks/gundabooka-national-park/little-mountain-walking-track/little-mountain-track-01.jpg"),
// ),
// );
// });
// },
// infoWindow: InfoWindow(
// title: "Sydney",
// snippet: "No Fire",
// )),
// );
_addMarkerList();
});
}
Expand All @@ -71,16 +82,23 @@ class _HomeScreenState extends State<HomeScreen> {
//todo change marker id -> unique
markerId: MarkerId("1"),
position: LatLng(-30.501446, 145.702932),
onTap: () {
showCupertinoModalBottomSheet(
context: context,
builder: (context, scrollController) {
return Container();
});
},
onTap: () => {
showCupertinoModalBottomSheet(
context: context,
builder: (context, scrollController) {
return CustomBottomSheet(
imageURL:
"https://www.nationalparks.nsw.gov.au/-/media/npws/images/parks/gundabooka-national-park/valley-of-eagles/valley-of-eagles-walk-01.jpg",
reports: "432",
location: "Gundabrooka",
isSafe: false,
rfsResponse: "in area",
areaUpdateCardsList: gundabrookaUpdateCardList);
}),
},
infoWindow: InfoWindow(
title: "Gunderbrooka",
snippet: "No Fire",
snippet: "🔥🔥🔥",
)),
);
_markers.add(
Expand Down Expand Up @@ -247,6 +265,8 @@ class _HomeScreenState extends State<HomeScreen> {
children: <Widget>[
GoogleMap(
onMapCreated: _onMapCreated,
myLocationEnabled: true,
myLocationButtonEnabled: false,
initialCameraPosition: CameraPosition(
target: LatLng(-33.8688, 151.2093),
zoom: 12,
Expand Down
28 changes: 28 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.3"
equatable:
dependency: transitive
description:
name: equatable
url: "https://pub.dartlang.org"
source: hosted
version: "1.2.3"
file:
dependency: transitive
description:
Expand Down Expand Up @@ -102,6 +109,20 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "8.8.1"
geolocator:
dependency: "direct main"
description:
name: geolocator
url: "https://pub.dartlang.org"
source: hosted
version: "5.3.2+2"
google_api_availability:
dependency: transitive
description:
name: google_api_availability
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.4"
google_fonts:
dependency: "direct main"
description:
Expand Down Expand Up @@ -151,6 +172,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
location_permissions:
dependency: transitive
description:
name: location_permissions
url: "https://pub.dartlang.org"
source: hosted
version: "3.0.0+1"
matcher:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ dependencies:
google_maps_flutter: ^0.5.30
modal_bottom_sheet: ^0.2.0+1
font_awesome_flutter: ^8.8.1
geolocator: ^5.3.2+2

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 8c96a93

Please sign in to comment.