-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
137 additions
and
211 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,41 @@ | ||
import 'package:get/get.dart'; | ||
|
||
import '../models/user.dart'; | ||
import '../models/user_pixel_log.dart'; | ||
import '../models/user_pixel_count.dart'; | ||
import '../service/user_service.dart'; | ||
|
||
class MyPageController extends GetxController { | ||
final UserService userService = UserService(); | ||
final Rx<User> currentUserInfo = User().obs; | ||
final Rx<UserPixelLog> userPixelLog = UserPixelLog().obs; | ||
final Rx<UserPixelCount> userPixelCount = UserPixelCount().obs; | ||
|
||
@override | ||
Future<void> onInit() async { | ||
super.onInit(); | ||
User userInfo = await userService.getCurrentUserInfo(); | ||
UserPixelLog userPixelLogInfo = await userService.getUserPixelLog(); | ||
UserPixelCount userPixelLogInfo = await userService.getUserPixelCount(); | ||
currentUserInfo.value = userInfo; | ||
userPixelLog.value = userPixelLogInfo; | ||
super.onInit(); | ||
userPixelCount.value = userPixelLogInfo; | ||
print('userinfo info ${userInfo}'); | ||
} | ||
|
||
getProfileImageURL() { | ||
return currentUserInfo.value.profileImageUrl; | ||
} | ||
|
||
getCurrentUserNickname() { | ||
return currentUserInfo.value.nickname; | ||
String getCurrentUserNickname() { | ||
return currentUserInfo.value.nickname ?? "-"; | ||
} | ||
|
||
getCurrentUserCommunityName() { | ||
String getCurrentUserCommunityName() { | ||
return currentUserInfo.value.communityName ?? "-"; | ||
} | ||
|
||
getCurrentUserPixel(){ | ||
return userPixelLog.value.currentPixelCount; | ||
int getCurrentUserPixel(){ | ||
return userPixelCount.value.currentPixelCount ?? 0; | ||
} | ||
|
||
getAccumulateUserPixel(){ | ||
return userPixelLog.value.accumulatePixelCount; | ||
int getAccumulateUserPixel(){ | ||
return userPixelCount.value.accumulatePixelCount ?? 0; | ||
} | ||
} |
6 changes: 3 additions & 3 deletions
6
lib/models/user_pixel_log.dart → lib/models/user_pixel_count.dart
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:get/get_core/src/get_main.dart'; | ||
|
||
import '../../controllers/my_page_controller.dart'; | ||
import '../../controllers/walking_controller.dart'; | ||
import 'dash_board_widget.dart'; | ||
|
||
class DashBoard extends StatelessWidget { | ||
DashBoard({ | ||
super.key, | ||
}); | ||
|
||
MyPageController myPageController = Get.find<MyPageController>(); | ||
WalkingController walkingController = Get.find<WalkingController>(); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Stack( | ||
alignment: Alignment.center, | ||
children: [ | ||
Container( | ||
padding: const EdgeInsets.all(10.0), | ||
height: 150, | ||
decoration: BoxDecoration( | ||
color: Color(0xFFD9D9D9), | ||
borderRadius: BorderRadius.circular(10), | ||
), | ||
), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceEvenly, | ||
children: [ | ||
DashBoardWidget( | ||
textValue: "현재 픽셀수", | ||
iconImageUrl: "currentTile.png", | ||
countValue: myPageController.getCurrentUserPixel().obs,), | ||
DashBoardWidget( | ||
textValue: "누적 픽셀수", | ||
iconImageUrl: "allTile.png", | ||
countValue: myPageController.getAccumulateUserPixel().obs,), | ||
DashBoardWidget( | ||
textValue: "걸음수", | ||
iconImageUrl: "stepIcon.png", | ||
countValue: walkingController.currentStep, | ||
), | ||
], | ||
), | ||
], | ||
); | ||
} | ||
} |
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
Oops, something went wrong.