diff --git a/lib/main.dart b/lib/main.dart index 407ebf7..d602edf 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -21,12 +21,12 @@ class MyApp extends StatelessWidget { colorScheme: ColorScheme.fromSeed(seedColor: const Color(0xFF7BA05B)), useMaterial3: true, ), - home: RepositoryProvider( + home: RepositoryProvider( lazy: true, - create: (_) => PotterRepository(), + create: (_) => RickandMortyRepository(), child: BlocProvider( lazy: false, - create: (context) => HomeBloc(context.read()), + create: (context) => HomeBloc(context.read()), child: const MyHomePage(title: "Пучкина Анна Алексеевна!"), ), ) diff --git a/lib/presentation/home_page/bloc/bloc.dart b/lib/presentation/home_page/bloc/bloc.dart index 78a7301..25aa9c3 100644 --- a/lib/presentation/home_page/bloc/bloc.dart +++ b/lib/presentation/home_page/bloc/bloc.dart @@ -5,8 +5,8 @@ import 'package:app/repositories/rick&morty_repositoty.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; class HomeBloc extends Bloc { - //final RickandMortyRepository repo; - final PotterRepository repo; + final RickandMortyRepository repo; + //final PotterRepository repo; HomeBloc(this.repo) : super(const HomeState()) { on(_onLoadData); diff --git a/lib/repositories/rick&morty_repositoty.dart b/lib/repositories/rick&morty_repositoty.dart index 1a2a335..1c32fa0 100644 --- a/lib/repositories/rick&morty_repositoty.dart +++ b/lib/repositories/rick&morty_repositoty.dart @@ -20,7 +20,6 @@ class RickandMortyRepository extends ApiInterface { OnErrorCallback? onError, String? q, int page = 1, - int pageSize= 25, }) async { try { const String url = '$_baseUrl/api/character'; @@ -28,9 +27,8 @@ class RickandMortyRepository extends ApiInterface { final Response response = await _dio.get>( url, queryParameters: { - 'filter[name_cont]': q, - 'page[number]' : page, - 'page[size]' : pageSize + 'name': q, + 'page' : page, }, );