kaparray/NewsDaily
소개
Flutter와 BLoC 패턴으로 만든 뉴스 앱입니다.
기타 프로젝트What you can do
- Feed: top headlines as Material 3 cards with the source, publish time, preview, share and favorite actions
- Search: full-text news search
- Favorites: saved stories are stored locally on the device with shared_preferences
- Settings: light and dark theme, primary accent color, news country, and opening stories in the in-app WebView or the default browser
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalNews Daily
A news reader built with Flutter 3.50 and Material 3. It shows top headlines from NewsAPI, lets you search stories, save favorites, and pick the theme, accent color and news country.
Features
- Feed: top headlines as Material 3 cards with the source, publish time, preview, share and favorite actions
- Search: full-text news search
- Favorites: saved stories are stored locally on the device with
shared_preferences - Settings: light and dark theme, primary accent color, news country, and opening stories in the in-app WebView or the default browser
Tech
- Flutter 3.50 / Dart 3.10, Material 3
- BLoC pattern with
rxdartstreams - iOS uses Swift Package Manager and the UIScene lifecycle (no CocoaPods)
Libraries
Getting started
Requirements
- Flutter 3.50 (stable) with Dart 3.10 or newer. Check with
flutter --version - Android: Android Studio with an SDK and an emulator or a device with USB debugging
- iOS: macOS with Xcode 16+ and an iOS 15+ simulator or device (dependencies are resolved by Swift Package Manager, no
pod installneeded)
Run
git clone https://github.com/kaparray/NewsDaily.git
cd NewsDaily/news_app
flutter pub get
flutter devices # list available simulators and devices
flutter run # or: flutter run -d <device-id>
Tests and static analysis
flutter analyze
flutter test
Release builds
flutter build apk --release # Android
flutter build ios --release # iOS (needs signing set up in Xcode)
Android release signing is read from android/key.properties when that file is present; otherwise the debug key is used.
NewsAPI key
News come from newsapi.org. The key lives in _apiKey in lib/resources/news_api_provider.dart. To use your own, register at newsapi.org and replace that value. The free plan is limited in requests per day.
Architecture
The app follows the BLoC (Business Logic Component) pattern: the UI never talks to the network or storage directly, it only listens to streams and calls methods on the bloc.
UI (screens, views) ──calls──▶ NewsBloc ──▶ Repository ──▶ NewsApiProvider ──▶ NewsAPI / SharedPreferences
▲ │
└──── Stream<NewsModel> ─────┘
Layers (news_app/lib)
| Folder | Responsibility |
|---|---|
models/ |
NewsModel, Articles, Source: plain data classes with fromJson / toJson |
resources/news_api_provider.dart |
Data sources: HTTP requests to NewsAPI (top headlines, search) and the local favorites store in shared_preferences |
resources/repository.dart |
Single entry point to data for the bloc; hides where each piece of data comes from |
blocs/news_bloc.dart |
Business logic. Exposes streams and actions for the UI |
ui/ |
Widgets: bottom_nav_bar.dart (tabs), screens/ (feed, search, favorites, settings, web view), views/ (cards, stream builder, search bar), theme.dart (Material 3 theme) |
utils/ |
Pure helpers: country codes, "time ago" formatting |
How the BLoC works
NewsBlocholds threerxdartPublishSubjects and exposes them as streams:allNews(feed),searchNews(search) andlikeNews(favorites).- Screens call
bloc.fetchAllNews(),bloc.fetchSearchNews()orbloc.fetchLikedNews()ininitStateand on pull-to-refresh. The bloc asks the repository for data and pushes either aNewsModelor an error into the matching subject. - Screens render the stream with a shared
streamBuilderwidget (ui/views/stream_builder.dart), which shows a loader, the list, an empty state or an error with a Retry button. - Favoriting goes through
bloc.addFavorite/bloc.deleteFavorite;ui/utils/favorites.dartalso keeps the list of liked URLs so the heart icon state is instant. - A single global
blocinstance is created innews_bloc.dartand disposed when the app widget is disposed.NewsBlocandRepositoryaccept their dependencies in the constructor, so tests can inject fakes (seetest/news_bloc_test.dart).
Local storage
shared_preferences (SharedPreferences on Android, NSUserDefaults on iOS) stores:
favorites: liked articles as JSON stringsliked: URLs of liked articles, for the heart iconcountry,priorityThemeand other settings; the theme mode is persisted byadaptive_theme
License
Released under the MIT license.
Author
Kirill Adeshchenko (@kaparray)
관련 프로젝트 살펴보기
불러오는 중…