Skip to content

Refactor change the package name #33

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 20 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f7b90a1
refactor(dependencies): migrate to flutter-news-app-full-source-code …
fulleni Jul 23, 2025
e01c1e2
ci: configure dependabot and update GitHub Actions
fulleni Jul 23, 2025
abbc6b8
refactor(dependencies): update package imports and rename classes
fulleni Jul 23, 2025
76095a7
refactor(dependencies): migrate to generic data and auth repositories
fulleni Jul 23, 2025
0f9a8d5
docs(README): update project name and URLs
fulleni Jul 23, 2025
47971e8
refactor(app_configuration): update imports and exceptions
fulleni Jul 23, 2025
736ce0b
refactor(authentication): update imports and exceptions
fulleni Jul 23, 2025
c616421
refactor(authentication): update package imports to flutter_news_app_…
fulleni Jul 23, 2025
cf79a1e
refactor(content_management): migrate to core and data_repository pac…
fulleni Jul 23, 2025
9252be5
refactor(dashboard): update imports and dependencies
fulleni Jul 23, 2025
34d4c85
refactor(settings): migrate to core library and update error handling
fulleni Jul 23, 2025
68b8a08
refactor(l10n): update import path for AppLocalizations
fulleni Jul 23, 2025
751e3c5
refactor(router): update imports and repository references
fulleni Jul 23, 2025
e2a98c8
refactor(localization): update import statements for localization
fulleni Jul 23, 2025
e6913c5
refactor(dependencies): reorganize dependencies and move imports
fulleni Jul 23, 2025
471c000
docs(README): comprehensive update with new structure and content
fulleni Jul 23, 2025
503f90d
docs(README): update app run instructions
fulleni Jul 23, 2025
37e5984
docs(README): add explanation for AppEnvironment.production
fulleni Jul 23, 2025
54e0c42
docs(README): update app name and environment note
fulleni Jul 23, 2025
b8a5dbb
fix(web): update app title and manifest
fulleni Jul 23, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@ updates:
schedule:
interval: "weekly"
ignore:
- dependency-name: "ht_*"
- dependency-name: "auth_api"
- dependency-name: "auth_client"
- dependency-name: "auth_inmemory"
- dependency-name: "auth_repository"
- dependency-name: "core"
- dependency-name: "data_api"
- dependency-name: "data_client"
- dependency-name: "data_inmemory"
- dependency-name: "data_repository"
- dependency-name: "http_client"
- dependency-name: "kv_storage_service"
- dependency-name: "kv_storage_shared_preferences"
- dependency-name: "ui_kit"
8 changes: 4 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: deploy
name: cd

# Run this workflow when a new release is published
on:
Expand All @@ -11,7 +11,7 @@ jobs:
steps:
# 1. Checkout the repository code
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

# 2. Setup Flutter SDK
- name: Setup Flutter
Expand All @@ -26,11 +26,11 @@ jobs:

# 4. Build the Flutter web app
- name: Build Web App
run: flutter build web --release --base-href /ht-dashboard/
run: flutter build web --release --base-href /flutter-news-app-web-dashboard-full-source-code/

# 5. Deploy the built app to GitHub Pages
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./build/web
119 changes: 68 additions & 51 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,89 +1,108 @@
# 📊✨ ht_dashboard
<div align="center">
<img src="https://avatars.githubusercontent.com/u/202675624?s=400&u=2daf23e8872a3b666bcd4f792a21fe2633097e79&v=4" alt="Flutter News App Dashboard Logo" width="220">

![coverage: percentage](https://img.shields.io/badge/coverage-XX-green)
[![Demo: Live](https://img.shields.io/badge/Demo-Live-orange)](https://headlines-toolkit.github.io/ht-dashboard/)
[![style: very good analysis](https://img.shields.io/badge/style-very_good_analysis-B22C89.svg)](https://pub.dev/packages/very_good_analysis)
[![License: PolyForm Free Trial](https://img.shields.io/badge/License-PolyForm%20Free%20Trial-blue)](https://polyformproject.org/licenses/free-trial/1.0.0)
# Flutter News App - Web Dashboard Full Source Code

`ht_dashboard` is a Flutter web application designed as a comprehensive content management and administration interface for the [Headlines Toolkit](https://github.com/headlines-toolkit) ecosystem. It provides a powerful, intuitive platform for managing news content, application configurations, and user-related settings, complementing the [mobile app](https://github.com/headlines-toolkit/ht-main) and the [backend service](https://github.com/headlines-toolkit/ht-api).
<p>
<img src="https://img.shields.io/badge/coverage-XX-green?style=for-the-badge" alt="coverage: percentage">
<a href="https://flutter-news-app-full-source-code.github.io/flutter-news-app-web-dashboard-full-source-code/"><img src="https://img.shields.io/badge/Demo-Live-orange?style=for-the-badge" alt="Demo: Live"></a>
<a href="https://github.com/sponsors/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/DOCS-READ-purple?style=for-the-badge" alt="DOCS READ"></a>
<a href="https://github.com/sponsors/flutter-news-app-full-source-code"><img src="https://img.shields.io/badge/LICENSE-BUY-pink?style=for-the-badge" alt="License: Buy"></a>
</p>
</div>

## ⭐ Features & Capabilities
This is a complete and fully-functional Flutter web application for comprehensive content management and administration. It is a key component of the [**flutter news app full source code toolkit**](https://github.com/flutter-news-app-full-source-code), an ecosystem that also includes a dart frog [backend API](https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code) and a [mobile client](https://github.com/flutter-news-app-full-source-code/flutter-news-app-mobile-client-full-source-code).

`ht_dashboard` offers a robust set of tools for efficient administration:
## ⭐ Everything You Get, Ready to Go

This dashboard comes packed with all the features you need to manage a professional news application.

#### 📰 **Comprehensive Content Management**
Effortlessly manage all aspects of your news content, including:
* **Headlines:** Create, edit, and delete news articles.
* **Categories:** Organize and define news categories.
Effortlessly manage all aspects of your news content with full CRUD (Create, Read, Update, Delete) capabilities:
* **Headlines:** Create, edit, and publish news articles.
* **Topics:** Organize and define news topics.
* **Sources:** Maintain and update news sources.
* **Benefit for you:** Centralized control over your content, ensuring accuracy and consistency across your news platform. ✍️
> **Your Advantage:** You get a powerful, centralized system to control your content, ensuring accuracy and consistency across your news platform. ✍️

#### ⚙️ **Dynamic Application Configuration**
Control the behavior and appearance of the `ht_main` mobile application remotely:
* **User Preference Limits:** Set limits for followed items and saved headlines
based on user roles (Guest, Authenticated, Premium).
* **Ad Settings:** Configure ad frequency and placement intervals for
different user tiers.
* **In-App Prompts:** Manage the display frequency of account-related
calls-to-action.
* **Operational Status (Kill Switch):** Remotely enable maintenance mode or
disable the app.
* **Force Update:** Mandate or suggest app updates to users.
* **Benefit for you:** Granular control over app features and monetization
strategies without requiring app store updates. 🚀

#### 📊 **Intuitive User Interface**
Built with Flutter, the dashboard provides a responsive and user-friendly
experience across various web browsers and screen sizes.
* **User-Friendly Error Handling:** Displays clear, localized error messages for a smooth and understandable user experience when issues arise.
* **Benefit for you:** A modern, maintainable, and visually appealing
interface for your administrative tasks. ✨
Control the behavior and appearance of the mobile application remotely:
* **User Preference Limits:** Set limits for followed items and saved headlines based on user roles (Guest, Authenticated, Premium).
* **Ad Settings:** Configure ad frequency and placement intervals for different user tiers.
* **In-App Prompts:** Manage the display frequency of account-related calls-to-action.
* **Operational Status:** Remotely enable maintenance mode or suggest app updates to users.
> **Your Advantage:** Granular control over app features and monetization strategies without requiring app store updates. 🚀

#### 📊 **Dashboard Analytics**
Get a quick overview of your content ecosystem with key statistics:
* **Content Counts:** View the total number of headlines, topics, and sources at a glance.
> **Your Advantage:** Instantly understand the scale of your content operation. 📈

#### 🔐 **Robust User Authentication**
Secure and flexible authentication flows are built-in for administrators and publishers using Email + Code (Passwordless) Sign-In.
> **Your Advantage:** All the complex security and user management for your administrative team is already done for you. ✅

#### 🖥️ **Responsive Web UI**
Built with `flutter_adaptive_scaffold`, the dashboard offers a clean, responsive interface that looks great on any screen size.
> **Your Advantage:** Deliver a consistent and optimized administrative experience on desktops, tablets, and even mobile browsers. ↔️

#### 🏗️ **Clean & Modern Architecture**
Developed with best practices for a maintainable and scalable codebase:
* **Flutter & Dart:** Cutting-edge web development.
* **BLoC Pattern:** Predictable and robust state management.
* **GoRouter:** Well-structured and powerful navigation.
* **Adaptive UI:** Responsive layouts using `flutter_adaptive_scaffold` for
optimal experience on different screen sizes.
* **Benefit for you:** An easy-to-understand, extendable, and testable
foundation for your project. 📈
> **Your Advantage:** The dashboard is built on a clean, modern architecture that's easy to understand and maintain. It's solid and built to last. 📈

#### ⚙️ **Flexible Environment Configuration**
Easily switch between development (in-memory data or local API) and production environments with a simple code change. This empowers rapid prototyping, robust testing, and seamless deployment.
> **Your Advantage:** A flexible setup that speeds up your development cycle and makes deployment simple. 🚀

#### 🌍 **Localization Ready**
Fully internationalized with working English and Arabic localizations (`.arb` files).
* **Benefit for you:** Easily adapt your dashboard for a global team. 🌐
Fully internationalized with working English and Arabic localizations (`.arb` files). Adding more languages is straightforward.
> **Your Advantage:** Easily adapt your dashboard for a global team. 🌐

---

## 🔑 Access and Licensing
## 🔑 License: Source-Available with a Free Trial

`ht_dashboard` is source-available as part of the Headlines Toolkit ecosystem.
Get started for free and purchase when you're ready to launch!

To acquire a commercial license for building unlimited news applications, please visit
the [Headlines Toolkit GitHub organization page](https://github.com/headlines-toolkit)
for more details.
* **TRY IT:** Download and explore the full source code under the polyForm free trial [license](LICENSE). Perfect for evaluation.
* **BUY IT:** Get an unlimited commercial lifetime license with a **one-time payment**. No subscriptions!
* **GET YOURS:** [**Purchase via GitHub Sponsors**](https://github.com/sponsors/flutter-news-app-full-source-code).

> *<p style="color:grey">Note: The single purchase provides a comprehensive commercial license covering every repository within the [Flutter News App - Full Source Code Toolkit](https://github.com/flutter-news-app-full-source-code) organization. No separate purchases are needed for the API or mobile client.</p>*
---

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The use of raw HTML (<p>) and inline styles within a Markdown blockquote (>) is unconventional and can lead to inconsistent rendering across different Markdown viewers. The * surrounding the <p> tag might also not produce the intended italicization reliably.

For better portability and maintainability, it's recommended to stick to standard Markdown syntax where possible. If the grey color is not a strict requirement, you can simplify this to a standard italicized blockquote, which is cleaner and more idiomatic.

Suggested change
> *<p style="color:grey">Note: The single purchase provides a comprehensive commercial license covering every repository within the [Flutter News App - Full Source Code Toolkit](https://github.com/flutter-news-app-full-source-code) organization. No separate purchases are needed for the API or mobile client.</p>*
> Note: The single purchase provides a comprehensive commercial license covering every repository within the [Flutter News App - Full Source Code Toolkit](https://github.com/flutter-news-app-full-source-code) organization. No separate purchases are needed for the API or mobile client.


## 🚀 Getting Started
## 🚀 Getting Started & Running Locally

1. **Ensure Flutter is installed.** (See [Flutter documentation](https://flutter.dev/docs/get-started/install))
2. **Clone the repository:**
```bash
git clone https://github.com/headlines-toolkit/ht-dashboard.git
cd ht-dashboard
git clone https://github.com/flutter-news-app-full-source-code/flutter-news-app-web-dashboard-full-source-code.git
cd flutter-news-app-web-dashboard-full-source-code
```
3. **Get dependencies:**
```bash
flutter pub get
```
4. **Run the app for web:**
4. **Run the app:**

To run the app, first select your desired environment in `lib/main.dart`:

```dart
// lib/main.dart

// Use `AppEnvironment.demo` to run with in-memory data (no API needed).
// Use `AppEnvironment.development` to connect to a local backend API.
// Use `AppEnvironment.production` to connect to a live backend API.
const appEnvironment = AppEnvironment.demo;
```

Then, run the app from your terminal:
```bash
flutter run -d chrome
# Or to run on a web server (e.g., for CORS testing with ht_api)
# flutter run -d web-server --web-hostname 0.0.0.0 --web-port 3000
```
*(Note: For full functionality, ensure the `ht_api` backend service is running and accessible. If running `ht_api` locally, ensure its `CORS_ALLOWED_ORIGIN` environment variable is configured to allow requests from the dashboard's origin, e.g., `http://localhost:3000` if using the web-server option.)*
*(Note: For `development/production` environment, ensure the [backend service](https://github.com/flutter-news-app-full-source-code/flutter-news-app-api-server-full-source-code) is running.)*

---

Expand All @@ -94,5 +113,3 @@ This project aims for high test coverage to ensure quality and reliability.
* Run tests with:
```bash
flutter test
```
*(Note: Ensure `very_good_cli` is activated: `dart pub global activate very_good_cli`)*
27 changes: 13 additions & 14 deletions lib/app/bloc/app_bloc.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,30 @@

import 'dart:async';

import 'package:auth_repository/auth_repository.dart';
import 'package:bloc/bloc.dart';
import 'package:core/core.dart';
import 'package:data_repository/data_repository.dart';
import 'package:equatable/equatable.dart';
import 'package:ht_auth_repository/ht_auth_repository.dart';
import 'package:ht_dashboard/app/config/config.dart' as local_config;
import 'package:ht_data_repository/ht_data_repository.dart';
import 'package:ht_shared/ht_shared.dart';
import 'package:flutter_news_app_web_dashboard_full_source_code/app/config/config.dart'
as local_config;
import 'package:logging/logging.dart';

part 'app_event.dart';
part 'app_state.dart';

class AppBloc extends Bloc<AppEvent, AppState> {
AppBloc({
required HtAuthRepository authenticationRepository,
required HtDataRepository<UserAppSettings> userAppSettingsRepository,
required HtDataRepository<RemoteConfig> appConfigRepository,
required AuthRepository authenticationRepository,
required DataRepository<UserAppSettings> userAppSettingsRepository,
required DataRepository<RemoteConfig> appConfigRepository,
required local_config.AppEnvironment environment,
Logger? logger,
}) : _authenticationRepository = authenticationRepository,
_userAppSettingsRepository = userAppSettingsRepository,
_appConfigRepository = appConfigRepository,
_logger = logger ?? Logger('AppBloc'),
super(
AppState(environment: environment),
) {
super(AppState(environment: environment)) {
on<AppUserChanged>(_onAppUserChanged);
on<AppLogoutRequested>(_onLogoutRequested);
on<AppUserAppSettingsChanged>(_onAppUserAppSettingsChanged);
Expand All @@ -36,9 +35,9 @@ class AppBloc extends Bloc<AppEvent, AppState> {
);
}

final HtAuthRepository _authenticationRepository;
final HtDataRepository<UserAppSettings> _userAppSettingsRepository;
final HtDataRepository<RemoteConfig> _appConfigRepository;
final AuthRepository _authenticationRepository;
final DataRepository<UserAppSettings> _userAppSettingsRepository;
final DataRepository<RemoteConfig> _appConfigRepository;
final Logger _logger;
late final StreamSubscription<User?> _userSubscription;

Expand Down Expand Up @@ -97,7 +96,7 @@ class AppBloc extends Bloc<AppEvent, AppState> {
);
await _userAppSettingsRepository.create(item: defaultSettings);
emit(state.copyWith(userAppSettings: defaultSettings));
} on HtHttpException catch (e, s) {
} on HttpException catch (e, s) {
// Handle HTTP exceptions during settings load
_logger.severe(
'Error loading user app settings for user ${user.id}: ${e.message}',
Expand Down
13 changes: 4 additions & 9 deletions lib/app/config/app_config.dart
Original file line number Diff line number Diff line change
@@ -1,20 +1,15 @@
import 'package:ht_dashboard/app/config/app_environment.dart';
import 'package:flutter_news_app_web_dashboard_full_source_code/app/config/app_environment.dart';

class AppConfig {
const AppConfig({
required this.environment,
required this.baseUrl,
});
const AppConfig({required this.environment, required this.baseUrl});

factory AppConfig.production() => const AppConfig(
environment: AppEnvironment.production,
baseUrl: 'http://api.yourproductiondomain.com',
);

factory AppConfig.demo() => const AppConfig(
environment: AppEnvironment.demo,
baseUrl: '',
);
factory AppConfig.demo() =>
const AppConfig(environment: AppEnvironment.demo, baseUrl: '');

factory AppConfig.development() => const AppConfig(
environment: AppEnvironment.development,
Expand Down
Loading
Loading