Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M3-276 디폴드 모드를 개인전으로 변경 및 걸음수 버튼 크기 키우기 #66

Merged
merged 4 commits into from
Aug 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions lib/controllers/map_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ class MapController extends SuperController {
late CameraPosition currentCameraPosition;
late Map<String, int> latestPixel;

Rx<PixelMode> currentPixelMode = PixelMode.individualHistory.obs;
Rx<PixelMode> currentPixelMode = PixelMode.individualMode.obs;
String? currentPeriod;
RxList<Pixel> pixels = <Pixel>[].obs;
RxList<Marker> markers = <Marker>[].obs;
RxBool isLoading = true.obs;
final RxInt selectedType = 0.obs;
final RxInt selectedMode = 1.obs;
final RxInt selectedPeriod = 0.obs;
final RxInt currentPixelCount = 0.obs;
final RxInt accumulatePixelCount = 0.obs;
Expand Down Expand Up @@ -109,15 +109,15 @@ class MapController extends SuperController {
}

getSelectedType() {
return selectedType.value;
return selectedMode.value;
}

getSelectedPeriod() {
return selectedPeriod.value;
}

void onCameraIdle() {
if(!isBottomSheetShowUp) {
if (!isBottomSheetShowUp) {
_cameraIdleTimer = Timer(Duration(milliseconds: 300), updatePixels);
}
}
Expand Down Expand Up @@ -268,7 +268,7 @@ class MapController extends SuperController {
}

void changePixelMode(int type) {
selectedType.value = type;
selectedMode.value = type;
currentPixelMode.value = PixelMode.fromInt(type);
bottomSheetController.minimize();

Expand Down Expand Up @@ -358,7 +358,9 @@ class MapController extends SuperController {
changePixelToNormalState();
}

lastOnTabPixel = Pixel.clonePixel(pixels.firstWhere((pixel) => pixel.pixelId == pixelId));
lastOnTabPixel = Pixel.clonePixel(
pixels.firstWhere((pixel) => pixel.pixelId == pixelId),
);
Pixel newPixel = Pixel.createOnTabStatePixel(lastOnTabPixel);
pixels.removeWhere((pixel) => pixel.pixelId == pixelId);
pixels.add(newPixel);
Expand All @@ -369,21 +371,20 @@ class MapController extends SuperController {
_updatePixelTimer?.cancel();

googleMapController?.animateCamera(
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
newPixel.points[0].latitude - Pixel.latPerPixel * 6,
newPixel.points[0].longitude,
),
zoom: 16.0,
CameraUpdate.newCameraPosition(
CameraPosition(
target: LatLng(
newPixel.points[0].latitude - Pixel.latPerPixel * 6,
newPixel.points[0].longitude,
),
zoom: 16.0,
),
),
);
}

void changePixelToNormalState() {
pixels.removeWhere((pixel) => pixel.pixelId == lastOnTabPixel.pixelId);
pixels.add(lastOnTabPixel);
}

}
53 changes: 35 additions & 18 deletions lib/widgets/my_page/step_bar_chart.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ class StepBarChart extends StatelessWidget {
color: AppColors.backgroundSecondary,
borderRadius: BorderRadius.circular(16),
),
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Column(
children: [
Row(
child: Column(
children: [
Padding(
padding: const EdgeInsets.fromLTRB(0.0, 0, 20, 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
Obx(
Expand All @@ -34,10 +34,17 @@ class StepBarChart extends StatelessWidget {
walkController.loadPreviousWeekSteps();
}
: null,
child: Icon(
Icons.arrow_back_ios_new_outlined,
color: AppColors.textPrimary,
size: 12,
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundSecondary,
borderRadius: BorderRadius.all(Radius.circular(16)),
),
padding: const EdgeInsets.fromLTRB(20.0, 20, 10, 20),
child: Icon(
Icons.arrow_back_ios_new_outlined,
color: AppColors.textPrimary,
size: 20,
),
),
),
),
Expand All @@ -56,18 +63,28 @@ class StepBarChart extends StatelessWidget {
walkController.loadNextWeekSteps();
}
: null,
child: Icon(
Icons.arrow_forward_ios_outlined,
color: AppColors.textPrimary,
size: 12,
child: Container(
decoration: BoxDecoration(
color: AppColors.backgroundSecondary,
borderRadius: BorderRadius.all(Radius.circular(16)),
),
padding: const EdgeInsets.fromLTRB(10.0, 20, 20, 20),
child: Icon(
Icons.arrow_forward_ios_outlined,
color: AppColors.textPrimary,
size: 20,
),
),
),
),
],
),
Expanded(
child: Obx(
() => BarChart(
),
Expanded(
child: Obx(
() => Padding(
padding: const EdgeInsets.all(20.0),
child: BarChart(
BarChartData(
barTouchData: getBarTouchData(),
titlesData: getTitlesData(walkController.getMaxStep()),
Expand All @@ -84,8 +101,8 @@ class StepBarChart extends StatelessWidget {
),
),
),
],
),
),
],
),
),
);
Expand Down