Fetch-Jokes is a Flutter-based application that delivers a delightful joke-telling experience through a clean, user-friendly interface. The app utilizes the Provider package for efficient state management and the Dio package for seamless HTTP requests. Designed with scalability and maintainability in mind, Fetch-Jokes ensures smooth performance and a polished user experience.
- Instant Joke Fetching: Retrieve jokes from an API with just one tap.
- Responsive UI: Dynamically adjusts to loading states and error scenarios.
- Material Design Principles: A scrollable joke list with modern, intuitive styling.
- Pull-to-Refresh: Swipe down to refresh jokes effortlessly.
- Offline Support: Cache jokes locally for uninterrupted enjoyment.
- No Internet Alert: Displays a pop-up notification when offline.
- Customizations: Personalized app icon and name for a unique branding experience.
- JSON Serialization/Deserialization: Ensures accurate data handling when converting JSON data from the API into Dart objects.
The app follows a modular and scalable folder structure:
lib/
├── components/ # Reusable UI components
│ ├── fetch_jokes_button.dart # Button to fetch jokes
│ ├── joke_card.dart # Card design for jokes
│ ├── joke_category_dropdown.dart # Dropdown menu for selecting categories
│ └── no_internet_popup.dart # Popup for no internet connection
├── services/ # Logic for API calls and caching
│ ├── joke_service.dart # API communication layer
│ └── cache_manager.dart # Handles local caching of jokes
├── state/ # State management using Provider
│ └── joke_state.dart # Centralized state for joke management
├── utils/ # Utilities and constants
│ └── app_constants.dart # Constants like API URLs
├── screens/ # Main app screens
│ ├── home_page.dart # Home screen UI
└── main.dart # Application entry point
assets/ # Static assets
├── images/ # Images used in the app
└── fonts/ # Custom fonts (Lato, LobsterTwo)
- Provider: Manages state efficiently across the app.
- Dio: Handles API requests with advanced networking features.
- flutter_launcher_icons: Customizes app icons.
- shared_preferences: Caches jokes locally for offline access.
- internet_connection_checker: Monitors internet connectivity.
Install dependencies:
flutter pub get
JokeState
: Governs the app's overall state, including loading and fetching joke data.
JokeService
: Uses Dio to fetch jokes from an external API.CacheManager
: Saves jokes locally with shared_preferences, ensuring offline availability.
- HomePage: Displays a joke-fetch button, category dropdown, and a styled list of jokes.
- No Internet Popup: Alerts the user when offline.
- Pull-to-Refresh: Swipe gesture to refresh the joke list.
- API: Update the API endpoint in
lib/utils/app_constants.dart
. - Styling: Modify fonts in the
assets/fonts
folder or adjust styles in relevant components. - Assets: Replace app images in the
assets/images
folder for a personalized touch.
-
Clone the Repository:
git clone https://github.com/manojtharindu11/fetch-jokes.git
-
Navigate to the Directory:
cd fetch-jokes
-
Fetch Dependencies:
flutter pub get
-
Run the App:
flutter run
We welcome contributions to improve Fetch-Jokes! To contribute:
- Fork the repository.
- Create a new branch for your feature:
git checkout -b feature/your-feature-name
- Commit your changes:
git commit -m "Add your feature description"
- Push the branch:
git push origin feature/your-feature-name
- Open a pull request.
- User-Generated Content: Allow users to submit their jokes.
- Theming Options: Introduce dark mode and custom themes.
- Social Sharing: Add functionality to share jokes across social platforms.
- Voice Integration: Implement a text-to-speech feature to read jokes aloud.
- Multi-Language Support: Provide jokes in multiple languages.
This project is licensed under the MIT License. See the LICENSE
file for details.