Skip to content

Commit

Permalink
Merge branch 'release/0.9.49+114' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
ljyo2o9 committed Jul 16, 2024
2 parents b8a873f + 340065b commit ed61d96
Show file tree
Hide file tree
Showing 74 changed files with 1,581 additions and 940 deletions.
Binary file added assets/image/icons_not_design_sys/Info.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: 2 additions & 0 deletions lib/core/component/image/images.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ class Images {
'assets/image/icons_not_design_sys/today_excersize_complete_icon.png';
static const String iconsNotDesignSysWakatimeIcon =
'assets/image/icons_not_design_sys/wakatime_icon.png';
static const String iconsNotDesignSysInfoIcon =
'assets/image/icons_not_design_sys/Info.png';
static const String iconsPickle = 'assets/image/icons/pickle.png';
static const String iconsPickleFilled =
'assets/image/icons/pickle-filled.png';
Expand Down
19 changes: 1 addition & 18 deletions lib/core/component/image_widget.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';

enum ImageType { svg, svgNetwork, png, pngNetwork }
enum ImageType { png, pngNetwork }

class ImageWidget extends StatelessWidget {
final double? width, height, imageWidth, imageHeight, radiusCircular;
Expand Down Expand Up @@ -61,22 +60,6 @@ class ImageWidget extends StatelessWidget {
height: imageHeight,
fit: BoxFit.cover,
);
case ImageType.svg:
return SvgPicture.asset(
image,
color: color,
width: imageWidth,
height: imageHeight,
fit: BoxFit.cover,
);
case ImageType.svgNetwork:
return SvgPicture.network(
image,
color: color,
width: imageWidth,
height: imageHeight,
fit: BoxFit.cover,
);
}
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class PoseMainTabBody extends ConsumerWidget {
child: Builder(
builder: (context) {
if (tabBodyData[ref.watch(poseTabController)] == "추천") {
return const PoseMainTabBodyRecommendScreen();
return PoseMainTabBodyRecommendScreen(useNavigator: useNavigator,);
} else {
return PoseMainTabBodyPartScreen(
tabName: tabBodyData[ref.watch(poseTabController)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:maeum_ga_gym_flutter/core/component/pose/presentation/provider/pose_recommend_provider.dart';

import '../../../../../../pose/presentation/widget/pose_data.dart';

/// Widget
import 'recommend/pose_recommend_widget.dart';

class PoseMainTabBodyRecommendScreen extends ConsumerWidget {
const PoseMainTabBodyRecommendScreen({super.key});
final bool useNavigator;
const PoseMainTabBodyRecommendScreen({super.key, required this.useNavigator});

@override
Widget build(BuildContext context, WidgetRef ref) {
Expand All @@ -24,6 +23,7 @@ class PoseMainTabBodyRecommendScreen extends ConsumerWidget {
recommendPoseData: poseRecommend
.poses![poseRecommend.poses!.keys.toList()[index]]!,
titleText: poseRecommend.poses!.keys.toList()[index],
useNavigator: useNavigator,
);
},
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@ class PoseRecommendWidget extends StatelessWidget {

final String titleText;

final bool useNavigator;

const PoseRecommendWidget({
required this.recommendPoseData,
required this.titleText,
required this.useNavigator,
super.key,
});

Expand All @@ -31,7 +34,7 @@ class PoseRecommendWidget extends StatelessWidget {
),

/// ~ 운동 하단
PoseRecommendWidgetBottom(recommendPoseData: recommendPoseData),
PoseRecommendWidgetBottom(recommendPoseData: recommendPoseData, useNavigator: useNavigator),
],
),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,21 @@ import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:maeum_ga_gym_flutter/core/component/image_widget.dart';
import 'package:maeum_ga_gym_flutter/core/component/pose/domain/model/pose_data_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/pose/domain/model/pose_recommend_model.dart';
import 'package:maeum_ga_gym_flutter/pose/presentation/provider/pose_detail_provider.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/model/exercise_info_edit_routine_pose_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/presentation/provider/my_routine/self_care_my_routine_pose_list_provider.dart';

import '../../../../../../../config/maeumgagym_color.dart';
import '../../../../../../../pose/presentation/view/pose_detail_screen.dart';
import '../../../../../text/pretendard/ptd_text_widget.dart';

class PoseRecommendWidgetBottom extends ConsumerWidget {
final List<PoseDataModel> recommendPoseData;
final bool useNavigator;

const PoseRecommendWidgetBottom({
super.key,
required this.recommendPoseData,
required this.useNavigator,
});

@override
Expand All @@ -31,15 +33,34 @@ class PoseRecommendWidgetBottom extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
GestureDetector(
onTap: () => Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PoseDetailScreen(
id: poseData.id!,
poseData: poseData,
),
),
),
onTap: () {
if (useNavigator == true) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PoseDetailScreen(
id: poseData.id!,
poseData: poseData,
),
),
);
} else {
ref.read(selfCareMyRoutinePostListProvider.notifier).insert(
ExerciseInfoEditRoutinePoseModel(
poseModel: PoseDataModel(
id: recommendPoseData[index].id,
thumbnail: recommendPoseData[index].thumbnail,
name: recommendPoseData[index].name,
needMachine: recommendPoseData[index].needMachine,
simplePart: recommendPoseData[index].simplePart,
exactPart: recommendPoseData[index].exactPart),
repetitionsController: TextEditingController(text: "10"),
setsController: TextEditingController(text: "1"),
),
);
Navigator.pop(context);
}
},
child: Padding(
padding: const EdgeInsets.only(right: 12),
child: ImageWidget(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import 'package:maeum_ga_gym_flutter/core/di/dio_di.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/exercise_info_request_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/model/routine_and_user_info_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_history_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_response_model.dart';

class RoutineRemoteDataSource {
Future<AsyncValue<int?>> addRoutine({
Expand Down Expand Up @@ -75,38 +74,6 @@ class RoutineRemoteDataSource {
}
}

Future<RoutineResponseModel> getTodayRoutine({
required String accessToken,
}) async {
try {
return await dio
.get(
"/routines/today",
options: Options(
headers: {
"Content-Type": "application/json",
"Authorization": accessToken,
},
),
)
.then((response) {
return RoutineResponseModel.fromJson(
response.data,
response.statusCode!,
);
});
} catch (err) {
return RoutineResponseModel(
statusCode: AsyncError(err, StackTrace.empty),
id: null,
routineName: null,
exerciseInfoResponseList: [],
dayOfWeeks: [],
routineStatus: null,
);
}
}

Future<AsyncValue<int?>> deleteRoutine({
required String accessToken,
required int routineId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,11 @@ import 'package:maeum_ga_gym_flutter/core/component/routine/data/datasource/remo
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/exercise_info_request_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/model/routine_and_user_info_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_history_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_response_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/repository/routine_repository.dart';

class RoutineRepositoryImpl implements RoutineRepository {
final RoutineRemoteDataSource _remoteDataSource = RoutineRemoteDataSource();

@override
Future<RoutineResponseModel> getTodayRoutine({
required String accessToken,
}) async {
return await _remoteDataSource.getTodayRoutine(
accessToken: accessToken,
);
}

@override
Future<RoutineAndUserInfoModel> getMyRoutine({
required String accessToken,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_response_model.dart';
import 'package:maeum_ga_gym_flutter/core/model/routine/maeumgagym_routine_list_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_user_info_model.dart';

class RoutineAndUserInfoModel {
final AsyncValue<int> statusCode;
final RoutineUserInfoModel? userInfo;
List<RoutineResponseModel> routineList = [];
List<RoutineModel> routineList = [];

RoutineAndUserInfoModel({
required this.statusCode,
Expand All @@ -20,16 +20,14 @@ class RoutineAndUserInfoModel {
return RoutineAndUserInfoModel(
statusCode: AsyncData(statusCode),
userInfo: RoutineUserInfoModel.fromJson(json['user_info']),
routineList: (json['routine_list'] as List)
.map((routineJson) => RoutineResponseModel.fromJson(routineJson, statusCode))
.toList(),
routineList: json['routine_list'].map<RoutineModel>((data) => RoutineModel.fromJson(data)).toList()
);
}

RoutineAndUserInfoModel copyWith({
AsyncValue<int>? statusCode,
RoutineUserInfoModel? userInfo,
List<RoutineResponseModel>? routineList,
List<RoutineModel>? routineList,
}) {
return RoutineAndUserInfoModel(
statusCode: statusCode ?? this.statusCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/exercise_info_request_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/model/routine_and_user_info_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_history_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_response_model.dart';

abstract class RoutineRepository {
Future<AsyncValue<int?>> addRoutine({
Expand All @@ -19,10 +18,6 @@ abstract class RoutineRepository {
required int index,
});

Future<RoutineResponseModel> getTodayRoutine({
required String accessToken,
});

Future<AsyncValue<int?>> deleteRoutine({
required String accessToken,
required int routineId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/exercise_info_request_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/model/routine_and_user_info_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_history_model.dart';
import 'package:maeum_ga_gym_flutter/self_care/domain/model/my_routine/routine_response_model.dart';
import 'package:maeum_ga_gym_flutter/core/component/routine/domain/repository/routine_repository.dart';

class RoutineUseCase {
Expand Down Expand Up @@ -38,14 +37,6 @@ class RoutineUseCase {
);
}

Future<RoutineResponseModel> getTodayRoutine({
required String accessToken,
}) async {
return await _repository.getTodayRoutine(
accessToken: accessToken,
);
}

Future<AsyncValue<int?>> deleteRoutine({
required String accessToken,
required int routineId,
Expand Down
9 changes: 9 additions & 0 deletions lib/core/component/timer_sound_component.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import 'package:audioplayers/audioplayers.dart';

final _audioPlayer = AudioPlayer();

class TimerSoundComponent {
static void timerPlay(){
_audioPlayer.play(AssetSource('sounds/timer/timer_end_sound.wav'));
}
}
Loading

0 comments on commit ed61d96

Please sign in to comment.