A simple Flutter application that demonstrates fetching and displaying data API. The application showcases proper API integration with error handling and a clean, responsive UI.
This project demonstrates:
- Clean architecture with separate screen components
- API integration using the http package
- Error handling for network requests
- Responsive UI with Material Design elements
- Navigation between screens
-
Home Screen
- Welcoming interface with gradient background
- Information about the application and developer
- Navigation to the API data page
-
API Data Screen
- Fetches post data from JSONPlaceholder API
- Displays data in a scrollable list using ListView with nicely formatted cards
- Comprehensive error handling with user-friendly error messages
- Refresh functionality to reload data
- Loading indicators during data fetching
-
UI/UX Features
- Consistent color scheme with brown as the primary color
- Material Design 3 implementation
- Responsive layout adaptable to different screen sizes
- Elevated cards with shadows for better visual hierarchy
- Clear typography with varying font sizes and weights
- Flutter SDK (2.5.0 or higher)
- Dart SDK (2.14.0 or higher)
- Android Studio / VS Code
- A physical device or emulator for testing
-
Clone the repository
git clone https://github.com/Nimal-dev/api_fetch_app.git cd api_fetch_app -
Install dependencies
flutter pub get -
Verify dependencies Ensure the following dependencies are in your
pubspec.yaml:dependencies: flutter: sdk: flutter http: ^1.3.0 # For API requests
-
Run the application
flutter run
lib/
├── main.dart # Application entry point
└── screens/
├── homePage.dart # Welcome screen with navigation
└── assignmentPage.dart # API fetching and display screen
- Internet connectivity is required for the application to function properly
- The API endpoint is stable and returns data in the expected format
- The API doesn't require authentication for accessing data
Welcome screen with gradient background and app information
Screen displaying fetched data in a card-based list view
Error handling UI when network issues occur
Error handling UI when api issues occur
Loading indicator while data is being fetched
Developed by: Nimal Prince