|
1 |
| -# Occurrence Time Range Selector |
| 1 | +# 📊 Occurrence Time Range Selector |
2 | 2 |
|
3 |
| -Flutter widget that lets the user "select" a time range while displaying an events occurrence chart. |
| 3 | +A highly interactive and customizable Flutter widget that allows users to select a time range while visualizing event occurrences on a dynamic chart. |
4 | 4 |
|
5 |
| - |
| 5 | + |
6 | 6 |
|
| 7 | +## ✨ Features |
| 8 | + |
| 9 | +- 🔍 Zoom and pan functionality for detailed exploration |
| 10 | +- 📅 Dynamic time scale adapting to the selected range |
| 11 | +- 📊 Stacked vertical bars for multiple event classes |
| 12 | +- 🎨 Customizable colors and styles |
| 13 | +- ⏱️ Millisecond precision for high-detail views |
| 14 | +- 🖱️ Optimized for desktop use with mouse and keyboard |
| 15 | + |
| 16 | +## 🚀 Getting Started |
| 17 | + |
| 18 | +### Usage |
| 19 | + |
| 20 | +Import the package in your Dart code: |
| 21 | + |
| 22 | +```dart |
| 23 | +import 'package:occurrence_time_range_selector/occurrence_time_range_selector.dart'; |
| 24 | +``` |
| 25 | + |
| 26 | +Then, you can use the `TimeRangeSelector` widget in your Flutter app: |
| 27 | + |
| 28 | +```dart |
| 29 | +final now = DateTime.now(); |
| 30 | +
|
| 31 | +TimeRangeSelector( |
| 32 | + startDate: now.subtract(Duration(days: 30)), |
| 33 | + endDate: now.add(Duration(days: 30)), |
| 34 | + events: [ |
| 35 | + TimeEvent(tag: 'Class A', dateTime: now.subtract(Duration(days: 15))), |
| 36 | + TimeEvent(tag: 'Class B', dateTime: now.subtract(Duration(days: 7))), |
| 37 | + TimeEvent(tag: 'Class A', dateTime: now), |
| 38 | + TimeEvent(tag: 'Class C', dateTime: now.add(Duration(days: 10))), |
| 39 | + TimeEvent(tag: 'Class B', dateTime: now.add(Duration(days: 20))), |
| 40 | + ], |
| 41 | + tagStyles: const { |
| 42 | + 'Class A': TagStyle(color: Colors.blue), |
| 43 | + 'Class B': TagStyle(color: Colors.red), |
| 44 | + 'Class C': TagStyle(color: Colors.green), |
| 45 | + }, |
| 46 | + onRangeChanged: (DateTime newStart, DateTime newEnd) { |
| 47 | + print('New range: $newStart to $newEnd'); |
| 48 | + }, |
| 49 | + style: const TimelineStyle( |
| 50 | + axisColor: Colors.black, |
| 51 | + axisLabelStyle: TextStyle(fontSize: 18, color: Colors.black), |
| 52 | + barSpacing: 2, |
| 53 | + backgroundColor: Colors.white, |
| 54 | + ), |
| 55 | +) |
| 56 | +``` |
| 57 | + |
| 58 | +## 🛠️ Customization |
| 59 | + |
| 60 | +The `TimeRangeSelector` widget offers various customization options: |
| 61 | + |
| 62 | +- `tagStyles`: Define colors for different event classes |
| 63 | +- `style`: Customize the appearance of the timeline |
| 64 | +- `minZoomFactor` and `maxZoomFactor`: Set limits for zooming capabilities |
| 65 | + |
| 66 | +## 📄 License |
| 67 | + |
| 68 | +This project is licensed under the MIT License - see the [LICENSE](link_to_license_file) file for details. |
| 69 | + |
| 70 | +--- |
| 71 | + |
| 72 | +Made with ❤️ by [odd.io](https://odd.io/) |
0 commit comments