lab6 ошибки фикс (* ^ ω ^)
This commit is contained in:
parent
66ec21d64a
commit
d8f7c11768
@ -12,7 +12,7 @@ class PotterRepository extends ApiInterface {
|
|||||||
requestBody: true,
|
requestBody: true,
|
||||||
));
|
));
|
||||||
|
|
||||||
static const String _baseUrl = 'https://api.potterdb.com';
|
static const String _baseUrl = 'https://api.pot----terdb.com';
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Future<HomeData?> loadData({
|
Future<HomeData?> loadData({
|
||||||
@ -37,7 +37,7 @@ class PotterRepository extends ApiInterface {
|
|||||||
final HomeData data = dto.toDomain();
|
final HomeData data = dto.toDomain();
|
||||||
return data;
|
return data;
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
onError?.call(e.error?.toString());
|
onError?.call(e.error?.toString() ?? e.type.toString());
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ class _BodyState extends State<_Body> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void _onNextPageListener() {
|
void _onNextPageListener() {
|
||||||
if (scrollController.offset > scrollController.position.maxScrollExtent) {
|
if (scrollController.offset >= scrollController.position.maxScrollExtent) {
|
||||||
// preventing multiple pagination request on multiple swipes
|
// preventing multiple pagination request on multiple swipes
|
||||||
final bloc = context.read<HomeBloc>();
|
final bloc = context.read<HomeBloc>();
|
||||||
if (!bloc.state.isPaginationLoading) {
|
if (!bloc.state.isPaginationLoading) {
|
||||||
@ -84,7 +84,8 @@ class _BodyState extends State<_Body> {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
BlocBuilder<HomeBloc, HomeState>(
|
BlocBuilder<HomeBloc, HomeState>(
|
||||||
builder: (context, state) => state.error != null
|
builder: (context, state)
|
||||||
|
=> state.error != null
|
||||||
? Text(
|
? Text(
|
||||||
state.error ?? '',
|
state.error ?? '',
|
||||||
style: Theme.of(context).textTheme.headlineSmall?.copyWith(color: Colors.red),
|
style: Theme.of(context).textTheme.headlineSmall?.copyWith(color: Colors.red),
|
||||||
@ -95,7 +96,6 @@ class _BodyState extends State<_Body> {
|
|||||||
child: RefreshIndicator(
|
child: RefreshIndicator(
|
||||||
onRefresh: _onRefresh,
|
onRefresh: _onRefresh,
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
physics: BouncingScrollPhysics(),
|
|
||||||
controller: scrollController,
|
controller: scrollController,
|
||||||
padding: EdgeInsets.zero,
|
padding: EdgeInsets.zero,
|
||||||
itemCount: state.data?.data?.length ?? 0,
|
itemCount: state.data?.data?.length ?? 0,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user