Skip to content

Commit

Permalink
카드 중앙을 클릭했을때도 디테일페이지로 넘어가도록 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ottuck committed Aug 24, 2024
1 parent bd97b71 commit 14d863a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 12 deletions.
6 changes: 3 additions & 3 deletions lib/feature/match/provider/MatchProvider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class MatchScreenNotifier extends StateNotifier<List<PetProfileModel>> {

// 펫 데이터를 Firestore에서 로드하고 필터링하는 함수
Future<void> loadPets({String? location, String? gender}) async {
_setLoading(true); // 로딩 상태를 true로 설정
_setLoading(true); //

try {
final ignoredPets = await _getIgnoredPets();
Expand All @@ -31,10 +31,10 @@ class MatchScreenNotifier extends StateNotifier<List<PetProfileModel>> {
state = filteredPets.isNotEmpty ? filteredPets : [];

if (filteredPets.isEmpty) {
talker.info(AppStrings.noFilteredResult); // 필터된 결과가 없을 때 정보 로그 기록
talker.info(AppStrings.noFilteredResult);
}
} catch (e) {
talker.error('${AppStrings.dbLoadError}$e'); // 에러 발생 시 로그 기록
talker.error('${AppStrings.dbLoadError}$e');
} finally {
_setLoading(false); // 로딩 상태를 false로 설정
}
Expand Down
11 changes: 8 additions & 3 deletions lib/feature/match/widget/MatchFilterOptionWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ class MatchFilterOptionWidget extends ConsumerWidget {
value: 'ignore',
child: Row(
children: [
Icon(Icons.block, color: Colors.red[400], size: 14),
Icon(Icons.block, color: Colors.red[400], size: 16),
const SizedBox(width: 8),
Text(AppStrings.ignoreThisPet,
style: TextStyle(color: Colors.red[400])),
const Text(
AppStrings.ignoreThisPet,
style: TextStyle(
color: Colors.black87,
fontSize: 14, // 글자 크기 줄이기
),
),
],
),
),
Expand Down
19 changes: 13 additions & 6 deletions lib/feature/match/widget/MatchProfileListWidget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class MatchProfileListWidget extends ConsumerWidget {
final isLoading = ref.watch(matchScreenProvider.notifier).isLoading;

if (isLoading) {
return _buildLoadingView(); // 로딩 중일 때 Shimmer UI를 표시
return _buildLoadingView(); // 로딩 중일 때 Shimmer UI를 표시
} else if (listState.isEmpty) {
return const Center(child: Text(AppStrings.noPetsMessage)); // 데이터가 비었을 때 표시
return const Center(child: Text(AppStrings.noPetsMessage)); // 데이터가 비었을 때 표시
} else {
return _buildCardView(context, ref, listState); // 데이터가 있을 때 카드 뷰 표시
return _buildCardView(context, ref, listState); // 데이터가 있을 때 카드 뷰 표시
}
}

Expand Down Expand Up @@ -53,7 +53,14 @@ class MatchProfileListWidget extends ConsumerWidget {
BuildContext context, WidgetRef ref, List<PetProfileModel> data) {
final cardSwiperController = CardSwiperController();
int currentIndex = 0;
final cards = data.map(SwipeCardWidget.new).toList();
final cards = data.map((petProfile) {
return GestureDetector(
onTap: () {
cardSwiperController.swipe(CardSwiperDirection.right);
},
child: SwipeCardWidget(petProfile),
);
}).toList();

return Column(
children: [
Expand Down Expand Up @@ -105,7 +112,7 @@ class MatchProfileListWidget extends ConsumerWidget {
final petId = data[currentIndex].petID;
await ref
.read(matchScreenProvider.notifier)
.addPetToSuperLikes(context, userId, petId); // context 추가
.addPetToSuperLikes(context, userId, petId);
cardSwiperController.swipe(CardSwiperDirection.right);
},
icon: Icons.star,
Expand All @@ -120,7 +127,7 @@ class MatchProfileListWidget extends ConsumerWidget {

await ref
.read(matchScreenProvider.notifier)
.addPetToLikes(context, userId, petId); // context 추가
.addPetToLikes(context, userId, petId);
cardSwiperController.swipe(CardSwiperDirection.right);
},
icon: Icons.favorite,
Expand Down

0 comments on commit 14d863a

Please sign in to comment.