Сменил иконку и пофиксил баг с прокруткой до конца

This commit is contained in:
Никита Потапов 2024-12-19 19:27:53 +04:00
parent 4d3d485e4d
commit c087b6a2a2
16 changed files with 21 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 76 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

BIN
assets/launcher.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

View File

@ -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) {

View File

@ -22,6 +22,6 @@ class MockRepository extends ApiInterface {
age: 24,
distance: 478.3,
)
], pageNumber: 0);
], pageNumber: 0, lastPageNumber: 0);
}
}

View File

@ -4,6 +4,7 @@ class HomeData {
final List<CardData>? 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});
}

View File

@ -14,6 +14,15 @@ class HomeBloc extends Bloc<HomeEvent, HomeState> {
Future<void> _onLoadData(
HomeLoadDataEvent event, Emitter<HomeState> 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 {

View File

@ -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});
}

View File

@ -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

View File

@ -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
));
}
}

View File

@ -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: