Skip to content

Commit

Permalink
map screen
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian0KIM committed Dec 2, 2024
1 parent 42c97d8 commit 701a628
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 6 deletions.
1 change: 1 addition & 0 deletions dartFront/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ dependencies:
dio: ^5.4.0
envied: ^0.5.3
url_launcher: ^6.2.5
google_maps_flutter: ^2.10.0

assets:
- assets/data/
Expand Down
2 changes: 2 additions & 0 deletions front/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release

.env
17 changes: 14 additions & 3 deletions front/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ plugins {
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
localPropertiesFile.withReader('UTF-8') { reader ->
localProperties.load(reader)
}
}
android {
namespace = "com.example.front"
compileSdk = flutter.compileSdkVersion
Expand All @@ -24,12 +30,13 @@ android {
applicationId = "com.example.front"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
minSdk = 20
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
resValue "string", "GOOGLE_MAPS_API_KEY", localProperties['GOOGLE_MAPS_API_KEY']
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
Expand All @@ -38,6 +45,10 @@ android {
}
}
}
dependencies { // 여기에 dependencies 블록 추가
implementation 'com.google.android.gms:play-services-maps:18.2.0'
implementation 'com.google.android.gms:play-services-location:21.2.0'
}

flutter {
source = "../.."
Expand Down
6 changes: 6 additions & 0 deletions front/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<application
android:label="front"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="@string/GOOGLE_MAPS_API_KEY" />
<activity
android:name=".MainActivity"
android:exported="true"
Expand Down
7 changes: 4 additions & 3 deletions front/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import "bus_info.dart";
import "passed_bus_page.dart";
import "bus_screen.dart";
import "station_screen.dart";
import "map_screen.dart";
void main() {
runApp(const MyApp());
}
Expand Down Expand Up @@ -51,8 +52,8 @@ class _LoginScreenState extends State<LoginScreen> {
}

try {
//final Uri url = Uri.parse('http://10.0.2.2:8081/user/login');
final Uri url = Uri.parse('http://localhost:8081/user/login');// 로그인 API 주소
final Uri url = Uri.parse('http://10.0.2.2:8081/user/login');
//final Uri url = Uri.parse('http://localhost:8081/user/login');// 로그인 API 주소
final response = await http.post(
url,
headers: {'Content-Type': 'application/json'},
Expand Down Expand Up @@ -207,7 +208,7 @@ class _NavigationBarScreenState extends State<NavigationBarScreen> {
_pages = [
const ComplaintServiceScreen(), // 민원 화면
const BusScreen(), // 버스 화면
const Center(child: Text('지도 화면')), // 지도 화면
const MapScreen(), // 지도 화면
const StationScreen(), // 정류장 화면
UserInfoScreen(
userName: widget.userName,
Expand Down
35 changes: 35 additions & 0 deletions front/lib/map_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:flutter/material.dart';

class MapScreen extends StatefulWidget {
const MapScreen({super.key});

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

class _MapScreenState extends State<MapScreen> {
static const CameraPosition _kGooglePlex = CameraPosition(
target: LatLng(37.2485, 127.0778), // 경희대학교 국제캠퍼스 좌표
zoom: 14.4746,
);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('캠퍼스 지도'),
),
body: GoogleMap(
mapType: MapType.normal,
initialCameraPosition: _kGooglePlex,
myLocationEnabled: true,
myLocationButtonEnabled: true,
zoomControlsEnabled: true,
onMapCreated: (GoogleMapController controller) {
// 필요한 경우 컨트롤러 저장
},
),
);
}
}
101 changes: 101 additions & 0 deletions front/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.6"
csslib:
dependency: transitive
description:
name: csslib
sha256: "09bad715f418841f976c77db72d5398dc1253c21fb9c0c7f0b0b985860b2d58e"
url: "https://pub.dev"
source: hosted
version: "1.0.2"
cupertino_icons:
dependency: "direct main"
description:
Expand Down Expand Up @@ -179,6 +187,14 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
flutter_dotenv:
dependency: "direct main"
description:
name: flutter_dotenv
sha256: b7c7be5cd9f6ef7a78429cabd2774d3c4af50e79cb2b7593e3d5d763ef95c61b
url: "https://pub.dev"
source: hosted
version: "5.2.1"
flutter_lints:
dependency: "direct dev"
description:
Expand All @@ -187,11 +203,24 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.0"
flutter_plugin_android_lifecycle:
dependency: transitive
description:
name: flutter_plugin_android_lifecycle
sha256: "9b78450b89f059e96c9ebb355fa6b3df1d6b330436e0b885fb49594c41721398"
url: "https://pub.dev"
source: hosted
version: "2.0.23"
flutter_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
get:
dependency: transitive
description:
Expand All @@ -216,6 +245,62 @@ packages:
url: "https://pub.dev"
source: hosted
version: "6.2.1"
google_maps:
dependency: transitive
description:
name: google_maps
sha256: "4d6e199c561ca06792c964fa24b2bac7197bf4b401c2e1d23e345e5f9939f531"
url: "https://pub.dev"
source: hosted
version: "8.1.1"
google_maps_flutter:
dependency: "direct main"
description:
name: google_maps_flutter
sha256: "209856c8e5571626afba7182cf634b2910069dc567954e76ec3e3fb37f5e9db3"
url: "https://pub.dev"
source: hosted
version: "2.10.0"
google_maps_flutter_android:
dependency: transitive
description:
name: google_maps_flutter_android
sha256: bccf64ccbb2ea672dc62a61177b315a340af86b0228564484b023657544a3fd5
url: "https://pub.dev"
source: hosted
version: "2.14.11"
google_maps_flutter_ios:
dependency: transitive
description:
name: google_maps_flutter_ios
sha256: "6f798adb0aa1db5adf551f2e39e24bd06c8c0fbe4de912fb2d9b5b3f48147b02"
url: "https://pub.dev"
source: hosted
version: "2.13.2"
google_maps_flutter_platform_interface:
dependency: transitive
description:
name: google_maps_flutter_platform_interface
sha256: a951981c22d790848efb9f114f81794945bc5c06bc566238a419a92f110af6cb
url: "https://pub.dev"
source: hosted
version: "2.9.5"
google_maps_flutter_web:
dependency: transitive
description:
name: google_maps_flutter_web
sha256: ff39211bd25d7fad125d19f757eba85bd154460907cd4d135e07e3d0f98a4130
url: "https://pub.dev"
source: hosted
version: "0.5.10"
html:
dependency: transitive
description:
name: html
sha256: "1fc58edeaec4307368c60d59b7e15b9d658b57d7f3125098b6294153c75337ec"
url: "https://pub.dev"
source: hosted
version: "0.15.5"
http:
dependency: "direct main"
description:
Expand Down Expand Up @@ -408,6 +493,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.4"
sanitize_html:
dependency: transitive
description:
name: sanitize_html
sha256: "12669c4a913688a26555323fb9cec373d8f9fbe091f2d01c40c723b33caa8989"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
sky_engine:
dependency: transitive
description: flutter
Expand Down Expand Up @@ -445,6 +538,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.2"
stream_transform:
dependency: transitive
description:
name: stream_transform
sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f"
url: "https://pub.dev"
source: hosted
version: "2.1.0"
string_scanner:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions front/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ dependencies:
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.8
no_context_navigation: ^3.0.0
google_maps_flutter: ^2.10.0
flutter_dotenv: ^5.2.1

dev_dependencies:
flutter_test:
Expand Down
4 changes: 4 additions & 0 deletions front/web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@
<meta name="apple-mobile-web-app-title" content="front">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Google Maps API -->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://maps.googleapis.com/maps/api/js?key=${GOOGLE_MAPS_API_KEY}"></script>

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

Expand Down

0 comments on commit 701a628

Please sign in to comment.