Сменил иконку и пофиксил баг с прокруткой до конца
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 44 KiB |
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 76 KiB |
Before Width: | Height: | Size: 104 KiB |
BIN
assets/launcher.jpg
Normal file
After Width: | Height: | Size: 1.4 MiB |
Before Width: | Height: | Size: 81 KiB |
@ -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) {
|
||||
|
@ -22,6 +22,6 @@ class MockRepository extends ApiInterface {
|
||||
age: 24,
|
||||
distance: 478.3,
|
||||
)
|
||||
], pageNumber: 0);
|
||||
], pageNumber: 0, lastPageNumber: 0);
|
||||
}
|
||||
}
|
||||
|
@ -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});
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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});
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
));
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|