Skip to content

Commit

Permalink
Merge branch '70-돌봄급구-돌봄급구-게시글-리스트-페이지네이션-구현' of https://github.com/p…
Browse files Browse the repository at this point in the history
…et-sitter/pets_next_door_flutter into 70-돌봄급구-돌봄급구-게시글-리스트-페이지네이션-구현
  • Loading branch information
Yellowtoast committed Feb 10, 2024
2 parents 5b7257a + f7e611b commit e35e33c
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 41 deletions.
20 changes: 0 additions & 20 deletions lib/features/pet/entities/pet_data_entity.dart

This file was deleted.

41 changes: 24 additions & 17 deletions lib/presentation/pages/sos/layouts/sos_post_list_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,30 @@ class _SosPostListView extends HookConsumerWidget with SosPostViewEvent {
return () => _scrollController.removeListener(_callBack);
}, [_scrollController]);

return PagedListView<int, SosPostEntity>.separated(
scrollController: _scrollController,
physics: AlwaysScrollableScrollPhysics(),
pagingController: ref.watch(sosPagingControllerProvider),
builderDelegate: PagedChildBuilderDelegate(
itemBuilder: (context, sosPost, index) => PndPostListTile.sosPage(
imageUrl: sosPost.thumbnailUrl,
title: sosPost.title,
dateInfo:
'${sosPost.careStartAt.formatyyMMdd} ~ ${sosPost.careEndAt.formatyyMMdd}',
location: '용답동',
pay: '${sosPost.rewardPer} ${sosPost.reward}'),
),
separatorBuilder: (context, index) => Divider(
height: 1,
thickness: 1,
color: AppColor.of.gray20,
return RefreshIndicator(
color: AppColor.of.primaryGreen,
displacement: 0,
onRefresh: () => onListRefresh(ref),
child: PagedListView<int, SosPostEntity>.separated(
pagingController: ref.watch(sosPagingControllerProvider),
scrollController: _scrollController,
physics: AlwaysScrollableScrollPhysics(),
builderDelegate: PagedChildBuilderDelegate(
itemBuilder: (context, sosPost, index) => PndPostListTile.sosPage(
imageUrl: sosPost.thumbnailUrl,
title: sosPost.title,
dateInfo:
'${sosPost.careStartAt.formatyyMMdd} ~ ${sosPost.careEndAt.formatyyMMdd}',
location: '용답동',
pay: '${sosPost.rewardPer} ${sosPost.reward}'),
firstPageProgressIndicatorBuilder: (context) => PndLoadingIndicator(),
newPageProgressIndicatorBuilder: (context) => PndLoadingIndicator(),
),
separatorBuilder: (context, index) => Divider(
height: 1,
thickness: 1,
color: AppColor.of.gray20,
),
),
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import 'package:riverpod_annotation/riverpod_annotation.dart';

part 'sos_post_paging_controller_provider.g.dart';

const _pagingSize = 20;
const _pagingSize = 10;

@riverpod
class SosPagingController extends _$SosPagingController {
Expand Down
6 changes: 3 additions & 3 deletions lib/presentation/pages/sos/sos_post_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'package:pets_next_door_flutter/presentation/pages/sos/sos_post_event.dar
import 'package:pets_next_door_flutter/presentation/widgets/button/radio_button.dart';
import 'package:pets_next_door_flutter/presentation/widgets/dropdown/dropdown_button.dart';
import 'package:pets_next_door_flutter/presentation/widgets/dropdown/dropdown_item.dart';
import 'package:pets_next_door_flutter/presentation/widgets/indicator/loading_indicator.dart';
import 'package:pets_next_door_flutter/presentation/widgets/list_tile/post_list_tile.dart';

part 'layouts/pet_filter.dart';
Expand All @@ -38,9 +39,8 @@ class SosPostView extends StatelessWidget {
);
}

Container _buildFilters() {
return Container(
height: 50,
Padding _buildFilters() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 24),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand Down
21 changes: 21 additions & 0 deletions lib/presentation/widgets/indicator/loading_indicator.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:flutter/material.dart';
import 'package:pets_next_door_flutter/core/constants/colors.dart';

class PndLoadingIndicator extends StatelessWidget {
const PndLoadingIndicator({
super.key,
});

@override
Widget build(BuildContext context) {
return Center(
child: SizedBox(
height: 35,
width: 35,
child: CircularProgressIndicator(
color: AppColor.of.primaryGreen,
),
),
);
}
}

0 comments on commit e35e33c

Please sign in to comment.