This Flutter application fetches posts from a public API and displays them in a dynamic list. Each post has a timer that starts when visible and pauses when scrolled away or clicked. Users can mark posts as read, and read posts are persisted using Hive.
- Fetch posts from
https://jsonplaceholder.typicode.com/posts
. - Display post titles in a scrollable list with initial light yellow background.
- Timer for each post with random durations (10s, 20s, 25s) that pauses when posts are off-screen or clicked.
- Post detail screen with minimal, modern UI showing the post body.
- Mark posts as read, changing background color to white.
- Local storage using Hive to persist posts and read status.
- Pull-to-refresh for real-time updates from API.
- State Management: StatefulWidgets with
setState
. - Data Persistence: Hive to cache posts and read status.
- Networking:
http
package for REST API calls. - Visibility Detection:
visibility_detector
for managing timers based on visibility. - UI: Minimal design using Flutter widgets, gradients, and smooth animations.
google_fonts
– custom fontshive
&hive_flutter
– local storagehttp
– REST API callsvisibility_detector
– detect widget visibilityintl
– date/time formattingshimmer
– loading placeholders
practical_task/
│
├─ android/
├─ ios/
├─ lib/
│ ├─ main.dart
│ ├─ screens/
│ │ ├─ post_list_screen.dart
│ │ └─ post_detail_screen.dart
│
├─ pubspec.yaml
├─ README.md
├─ .gitignore
└─ assets/
1.Clone the repository:
git clone https://github.com/OmkarNarwade/Flutter-Practical-Task.git
cd Flutter-Practical-Task`
2.Install dependencies:
flutter pub get`
3.Run the app:
flutter run`
-
Ensure Android SDK and Flutter are properly installed.
-
The app uses Hive, so first launch may require initializing the Hive box.
-
Timers automatically pause/resume based on post visibility for better UX and performance.