diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png index 52a2ddc..fa73b82 100644 Binary files a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-hdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png index 6059953..8f36c9c 100644 Binary files a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-mdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png index 585ce95..a759bf4 100644 Binary files a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png index e1a8742..6d4b029 100644 Binary files a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png differ diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png index ce2d49c..f29ff94 100644 Binary files a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/assets/launcher.jpeg b/assets/launcher.jpeg deleted file mode 100644 index 3fecd11..0000000 Binary files a/assets/launcher.jpeg and /dev/null differ diff --git a/assets/launcher.jpg b/assets/launcher.jpg new file mode 100644 index 0000000..00f9cab Binary files /dev/null and b/assets/launcher.jpg differ diff --git a/assets/launcher.png b/assets/launcher.png deleted file mode 100644 index baf0ce4..0000000 Binary files a/assets/launcher.png and /dev/null differ diff --git a/lib/data/repositories/api_repository.dart b/lib/data/repositories/api_repository.dart index e2594b1..b32d015 100644 --- a/lib/data/repositories/api_repository.dart +++ b/lib/data/repositories/api_repository.dart @@ -41,7 +41,8 @@ class ApiRepository extends ApiInterface { HomeData homeData = HomeData( data: data, pageNumber: pageDto.pageNumber, - nextPageNumber: pageDto.nextPageNumber); + nextPageNumber: pageDto.nextPageNumber, + lastPageNumber: pageDto.lastPageNumber); return homeData; } on DioException catch (e) { diff --git a/lib/data/repositories/mock_repository.dart b/lib/data/repositories/mock_repository.dart index 5d8287c..af2f395 100644 --- a/lib/data/repositories/mock_repository.dart +++ b/lib/data/repositories/mock_repository.dart @@ -22,6 +22,6 @@ class MockRepository extends ApiInterface { age: 24, distance: 478.3, ) - ], pageNumber: 0); + ], pageNumber: 0, lastPageNumber: 0); } } diff --git a/lib/domain/models/home.dart b/lib/domain/models/home.dart index 0249aed..35f6102 100644 --- a/lib/domain/models/home.dart +++ b/lib/domain/models/home.dart @@ -4,6 +4,7 @@ class HomeData { final List? data; final int? pageNumber; final int? nextPageNumber; + final int? lastPageNumber; - HomeData({this.data, this.pageNumber, this.nextPageNumber}); + HomeData({this.data, this.pageNumber, this.nextPageNumber, this.lastPageNumber}); } diff --git a/lib/presentation/home_page/bloc/bloc.dart b/lib/presentation/home_page/bloc/bloc.dart index 46e4c5e..2fd0569 100644 --- a/lib/presentation/home_page/bloc/bloc.dart +++ b/lib/presentation/home_page/bloc/bloc.dart @@ -14,6 +14,15 @@ class HomeBloc extends Bloc { Future _onLoadData( HomeLoadDataEvent event, Emitter emit) async { + + if (event.pageNumber == event.lastPageNumber && event.pageNumber != null) { + emit(state.copyWith( + isLoading: false, + isPaginationLoading: false, + )); + return; + } + if (event.nextPageNumber == null) { emit(state.copyWith(isLoading: true)); } else { diff --git a/lib/presentation/home_page/bloc/events.dart b/lib/presentation/home_page/bloc/events.dart index 52d4190..0f86dab 100644 --- a/lib/presentation/home_page/bloc/events.dart +++ b/lib/presentation/home_page/bloc/events.dart @@ -6,6 +6,8 @@ class HomeLoadDataEvent extends HomeEvent { final String? search; final int? pageNumber; final int? nextPageNumber; + final int? lastPageNumber; - const HomeLoadDataEvent({this.search, this.pageNumber, this.nextPageNumber}); + const HomeLoadDataEvent( + {this.search, this.pageNumber, this.nextPageNumber, this.lastPageNumber}); } diff --git a/lib/presentation/home_page/card.dart b/lib/presentation/home_page/card.dart index 462c28b..1d4d9dc 100644 --- a/lib/presentation/home_page/card.dart +++ b/lib/presentation/home_page/card.dart @@ -114,7 +114,7 @@ class _Card extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.center, children: [ GestureDetector( - onTap: () => onLike?.call(id, description!, isLiked), + onTap: () => onLike?.call(id, "${name!} ${surname!}", isLiked), child: AnimatedSwitcher( duration: const Duration(milliseconds: 250), child: !isLiked diff --git a/lib/presentation/home_page/home_page.dart b/lib/presentation/home_page/home_page.dart index 1679d2e..c0801b4 100644 --- a/lib/presentation/home_page/home_page.dart +++ b/lib/presentation/home_page/home_page.dart @@ -63,7 +63,9 @@ class _BodyState extends State<_Body> { if (!bloc.state.isPaginationLoading) { bloc.add(HomeLoadDataEvent( search: searchController.text, + pageNumber: bloc.state.data?.pageNumber, nextPageNumber: bloc.state.data?.nextPageNumber, + lastPageNumber: bloc.state.data?.lastPageNumber )); } } diff --git a/pubspec.yaml b/pubspec.yaml index ffddfdd..c8b573e 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -57,7 +57,7 @@ dependencies: flutter_icons: android: "ic_launcher" - image_path: "assets/launcher.jpeg" + image_path: "assets/launcher.jpg" min_sdk_android: 21 dev_dependencies: