A modern, interactive metrics dashboard built with Flutter and fl_chart library. This application displays real-time data visualization with three types of interactive charts - Line Chart for daily usage, Bar Chart for weekly statistics, and Pie Chart for category distribution.
- Contributing Guide - Learn how to contribute to this project
- Changelog - Version history and release notes
- Line Chart: Daily app usage metrics with smooth curved lines and gradient fill
- Bar Chart: Weekly usage statistics with color-coded bars
- Pie Chart: Category distribution with dynamic color assignment
- Real-time Data Fetching: HTTP requests to external APIs using the http package
- Responsive Design: Scrollable layout that adapts to different screen sizes
- Error Handling: Comprehensive try-catch blocks with fallback data
- Cross-Platform: Runs on Web, Android, iOS, Windows, macOS, and Linux
- Material Design: Clean UI following Flutter's Material Design principles
βββββββββββββββββββββββββββββββββββββββ
β π Metrics Dashboard β
βββββββββββββββββββββββββββββββββββββββ€
β β
β Daily App Usage β
β βββββββββββββββββββββββββββββ β
β β β±β² β±β² β β
β β β± β² β± β² β±β² β β
β β β± β²β± β² β± β² β β
β β β± β²β± β² β β
β βββββββββββββββββββββββββββββ β
β β
β Weekly App Usage β
β βββββββββββββββββββββββββββββ β
β β βββ βββ βββ βββ βββ β β
β β βββ βββ βββ βββ βββ βββ β β
β βββββββββββββββββββββββββββββ β
β β
β App Usage by Category β
β βββββββββββββββββββββββββββββ β
β β β±βββββββ² β β
β β β π¨ β β β
β β β²βββββββ± β β
β βββββββββββββββββββββββββββββ β
β β
βββββββββββββββββββββββββββββββββββββββ
- Flutter SDK - ^3.9.2 - UI framework for cross-platform development
- Dart - ^3.9.2 - Programming language
- fl_chart - 0.69.1 - Beautiful and interactive chart library
- http - 1.2.2 - HTTP client for API requests
- Material Design - Flutter's built-in design system
metrics_dashboard/
βββ lib/
β βββ main.dart # Main application with dashboard and charts
βββ test/
β βββ widget_test.dart # Widget tests
βββ android/ # Android platform files
βββ ios/ # iOS platform files
βββ web/ # Web platform files
βββ linux/ # Linux platform files
βββ macos/ # macOS platform files
βββ windows/ # Windows platform files
βββ pubspec.yaml # Dependencies configuration
βββ LICENSE # MIT License
βββ README.md # Project documentation
βββ CONTRIBUTING.md # Contribution guidelines
βββ CHANGELOG.md # Version history
Before you begin, ensure you have the following installed:
- Flutter SDK >= 3.9.2
- Dart SDK >= 3.9.2
- Android Studio or VS Code with Flutter extensions
- Git for version control
Follow these steps to get your development environment running:
-
Clone the repository:
git clone https://github.com/mohammadfirmansyah/metrics_dashboard.git cd metrics_dashboard -
Install dependencies:
flutter pub get
-
Verify installation:
flutter doctor
flutter run -d chrome# Android
flutter run -d android
# iOS (macOS only)
flutter run -d ios
# Windows
flutter run -d windows
# macOS
flutter run -d macos
# Linux
flutter run -d linux# Web
flutter build web
# Android APK
flutter build apk
# iOS
flutter build ios
# Windows
flutter build windows
# macOS
flutter build macos
# Linux
flutter build linuxEntry point of the application that sets up the Material app with theme configuration.
Main dashboard screen containing all charts and data fetching logic.
class Dashboard extends StatefulWidget {
@override
_DashboardState createState() => _DashboardState();
}fetchDailyUsageMetrics(): Retrieves daily usage data from API
- Parses JSON response
- Converts values to double for chart rendering
- Implements fallback for empty data
Future<void> fetchDailyUsageMetrics() async {
final response = await http.get(Uri.parse(API_URL));
if (response.statusCode == 200) {
var data = json.decode(response.body);
// Process data and update state
setState(() {
dailyUsageData = List<double>.from(data['values']);
});
}
}fetchWeeklyUsageData(): Fetches weekly statistics
- Extracts data from nested JSON structure
- Filters out invalid values (NaN, Infinity)
fetchCategoryData(): Gets category distribution
- Maps category names and values
- Prepares data for pie chart rendering
- Features: Curved lines, gradient fill, interactive touch
- Data: Daily usage values with labels
- Customization: Blue color scheme, grid display
- Features: Vertical bars, value display on hover
- Data: Weekly usage statistics
- Customization: Green color scheme, bottom labels
- Features: Interactive sections, color-coded segments
- Data: Category names with population values
- Customization: Dynamic colors from Flutter's Colors.primaries
This project demonstrates Flutter development best practices:
- β State Management: Using StatefulWidget and setState for reactive UI
- β Async Programming: HTTP requests with async/await patterns
- β Error Handling: Try-catch blocks with fallback mechanisms
- β JSON Parsing: Decoding and mapping API responses
- β Chart Integration: Implementing fl_chart library for data visualization
- β Responsive Layout: Using SingleChildScrollView for scrollable content
- β Cross-Platform Development: Single codebase for multiple platforms
- β Material Design: Following Flutter UI/UX best practices
The application fetches data from the following endpoints:
-
Daily Usage:
https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/ZA40HNE2G0l7ZUgnq5VO4Q/dataoveraweek.json -
Weekly Usage:
https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/4vOv2DroCvrpvIqvHjRq3w/weeklydata.json -
Category Data:
https://cf-courses-data.s3.us.cloud-object-storage.appdomain.cloud/Q4E2g7pKaK__9XII3C1GEQ/socialmedia.json
We welcome contributions! Please see our Contributing Guide for details on how to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'feat: add some amazing feature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
- No offline support (requires internet connection)
- No data caching mechanism
- No loading indicators during data fetch
- No error messages displayed to users
- Add loading spinners while fetching data
- Implement error dialogs for failed API calls
- Add pull-to-refresh functionality
- Cache data locally using shared_preferences
- Add date range filters for charts
- Dark mode theme support
- Export chart data as PNG/PDF
- Add more chart types (scatter, radar, etc.)
- Real-time data updates with WebSocket
- User authentication and personalized dashboards
This project is licensed under the MIT License. See the LICENSE file for details.
- Mohammad Firman Syah
- Project Link: https://github.com/mohammadfirmansyah/metrics_dashboard
Note: For production deployment, consider:
- Implementing proper error handling with user-friendly messages
- Adding loading states and progress indicators
- Caching API responses to reduce network calls
- Optimizing chart rendering for large datasets
- Adding unit tests and widget tests for reliability
- Implementing CI/CD pipeline for automated testing
Built with β€οΈ using Flutter & Dart