Skip to content

Commit

Permalink
Merge pull request #45 from SWM-M3PRO/feature/M3-203-individualPixelD…
Browse files Browse the repository at this point in the history
…esign

M3-203 픽셀 정보창 개인전 디자인
  • Loading branch information
koomin1227 authored Jul 24, 2024
2 parents 1289599 + 6c1455a commit 48058eb
Show file tree
Hide file tree
Showing 69 changed files with 868 additions and 496 deletions.
Binary file modified android/app/src/main/res/drawable-hdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-mdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/drawable-xxxhdpi/splash.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-hdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-mdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ground_flip_app_icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion flutter_launcher_icons.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
flutter_icons:
ios: true
android: true
image_path: "assets/images/app_icon.png"
image_path: "assets/images/ground_flip_app_icon.png"
remove_alpha_ios: true
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
Binary file modified ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
2 changes: 1 addition & 1 deletion ios/Runner/Base.lproj/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
</scene>
</scenes>
<resources>
<image name="LaunchImage" width="513" height="103"/>
<image name="LaunchImage" width="1024" height="1024"/>
<image name="LaunchBackground" width="1" height="1"/>
</resources>
</document>
2 changes: 1 addition & 1 deletion ios/Runner/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
<string>This app needs GPS</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This app needs GPS</string>
<string>This app needs GPS</string>
<key>UIApplicationSupportsIndirectInputEvents</key>
<true/>
<key>UILaunchStoryboardName</key>
Expand Down
2 changes: 1 addition & 1 deletion lib/constants/app_colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ class AppColors {
static const Color boxColor = Color(0xFF1F1F1F);
static const Color boxColorSecond = Color(0xFF555555);
static const Color buttonColor = Colors.white;
static const Color navigationBarColor = Color(0xA6212121);
static const Color navigationBarColor = Color(0xFF1D1D1D);
}
12 changes: 12 additions & 0 deletions lib/constants/text_styles.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ class TextStyles {
fontWeight: FontWeight.w500,
);

static TextStyle fs14w500cTextSecondary = TextStyle(
color: AppColors.textSecondary,
fontSize: 14,
fontWeight: FontWeight.w500,
);

static TextStyle fs14w400cTextSecondary = TextStyle(
color: AppColors.textSecondary,
fontSize: 14,
Expand All @@ -75,6 +81,12 @@ class TextStyles {
fontWeight: FontWeight.w800,
);

static TextStyle fs24w900cTextPrimary = TextStyle(
color: AppColors.textPrimary,
fontSize: 24,
fontWeight: FontWeight.w900,
);

static TextStyle fs32w400cTextSecondary = TextStyle(
color: AppColors.textSecondary,
fontSize: 32,
Expand Down
95 changes: 95 additions & 0 deletions lib/controllers/bottom_sheet_controller.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../enums/pixel_mode.dart';
import '../models/individual_history_pixel_info.dart';
import '../models/individual_mode_pixel_info.dart';
import '../service/pixel_service.dart';
import '../widgets/map/bottom_sheet/individual_history_list.dart';
import '../widgets/map/bottom_sheet/pixel_info_header.dart';
import '../widgets/map/bottom_sheet/step_stats.dart';
import '../widgets/map/bottom_sheet/visited_user_list.dart';

class BottomSheetController extends GetxController {
final PixelService pixelService = PixelService();
final DraggableScrollableController draggableController =
DraggableScrollableController();
Widget currentBody = StepStatsBody();
Widget currentHeader = StepStats();
RxInt mode = 0.obs;
RxBool changeVar = true.obs;
double size = 1.1;

void showIndividualHistoryPixelInfo(IndividualHistoryPixelInfo pixelInfo) {
mode.value = 1;
changeVar.value = changeVar.value ? false : true;
draggableController.animateTo(
0.6,
duration: Duration(milliseconds: 500),
curve: Curves.easeInOut,
);
currentHeader = PixelInfoHeader(
address: pixelInfo.address,
visitCount: pixelInfo.visitCount!,
mode: PixelMode.individualHistory,
);
currentBody = IndividualHistoryList(
visitList: pixelInfo.visitList ?? [],
);
mode.value = 1;
}

void showIndividualModePixelInfo(IndividualModePixelInfo pixelInfo) {
mode.value = 2;
changeVar.value = changeVar.value ? false : true;
draggableController.animateTo(
0.6,
duration: Duration(milliseconds: 300),
curve: Curves.easeInOut,
);
currentHeader = PixelInfoHeader(
address: pixelInfo.address,
visitCount: pixelInfo.visitCount!,
mode: PixelMode.individualMode,
);
currentBody = VisitedUserList(
pixelOwnerUser: pixelInfo.pixelOwnerUser!,
visitList: pixelInfo.visitList ?? [],
);
mode.value = 2;
}

minimize() {
currentHeader = StepStats();
currentBody = StepStatsBody();
mode.value = 0;
draggableController.animateTo(
0.1,
duration: Duration(milliseconds: 500),
curve: Curves.easeInOut,
);
}

void changeStepStatIfMinimized() {
if (draggableController.size <= 0.111 && size > draggableController.size) {
currentHeader = StepStats();
currentBody = StepStatsBody();
mode.value = 0;
}
size = draggableController.size;
}

getBody() {
if (mode.value == 0 && changeVar.value) {
// changeVar.value = changeVar.value ? false : true;
}
return currentBody;
}

getHeader() {
if (mode.value == 0 && changeVar.value) {
// changeVar.value = changeVar.value ? false : true;
}
return currentHeader;
}
}
52 changes: 49 additions & 3 deletions lib/controllers/map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,19 @@ import 'package:location/location.dart';
import '../enums/pixel_mode.dart';
import '../models/individual_history_pixel.dart';
import '../models/individual_mode_pixel.dart';
import '../models/user_pixel_count.dart';
import '../service/location_service.dart';
import '../service/pixel_service.dart';
import '../service/user_service.dart';
import '../utils/user_manager.dart';
import '../widgets/pixel.dart';
import 'bottom_sheet_controller.dart';

class MapController extends GetxController {
final PixelService pixelService = PixelService();
final UserService userService = UserService();
final BottomSheetController bottomSheetController =
Get.find<BottomSheetController>();

static const String darkMapStylePath =
'assets/map_style/dark_map_style_with_landmarks.txt';
Expand All @@ -35,6 +42,9 @@ class MapController extends GetxController {
RxList<Pixel> pixels = <Pixel>[].obs;
RxList<Marker> markers = <Marker>[].obs;
RxBool isLoading = true.obs;
final RxInt selectedType = 0.obs;
final RxInt currentPixelCount = 0.obs;
final RxInt accumulatePixelCount = 0.obs;

Timer? _cameraIdleTimer;

Expand All @@ -44,13 +54,28 @@ class MapController extends GetxController {
await _loadMapStyle();
await initCurrentLocation();
_updateLatestPixel();
await updateCurrentPixel();
await occupyPixel();
updatePixels();
_createUserMarker();
_trackUserLocation();
_trackPixels();
}

onHidden() {
bottomSheetController.minimize();
}

updateCurrentPixel() async {
UserPixelCount pixelCount = await userService.getUserPixelCount();
currentPixelCount.value = pixelCount.currentPixelCount!;
accumulatePixelCount.value = pixelCount.accumulatePixelCount!;
}

getSelectedType() {
return selectedType.value;
}

void onCameraIdle() {
_cameraIdleTimer = Timer(Duration(milliseconds: 300), updatePixels);
}
Expand All @@ -60,6 +85,16 @@ class MapController extends GetxController {
_cameraIdleTimer?.cancel();
}

focusOnCurrentLocation() {
currentCameraPosition = CameraPosition(
target: LatLng(currentLocation.latitude!, currentLocation.longitude!),
zoom: 16.0,
);
googleMapController?.animateCamera(
CameraUpdate.newCameraPosition(currentCameraPosition),
);
}

void _trackUserLocation() {
location.onLocationChanged.listen((newLocation) async {
currentLocation = newLocation;
Expand All @@ -73,7 +108,7 @@ class MapController extends GetxController {

Future<void> initCurrentLocation() async {
try {
currentLocation = await location.getLocation();
currentLocation = LocationService().currentLocation!;
currentCameraPosition = CameraPosition(
target: LatLng(currentLocation.latitude!, currentLocation.longitude!),
zoom: 16.0,
Expand Down Expand Up @@ -182,6 +217,7 @@ class MapController extends GetxController {
currentLongitude: currentLocation.longitude!,
);
updatePixels();
await updateCurrentPixel();
}

isPixelChanged() {
Expand All @@ -194,8 +230,10 @@ class MapController extends GetxController {
latestPixel['y'] != currentPixel['y'];
}

void changePixelMode(String pixelModeKrName) {
currentPixelMode.value = PixelMode.fromKrName(pixelModeKrName);
void changePixelMode(int type) {
selectedType.value = type;
currentPixelMode.value = PixelMode.fromInt(type);
bottomSheetController.minimize();
updatePixels();
}

Expand Down Expand Up @@ -234,4 +272,12 @@ class MapController extends GetxController {
double _toRadians(double degree) {
return degree * math.pi / 180;
}

getPixelCount() {
if (currentPixelMode.value == PixelMode.individualHistory) {
return accumulatePixelCount.value;
} else {
return currentPixelCount.value;
}
}
}
8 changes: 0 additions & 8 deletions lib/controllers/my_page_controller.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:get/get.dart';
import 'package:location/location.dart';

import '../models/user.dart';
import '../models/user_pixel_count.dart';
Expand All @@ -17,13 +16,6 @@ class MyPageController extends GetxController {
User userInfo = await userService.getCurrentUserInfo();
currentUserInfo.value = userInfo;
await _updatePixelCount();
_trackPixelCount();
}

_trackPixelCount() {
Location().onLocationChanged.listen((newLocation) async {
await _updatePixelCount();
});
}

_updatePixelCount() async {
Expand Down
9 changes: 7 additions & 2 deletions lib/controllers/navigation_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import '../screens/map_screen.dart';
import '../screens/my_page_screen.dart';
import '../screens/ranking_screen.dart';
import '../widgets/common/app_bar.dart';
import 'map_controller.dart';
import 'ranking_controller.dart';

class NavigationController extends GetxController {
final RankingController rankingController = Get.find<RankingController>();
final MapController mapController = Get.find<MapController>();
final RxInt selectedIndex = 0.obs;
static List<Widget> tabPages = <Widget>[
const MapScreen(),
Expand All @@ -24,10 +26,13 @@ class NavigationController extends GetxController {
];

void changeIndex(int index) {
selectedIndex(index);
if (index == 1) {
if (selectedIndex.value != 1 && index == 1) {
rankingController.onVisible();
}
if (selectedIndex.value == 0 && index != 0) {
mapController.onHidden();
}
selectedIndex(index);
}

Widget getCurrentPage() {
Expand Down
21 changes: 16 additions & 5 deletions lib/enums/pixel_mode.dart
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@
enum PixelMode {
individualMode(koreanName : '개인전'),
individualHistory(koreanName : '개인 기록'),
groupMode(koreanName : '그룹전');
individualMode(koreanName: '개인전'),
individualHistory(koreanName: '개인 기록'),
groupMode(koreanName: '그룹전');

const PixelMode({required this.koreanName});

final String koreanName;

static PixelMode fromKrName(String krName) {
return PixelMode.values.firstWhere((mode) => mode.koreanName == krName,
orElse: () => throw ArgumentError('No enum value with krName $krName'),
return PixelMode.values.firstWhere(
(mode) => mode.koreanName == krName,
orElse: () => throw ArgumentError('No enum value with krName $krName'),
);
}

static PixelMode fromInt(int number) {
if (number == 0) {
return PixelMode.individualHistory;
} else if (number == 1) {
return PixelMode.individualMode;
} else {
return PixelMode.groupMode;
}
}
}
11 changes: 6 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@ import 'screens/policy_screen.dart';
import 'screens/setting_screen.dart';
import 'screens/sign_up_screen.dart';
import 'service/auth_service.dart';
import 'service/location_service.dart';

Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await dotenv.load(fileName: ".env");
await GetStorage.init();
KakaoSdk.init(nativeAppKey: dotenv.env['NATIVE_APP_KEY']!);

await LocationService().initCurrentLocation();
String initialRoute = await AuthService().isLogin() ? '/main' : '/permission';

await Future.delayed(Duration(seconds: 2));
runApp(
MyApp(
initialRoute: initialRoute,
Expand All @@ -35,7 +34,6 @@ class MyApp extends StatelessWidget {

@override
Widget build(BuildContext context) {

return MediaQuery(
data: MediaQuery.of(context).copyWith(textScaler: TextScaler.noScaling),
child: GetMaterialApp(
Expand All @@ -51,7 +49,10 @@ class MyApp extends StatelessWidget {
GetPage(name: '/setting', page: () => const SettingScreen()),
GetPage(name: '/signup', page: () => const SignUpScreen()),
GetPage(name: '/policy', page: () => const PolicyScreen()),
GetPage(name: '/permission', page: () => const PermissionRequestScreen()),
GetPage(
name: '/permission',
page: () => const PermissionRequestScreen(),
),
],
),
);
Expand Down
Loading

0 comments on commit 48058eb

Please sign in to comment.