diff --git a/.github/dependabot.yaml b/.github/dependabot.yaml new file mode 100644 index 0000000..33826d0 --- /dev/null +++ b/.github/dependabot.yaml @@ -0,0 +1,10 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + - package-ecosystem: "pub" + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/flutter.yml b/.github/workflows/flutter.yml new file mode 100644 index 0000000..50bb90a --- /dev/null +++ b/.github/workflows/flutter.yml @@ -0,0 +1,32 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: + - master + - feature/* + - bugfix/* + - hotfix/* + +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v3 + with: + path: | + ~/.gradle/wrapper + /opt/hostedtoolcache/flutter + key: ${{ runner.OS }}-flutter-install-cache + - uses: subosito/flutter-action@v2 + with: + channel: 'stable' + - name: Flutter pub get + run: flutter pub get + - name: Flutter format + run: flutter format -o none --set-exit-if-changed . + - name: Flutter analyze + run: flutter analyze diff --git a/README.md b/README.md index 5f8f2ee..22d3f20 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,20 @@ -[![pub package](https://img.shields.io/pub/v/[PACKAGE NAME ON PUB].svg)](https://github.com/Iconica-Development) [![Build status](https://github.com/Iconica-Development/agenda)](URL TO GITHUB ACTIONS) [![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart) +[![pub package](https://img.shields.io/pub/v/agenda.svg)](https://github.com/Iconica-Development) [![Build status](https://img.shields.io/github/workflow/status/Iconica-Development/agenda/CI)](https://github.com/Iconica-Development/agenda/actions/new) [![style: effective dart](https://img.shields.io/badge/style-effective_dart-40c4ff.svg)](https://github.com/tenhobi/effective_dart) # Agenda A Flutter package for creating an agenda that displays events per day with an included calendar for picking the date. Multiple events at the same time are alongside each other. There is also the option to stack multiple items at the same time. The underlying datepicker widget supports marking dates and disabling dates. - +![Agenda GIF](agenda.gif) Supports all Flutter platforms. ## Usage -To use this package, add `agenda` as a [dependency in your pubspec.yaml file](https://flutter.dev/docs/development/platform-integration/platform-channels). +To use this package, add `agenda` as a dependency in your pubspec.yaml file. -### Example +## How to Use -See [Example Code](example/lib/main.dart) for more info. +See the [Example Code](example/lib/main.dart) for an example on how to use this package. ## Issues @@ -26,4 +26,4 @@ If you would like to contribute to the plugin (e.g. by improving the documentati ## Author -This agenda for Flutter is developed by [Iconica](https://iconica.nl). You can contact us at \ No newline at end of file +This `agenda` for Flutter is developed by [Iconica](https://iconica.nl). You can contact us at \ No newline at end of file diff --git a/agenda.gif b/agenda.gif new file mode 100644 index 0000000..3966ba5 Binary files /dev/null and b/agenda.gif differ diff --git a/example/lib/main.dart b/example/lib/main.dart index 3ff9bf8..f06c952 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -6,7 +6,11 @@ import 'package:agenda/agenda.dart'; import 'package:flutter/material.dart'; void main() { - runApp(const MaterialApp(home: AgendaDemo())); + runApp( + const MaterialApp( + home: AgendaDemo(), + ), + ); } class AgendaDemo extends StatelessWidget { @@ -15,69 +19,113 @@ class AgendaDemo extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - body: SafeArea( - child: AgendaWidget( - header: Text('Agenda', style: Theme.of(context).textTheme.headline6), - blockWidth: 50, - highlightToday: false, - blocks: [ - AgendaEvent( - start: DateTime.now().subtract(const Duration(hours: 3)), - end: DateTime.now().add(const Duration(hours: 2)), + appBar: AppBar(), + body: AgendaWidget( + header: Text( + 'Agenda', + style: Theme.of(context).textTheme.headline6, + ), + blockWidth: 50, + highlightToday: false, + blocks: [ + AgendaEvent( + start: DateTime.now().subtract( + const Duration(hours: 3), ), - AgendaEvent( - start: DateTime.now().subtract(const Duration(hours: 2)), - end: DateTime.now().add(const Duration(hours: 1)), + end: DateTime.now().add( + const Duration(hours: 2), ), - AgendaEvent( - start: DateTime.now().subtract(const Duration(hours: 1)), - end: DateTime.now().add(const Duration(hours: 1)), + ), + AgendaEvent( + start: DateTime.now().subtract( + const Duration(hours: 2), ), - AgendaEvent( - start: DateTime.now().add(const Duration(hours: 3)), - end: DateTime.now().add(const Duration(hours: 4)), - id: 4, - content: const Text('event 4'), + end: DateTime.now().add( + const Duration(hours: 1), ), - AgendaEvent( - start: DateTime.now().add(const Duration(hours: 3)), - end: DateTime.now().add(const Duration(hours: 4)), - id: 4, - content: const Text('event 5'), + ), + AgendaEvent( + start: DateTime.now().subtract( + const Duration(hours: 1), ), - AgendaEvent( - start: DateTime.now().add(const Duration(hours: 3)), - end: DateTime.now().add(const Duration(hours: 4)), - id: 4, - content: const Text('event 6'), + end: DateTime.now().add( + const Duration(hours: 1), ), - AgendaEvent( - start: DateTime.now().add(const Duration(days: 1)), - end: DateTime.now() - .add(const Duration(days: 1)) - .add(const Duration(hours: 2)), + ), + AgendaEvent( + start: DateTime.now().add( + const Duration(hours: 3), ), - AgendaEvent( - start: DateTime.now().subtract(const Duration(hours: 2)), - end: DateTime.now().add(const Duration(hours: 1)), + end: DateTime.now().add( + const Duration(hours: 4), ), - AgendaEvent( - start: DateTime.now().add(const Duration(days: 2)), - end: DateTime.now().add(const Duration(days: 3)), + id: 4, + content: const Text('event 4'), + ), + AgendaEvent( + start: DateTime.now().add( + const Duration(hours: 3), ), - ], - disabledDates: [ - // yesterday - DateTime.now().subtract(const Duration(days: 1)), - ], - highlightedDates: [ - // tomorrow - DateTime.now().add(const Duration(days: 1)), - ], - theme: const AgendaTheme( - tableTheme: TableTheme( - blockPaddingBetween: 10, + end: DateTime.now().add( + const Duration(hours: 4), ), + id: 4, + content: const Text('event 5'), + ), + AgendaEvent( + start: DateTime.now().add( + const Duration(hours: 3), + ), + end: DateTime.now().add( + const Duration(hours: 4), + ), + id: 4, + content: const Text('event 6'), + ), + AgendaEvent( + start: DateTime.now().add( + const Duration(days: 1), + ), + end: DateTime.now() + .add( + const Duration(days: 1), + ) + .add( + const Duration(hours: 2), + ), + ), + AgendaEvent( + start: DateTime.now().subtract( + const Duration(hours: 2), + ), + end: DateTime.now().add( + const Duration(hours: 1), + ), + ), + AgendaEvent( + start: DateTime.now().add( + const Duration(days: 2), + ), + end: DateTime.now().add( + const Duration(days: 3), + ), + ), + ], + disabledDates: [ + // yesterday + DateTime.now().subtract( + const Duration(days: 1), + ), + ], + highlightedDates: [ + // tomorrow + DateTime.now().add( + const Duration(days: 1), + ), + ], + theme: const AgendaTheme( + tableTheme: TableTheme( + blockPaddingBetween: 10, ), ), ), diff --git a/example/pubspec.lock b/example/pubspec.lock index 33f8b45..551695a 100644 --- a/example/pubspec.lock +++ b/example/pubspec.lock @@ -66,11 +66,11 @@ packages: dependency: transitive description: path: "." - ref: stable - resolved-ref: "6b3f1f5d12c1762bc208a1f1a4b9384dcb3369d4" - url: "git@github.com:Iconica-Development/flutter_date_time_picker.git" + ref: "2.2.1" + resolved-ref: "6c78d4d73fa61ac4e2b103c821edf474421f81b4" + url: "https://github.com/Iconica-Development/flutter_date_time_picker" source: git - version: "0.0.1" + version: "2.2.1" flutter_lints: dependency: "direct dev" description: @@ -176,11 +176,11 @@ packages: dependency: transitive description: path: "." - ref: "v0.0.2" - resolved-ref: "62fdaa443818bd646058b536a12304725d1619fd" - url: "git@github.com:Iconica-Development/timetable.git" + ref: "1.0.0" + resolved-ref: dada4ea9a440bcfe58a235dfd93798e4d5ce857a + url: "https://github.com/Iconica-Development/flutter_timetable" source: git - version: "0.0.1" + version: "0.0.2" vector_math: dependency: transitive description: diff --git a/lib/src/agenda.dart b/lib/src/agenda.dart index 5199755..a103a04 100644 --- a/lib/src/agenda.dart +++ b/lib/src/agenda.dart @@ -93,7 +93,7 @@ class _AgendaWidgetState extends State { @override Widget build(BuildContext context) { var events = _filterEventsOnDay(widget.blocks, _selectedDate); - return DateTimePicker( + return DragDownDateTimePicker( initialDate: _selectedDate, pickTime: false, highlightToday: widget.highlightToday, @@ -110,8 +110,6 @@ class _AgendaWidgetState extends State { scrollPhysics: widget.scrollPhysics, scrollController: widget.scrollController, blockColor: widget.blockColor, - blockWidth: widget.blockWidth, - hourHeight: widget.hourHeight, startHour: widget.startHour, endHour: widget.endHour, timeBlocks: events, diff --git a/pubspec.yaml b/pubspec.yaml index 467d7c8..15533d2 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -14,12 +14,12 @@ dependencies: sdk: flutter flutter_date_time_picker: git: - url: git@github.com:Iconica-Development/flutter_date_time_picker.git - ref: stable + url: https://github.com/Iconica-Development/flutter_date_time_picker + ref: 2.2.1 timetable: git: - url: git@github.com:Iconica-Development/timetable.git - ref: v0.0.2 + url: https://github.com/Iconica-Development/flutter_timetable + ref: 1.0.0 dev_dependencies: flutter_test: