Posts

Pagination using HTTP API (Fetch More Data) in Flutter

Image
  import "dart:convert" ; import "package:flutter/material.dart" ; import "package:http/http.dart" as http ; void main () { runApp ( const MyApp () ) ; } class MyApp extends StatelessWidget { const MyApp ( { super .key } ) ; @override Widget build ( BuildContext context ) { return MaterialApp ( title: "Pagination using HTTP API" , debugShowCheckedModeBanner: false, theme: ThemeData ( appBarTheme: const AppBarTheme ( backgroundColor: Colors. grey , centerTitle: true, ) , ) , home: const HomeScreenUsingHttpApi () , ) ; } } class HomeScreenUsingHttpApi extends StatefulWidget { const HomeScreenUsingHttpApi ( { super .key } ) ; @override State < HomeScreenUsingHttpApi > createState () { return HomeScreenUsingHttpApiState () ; } } class HomeScreenUsingHttpApiState extends State < HomeScreenUsingHttpApi > { List itemList = [] ; int page = 1 ; ...

Pagination (Second Practical) with Cubit in Flutter

Image
  import "package:flutter/material.dart" ; import "package:flutter_bloc/flutter_bloc.dart" ; import "package:pagination_practice/Pagination_with_Cubit/cubit/posts_cubit.dart" ; import "package:pagination_practice/Pagination_with_Cubit/data/repositories/posts_repository.dart" ; import "package:pagination_practice/Pagination_with_Cubit/data/services/posts_service.dart" ; import "package:pagination_practice/Pagination_with_Cubit/presentation/posts_screen.dart" ; void main () { runApp ( MyApp ( repository: PostsRepository ( PostsService () ) , ) , ) ; } class MyApp extends StatelessWidget { final PostsRepository repository ; const MyApp ( { super .key , required this . repository } ) ; @override Widget build ( BuildContext context ) { return BlocProvider ( create: ( context ) => PostsCubit ( repository ) , child: MaterialApp ( title: "Pagination" , debugShowChe...

Pagination First Practical in Flutter

Image
  import "package:dio/dio.dart" ; import "package:flutter/material.dart" ; import "package:flutter_spinkit/flutter_spinkit.dart" ; import "package:pagination_practice/Pagination/Model/productModel.dart" ; void main () { runApp ( const MyApp () ) ; } class MyApp extends StatelessWidget { const MyApp ( { super .key } ) ; @override Widget build ( BuildContext context ) { return MaterialApp ( title: "HomePage" , debugShowCheckedModeBanner: false, theme: ThemeData ( appBarTheme: const AppBarTheme ( backgroundColor: Colors. grey , centerTitle: true, ) , ) , home: const HomePage () , ) ; } } class HomePage extends StatefulWidget { const HomePage ( { super .key } ) ; @override State < HomePage > createState () { return HomePageState () ; } } class HomePageState extends State < HomePage > { final ScrollController scrollController = Scrol...