├── example
├── lib
│ ├── widgets
│ │ ├── event_provider.dart
│ │ ├── show_event_widget.dart
│ │ ├── responsive_widget.dart
│ │ ├── month_view_widget.dart
│ │ ├── calendar_views.dart
│ │ ├── custom_button.dart
│ │ ├── week_view_widget.dart
│ │ ├── multi_day_view_widget.dart
│ │ ├── delete_event_dialog.dart
│ │ ├── day_view_widget.dart
│ │ └── calendar_configs.dart
│ ├── enumerations.dart
│ ├── theme
│ │ ├── dark_app_colors.dart
│ │ ├── app_colors.dart
│ │ ├── app_theme_extension.dart
│ │ └── app_theme.dart
│ ├── pages
│ │ ├── home_page.dart
│ │ ├── multi_day_view_page.dart
│ │ ├── week_view_page.dart
│ │ ├── day_view_page.dart
│ │ ├── month_view_page.dart
│ │ ├── web
│ │ │ └── web_home_page.dart
│ │ ├── create_event_page.dart
│ │ └── mobile
│ │ │ └── mobile_home_page.dart
│ ├── constants.dart
│ ├── extension.dart
│ └── main.dart
├── linux
│ ├── .gitignore
│ ├── main.cc
│ ├── my_application.h
│ ├── flutter
│ │ └── CMakeLists.txt
│ ├── my_application.cc
│ └── CMakeLists.txt
├── ios
│ ├── Flutter
│ │ ├── Debug.xcconfig
│ │ ├── Release.xcconfig
│ │ └── AppFrameworkInfo.plist
│ ├── Runner
│ │ ├── Runner-Bridging-Header.h
│ │ ├── Assets.xcassets
│ │ │ ├── LaunchImage.imageset
│ │ │ │ ├── LaunchImage.png
│ │ │ │ ├── LaunchImage@2x.png
│ │ │ │ ├── LaunchImage@3x.png
│ │ │ │ ├── README.md
│ │ │ │ └── Contents.json
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── Icon-App-20x20@1x.png
│ │ │ │ ├── Icon-App-20x20@2x.png
│ │ │ │ ├── Icon-App-20x20@3x.png
│ │ │ │ ├── Icon-App-29x29@1x.png
│ │ │ │ ├── Icon-App-29x29@2x.png
│ │ │ │ ├── Icon-App-29x29@3x.png
│ │ │ │ ├── Icon-App-40x40@1x.png
│ │ │ │ ├── Icon-App-40x40@2x.png
│ │ │ │ ├── Icon-App-40x40@3x.png
│ │ │ │ ├── Icon-App-60x60@2x.png
│ │ │ │ ├── Icon-App-60x60@3x.png
│ │ │ │ ├── Icon-App-76x76@1x.png
│ │ │ │ ├── Icon-App-76x76@2x.png
│ │ │ │ ├── Icon-App-1024x1024@1x.png
│ │ │ │ ├── Icon-App-83.5x83.5@2x.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Base.lproj
│ │ │ ├── Main.storyboard
│ │ │ └── LaunchScreen.storyboard
│ │ └── Info.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ ├── contents.xcworkspacedata
│ │ │ └── xcshareddata
│ │ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ ├── WorkspaceSettings.xcsettings
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── .gitignore
│ └── Podfile
├── macos
│ ├── Flutter
│ │ ├── Flutter-Debug.xcconfig
│ │ └── Flutter-Release.xcconfig
│ ├── Runner
│ │ ├── Configs
│ │ │ ├── Debug.xcconfig
│ │ │ ├── Release.xcconfig
│ │ │ ├── Warnings.xcconfig
│ │ │ └── AppInfo.xcconfig
│ │ ├── Assets.xcassets
│ │ │ └── AppIcon.appiconset
│ │ │ │ ├── app_icon_16.png
│ │ │ │ ├── app_icon_32.png
│ │ │ │ ├── app_icon_64.png
│ │ │ │ ├── app_icon_1024.png
│ │ │ │ ├── app_icon_128.png
│ │ │ │ ├── app_icon_256.png
│ │ │ │ ├── app_icon_512.png
│ │ │ │ └── Contents.json
│ │ ├── AppDelegate.swift
│ │ ├── Release.entitlements
│ │ ├── DebugProfile.entitlements
│ │ ├── MainFlutterWindow.swift
│ │ └── Info.plist
│ ├── .gitignore
│ ├── Runner.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcshareddata
│ │ │ └── IDEWorkspaceChecks.plist
│ ├── Runner.xcodeproj
│ │ ├── project.xcworkspace
│ │ │ └── xcshareddata
│ │ │ │ └── IDEWorkspaceChecks.plist
│ │ └── xcshareddata
│ │ │ └── xcschemes
│ │ │ └── Runner.xcscheme
│ └── Podfile
├── android
│ ├── gradle.properties
│ ├── app
│ │ ├── src
│ │ │ ├── main
│ │ │ │ ├── res
│ │ │ │ │ ├── mipmap-hdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-mdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── mipmap-xxxhdpi
│ │ │ │ │ │ └── ic_launcher.png
│ │ │ │ │ ├── drawable
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── drawable-v21
│ │ │ │ │ │ └── launch_background.xml
│ │ │ │ │ ├── values
│ │ │ │ │ │ └── styles.xml
│ │ │ │ │ └── values-night
│ │ │ │ │ │ └── styles.xml
│ │ │ │ ├── kotlin
│ │ │ │ │ └── com
│ │ │ │ │ │ └── simformsolutions
│ │ │ │ │ │ └── calendarview
│ │ │ │ │ │ └── MainActivity.kt
│ │ │ │ └── AndroidManifest.xml
│ │ │ ├── debug
│ │ │ │ └── AndroidManifest.xml
│ │ │ └── profile
│ │ │ │ └── AndroidManifest.xml
│ │ └── build.gradle
│ ├── gradle
│ │ └── wrapper
│ │ │ └── gradle-wrapper.properties
│ ├── .gitignore
│ ├── build.gradle
│ └── settings.gradle
├── web
│ ├── favicon.png
│ ├── icons
│ │ ├── Icon-192.png
│ │ ├── Icon-512.png
│ │ ├── Icon-maskable-192.png
│ │ └── Icon-maskable-512.png
│ ├── manifest.json
│ └── index.html
├── windows
│ ├── runner
│ │ ├── resources
│ │ │ └── app_icon.ico
│ │ ├── resource.h
│ │ ├── CMakeLists.txt
│ │ ├── utils.h
│ │ ├── runner.exe.manifest
│ │ ├── run_loop.h
│ │ ├── flutter_window.h
│ │ ├── main.cpp
│ │ ├── utils.cpp
│ │ ├── flutter_window.cpp
│ │ ├── run_loop.cpp
│ │ ├── Runner.rc
│ │ └── win32_window.h
│ ├── .gitignore
│ ├── CMakeLists.txt
│ └── flutter
│ │ └── CMakeLists.txt
├── README.md
├── test
│ └── widget_test.dart
├── .gitignore
├── analysis_options.yaml
├── .metadata
└── pubspec.yaml
├── readme_assets
├── demo.gif
└── plugin_banner.png
├── .gitignore
├── lib
├── src
│ ├── calendar_constants.dart
│ ├── theme
│ │ ├── dark_app_colors.dart
│ │ ├── light_app_colors.dart
│ │ ├── calendar_theme_data.dart
│ │ └── day_view_theme_data.dart
│ ├── components
│ │ ├── components.dart
│ │ ├── week_view_components.dart
│ │ ├── event_scroll_notifier.dart
│ │ ├── headers
│ │ │ ├── month_page_header.dart
│ │ │ ├── day_page_header.dart
│ │ │ └── week_page_header.dart
│ │ ├── safe_area_wrapper.dart
│ │ └── common_components.dart
│ ├── constants.dart
│ ├── calendar_theme_provider.dart
│ ├── calendar_controller_provider.dart
│ ├── enumerations.dart
│ ├── event_arrangers
│ │ └── event_arrangers.dart
│ └── typedefs.dart
└── calendar_view.dart
├── analysis_options.yaml
├── pubspec.yaml
├── .github
├── workflows
│ ├── flutter_analyze.yml
│ └── github_pages.yml
└── pull_request_template.md
├── test
├── src
│ └── event_controller_test.dart
└── custom_sort_test.dart
├── LICENSE
├── README.md
└── doc
└── theme_guide.md
/example/lib/widgets/event_provider.dart:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/example/linux/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Flutter/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/ios/Runner/Runner-Bridging-Header.h:
--------------------------------------------------------------------------------
1 | #import "GeneratedPluginRegistrant.h"
2 |
--------------------------------------------------------------------------------
/example/lib/enumerations.dart:
--------------------------------------------------------------------------------
1 | enum CalendarView {
2 | month,
3 | day,
4 | week,
5 | }
6 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/macos/Flutter/Flutter-Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "ephemeral/Flutter-Generated.xcconfig"
2 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | org.gradle.jvmargs=-Xmx1536M
2 | android.useAndroidX=true
3 | android.enableJetifier=true
4 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Debug.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Debug.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/web/favicon.png
--------------------------------------------------------------------------------
/readme_assets/demo.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/readme_assets/demo.gif
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Release.xcconfig:
--------------------------------------------------------------------------------
1 | #include "../../Flutter/Flutter-Release.xcconfig"
2 | #include "Warnings.xcconfig"
3 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/web/icons/Icon-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/web/icons/Icon-512.png
--------------------------------------------------------------------------------
/readme_assets/plugin_banner.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/readme_assets/plugin_banner.png
--------------------------------------------------------------------------------
/example/macos/.gitignore:
--------------------------------------------------------------------------------
1 | # Flutter-related
2 | **/Flutter/ephemeral/
3 | **/Pods/
4 |
5 | # Xcode-related
6 | **/xcuserdata/
7 | /DerivedData/
8 |
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/web/icons/Icon-maskable-192.png
--------------------------------------------------------------------------------
/example/web/icons/Icon-maskable-512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/web/icons/Icon-maskable-512.png
--------------------------------------------------------------------------------
/example/windows/runner/resources/app_icon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/windows/runner/resources/app_icon.ico
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png
--------------------------------------------------------------------------------
/example/linux/main.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | int main(int argc, char** argv) {
4 | g_autoptr(MyApplication) app = my_application_new();
5 | return g_application_run(G_APPLICATION(app), argc, argv);
6 | }
7 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-29x29@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-40x40@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-60x60@3x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/SimformSolutionsPvtLtd/flutter_calendar_view/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.png
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/example/android/app/src/main/kotlin/com/simformsolutions/calendarview/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.simformsolutions.calendarview
2 |
3 | import io.flutter.embedding.android.FlutterActivity
4 |
5 | class MainActivity: FlutterActivity() {
6 | }
7 |
--------------------------------------------------------------------------------
/example/lib/widgets/show_event_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class EventDescription extends StatelessWidget {
4 | @override
5 | Widget build(BuildContext context) {
6 | return Container();
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/example/macos/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | @NSApplicationMain
5 | class AppDelegate: FlutterAppDelegate {
6 | override func applicationShouldTerminateAfterLastWindowClosed(_ sender: NSApplication) -> Bool {
7 | return true
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Fri Jun 23 08:50:38 CEST 2017
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-all.zip
7 |
--------------------------------------------------------------------------------
/example/macos/Runner/Release.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # IntelliJ related
2 | *.iml
3 | *.ipr
4 | *.iws
5 | .idea/
6 |
7 | # Flutter/Dart/Pub related
8 | **/doc/api/
9 | **/ios/Flutter/.last_build_id
10 | .dart_tool/
11 | .flutter-plugins
12 | .flutter-plugins-dependencies
13 | .packages
14 | .pub-cache/
15 | .pub/
16 |
17 | pubspec.lock
18 | .vscode/
19 | /build/
20 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/android/.gitignore:
--------------------------------------------------------------------------------
1 | gradle-wrapper.jar
2 | /.gradle
3 | /captures/
4 | /gradlew
5 | /gradlew.bat
6 | /local.properties
7 | GeneratedPluginRegistrant.java
8 |
9 | # Remember to never publicly share your keystore.
10 | # See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
11 | key.properties
12 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreviewsEnabled
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/example/lib/theme/dark_app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | class DarkAppColors {
4 | DarkAppColors._();
5 |
6 | static const Color primary = Color(0xffffb3b6);
7 | static const Color onPrimary = Color(0xff561d23);
8 | static const Color outline = Color(0xff9f8c8c);
9 | static const Color outlineVariant = Color(0xff524343);
10 | }
11 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/android/app/src/profile/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/example/windows/.gitignore:
--------------------------------------------------------------------------------
1 | flutter/ephemeral/
2 |
3 | # Visual Studio user-specific files.
4 | *.suo
5 | *.user
6 | *.userosscache
7 | *.sln.docstates
8 |
9 | # Visual Studio build-related files.
10 | x64/
11 | x86/
12 |
13 | # Visual Studio cache files
14 | # files ending in .cache can be ignored
15 | *.[Cc]ache
16 | # but keep track of directories ending in .cache
17 | !*.[Cc]ache/
18 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md:
--------------------------------------------------------------------------------
1 | # Launch Screen Assets
2 |
3 | You can customize the launch screen with your own desired assets by replacing the image files in this directory.
4 |
5 | You can also do it by opening your Flutter project's Xcode project with `open ios/Runner.xcworkspace`, selecting `Runner/Assets.xcassets` in the Project Navigator and dropping in the desired images.
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | allprojects {
2 | repositories {
3 | google()
4 | mavenCentral()
5 | }
6 | }
7 |
8 | rootProject.buildDir = '../build'
9 | subprojects {
10 | project.buildDir = "${rootProject.buildDir}/${project.name}"
11 | }
12 | subprojects {
13 | project.evaluationDependsOn(':app')
14 | }
15 |
16 | tasks.register("clean", Delete) {
17 | delete rootProject.buildDir
18 | }
19 |
--------------------------------------------------------------------------------
/example/macos/Runner/DebugProfile.entitlements:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | com.apple.security.app-sandbox
6 |
7 | com.apple.security.cs.allow-jit
8 |
9 | com.apple.security.network.server
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/example/ios/Runner/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import Flutter
3 |
4 | @UIApplicationMain
5 | @objc class AppDelegate: FlutterAppDelegate {
6 | override func application(
7 | _ application: UIApplication,
8 | didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
9 | ) -> Bool {
10 | GeneratedPluginRegistrant.register(with: self)
11 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/example/linux/my_application.h:
--------------------------------------------------------------------------------
1 | #ifndef FLUTTER_MY_APPLICATION_H_
2 | #define FLUTTER_MY_APPLICATION_H_
3 |
4 | #include
5 |
6 | G_DECLARE_FINAL_TYPE(MyApplication, my_application, MY, APPLICATION,
7 | GtkApplication)
8 |
9 | /**
10 | * my_application_new:
11 | *
12 | * Creates a new Flutter-based application.
13 | *
14 | * Returns: a new #MyApplication.
15 | */
16 | MyApplication* my_application_new();
17 |
18 | #endif // FLUTTER_MY_APPLICATION_H_
19 |
--------------------------------------------------------------------------------
/example/macos/Runner/MainFlutterWindow.swift:
--------------------------------------------------------------------------------
1 | import Cocoa
2 | import FlutterMacOS
3 |
4 | class MainFlutterWindow: NSWindow {
5 | override func awakeFromNib() {
6 | let flutterViewController = FlutterViewController.init()
7 | let windowFrame = self.frame
8 | self.contentViewController = flutterViewController
9 | self.setFrame(windowFrame, display: true)
10 |
11 | RegisterGeneratedPlugins(registry: flutterViewController)
12 |
13 | super.awakeFromNib()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/example/windows/runner/resource.h:
--------------------------------------------------------------------------------
1 | //{{NO_DEPENDENCIES}}
2 | // Microsoft Visual C++ generated include file.
3 | // Used by Runner.rc
4 | //
5 | #define IDI_APP_ICON 101
6 |
7 | // Next default values for new objects
8 | //
9 | #ifdef APSTUDIO_INVOKED
10 | #ifndef APSTUDIO_READONLY_SYMBOLS
11 | #define _APS_NEXT_RESOURCE_VALUE 102
12 | #define _APS_NEXT_COMMAND_VALUE 40001
13 | #define _APS_NEXT_CONTROL_VALUE 1001
14 | #define _APS_NEXT_SYMED_VALUE 101
15 | #endif
16 | #endif
17 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable-v21/launch_background.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
12 |
13 |
--------------------------------------------------------------------------------
/lib/src/calendar_constants.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | class CalendarConstants {
6 | CalendarConstants._();
7 |
8 | /// minimum and maximum dates are approx. 100,000,000 days
9 | /// before and after epochDate
10 | static final DateTime epochDate = DateTime(1970);
11 | static final DateTime maxDate = DateTime(275759);
12 | static final DateTime minDate = DateTime(-271819);
13 | }
14 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "universal",
5 | "filename" : "LaunchImage.png",
6 | "scale" : "1x"
7 | },
8 | {
9 | "idiom" : "universal",
10 | "filename" : "LaunchImage@2x.png",
11 | "scale" : "2x"
12 | },
13 | {
14 | "idiom" : "universal",
15 | "filename" : "LaunchImage@3x.png",
16 | "scale" : "3x"
17 | }
18 | ],
19 | "info" : {
20 | "version" : 1,
21 | "author" : "xcode"
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | include: package:lints/core.yaml
2 |
3 | analyzer:
4 | exclude:
5 | - example/build/**
6 | - exmaple/android/**
7 | - example/ios/**
8 | - example/web/**
9 | - idea/**
10 | - .dart_tool/**
11 | - example/.dart_tool/**
12 |
13 | linter:
14 | rules:
15 | public_member_api_docs: false
16 | avoid_print: true
17 | avoid_empty_else: true
18 | annotate_overrides: true
19 | cancel_subscriptions: true
20 | close_sinks: true
21 | avoid_positional_boolean_parameters: false
22 | use_super_parameters: true
23 | prefer_relative_imports: true
--------------------------------------------------------------------------------
/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: calendar_view
2 | description: A Flutter package allows you to easily implement all calendar UI and calendar event functionality.
3 | version: 2.0.0
4 | homepage: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view
5 | issue_tracker: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues?q=is%3Aissue+is%3Aopen+label%3Abug
6 |
7 | environment:
8 | sdk: ">=2.15.0 <4.0.0"
9 | flutter: ">=1.17.0"
10 |
11 | dependencies:
12 | flutter:
13 | sdk: flutter
14 |
15 | dev_dependencies:
16 | lints:
17 | flutter_test:
18 | sdk: flutter
19 |
20 | flutter:
21 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | # example
2 |
3 | A new Flutter project.
4 |
5 | ## Getting Started
6 |
7 | This project is a starting point for a Flutter application.
8 |
9 | A few resources to get you started if this is your first Flutter project:
10 |
11 | - [Lab: Write your first Flutter app](https://flutter.dev/docs/get-started/codelab)
12 | - [Cookbook: Useful Flutter samples](https://flutter.dev/docs/cookbook)
13 |
14 | For help getting started with Flutter, view our
15 | [online documentation](https://flutter.dev/docs), which offers tutorials,
16 | samples, guidance on mobile development, and a full API reference.
17 |
--------------------------------------------------------------------------------
/lib/src/theme/dark_app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | class DarkAppColors {
4 | DarkAppColors._();
5 |
6 | static const Color primary = Color(0xffffb3b6);
7 | static const Color onPrimary = Color(0xff561d23);
8 | static const Color surfaceContainerHigh = Color(0xff322828);
9 | static const Color outlineVariant = Color(0xff524343);
10 | static const Color onSurface = Color(0xfff0dede);
11 | static const Color surfaceContainerLowest = Color(0xff140c0c);
12 | static const Color surfaceContainerLow = Color(0xff22191a);
13 | static const Color surfaceContainerHighest = Color(0xff3d3232);
14 | }
15 |
--------------------------------------------------------------------------------
/lib/src/theme/light_app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | class LightAppColors {
4 | LightAppColors();
5 |
6 | static const Color primary = Color(0xffEF5366);
7 | static const Color onPrimary = Color(0xffffffff);
8 | static const Color surfaceContainerHigh = Color(0xfff6e4e4);
9 | static const Color outlineVariant = Color(0xffd7c1c2);
10 | static const Color onSurface = Color(0xff22191a);
11 | static const Color surfaceContainerLowest = Color(0xffffffff);
12 | static const Color surfaceContainerLow = Color(0xfffff0f0);
13 | static const Color surfaceContainerHighest = Color(0xfff0dede);
14 | }
15 |
--------------------------------------------------------------------------------
/lib/src/components/components.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | export 'common_components.dart';
6 | export 'day_view_components.dart';
7 | export 'event_scroll_notifier.dart';
8 | export 'headers/calendar_page_header.dart';
9 | export 'headers/day_page_header.dart';
10 | export 'headers/month_page_header.dart';
11 | export 'headers/week_page_header.dart';
12 | export 'month_view_components.dart';
13 | export 'safe_area_wrapper.dart';
14 | export 'week_view_components.dart';
15 |
--------------------------------------------------------------------------------
/lib/src/components/week_view_components.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/material.dart';
6 |
7 | class FullDayHeaderTextConfig {
8 | /// Set full day events header text config
9 | const FullDayHeaderTextConfig({
10 | this.textAlign = TextAlign.center,
11 | this.maxLines = 2,
12 | this.textOverflow = TextOverflow.ellipsis,
13 | });
14 |
15 | final TextAlign textAlign;
16 | final int maxLines;
17 | final TextOverflow textOverflow;
18 | }
19 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/Warnings.xcconfig:
--------------------------------------------------------------------------------
1 | WARNING_CFLAGS = -Wall -Wconditional-uninitialized -Wnullable-to-nonnull-conversion -Wmissing-method-return-type -Woverlength-strings
2 | GCC_WARN_UNDECLARED_SELECTOR = YES
3 | CLANG_UNDEFINED_BEHAVIOR_SANITIZER_NULLABILITY = YES
4 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE
5 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES
6 | CLANG_WARN_PRAGMA_PACK = YES
7 | CLANG_WARN_STRICT_PROTOTYPES = YES
8 | CLANG_WARN_COMMA = YES
9 | GCC_WARN_STRICT_SELECTOR_MATCH = YES
10 | CLANG_WARN_OBJC_REPEATED_USE_OF_WEAK = YES
11 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES
12 | GCC_WARN_SHADOW = YES
13 | CLANG_WARN_UNREACHABLE_CODE = YES
14 |
--------------------------------------------------------------------------------
/example/web/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "short_name": "example",
4 | "start_url": ".",
5 | "display": "standalone",
6 | "background_color": "#0175C2",
7 | "theme_color": "#0175C2",
8 | "description": "A new Flutter project.",
9 | "orientation": "portrait-primary",
10 | "prefer_related_applications": false,
11 | "icons": [
12 | {
13 | "src": "icons/Icon-192.png",
14 | "sizes": "192x192",
15 | "type": "image/png"
16 | },
17 | {
18 | "src": "icons/Icon-512.png",
19 | "sizes": "512x512",
20 | "type": "image/png"
21 | }
22 | ]
23 | }
24 |
--------------------------------------------------------------------------------
/example/windows/runner/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(runner LANGUAGES CXX)
3 |
4 | add_executable(${BINARY_NAME} WIN32
5 | "flutter_window.cpp"
6 | "main.cpp"
7 | "run_loop.cpp"
8 | "utils.cpp"
9 | "win32_window.cpp"
10 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
11 | "Runner.rc"
12 | "runner.exe.manifest"
13 | )
14 | apply_standard_settings(${BINARY_NAME})
15 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
16 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app)
17 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}")
18 | add_dependencies(${BINARY_NAME} flutter_assemble)
19 |
--------------------------------------------------------------------------------
/example/ios/.gitignore:
--------------------------------------------------------------------------------
1 | *.mode1v3
2 | *.mode2v3
3 | *.moved-aside
4 | *.pbxuser
5 | *.perspectivev3
6 | **/*sync/
7 | .sconsign.dblite
8 | .tags*
9 | **/.vagrant/
10 | **/DerivedData/
11 | Icon?
12 | **/Pods/
13 | **/.symlinks/
14 | profile
15 | xcuserdata
16 | **/.generated/
17 | Flutter/App.framework
18 | Flutter/Flutter.framework
19 | Flutter/Flutter.podspec
20 | Flutter/Generated.xcconfig
21 | Flutter/app.flx
22 | Flutter/app.zip
23 | Flutter/flutter_assets/
24 | Flutter/flutter_export_environment.sh
25 | ServiceDefinitions.json
26 | Runner/GeneratedPluginRegistrant.*
27 |
28 | # Exceptions to above rules.
29 | !default.mode1v3
30 | !default.mode2v3
31 | !default.pbxuser
32 | !default.perspectivev3
33 |
--------------------------------------------------------------------------------
/example/lib/pages/home_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../widgets/responsive_widget.dart';
4 | import 'mobile/mobile_home_page.dart';
5 | import 'web/web_home_page.dart';
6 |
7 | class HomePage extends StatelessWidget {
8 | const HomePage({
9 | this.onChangeTheme,
10 | super.key,
11 | });
12 |
13 | /// Return true for dark mode
14 | /// false for light mode
15 | final void Function(bool)? onChangeTheme;
16 |
17 | @override
18 | Widget build(BuildContext context) {
19 | return ResponsiveWidget(
20 | mobileWidget: MobileHomePage(onChangeTheme: onChangeTheme),
21 | webWidget: WebHomePage(onThemeChange: onChangeTheme),
22 | );
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/example/macos/Runner/Configs/AppInfo.xcconfig:
--------------------------------------------------------------------------------
1 | // Application-level settings for the Runner target.
2 | //
3 | // This may be replaced with something auto-generated from metadata (e.g., pubspec.yaml) in the
4 | // future. If not, the values below would default to using the project name when this becomes a
5 | // 'flutter create' template.
6 |
7 | // The application's name. By default this is also the title of the Flutter window.
8 | PRODUCT_NAME = example
9 |
10 | // The application's bundle identifier
11 | PRODUCT_BUNDLE_IDENTIFIER = com.calendar.page.example.example
12 |
13 | // The copyright displayed in application information
14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.calendar.page.example. All rights reserved.
15 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_UTILS_H_
2 | #define RUNNER_UTILS_H_
3 |
4 | #include
5 | #include
6 |
7 | // Creates a console for the process, and redirects stdout and stderr to
8 | // it for both the runner and the Flutter library.
9 | void CreateAndAttachConsole();
10 |
11 | // Takes a null-terminated wchar_t* encoded in UTF-16 and returns a std::string
12 | // encoded in UTF-8. Returns an empty std::string on failure.
13 | std::string Utf8FromUtf16(const wchar_t* utf16_string);
14 |
15 | // Gets the command line arguments passed in as a std::vector,
16 | // encoded in UTF-8. Returns an empty std::vector on failure.
17 | std::vector GetCommandLineArguments();
18 |
19 | #endif // RUNNER_UTILS_H_
20 |
--------------------------------------------------------------------------------
/example/lib/widgets/responsive_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../constants.dart';
4 |
5 | class ResponsiveWidget extends StatelessWidget {
6 | final double? width;
7 | final double breakPoint;
8 | final Widget webWidget;
9 | final Widget mobileWidget;
10 |
11 | const ResponsiveWidget({
12 | super.key,
13 | this.width,
14 | this.breakPoint = BreakPoints.web,
15 | required this.webWidget,
16 | required this.mobileWidget,
17 | });
18 |
19 | @override
20 | Widget build(BuildContext context) {
21 | final width = this.width ?? MediaQuery.of(context).size.width;
22 |
23 | if (width < breakPoint) {
24 | return mobileWidget;
25 | } else {
26 | return webWidget;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/example/lib/theme/app_colors.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | // TODO(Shubham): Remove if not required
4 | class AppColors {
5 | AppColors._();
6 |
7 | static const Color primary = Color(0xffEF5366);
8 | static const Color onPrimary = Color(0xfff0f0f0);
9 | static const Color outlineVariant = Color(0xffd7c1c2);
10 | static const Color outline = Color(0xff857373);
11 | static const Color black = Color(0xff626262);
12 | static const Color radiantWhite = Color(0xffffffff);
13 | static const Color white = Color(0xfff0f0f0);
14 | static const Color bluishGrey = Color(0xffdddee9);
15 | static const Color navyBlue = Color(0xff6471e9);
16 | static const Color lightNavyBlue = Color(0xffb3b9ed);
17 | static const Color red = Color(0xfff96c6c);
18 | static const Color grey = Color(0xffe0e0e0);
19 | }
20 |
--------------------------------------------------------------------------------
/.github/workflows/flutter_analyze.yml:
--------------------------------------------------------------------------------
1 | # This workflow uses actions that are not certified by GitHub.
2 | # They are provided by a third-party and are governed by
3 | # separate terms of service, privacy policy, and support
4 | # documentation.
5 |
6 | name: Analyze
7 |
8 | on:
9 | pull_request:
10 | branches: [ master, develop ]
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 |
16 | steps:
17 | - name: Checkout
18 | uses: actions/checkout@v2
19 |
20 | - name: Install Flutter
21 | uses: britannio/action-install-flutter@v1.1
22 |
23 | - name: Install dependencies
24 | run: flutter pub get
25 |
26 | - name: Formatting check
27 | run: dart format . --set-exit-if-changed
28 |
29 | - name: Analyse
30 | run: flutter analyze
31 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement {
2 | def flutterSdkPath = {
3 | def properties = new Properties()
4 | file("local.properties").withInputStream { properties.load(it) }
5 | def flutterSdkPath = properties.getProperty("flutter.sdk")
6 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
7 | return flutterSdkPath
8 | }()
9 |
10 | includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
11 |
12 | repositories {
13 | google()
14 | mavenCentral()
15 | gradlePluginPortal()
16 | }
17 | }
18 |
19 | plugins {
20 | id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21 | id "com.android.application" version "7.4.2" apply false
22 | id "org.jetbrains.kotlin.android" version "1.7.0" apply false
23 | }
24 |
25 | include ":app"
--------------------------------------------------------------------------------
/example/ios/Flutter/AppFrameworkInfo.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleExecutable
8 | App
9 | CFBundleIdentifier
10 | io.flutter.flutter.app
11 | CFBundleInfoDictionaryVersion
12 | 6.0
13 | CFBundleName
14 | App
15 | CFBundlePackageType
16 | FMWK
17 | CFBundleShortVersionString
18 | 1.0
19 | CFBundleSignature
20 | ????
21 | CFBundleVersion
22 | 1.0
23 | MinimumOSVersion
24 | 11.0
25 |
26 |
27 |
--------------------------------------------------------------------------------
/test/src/event_controller_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 |
4 | void main() {
5 | testWidgets('event controller ...', (tester) async {
6 | final controller = EventController();
7 |
8 | final now = DateTime.now();
9 | controller.add(CalendarEventData(
10 | title: 'none',
11 | date: now,
12 | startTime: now,
13 | endTime: now.add(Duration(hours: 1))));
14 | controller.add(CalendarEventData(
15 | title: 'All Day',
16 | date: DateTime.now().withoutTime,
17 | ));
18 |
19 | expect(controller.getFullDayEvent(now).length, equals(1));
20 | expect(controller.getEventsOnDay(now).length, equals(2));
21 | expect(controller.allEvents.length, equals(2));
22 | controller.clear();
23 | expect(controller.allEvents.length, equals(0));
24 | });
25 | }
26 |
--------------------------------------------------------------------------------
/example/windows/runner/runner.exe.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PerMonitorV2
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/lib/src/constants.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'dart:math';
6 | import 'dart:ui';
7 |
8 | class Constants {
9 | Constants._();
10 |
11 | static final Random _random = Random();
12 | static final int _maxColor = 256;
13 |
14 | static const int hoursADay = 24;
15 | static const int minutesADay = 1440;
16 |
17 | static final List weekTitles = ["M", "T", "W", "T", "F", "S", "S"];
18 |
19 | static const Color defaultLiveTimeIndicatorColor = Color(0xff444444);
20 | static const Color black = Color(0xff000000);
21 | static const Color white = Color(0xffffffff);
22 | static const Color headerBackground = Color(0xFFDCF0FF);
23 |
24 | static Color get randomColor {
25 | return Color.fromRGBO(_random.nextInt(_maxColor),
26 | _random.nextInt(_maxColor), _random.nextInt(_maxColor), 1);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/.github/workflows/github_pages.yml:
--------------------------------------------------------------------------------
1 | # This workflow uses actions that are not certified by GitHub.
2 | # They are provided by a third-party and are governed by
3 | # separate terms of service, privacy policy, and support
4 | # documentation.
5 |
6 | name: Build
7 |
8 | on:
9 | push:
10 | branches: [ master ]
11 |
12 | jobs:
13 | build:
14 | runs-on: ubuntu-latest
15 |
16 | steps:
17 | - name: Checkout
18 | uses: actions/checkout@v2
19 |
20 | - name: Install Flutter
21 | uses: britannio/action-install-flutter@v1.1
22 | with:
23 | version: 3.24.3
24 |
25 | - name: Install dependencies
26 | run: flutter pub get
27 |
28 | - name: Build Artifect
29 | run: cd example && flutter build web
30 |
31 | - name: Deploy to GitHub Pages
32 | if: success()
33 | uses: crazy-max/ghaction-github-pages@v2
34 | with:
35 | target_branch: gh-pages
36 | build_dir: example/build/web
37 | env:
38 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values-night/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
9 |
15 |
18 |
19 |
--------------------------------------------------------------------------------
/example/lib/pages/multi_day_view_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../enumerations.dart';
4 | import '../extension.dart';
5 | import '../widgets/responsive_widget.dart';
6 | import '../widgets/multi_day_view_widget.dart';
7 | import 'create_event_page.dart';
8 | import 'web/web_home_page.dart';
9 |
10 | class MultiDayViewDemo extends StatefulWidget {
11 | const MultiDayViewDemo({super.key});
12 |
13 | @override
14 | _MultiDayViewDemoState createState() => _MultiDayViewDemoState();
15 | }
16 |
17 | class _MultiDayViewDemoState extends State {
18 | @override
19 | Widget build(BuildContext context) {
20 | return ResponsiveWidget(
21 | webWidget: WebHomePage(
22 | selectedView: CalendarView.week,
23 | ),
24 | mobileWidget: Scaffold(
25 | floatingActionButton: FloatingActionButton(
26 | child: Icon(Icons.add),
27 | elevation: 8,
28 | onPressed: () => context.pushRoute(CreateEventPage()),
29 | ),
30 | body: MultiDayViewWidget(),
31 | ),
32 | );
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2021 Simform Solutions
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/example/test/widget_test.dart:
--------------------------------------------------------------------------------
1 | // This is a basic Flutter widget test.
2 | //
3 | // To perform an interaction with a widget in your test, use the WidgetTester
4 | // utility in the flutter_test package. For example, you can send tap and scroll
5 | // gestures. You can also use WidgetTester to find child widgets in the widget
6 | // tree, read text, and verify that the values of widget properties are correct.
7 |
8 | import 'package:example/main.dart';
9 | import 'package:flutter/material.dart';
10 | import 'package:flutter_test/flutter_test.dart';
11 |
12 | void main() {
13 | testWidgets('Counter increments smoke test', (WidgetTester tester) async {
14 | // Build our app and trigger a frame.
15 | await tester.pumpWidget(MyApp());
16 |
17 | // Verify that our counter starts at 0.
18 | expect(find.text('0'), findsOneWidget);
19 | expect(find.text('1'), findsNothing);
20 |
21 | // Tap the '+' icon and trigger a frame.
22 | await tester.tap(find.byIcon(Icons.add));
23 | await tester.pump();
24 |
25 | // Verify that our counter has incremented.
26 | expect(find.text('0'), findsNothing);
27 | expect(find.text('1'), findsOneWidget);
28 | });
29 | }
30 |
--------------------------------------------------------------------------------
/example/lib/widgets/month_view_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../pages/event_details_page.dart';
5 |
6 | class MonthViewWidget extends StatelessWidget {
7 | final GlobalKey? state;
8 | final double? width;
9 |
10 | const MonthViewWidget({
11 | super.key,
12 | this.state,
13 | this.width,
14 | });
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return MonthView(
19 | key: state,
20 | width: width,
21 | showWeekends: true,
22 | startDay: WeekDays.friday,
23 | useAvailableVerticalSpace: true,
24 | hideDaysNotInMonth: true,
25 | onEventTap: (event, date) {
26 | Navigator.of(context).push(
27 | MaterialPageRoute(
28 | builder: (_) => DetailsPage(
29 | event: event,
30 | date: date,
31 | ),
32 | ),
33 | );
34 | },
35 | onEventLongTap: (event, date) {
36 | SnackBar snackBar = SnackBar(content: Text("on LongTap"));
37 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
38 | },
39 | );
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/example/macos/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | $(DEVELOPMENT_LANGUAGE)
7 | CFBundleExecutable
8 | $(EXECUTABLE_NAME)
9 | CFBundleIconFile
10 |
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleVersion
22 | $(FLUTTER_BUILD_NUMBER)
23 | LSMinimumSystemVersion
24 | $(MACOSX_DEPLOYMENT_TARGET)
25 | NSHumanReadableCopyright
26 | $(PRODUCT_COPYRIGHT)
27 | NSMainNibFile
28 | MainMenu
29 | NSPrincipalClass
30 | NSApplication
31 |
32 |
33 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_RUN_LOOP_H_
2 | #define RUNNER_RUN_LOOP_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 |
9 | // A runloop that will service events for Flutter instances as well
10 | // as native messages.
11 | class RunLoop {
12 | public:
13 | RunLoop();
14 | ~RunLoop();
15 |
16 | // Prevent copying
17 | RunLoop(RunLoop const&) = delete;
18 | RunLoop& operator=(RunLoop const&) = delete;
19 |
20 | // Runs the run loop until the application quits.
21 | void Run();
22 |
23 | // Registers the given Flutter instance for event servicing.
24 | void RegisterFlutterInstance(
25 | flutter::FlutterEngine* flutter_instance);
26 |
27 | // Unregisters the given Flutter instance from event servicing.
28 | void UnregisterFlutterInstance(
29 | flutter::FlutterEngine* flutter_instance);
30 |
31 | private:
32 | using TimePoint = std::chrono::steady_clock::time_point;
33 |
34 | // Processes all currently pending messages for registered Flutter instances.
35 | TimePoint ProcessFlutterMessages();
36 |
37 | std::set flutter_instances_;
38 | };
39 |
40 | #endif // RUNNER_RUN_LOOP_H_
41 |
--------------------------------------------------------------------------------
/lib/calendar_view.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | library calendar_view;
6 |
7 | export './src/calendar_constants.dart';
8 | export './src/calendar_controller_provider.dart';
9 | export './src/calendar_event_data.dart';
10 | export './src/calendar_theme_provider.dart';
11 | export './src/components/components.dart';
12 | export './src/day_view/day_view.dart';
13 | export './src/enumerations.dart';
14 | export './src/event_arrangers/event_arrangers.dart';
15 | export './src/event_controller.dart';
16 | export './src/extensions.dart' hide BuildContextExtension;
17 | export './src/modals.dart';
18 | export './src/month_view/month_view.dart';
19 | export './src/style/header_style.dart';
20 | export './src/theme/calendar_theme_data.dart';
21 | export './src/theme/day_view_theme_data.dart';
22 | export './src/theme/month_view_theme_data.dart';
23 | export './src/theme/week_view_theme_data.dart';
24 | export './src/theme/multi_day_view_theme_data.dart';
25 | export './src/typedefs.dart';
26 | export './src/week_view/week_view.dart';
27 | export './src/multi_day_view/multi_day_view.dart';
28 |
--------------------------------------------------------------------------------
/example/lib/widgets/calendar_views.dart:
--------------------------------------------------------------------------------
1 | import 'dart:math';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | import '../enumerations.dart';
6 | import '../theme/app_colors.dart';
7 | import 'day_view_widget.dart';
8 | import 'month_view_widget.dart';
9 | import 'week_view_widget.dart';
10 |
11 | class CalendarViews extends StatelessWidget {
12 | final CalendarView view;
13 |
14 | const CalendarViews({super.key, this.view = CalendarView.month});
15 |
16 | final _breakPoint = 490.0;
17 |
18 | @override
19 | Widget build(BuildContext context) {
20 | final availableWidth = MediaQuery.of(context).size.width;
21 | final width = min(_breakPoint, availableWidth);
22 |
23 | return Container(
24 | height: double.infinity,
25 | width: double.infinity,
26 | color: AppColors.grey,
27 | child: Center(
28 | child: view == CalendarView.month
29 | ? MonthViewWidget(
30 | width: width,
31 | )
32 | : view == CalendarView.day
33 | ? DayViewWidget(
34 | width: width,
35 | )
36 | : WeekViewWidget(
37 | width: width,
38 | ),
39 | ),
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/lib/src/calendar_theme_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../calendar_view.dart';
4 |
5 | class CalendarThemeProvider extends InheritedWidget {
6 | /// This will provide the theme to its subtree.
7 | ///
8 | /// Use this widget to provide the same theme object to all calendar
9 | /// view widgets and synchronize the theme between them.
10 | const CalendarThemeProvider({
11 | required this.calendarTheme,
12 | required Widget child,
13 | Key? key,
14 | }) : super(key: key, child: child);
15 |
16 | /// Theme for Calendar views.
17 | final CalendarThemeData calendarTheme;
18 |
19 | static CalendarThemeProvider of(BuildContext context) {
20 | final result =
21 | context.dependOnInheritedWidgetOfExactType();
22 | assert(
23 | result != null,
24 | 'No CalendarThemeProvider found in context. '
25 | 'To solve this issue, either wrap the material app with '
26 | "'CalendarThemeProvider' or provide a theme argument in "
27 | 'the respective calendar view class.');
28 | return result!;
29 | }
30 |
31 | @override
32 | bool updateShouldNotify(CalendarThemeProvider oldWidget) =>
33 | oldWidget.calendarTheme != calendarTheme;
34 | }
35 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # Miscellaneous
2 | *.class
3 | *.log
4 | *.pyc
5 | *.swp
6 | .DS_Store
7 | .atom/
8 | .buildlog/
9 | .history
10 | .svn/
11 |
12 | # IntelliJ related
13 | *.iml
14 | *.ipr
15 | *.iws
16 | .idea/
17 |
18 | # The .vscode folder contains launch configuration and tasks you configure in
19 | # VS Code which you may wish to be included in version control, so this line
20 | # is commented out by default.
21 | #.vscode/
22 |
23 | # Flutter/Dart/Pub related
24 | **/doc/api/
25 | **/ios/Flutter/.last_build_id
26 | .dart_tool/
27 | .flutter-plugins
28 | .flutter-plugins-dependencies
29 | .packages
30 | .pub-cache/
31 | .pub/
32 | /build/
33 |
34 | # Web related
35 |
36 | # Symbolication related
37 | app.*.symbols
38 |
39 | # Obfuscation related
40 | app.*.map.json
41 |
42 | # Android Studio will place build artifacts here
43 | /android/app/debug
44 | /android/app/profile
45 | /android/app/release
46 |
47 | pubspec.lock
48 | .vscode/
49 | /linux/flutter/generated_plugin_registrant.cc
50 | /linux/flutter/generated_plugin_registrant.h
51 | /linux/flutter/generated_plugins.cmake
52 | /macos/Flutter/GeneratedPluginRegistrant.swift
53 | /windows/flutter/generated_plugin_registrant.cc
54 | /windows/flutter/generated_plugin_registrant.h
55 | /windows/flutter/generated_plugins.cmake
56 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_FLUTTER_WINDOW_H_
2 | #define RUNNER_FLUTTER_WINDOW_H_
3 |
4 | #include
5 | #include
6 |
7 | #include
8 |
9 | #include "run_loop.h"
10 | #include "win32_window.h"
11 |
12 | // A window that does nothing but host a Flutter view.
13 | class FlutterWindow : public Win32Window {
14 | public:
15 | // Creates a new FlutterWindow driven by the |run_loop|, hosting a
16 | // Flutter view running |project|.
17 | explicit FlutterWindow(RunLoop* run_loop,
18 | const flutter::DartProject& project);
19 | virtual ~FlutterWindow();
20 |
21 | protected:
22 | // Win32Window:
23 | bool OnCreate() override;
24 | void OnDestroy() override;
25 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam,
26 | LPARAM const lparam) noexcept override;
27 |
28 | private:
29 | // The run loop driving events for this window.
30 | RunLoop* run_loop_;
31 |
32 | // The project to run.
33 | flutter::DartProject project_;
34 |
35 | // The Flutter instance hosted by this window.
36 | std::unique_ptr flutter_controller_;
37 | };
38 |
39 | #endif // RUNNER_FLUTTER_WINDOW_H_
40 |
--------------------------------------------------------------------------------
/example/lib/widgets/custom_button.dart:
--------------------------------------------------------------------------------
1 | import 'package:example/extension.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../theme/app_colors.dart';
5 |
6 | class CustomButton extends StatelessWidget {
7 | final String title;
8 | final VoidCallback? onTap;
9 |
10 | const CustomButton({super.key, required this.title, this.onTap});
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | final themeColors = context.appColors;
15 |
16 | return GestureDetector(
17 | onTap: onTap,
18 | child: Container(
19 | padding: EdgeInsets.symmetric(
20 | vertical: 10,
21 | horizontal: 40,
22 | ),
23 | decoration: BoxDecoration(
24 | color: themeColors.primary,
25 | borderRadius: BorderRadius.circular(7.0),
26 | boxShadow: [
27 | BoxShadow(
28 | color: AppColors.black,
29 | offset: Offset(0, 4),
30 | blurRadius: 10,
31 | spreadRadius: -3,
32 | )
33 | ],
34 | ),
35 | child: Text(
36 | title,
37 | style: TextStyle(
38 | color: themeColors.onPrimary,
39 | fontSize: 20,
40 | ),
41 | ),
42 | ),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/example/lib/pages/week_view_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../enumerations.dart';
4 | import '../extension.dart';
5 | import '../widgets/responsive_widget.dart';
6 | import '../widgets/week_view_widget.dart';
7 | import 'create_event_page.dart';
8 | import 'web/web_home_page.dart';
9 |
10 | class WeekViewDemo extends StatefulWidget {
11 | const WeekViewDemo({super.key});
12 |
13 | @override
14 | _WeekViewDemoState createState() => _WeekViewDemoState();
15 | }
16 |
17 | class _WeekViewDemoState extends State {
18 | @override
19 | Widget build(BuildContext context) {
20 | final themeColors = context.appColors;
21 |
22 | return ResponsiveWidget(
23 | webWidget: WebHomePage(
24 | selectedView: CalendarView.week,
25 | ),
26 | mobileWidget: Scaffold(
27 | primary: false,
28 | appBar: AppBar(
29 | leading: const SizedBox.shrink(),
30 | ),
31 | floatingActionButton: FloatingActionButton(
32 | child: Icon(
33 | Icons.add,
34 | color: themeColors.onPrimary,
35 | ),
36 | elevation: 8,
37 | onPressed: () => context.pushRoute(CreateEventPage()),
38 | ),
39 | body: WeekViewWidget(),
40 | ),
41 | );
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/example/lib/pages/day_view_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../enumerations.dart';
4 | import '../extension.dart';
5 | import '../widgets/day_view_widget.dart';
6 | import '../widgets/responsive_widget.dart';
7 | import 'create_event_page.dart';
8 | import 'web/web_home_page.dart';
9 |
10 | class DayViewPageDemo extends StatefulWidget {
11 | const DayViewPageDemo({super.key});
12 |
13 | @override
14 | _DayViewPageDemoState createState() => _DayViewPageDemoState();
15 | }
16 |
17 | class _DayViewPageDemoState extends State {
18 | @override
19 | Widget build(BuildContext context) {
20 | final appColors = context.appColors;
21 |
22 | return ResponsiveWidget(
23 | webWidget: WebHomePage(
24 | selectedView: CalendarView.day,
25 | ),
26 | mobileWidget: Scaffold(
27 | primary: false,
28 | appBar: AppBar(
29 | leading: const SizedBox.shrink(),
30 | ),
31 | floatingActionButton: FloatingActionButton(
32 | child: Icon(
33 | Icons.add,
34 | color: appColors.onPrimary,
35 | ),
36 | elevation: 8,
37 | onPressed: () => context.pushRoute(CreateEventPage()),
38 | ),
39 | body: DayViewWidget(),
40 | ),
41 | );
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/example/lib/pages/month_view_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../enumerations.dart';
4 | import '../extension.dart';
5 | import '../widgets/month_view_widget.dart';
6 | import '../widgets/responsive_widget.dart';
7 | import 'create_event_page.dart';
8 | import 'web/web_home_page.dart';
9 |
10 | class MonthViewPageDemo extends StatefulWidget {
11 | const MonthViewPageDemo({
12 | super.key,
13 | });
14 |
15 | @override
16 | _MonthViewPageDemoState createState() => _MonthViewPageDemoState();
17 | }
18 |
19 | class _MonthViewPageDemoState extends State {
20 | @override
21 | Widget build(BuildContext context) {
22 | final appColors = context.appColors;
23 |
24 | return ResponsiveWidget(
25 | webWidget: WebHomePage(
26 | selectedView: CalendarView.month,
27 | ),
28 | mobileWidget: Scaffold(
29 | primary: false,
30 | appBar: AppBar(
31 | leading: const SizedBox.shrink(),
32 | ),
33 | floatingActionButton: FloatingActionButton(
34 | child: Icon(
35 | Icons.add,
36 | color: appColors.onPrimary,
37 | ),
38 | elevation: 8,
39 | onPressed: () => context.pushRoute(CreateEventPage()),
40 | ),
41 | body: MonthViewWidget(),
42 | ),
43 | );
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/example/windows/runner/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include
4 |
5 | #include "flutter_window.h"
6 | #include "run_loop.h"
7 | #include "utils.h"
8 |
9 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
10 | _In_ wchar_t *command_line, _In_ int show_command) {
11 | // Attach to console when present (e.g., 'flutter run') or create a
12 | // new console when running with a debugger.
13 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) {
14 | CreateAndAttachConsole();
15 | }
16 |
17 | // Initialize COM, so that it is available for use in the library and/or
18 | // plugins.
19 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
20 |
21 | RunLoop run_loop;
22 |
23 | flutter::DartProject project(L"data");
24 |
25 | std::vector command_line_arguments =
26 | GetCommandLineArguments();
27 |
28 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments));
29 |
30 | FlutterWindow window(&run_loop, project);
31 | Win32Window::Point origin(10, 10);
32 | Win32Window::Size size(1280, 720);
33 | if (!window.CreateAndShow(L"example", origin, size)) {
34 | return EXIT_FAILURE;
35 | }
36 | window.SetQuitOnClose(true);
37 |
38 | run_loop.Run();
39 |
40 | ::CoUninitialize();
41 | return EXIT_SUCCESS;
42 | }
43 |
--------------------------------------------------------------------------------
/lib/src/components/event_scroll_notifier.dart:
--------------------------------------------------------------------------------
1 | import 'dart:async';
2 |
3 | import 'package:flutter/material.dart';
4 |
5 | import '../calendar_event_data.dart';
6 |
7 | class EventScrollConfiguration extends ValueNotifier {
8 | bool _shouldScroll = false;
9 | CalendarEventData? _event;
10 | Duration? _duration;
11 | Curve? _curve;
12 |
13 | Completer? _completer;
14 |
15 | EventScrollConfiguration() : super(false);
16 |
17 | bool get shouldScroll => _shouldScroll;
18 |
19 | CalendarEventData? get event => _event;
20 |
21 | Duration? get duration => _duration;
22 |
23 | Curve? get curve => _curve;
24 |
25 | // This function will be completed once [completeScroll] is called.
26 | Future setScrollEvent({
27 | required CalendarEventData event,
28 | required Duration? duration,
29 | required Curve? curve,
30 | }) {
31 | if (shouldScroll || _completer != null) return Future.value();
32 |
33 | _completer = Completer();
34 |
35 | _duration = duration;
36 | _curve = curve;
37 | _event = event;
38 | _shouldScroll = true;
39 | value = !value;
40 |
41 | return _completer!.future;
42 | }
43 |
44 | void resetScrollEvent() {
45 | _event = null;
46 | _shouldScroll = false;
47 | _duration = null;
48 | _curve = null;
49 | }
50 |
51 | void completeScroll() {
52 | _completer?.complete();
53 | _completer = null;
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/lib/src/calendar_controller_provider.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/widgets.dart';
2 |
3 | import 'event_controller.dart';
4 |
5 | class CalendarControllerProvider extends InheritedWidget {
6 | /// Event controller for Calendar views.
7 | final EventController controller;
8 |
9 | /// This will provide controller to its subtree.
10 | /// If controller argument is not provided in calendar views then
11 | /// controller from this class will be considered.
12 | ///
13 | /// Use this widget to provide same controller object to all calendar
14 | /// view widgets and synchronize events between them.
15 | const CalendarControllerProvider({
16 | Key? key,
17 | required this.controller,
18 | required Widget child,
19 | }) : super(key: key, child: child);
20 |
21 | static CalendarControllerProvider of(
22 | BuildContext context) {
23 | final result = context
24 | .dependOnInheritedWidgetOfExactType>();
25 | assert(
26 | result != null,
27 | 'No CalendarControllerProvider<$T> found in context. '
28 | 'To solve this issue either wrap material app with '
29 | '\'CalendarControllerProvider<$T>\' or provide controller argument in '
30 | 'respected calendar view class.');
31 | return result!;
32 | }
33 |
34 | @override
35 | bool updateShouldNotify(CalendarControllerProvider oldWidget) =>
36 | oldWidget.controller != controller;
37 | }
38 |
--------------------------------------------------------------------------------
/example/macos/Podfile:
--------------------------------------------------------------------------------
1 | platform :osx, '10.11'
2 |
3 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
4 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
5 |
6 | project 'Runner', {
7 | 'Debug' => :debug,
8 | 'Profile' => :release,
9 | 'Release' => :release,
10 | }
11 |
12 | def flutter_root
13 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'ephemeral', 'Flutter-Generated.xcconfig'), __FILE__)
14 | unless File.exist?(generated_xcode_build_settings_path)
15 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure \"flutter pub get\" is executed first"
16 | end
17 |
18 | File.foreach(generated_xcode_build_settings_path) do |line|
19 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
20 | return matches[1].strip if matches
21 | end
22 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Flutter-Generated.xcconfig, then run \"flutter pub get\""
23 | end
24 |
25 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
26 |
27 | flutter_macos_podfile_setup
28 |
29 | target 'Runner' do
30 | use_frameworks!
31 | use_modular_headers!
32 |
33 | flutter_install_all_macos_pods File.dirname(File.realpath(__FILE__))
34 | end
35 |
36 | post_install do |installer|
37 | installer.pods_project.targets.each do |target|
38 | flutter_additional_macos_build_settings(target)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/lib/src/theme/calendar_theme_data.dart:
--------------------------------------------------------------------------------
1 | import '../../calendar_view.dart';
2 |
3 | class CalendarThemeData {
4 | const CalendarThemeData({
5 | required this.monthViewTheme,
6 | required this.dayViewTheme,
7 | required this.weekViewTheme,
8 | required this.multiDayViewTheme,
9 | });
10 |
11 | final MonthViewThemeData monthViewTheme;
12 | final DayViewThemeData dayViewTheme;
13 | final WeekViewThemeData weekViewTheme;
14 | final MultiDayViewThemeData multiDayViewTheme;
15 |
16 | /// Creates a copy of this `CalendarThemeData` with optional overrides.
17 | CalendarThemeData copyWith({
18 | MonthViewThemeData? monthViewTheme,
19 | DayViewThemeData? dayViewTheme,
20 | WeekViewThemeData? weekViewTheme,
21 | MultiDayViewThemeData? multiDayViewTheme,
22 | }) {
23 | return CalendarThemeData(
24 | monthViewTheme: monthViewTheme ?? this.monthViewTheme,
25 | dayViewTheme: dayViewTheme ?? this.dayViewTheme,
26 | weekViewTheme: weekViewTheme ?? this.weekViewTheme,
27 | multiDayViewTheme: multiDayViewTheme ?? this.multiDayViewTheme,
28 | );
29 | }
30 |
31 | /// Merges another `CalendarThemeData` into this one.
32 | CalendarThemeData merge(CalendarThemeData? other) {
33 | if (other == null) return this;
34 |
35 | return copyWith(
36 | monthViewTheme: other.monthViewTheme,
37 | dayViewTheme: other.dayViewTheme,
38 | weekViewTheme: other.weekViewTheme,
39 | multiDayViewTheme: other.multiDayViewTheme,
40 | );
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Uncomment this line to define a global platform for your project
2 | # platform :ios, '11.0'
3 |
4 | # CocoaPods analytics sends network stats synchronously affecting flutter build latency.
5 | ENV['COCOAPODS_DISABLE_STATS'] = 'true'
6 |
7 | project 'Runner', {
8 | 'Debug' => :debug,
9 | 'Profile' => :release,
10 | 'Release' => :release,
11 | }
12 |
13 | def flutter_root
14 | generated_xcode_build_settings_path = File.expand_path(File.join('..', 'Flutter', 'Generated.xcconfig'), __FILE__)
15 | unless File.exist?(generated_xcode_build_settings_path)
16 | raise "#{generated_xcode_build_settings_path} must exist. If you're running pod install manually, make sure flutter pub get is executed first"
17 | end
18 |
19 | File.foreach(generated_xcode_build_settings_path) do |line|
20 | matches = line.match(/FLUTTER_ROOT\=(.*)/)
21 | return matches[1].strip if matches
22 | end
23 | raise "FLUTTER_ROOT not found in #{generated_xcode_build_settings_path}. Try deleting Generated.xcconfig, then run flutter pub get"
24 | end
25 |
26 | require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
27 |
28 | flutter_ios_podfile_setup
29 |
30 | target 'Runner' do
31 | use_frameworks!
32 | use_modular_headers!
33 |
34 | flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
35 | end
36 |
37 | post_install do |installer|
38 | installer.pods_project.targets.each do |target|
39 | flutter_additional_ios_build_settings(target)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/example/web/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 | example
30 |
31 |
32 |
33 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/example/analysis_options.yaml:
--------------------------------------------------------------------------------
1 | # This file configures the analyzer, which statically analyzes Dart code to
2 | # check for errors, warnings, and lints.
3 | #
4 | # The issues identified by the analyzer are surfaced in the UI of Dart-enabled
5 | # IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
6 | # invoked from the command line by running `flutter analyze`.
7 |
8 | # The following line activates a set of recommended lints for Flutter apps,
9 | # packages, and plugins designed to encourage good coding practices.
10 | include: package:lints/core.yaml
11 |
12 | linter:
13 | # The lint rules applied to this project can be customized in the
14 | # section below to disable rules from the `package:flutter_lints/flutter.yaml`
15 | # included above or to enable additional rules. A list of all available lints
16 | # and their documentation is published at
17 | # https://dart-lang.github.io/linter/lints/index.html.
18 | #
19 | # Instead of disabling a lint rule for the entire project in the
20 | # section below, it can also be suppressed for a single line of code
21 | # or a specific dart file by using the `// ignore: name_of_lint` and
22 | # `// ignore_for_file: name_of_lint` syntax on the line or in the file
23 | # producing the lint.
24 | rules:
25 | # avoid_print: false # Uncomment to disable the `avoid_print` rule
26 | # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
27 |
28 | # Additional information about this file can be found at
29 | # https://dart.dev/guides/language/analysis-options
30 |
--------------------------------------------------------------------------------
/example/lib/widgets/week_view_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../pages/event_details_page.dart';
5 |
6 | class WeekViewWidget extends StatelessWidget {
7 | final GlobalKey? state;
8 | final double? width;
9 |
10 | const WeekViewWidget({super.key, this.state, this.width});
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return WeekView(
15 | key: state,
16 | width: width,
17 | showWeekends: true,
18 | showLiveTimeLineInAllDays: true,
19 | eventArranger: SideEventArranger(maxWidth: 30),
20 | timeLineWidth: 65,
21 | scrollPhysics: const BouncingScrollPhysics(),
22 | liveTimeIndicatorSettings: LiveTimeIndicatorSettings(
23 | color: Colors.redAccent,
24 | showTime: true,
25 | ),
26 | onTimestampTap: (date) {
27 | SnackBar snackBar = SnackBar(
28 | content: Text("On tap: ${date.hour} Hr : ${date.minute} Min"),
29 | );
30 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
31 | },
32 | onEventTap: (events, date) {
33 | Navigator.of(context).push(
34 | MaterialPageRoute(
35 | builder: (_) => DetailsPage(
36 | event: events.first,
37 | date: date,
38 | ),
39 | ),
40 | );
41 | },
42 | onEventLongTap: (events, date) {
43 | SnackBar snackBar = SnackBar(content: Text("on LongTap"));
44 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
45 | },
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "16x16",
5 | "idiom" : "mac",
6 | "filename" : "app_icon_16.png",
7 | "scale" : "1x"
8 | },
9 | {
10 | "size" : "16x16",
11 | "idiom" : "mac",
12 | "filename" : "app_icon_32.png",
13 | "scale" : "2x"
14 | },
15 | {
16 | "size" : "32x32",
17 | "idiom" : "mac",
18 | "filename" : "app_icon_32.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "32x32",
23 | "idiom" : "mac",
24 | "filename" : "app_icon_64.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "128x128",
29 | "idiom" : "mac",
30 | "filename" : "app_icon_128.png",
31 | "scale" : "1x"
32 | },
33 | {
34 | "size" : "128x128",
35 | "idiom" : "mac",
36 | "filename" : "app_icon_256.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "256x256",
41 | "idiom" : "mac",
42 | "filename" : "app_icon_256.png",
43 | "scale" : "1x"
44 | },
45 | {
46 | "size" : "256x256",
47 | "idiom" : "mac",
48 | "filename" : "app_icon_512.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "512x512",
53 | "idiom" : "mac",
54 | "filename" : "app_icon_512.png",
55 | "scale" : "1x"
56 | },
57 | {
58 | "size" : "512x512",
59 | "idiom" : "mac",
60 | "filename" : "app_icon_1024.png",
61 | "scale" : "2x"
62 | }
63 | ],
64 | "info" : {
65 | "version" : 1,
66 | "author" : "xcode"
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/example/lib/constants.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'theme/app_colors.dart';
4 |
5 | class AppConstants {
6 | AppConstants._();
7 |
8 | static final List weekTitles = ['M', 'T', 'W', 'T', 'F', 'S', 'S'];
9 |
10 | static OutlineInputBorder inputBorder = OutlineInputBorder(
11 | borderRadius: BorderRadius.circular(7),
12 | borderSide: BorderSide(
13 | width: 2,
14 | color: AppColors.outlineVariant,
15 | ),
16 | );
17 |
18 | static InputDecoration get inputDecoration => InputDecoration(
19 | border: inputBorder,
20 | disabledBorder: inputBorder,
21 | errorBorder: inputBorder.copyWith(
22 | borderSide: BorderSide(
23 | width: 2,
24 | color: AppColors.red,
25 | ),
26 | ),
27 | enabledBorder: inputBorder,
28 | focusedBorder: inputBorder,
29 | focusedErrorBorder: inputBorder,
30 | hintText: "Event Title",
31 | hintStyle: TextStyle(
32 | color: AppColors.black,
33 | fontSize: 17,
34 | ),
35 | labelStyle: TextStyle(
36 | color: AppColors.black,
37 | fontSize: 17,
38 | ),
39 | helperStyle: TextStyle(
40 | color: AppColors.black,
41 | fontSize: 17,
42 | ),
43 | errorStyle: TextStyle(
44 | color: AppColors.red,
45 | fontSize: 12,
46 | ),
47 | contentPadding: EdgeInsets.symmetric(
48 | vertical: 10,
49 | horizontal: 20,
50 | ),
51 | );
52 | }
53 |
54 | class BreakPoints {
55 | static const double web = 800;
56 | }
57 |
--------------------------------------------------------------------------------
/example/lib/widgets/multi_day_view_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../pages/event_details_page.dart';
5 |
6 | class MultiDayViewWidget extends StatelessWidget {
7 | final GlobalKey? state;
8 | final double? width;
9 |
10 | const MultiDayViewWidget({super.key, this.state, this.width});
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return MultiDayView(
15 | key: state,
16 | daysInView: 3,
17 | width: width,
18 | showLiveTimeLineInAllDays: true,
19 | eventArranger: SideEventArranger(maxWidth: 30),
20 | timeLineWidth: 65,
21 | scrollPhysics: const BouncingScrollPhysics(),
22 | liveTimeIndicatorSettings: LiveTimeIndicatorSettings(
23 | color: Colors.redAccent,
24 | onlyShowToday: true,
25 | ),
26 | onTimestampTap: (date) {
27 | SnackBar snackBar = SnackBar(
28 | content: Text("On tap: ${date.hour} Hr : ${date.minute} Min"),
29 | );
30 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
31 | },
32 | onEventTap: (events, date) {
33 | Navigator.of(context).push(
34 | MaterialPageRoute(
35 | builder: (_) => DetailsPage(
36 | event: events.first,
37 | date: date,
38 | ),
39 | ),
40 | );
41 | },
42 | onEventLongTap: (events, date) {
43 | SnackBar snackBar = SnackBar(content: Text("on LongTap"));
44 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
45 | },
46 | );
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/example/lib/pages/web/web_home_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../enumerations.dart';
4 | import '../../widgets/calendar_configs.dart';
5 | import '../../widgets/calendar_views.dart';
6 |
7 | class WebHomePage extends StatefulWidget {
8 | WebHomePage({
9 | this.selectedView = CalendarView.month,
10 | this.onThemeChange,
11 | });
12 |
13 | final CalendarView selectedView;
14 | final void Function(bool)? onThemeChange;
15 |
16 | @override
17 | _WebHomePageState createState() => _WebHomePageState();
18 | }
19 |
20 | class _WebHomePageState extends State {
21 | late var _selectedView = widget.selectedView;
22 |
23 | void _setView(CalendarView view) {
24 | if (view != _selectedView && mounted) {
25 | setState(() {
26 | _selectedView = view;
27 | });
28 | }
29 | }
30 |
31 | @override
32 | Widget build(BuildContext context) {
33 | return Scaffold(
34 | body: Row(
35 | children: [
36 | Expanded(
37 | child: CalendarConfig(
38 | onViewChange: _setView,
39 | currentView: _selectedView,
40 | onThemeChange: widget.onThemeChange,
41 | ),
42 | ),
43 | Expanded(
44 | child: MediaQuery(
45 | data: MediaQuery.of(context).copyWith(
46 | size: Size(MediaQuery.of(context).size.width / 2,
47 | MediaQuery.of(context).size.height),
48 | ),
49 | child: CalendarViews(
50 | view: _selectedView,
51 | ),
52 | ),
53 | ),
54 | ],
55 | ),
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/Main.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | plugins {
2 | id "com.android.application"
3 | id "kotlin-android"
4 | id "dev.flutter.flutter-gradle-plugin"
5 | }
6 |
7 | def localProperties = new Properties()
8 | def localPropertiesFile = rootProject.file('local.properties')
9 | if (localPropertiesFile.exists()) {
10 | localPropertiesFile.withReader('UTF-8') { reader ->
11 | localProperties.load(reader)
12 | }
13 | }
14 |
15 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
16 | if (flutterVersionCode == null) {
17 | flutterVersionCode = '1'
18 | }
19 |
20 | def flutterVersionName = localProperties.getProperty('flutter.versionName')
21 | if (flutterVersionName == null) {
22 | flutterVersionName = '1.0'
23 | }
24 |
25 | android {
26 | compileSdkVersion 34
27 |
28 | sourceSets {
29 | main.java.srcDirs += 'src/main/kotlin'
30 | }
31 |
32 | defaultConfig {
33 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
34 | applicationId "com.simformsolutions.calendarview"
35 | minSdkVersion flutter.minSdkVersion
36 | targetSdkVersion 31
37 | versionCode flutterVersionCode.toInteger()
38 | versionName flutterVersionName
39 | }
40 |
41 | buildTypes {
42 | release {
43 | // TODO: Add your own signing config for the release build.
44 | // Signing with the debug keys for now, so `flutter run --release` works.
45 | signingConfig signingConfigs.debug
46 | }
47 | }
48 | namespace 'com.simformsolutions.calendarview'
49 | }
50 |
51 | flutter {
52 | source '../..'
53 | }
54 |
55 | dependencies {
56 | // Add required dependencies...
57 | }
58 |
--------------------------------------------------------------------------------
/lib/src/components/headers/month_page_header.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/foundation.dart';
6 | import 'package:flutter/material.dart';
7 |
8 | import '../../../calendar_view.dart';
9 | import '../../constants.dart';
10 |
11 | class MonthPageHeader extends CalendarPageHeader {
12 | /// A header widget to display on month view.
13 | const MonthPageHeader({
14 | Key? key,
15 | VoidCallback? onNextMonth,
16 | bool showNextIcon = true,
17 | AsyncCallback? onTitleTapped,
18 | VoidCallback? onPreviousMonth,
19 | bool showPreviousIcon = true,
20 | @Deprecated("Use HeaderStyle to provide icon color") Color? iconColor,
21 | @Deprecated("Use HeaderStyle to provide background color")
22 | Color backgroundColor = Constants.headerBackground,
23 | StringProvider? dateStringBuilder,
24 | required DateTime date,
25 | HeaderStyle headerStyle = const HeaderStyle(),
26 | }) : super(
27 | key: key,
28 | date: date,
29 | onNextDay: onNextMonth,
30 | showNextIcon: showNextIcon,
31 | onPreviousDay: onPreviousMonth,
32 | showPreviousIcon: showPreviousIcon,
33 | onTitleTapped: onTitleTapped,
34 | // ignore_for_file: deprecated_member_use_from_same_package
35 | backgroundColor: backgroundColor,
36 | iconColor: iconColor,
37 | dateStringBuilder:
38 | dateStringBuilder ?? MonthPageHeader._monthStringBuilder,
39 | headerStyle: headerStyle,
40 | );
41 |
42 | static String _monthStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
43 | "${date.month} - ${date.year}";
44 | }
45 |
--------------------------------------------------------------------------------
/example/lib/pages/create_event_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../extension.dart';
5 | import '../widgets/add_event_form.dart';
6 |
7 | class CreateEventPage extends StatelessWidget {
8 | const CreateEventPage({super.key, this.event});
9 |
10 | final CalendarEventData? event;
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | final themeColor = context.appColors;
15 |
16 | return Scaffold(
17 | appBar: AppBar(
18 | elevation: 0,
19 | centerTitle: false,
20 | leading: IconButton(
21 | onPressed: context.pop,
22 | icon: Icon(
23 | Icons.arrow_back,
24 | color: themeColor.onPrimary,
25 | ),
26 | ),
27 | title: Text(
28 | event == null ? "Create New Event" : "Update Event",
29 | style: TextStyle(
30 | color: themeColor.onPrimary,
31 | fontSize: 20.0,
32 | fontWeight: FontWeight.bold,
33 | ),
34 | ),
35 | ),
36 | body: SingleChildScrollView(
37 | physics: ClampingScrollPhysics(),
38 | child: Padding(
39 | padding: EdgeInsets.all(20.0),
40 | child: AddOrEditEventForm(
41 | onEventAdd: (newEvent) {
42 | if (this.event != null) {
43 | CalendarControllerProvider.of(context)
44 | .controller
45 | .update(this.event!, newEvent);
46 | } else {
47 | CalendarControllerProvider.of(context).controller.add(newEvent);
48 | }
49 |
50 | context.pop(true);
51 | },
52 | event: event,
53 | ),
54 | ),
55 | ),
56 | );
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/example/.metadata:
--------------------------------------------------------------------------------
1 | # This file tracks properties of this Flutter project.
2 | # Used by Flutter tool to assess capabilities and perform upgrades etc.
3 | #
4 | # This file should be version controlled.
5 |
6 | version:
7 | revision: 135454af32477f815a7525073027a3ff9eff1bfd
8 | channel: stable
9 |
10 | project_type: app
11 |
12 | # Tracks metadata for the flutter migrate command
13 | migration:
14 | platforms:
15 | - platform: root
16 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
17 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
18 | - platform: android
19 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
20 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
21 | - platform: ios
22 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
23 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
24 | - platform: linux
25 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
26 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
27 | - platform: macos
28 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
29 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
30 | - platform: web
31 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
32 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
33 | - platform: windows
34 | create_revision: 135454af32477f815a7525073027a3ff9eff1bfd
35 | base_revision: 135454af32477f815a7525073027a3ff9eff1bfd
36 |
37 | # User provided section
38 |
39 | # List of Local paths (relative to this file) that should be
40 | # ignored by the migrate tool.
41 | #
42 | # Files that are not part of the templates will be ignored by default.
43 | unmanaged_files:
44 | - 'lib/main.dart'
45 | - 'ios/Runner.xcodeproj/project.pbxproj'
46 |
--------------------------------------------------------------------------------
/example/ios/Runner/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CADisableMinimumFrameDurationOnPhone
6 |
7 | CFBundleDevelopmentRegion
8 | $(DEVELOPMENT_LANGUAGE)
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | example
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(FLUTTER_BUILD_NAME)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(FLUTTER_BUILD_NUMBER)
25 | LSRequiresIPhoneOS
26 |
27 | UIApplicationSupportsIndirectInputEvents
28 |
29 | UILaunchStoryboardName
30 | LaunchScreen
31 | UIMainStoryboardFile
32 | Main
33 | UISupportedInterfaceOrientations
34 |
35 | UIInterfaceOrientationPortrait
36 | UIInterfaceOrientationLandscapeLeft
37 | UIInterfaceOrientationLandscapeRight
38 |
39 | UISupportedInterfaceOrientations~ipad
40 |
41 | UIInterfaceOrientationPortrait
42 | UIInterfaceOrientationPortraitUpsideDown
43 | UIInterfaceOrientationLandscapeLeft
44 | UIInterfaceOrientationLandscapeRight
45 |
46 | UIViewControllerBasedStatusBarAppearance
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/example/lib/theme/app_theme_extension.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'app_colors.dart';
4 | import 'dark_app_colors.dart';
5 |
6 | class AppThemeExtension extends ThemeExtension {
7 | AppThemeExtension({
8 | this.primary = AppColors.primary,
9 | this.onPrimary = AppColors.onPrimary,
10 | this.outlineVariant = AppColors.outlineVariant,
11 | });
12 |
13 | // Light theme constructor
14 | AppThemeExtension.light()
15 | : primary = AppColors.primary,
16 | onPrimary = AppColors.onPrimary,
17 | outlineVariant = AppColors.outlineVariant;
18 |
19 | // Dark theme constructor
20 | AppThemeExtension.dark()
21 | : primary = DarkAppColors.primary,
22 | onPrimary = DarkAppColors.onPrimary,
23 | outlineVariant = DarkAppColors.outlineVariant;
24 |
25 | final Color primary;
26 | final Color onPrimary;
27 | final Color outlineVariant;
28 |
29 | @override
30 | ThemeExtension copyWith({
31 | Color? primary,
32 | Color? onPrimary,
33 | Color? outlineVariant,
34 | }) {
35 | return AppThemeExtension(
36 | primary: primary ?? this.primary,
37 | onPrimary: onPrimary ?? this.onPrimary,
38 | outlineVariant: outlineVariant ?? this.outlineVariant,
39 | );
40 | }
41 |
42 | @override
43 | ThemeExtension lerp(
44 | covariant ThemeExtension? other,
45 | double t,
46 | ) {
47 | if (other is! AppThemeExtension) {
48 | return this;
49 | }
50 | return AppThemeExtension(
51 | primary: Color.lerp(primary, other.primary, t) ?? primary,
52 | onPrimary: Color.lerp(onPrimary, other.onPrimary, t) ?? onPrimary,
53 | outlineVariant:
54 | Color.lerp(outlineVariant, other.outlineVariant, t) ?? outlineVariant,
55 | );
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/lib/src/components/headers/day_page_header.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/foundation.dart';
6 | import 'package:flutter/material.dart';
7 |
8 | import '../../constants.dart';
9 | import '../../style/header_style.dart';
10 | import '../../typedefs.dart';
11 | import 'calendar_page_header.dart';
12 |
13 | /// A header widget to display on day view.
14 | class DayPageHeader extends CalendarPageHeader {
15 | /// A header widget to display on day view.
16 | const DayPageHeader({
17 | Key? key,
18 | VoidCallback? onNextDay,
19 | bool showNextIcon = true,
20 | AsyncCallback? onTitleTapped,
21 | VoidCallback? onPreviousDay,
22 | bool showPreviousIcon = true,
23 | StringProvider? dateStringBuilder,
24 | required DateTime date,
25 | @Deprecated("Use HeaderStyle to provide icon color") Color? iconColor,
26 | @Deprecated("Use HeaderStyle to provide background")
27 | Color backgroundColor = Constants.headerBackground,
28 | HeaderStyle headerStyle = const HeaderStyle(),
29 | }) : super(
30 | key: key,
31 | date: date,
32 | // ignore_for_file: deprecated_member_use_from_same_package
33 | backgroundColor: backgroundColor,
34 | iconColor: iconColor,
35 | onNextDay: onNextDay,
36 | showNextIcon: showNextIcon,
37 | onPreviousDay: onPreviousDay,
38 | showPreviousIcon: showPreviousIcon,
39 | onTitleTapped: onTitleTapped,
40 | dateStringBuilder:
41 | dateStringBuilder ?? DayPageHeader._dayStringBuilder,
42 | headerStyle: headerStyle,
43 | );
44 |
45 | static String _dayStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
46 | "${date.day} - ${date.month} - ${date.year}";
47 | }
48 |
--------------------------------------------------------------------------------
/example/windows/runner/utils.cpp:
--------------------------------------------------------------------------------
1 | #include "utils.h"
2 |
3 | #include
4 | #include
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | void CreateAndAttachConsole() {
11 | if (::AllocConsole()) {
12 | FILE *unused;
13 | if (freopen_s(&unused, "CONOUT$", "w", stdout)) {
14 | _dup2(_fileno(stdout), 1);
15 | }
16 | if (freopen_s(&unused, "CONOUT$", "w", stderr)) {
17 | _dup2(_fileno(stdout), 2);
18 | }
19 | std::ios::sync_with_stdio();
20 | FlutterDesktopResyncOutputStreams();
21 | }
22 | }
23 |
24 | std::vector GetCommandLineArguments() {
25 | // Convert the UTF-16 command line arguments to UTF-8 for the Engine to use.
26 | int argc;
27 | wchar_t** argv = ::CommandLineToArgvW(::GetCommandLineW(), &argc);
28 | if (argv == nullptr) {
29 | return std::vector();
30 | }
31 |
32 | std::vector command_line_arguments;
33 |
34 | // Skip the first argument as it's the binary name.
35 | for (int i = 1; i < argc; i++) {
36 | command_line_arguments.push_back(Utf8FromUtf16(argv[i]));
37 | }
38 |
39 | ::LocalFree(argv);
40 |
41 | return command_line_arguments;
42 | }
43 |
44 | std::string Utf8FromUtf16(const wchar_t* utf16_string) {
45 | if (utf16_string == nullptr) {
46 | return std::string();
47 | }
48 | int target_length = ::WideCharToMultiByte(
49 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
50 | -1, nullptr, 0, nullptr, nullptr);
51 | if (target_length == 0) {
52 | return std::string();
53 | }
54 | std::string utf8_string;
55 | utf8_string.resize(target_length);
56 | int converted_length = ::WideCharToMultiByte(
57 | CP_UTF8, WC_ERR_INVALID_CHARS, utf16_string,
58 | -1, utf8_string.data(),
59 | target_length, nullptr, nullptr);
60 | if (converted_length == 0) {
61 | return std::string();
62 | }
63 | return utf8_string;
64 | }
65 |
--------------------------------------------------------------------------------
/.github/pull_request_template.md:
--------------------------------------------------------------------------------
1 | # Description
2 |
8 |
9 |
10 | ## Checklist
11 |
15 |
16 | - [ ] The title of my PR starts with a [Conventional Commit] prefix (`fix:`, `feat:`, `docs:` etc).
17 | - [ ] I have followed the [Contributor Guide] when preparing my PR.
18 | - [ ] I have updated/added tests for ALL new/updated/fixed functionality.
19 | - [ ] I have updated/added relevant documentation in `docs` and added dartdoc comments with `///`.
20 | - [ ] I have updated/added relevant examples in `examples` or `docs`.
21 |
22 |
23 | ## Breaking Change?
24 |
36 |
37 | - [ ] Yes, this PR is a breaking change.
38 | - [ ] No, this PR is not a breaking change.
39 |
40 |
41 | ## Related Issues
42 |
46 |
47 |
48 | [Contributor Guide]: https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/blob/master/CONTRIBUTING.md
49 | [Conventional Commit]: https://conventionalcommits.org
--------------------------------------------------------------------------------
/lib/src/components/safe_area_wrapper.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | class SafeAreaWrapper extends SafeArea {
4 | SafeAreaWrapper({
5 | SafeAreaOption option = const SafeAreaOption(),
6 | required Widget child,
7 | }) : super(
8 | left: option.left,
9 | top: option.top,
10 | right: option.right,
11 | bottom: option.bottom,
12 | minimum: option.minimum,
13 | maintainBottomViewPadding: option.maintainBottomViewPadding,
14 | child: child,
15 | );
16 | }
17 |
18 | class SafeAreaOption {
19 | /// Whether to avoid system intrusions on the left.
20 | final bool left;
21 |
22 | /// Whether to avoid system intrusions at the top of the screen, typically the
23 | /// system status bar.
24 | final bool top;
25 |
26 | /// Whether to avoid system intrusions on the right.
27 | final bool right;
28 |
29 | /// Whether to avoid system intrusions on the bottom side of the screen.
30 | final bool bottom;
31 |
32 | /// This minimum padding to apply.
33 | ///
34 | /// The greater of the minimum insets and the media padding will be applied.
35 | final EdgeInsets minimum;
36 |
37 | /// Specifies whether the [SafeArea] should maintain the bottom
38 | /// [MediaQueryData.viewPadding] instead of the bottom
39 | /// [MediaQueryData.padding], defaults to false.
40 | ///
41 | /// For example, if there is an onscreen keyboard displayed above the
42 | /// SafeArea, the padding can be maintained below the obstruction rather than
43 | /// being consumed. This can be helpful in cases where your layout contains
44 | /// flexible widgets, which could visibly move when opening a software
45 | /// keyboard due to the change in the padding value. Setting this to true will
46 | /// avoid the UI shift.
47 | final bool maintainBottomViewPadding;
48 |
49 | const SafeAreaOption({
50 | this.left = true,
51 | this.top = true,
52 | this.right = true,
53 | this.bottom = true,
54 | this.minimum = EdgeInsets.zero,
55 | this.maintainBottomViewPadding = false,
56 | });
57 | }
58 |
--------------------------------------------------------------------------------
/lib/src/components/headers/week_page_header.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/foundation.dart';
6 | import 'package:flutter/material.dart';
7 |
8 | import '../../constants.dart';
9 | import '../../style/header_style.dart';
10 | import '../../typedefs.dart';
11 | import 'calendar_page_header.dart';
12 |
13 | class WeekPageHeader extends CalendarPageHeader {
14 | /// A header widget to display on week view.
15 | const WeekPageHeader({
16 | Key? key,
17 | VoidCallback? onNextDay,
18 | bool showNextIcon = true,
19 | AsyncCallback? onTitleTapped,
20 | VoidCallback? onPreviousDay,
21 | bool showPreviousIcon = true,
22 | required DateTime startDate,
23 | required DateTime endDate,
24 | @Deprecated("Use HeaderStyle to provide icon color") Color? iconColor,
25 | @Deprecated("Use HeaderStyle to provide background color")
26 | Color backgroundColor = Constants.headerBackground,
27 | StringProvider? headerStringBuilder,
28 | HeaderStyle headerStyle = const HeaderStyle(),
29 | }) : super(
30 | key: key,
31 | date: startDate,
32 | secondaryDate: endDate,
33 | onNextDay: onNextDay,
34 | showNextIcon: showNextIcon,
35 | onPreviousDay: onPreviousDay,
36 | showPreviousIcon: showPreviousIcon,
37 | onTitleTapped: onTitleTapped,
38 | // ignore_for_file: deprecated_member_use_from_same_package
39 | iconColor: iconColor,
40 | backgroundColor: backgroundColor,
41 | dateStringBuilder:
42 | headerStringBuilder ?? WeekPageHeader._weekStringBuilder,
43 | headerStyle: headerStyle,
44 | );
45 |
46 | static String _weekStringBuilder(DateTime date, {DateTime? secondaryDate}) =>
47 | "${date.day} / ${date.month} / ${date.year} to "
48 | "${secondaryDate != null ? "${secondaryDate.day} / "
49 | "${secondaryDate.month} / ${secondaryDate.year}" : ""}";
50 | }
51 |
--------------------------------------------------------------------------------
/example/lib/widgets/delete_event_dialog.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | class DeleteEventDialog extends StatefulWidget {
5 | @override
6 | _RadioDialogState createState() => _RadioDialogState();
7 | }
8 |
9 | class _RadioDialogState extends State {
10 | DeleteEvent _selectedOption = DeleteEvent.current;
11 |
12 | @override
13 | Widget build(BuildContext context) {
14 | return AlertDialog(
15 | title: Text('Delete recurring event '),
16 | content: Column(
17 | mainAxisSize: MainAxisSize.min,
18 | children: [
19 | RadioListTile(
20 | title: Text('This event'),
21 | value: DeleteEvent.current,
22 | groupValue: _selectedOption,
23 | onChanged: (deleteType) {
24 | if (deleteType != null) {
25 | setState(() => _selectedOption = deleteType);
26 | }
27 | },
28 | ),
29 | RadioListTile(
30 | title: Text('This and following events'),
31 | value: DeleteEvent.following,
32 | groupValue: _selectedOption,
33 | onChanged: (deleteType) {
34 | if (deleteType != null) {
35 | setState(() => _selectedOption = deleteType);
36 | }
37 | },
38 | ),
39 | RadioListTile(
40 | title: Text('All events'),
41 | value: DeleteEvent.all,
42 | groupValue: _selectedOption,
43 | onChanged: (deleteType) {
44 | if (deleteType != null) {
45 | setState(() => _selectedOption = deleteType);
46 | }
47 | },
48 | ),
49 | ],
50 | ),
51 | actions: [
52 | TextButton(
53 | onPressed: () => Navigator.of(context).pop(),
54 | child: Text('Cancel'),
55 | ),
56 | TextButton(
57 | onPressed: () => Navigator.of(context).pop(_selectedOption),
58 | child: Text('Done'),
59 | ),
60 | ],
61 | );
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/lib/src/enumerations.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | // Note: Do not change sequence of this enumeration if not necessary
6 | // this can change behaviour of month and week view.
7 | /// Defines day of week
8 | enum WeekDays {
9 | /// Monday: 0
10 | monday,
11 |
12 | /// Tuesday: 1
13 | tuesday,
14 |
15 | /// Wednesday: 2
16 | wednesday,
17 |
18 | /// Thursday: 3
19 | thursday,
20 |
21 | /// Friday: 4
22 | friday,
23 |
24 | /// Saturday: 5
25 | saturday,
26 |
27 | /// Sunday: 6
28 | sunday,
29 | }
30 |
31 | /// Defines different minute slot sizes.
32 | enum MinuteSlotSize {
33 | /// Slot size: 15 minutes
34 | minutes15,
35 |
36 | /// Slot size: 30 minutes
37 | minutes30,
38 |
39 | /// Slot size: 60 minutes
40 | minutes60,
41 | }
42 |
43 | /// Defines different line styles
44 | enum LineStyle {
45 | /// Solid line
46 | solid,
47 |
48 | /// Dashed line
49 | dashed,
50 | }
51 |
52 | /// Defines reoccurrence of event: Daily, weekly, monthly or yearly
53 | enum RepeatFrequency {
54 | doNotRepeat,
55 | daily,
56 | weekly,
57 | monthly,
58 | yearly,
59 | }
60 |
61 | /// Defines reoccurrence event ends on:
62 | /// `never` to repeat without any end date specified,
63 | /// `onDate` to repeat till date specified
64 | /// `after` repeat till defined number of occurrence.
65 | enum RecurrenceEnd {
66 | never,
67 | onDate,
68 | after,
69 | }
70 |
71 | /// Specifies the scope of deletion for recurring events in a calendar.
72 | ///
73 | /// This enum is used to determine which instances of a recurring event
74 | /// should be deleted when a deletion action is performed.
75 | ///
76 | /// - [DeleteEvent.all] - Deletes all instances of the recurring event.
77 | /// - [DeleteEvent.current] - Deletes only the currently selected instance
78 | /// of the event.
79 | /// - [DeleteEvent.following] - Deletes the current and all future instances
80 | /// of the recurring event.
81 | enum DeleteEvent {
82 | all,
83 | current,
84 | following,
85 | }
86 |
--------------------------------------------------------------------------------
/example/windows/runner/flutter_window.cpp:
--------------------------------------------------------------------------------
1 | #include "flutter_window.h"
2 |
3 | #include
4 |
5 | #include "flutter/generated_plugin_registrant.h"
6 |
7 | FlutterWindow::FlutterWindow(RunLoop* run_loop,
8 | const flutter::DartProject& project)
9 | : run_loop_(run_loop), project_(project) {}
10 |
11 | FlutterWindow::~FlutterWindow() {}
12 |
13 | bool FlutterWindow::OnCreate() {
14 | if (!Win32Window::OnCreate()) {
15 | return false;
16 | }
17 |
18 | RECT frame = GetClientArea();
19 |
20 | // The size here must match the window dimensions to avoid unnecessary surface
21 | // creation / destruction in the startup path.
22 | flutter_controller_ = std::make_unique(
23 | frame.right - frame.left, frame.bottom - frame.top, project_);
24 | // Ensure that basic setup of the controller was successful.
25 | if (!flutter_controller_->engine() || !flutter_controller_->view()) {
26 | return false;
27 | }
28 | RegisterPlugins(flutter_controller_->engine());
29 | run_loop_->RegisterFlutterInstance(flutter_controller_->engine());
30 | SetChildContent(flutter_controller_->view()->GetNativeWindow());
31 | return true;
32 | }
33 |
34 | void FlutterWindow::OnDestroy() {
35 | if (flutter_controller_) {
36 | run_loop_->UnregisterFlutterInstance(flutter_controller_->engine());
37 | flutter_controller_ = nullptr;
38 | }
39 |
40 | Win32Window::OnDestroy();
41 | }
42 |
43 | LRESULT
44 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message,
45 | WPARAM const wparam,
46 | LPARAM const lparam) noexcept {
47 | // Give Flutter, including plugins, an opportunity to handle window messages.
48 | if (flutter_controller_) {
49 | std::optional result =
50 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam,
51 | lparam);
52 | if (result) {
53 | return *result;
54 | }
55 | }
56 |
57 | switch (message) {
58 | case WM_FONTCHANGE:
59 | flutter_controller_->engine()->ReloadSystemFonts();
60 | break;
61 | }
62 |
63 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam);
64 | }
65 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 | # Calendar View
4 |
5 | [](https://pub.dev/packages/calendar_view)
6 | [](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/blob/main/LICENSE)
7 |
8 |
9 | A Flutter package that allows you to easily implement all calendar UI and calendar event functionality in your application.
10 |
11 | _Check out other amazing open-source [Flutter libraries](https://pub.dev/publishers/simform.com/packages) and [Awesome Mobile Libraries](https://github.com/SimformSolutionsPvtLtd/Awesome-Mobile-Libraries) developed by Simform Solutions!_
12 |
13 | ## Preview
14 |
15 | 
16 |
17 | ## Features
18 |
19 | - Multiple calendar view options:
20 | - Month View
21 | - Day View
22 | - Week View
23 | - Highly customisable UI components
24 | - Manage events (add, remove, update)
25 | - Manage reminders (add, remove, update)
26 | - Manage full-day events (add, remove, update)
27 | - Show working days in week view and day views
28 | - Sync event data between multiple views
29 |
30 | ## Documentation
31 |
32 | Visit our [documentation](https://simform-flutter-packages.web.app/calendarView) site for all implementation details, usage instructions, code examples, and advanced features.
33 |
34 | ## Installation
35 |
36 | 1. Add dependency to your `pubspec.yaml`:
37 |
38 | ```yaml
39 | dependencies:
40 | calendar_view:
41 | ```
42 |
43 | ## Support
44 |
45 | For questions, issues, or feature requests, [create an issue](https://github.com/SimformSolutionsPvtLtd/flutter_calendar_view/issues) on GitHub or reach out via the GitHub Discussions tab. We're happy to help and encourage community contributions.
46 | To contribute documentation updates specifically, please make changes to the doc/documentation.md file and submit a pull request.
47 |
48 | ## License
49 |
50 | This project is licensed under the MIT License - see the [LICENSE](https://simform-flutter-packages.web.app/calendarView/license) file for details.
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
13 |
17 |
21 |
26 |
30 |
31 |
32 |
33 |
34 |
35 |
37 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/example/lib/pages/mobile/mobile_home_page.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import '../../extension.dart';
4 | import '../day_view_page.dart';
5 | import '../month_view_page.dart';
6 | import '../multi_day_view_page.dart';
7 | import '../week_view_page.dart';
8 |
9 | class MobileHomePage extends StatefulWidget {
10 | MobileHomePage({
11 | this.onChangeTheme,
12 | super.key,
13 | });
14 |
15 | final void Function(bool)? onChangeTheme;
16 |
17 | @override
18 | State createState() => _MobileHomePageState();
19 | }
20 |
21 | class _MobileHomePageState extends State {
22 | bool isDarkMode = false;
23 |
24 | @override
25 | Widget build(BuildContext context) {
26 | return Scaffold(
27 | appBar: AppBar(
28 | title: Text("Flutter Calendar Page"),
29 | centerTitle: true,
30 | ),
31 | body: Center(
32 | child: Column(
33 | mainAxisSize: MainAxisSize.min,
34 | children: [
35 | ElevatedButton(
36 | onPressed: () => context.pushRoute(MonthViewPageDemo()),
37 | child: Text("Month View"),
38 | ),
39 | SizedBox(
40 | height: 20,
41 | ),
42 | ElevatedButton(
43 | onPressed: () => context.pushRoute(DayViewPageDemo()),
44 | child: Text("Day View"),
45 | ),
46 | SizedBox(
47 | height: 20,
48 | ),
49 | ElevatedButton(
50 | onPressed: () => context.pushRoute(WeekViewDemo()),
51 | child: Text("Week View"),
52 | ),
53 | SizedBox(
54 | height: 20,
55 | ),
56 | ElevatedButton(
57 | onPressed: () => context.pushRoute(MultiDayViewDemo()),
58 | child: Text("Multi-Day View"),
59 | ),
60 | ],
61 | ),
62 | ),
63 | floatingActionButton: FloatingActionButton(
64 | child: Icon(
65 | Icons.dark_mode,
66 | color: context.appColors.onPrimary,
67 | ),
68 | onPressed: () {
69 | isDarkMode = !isDarkMode;
70 | if (widget.onChangeTheme != null) {
71 | widget.onChangeTheme!(isDarkMode);
72 | }
73 | setState(() {});
74 | },
75 | ),
76 | );
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/example/windows/runner/run_loop.cpp:
--------------------------------------------------------------------------------
1 | #include "run_loop.h"
2 |
3 | #include
4 |
5 | #include
6 |
7 | RunLoop::RunLoop() {}
8 |
9 | RunLoop::~RunLoop() {}
10 |
11 | void RunLoop::Run() {
12 | bool keep_running = true;
13 | TimePoint next_flutter_event_time = TimePoint::clock::now();
14 | while (keep_running) {
15 | std::chrono::nanoseconds wait_duration =
16 | std::max(std::chrono::nanoseconds(0),
17 | next_flutter_event_time - TimePoint::clock::now());
18 | ::MsgWaitForMultipleObjects(
19 | 0, nullptr, FALSE, static_cast(wait_duration.count() / 1000),
20 | QS_ALLINPUT);
21 | bool processed_events = false;
22 | MSG message;
23 | // All pending Windows messages must be processed; MsgWaitForMultipleObjects
24 | // won't return again for items left in the queue after PeekMessage.
25 | while (::PeekMessage(&message, nullptr, 0, 0, PM_REMOVE)) {
26 | processed_events = true;
27 | if (message.message == WM_QUIT) {
28 | keep_running = false;
29 | break;
30 | }
31 | ::TranslateMessage(&message);
32 | ::DispatchMessage(&message);
33 | // Allow Flutter to process messages each time a Windows message is
34 | // processed, to prevent starvation.
35 | next_flutter_event_time =
36 | std::min(next_flutter_event_time, ProcessFlutterMessages());
37 | }
38 | // If the PeekMessage loop didn't run, process Flutter messages.
39 | if (!processed_events) {
40 | next_flutter_event_time =
41 | std::min(next_flutter_event_time, ProcessFlutterMessages());
42 | }
43 | }
44 | }
45 |
46 | void RunLoop::RegisterFlutterInstance(
47 | flutter::FlutterEngine* flutter_instance) {
48 | flutter_instances_.insert(flutter_instance);
49 | }
50 |
51 | void RunLoop::UnregisterFlutterInstance(
52 | flutter::FlutterEngine* flutter_instance) {
53 | flutter_instances_.erase(flutter_instance);
54 | }
55 |
56 | RunLoop::TimePoint RunLoop::ProcessFlutterMessages() {
57 | TimePoint next_event_time = TimePoint::max();
58 | for (auto instance : flutter_instances_) {
59 | std::chrono::nanoseconds wait_duration = instance->ProcessMessages();
60 | if (wait_duration != std::chrono::nanoseconds::max()) {
61 | next_event_time =
62 | std::min(next_event_time, TimePoint::clock::now() + wait_duration);
63 | }
64 | }
65 | return next_event_time;
66 | }
67 |
--------------------------------------------------------------------------------
/example/ios/Runner/Base.lproj/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/linux/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 |
11 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...),
12 | # which isn't available in 3.10.
13 | function(list_prepend LIST_NAME PREFIX)
14 | set(NEW_LIST "")
15 | foreach(element ${${LIST_NAME}})
16 | list(APPEND NEW_LIST "${PREFIX}${element}")
17 | endforeach(element)
18 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE)
19 | endfunction()
20 |
21 | # === Flutter Library ===
22 | # System-level dependencies.
23 | find_package(PkgConfig REQUIRED)
24 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
25 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0)
26 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0)
27 |
28 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so")
29 |
30 | # Published to parent scope for install step.
31 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
32 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
33 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
34 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE)
35 |
36 | list(APPEND FLUTTER_LIBRARY_HEADERS
37 | "fl_basic_message_channel.h"
38 | "fl_binary_codec.h"
39 | "fl_binary_messenger.h"
40 | "fl_dart_project.h"
41 | "fl_engine.h"
42 | "fl_json_message_codec.h"
43 | "fl_json_method_codec.h"
44 | "fl_message_codec.h"
45 | "fl_method_call.h"
46 | "fl_method_channel.h"
47 | "fl_method_codec.h"
48 | "fl_method_response.h"
49 | "fl_plugin_registrar.h"
50 | "fl_plugin_registry.h"
51 | "fl_standard_message_codec.h"
52 | "fl_standard_method_codec.h"
53 | "fl_string_codec.h"
54 | "fl_value.h"
55 | "fl_view.h"
56 | "flutter_linux.h"
57 | )
58 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/")
59 | add_library(flutter INTERFACE)
60 | target_include_directories(flutter INTERFACE
61 | "${EPHEMERAL_DIR}"
62 | )
63 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}")
64 | target_link_libraries(flutter INTERFACE
65 | PkgConfig::GTK
66 | PkgConfig::GLIB
67 | PkgConfig::GIO
68 | )
69 | add_dependencies(flutter flutter_assemble)
70 |
71 | # === Flutter tool backend ===
72 | # _phony_ is a non-existent file to force this command to run every time,
73 | # since currently there's no way to get a full input/output list from the
74 | # flutter tool.
75 | add_custom_command(
76 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
77 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_
78 | COMMAND ${CMAKE_COMMAND} -E env
79 | ${FLUTTER_TOOL_ENVIRONMENT}
80 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh"
81 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE}
82 | VERBATIM
83 | )
84 | add_custom_target(flutter_assemble DEPENDS
85 | "${FLUTTER_LIBRARY}"
86 | ${FLUTTER_LIBRARY_HEADERS}
87 | )
88 |
--------------------------------------------------------------------------------
/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "size" : "20x20",
5 | "idiom" : "iphone",
6 | "filename" : "Icon-App-20x20@2x.png",
7 | "scale" : "2x"
8 | },
9 | {
10 | "size" : "20x20",
11 | "idiom" : "iphone",
12 | "filename" : "Icon-App-20x20@3x.png",
13 | "scale" : "3x"
14 | },
15 | {
16 | "size" : "29x29",
17 | "idiom" : "iphone",
18 | "filename" : "Icon-App-29x29@1x.png",
19 | "scale" : "1x"
20 | },
21 | {
22 | "size" : "29x29",
23 | "idiom" : "iphone",
24 | "filename" : "Icon-App-29x29@2x.png",
25 | "scale" : "2x"
26 | },
27 | {
28 | "size" : "29x29",
29 | "idiom" : "iphone",
30 | "filename" : "Icon-App-29x29@3x.png",
31 | "scale" : "3x"
32 | },
33 | {
34 | "size" : "40x40",
35 | "idiom" : "iphone",
36 | "filename" : "Icon-App-40x40@2x.png",
37 | "scale" : "2x"
38 | },
39 | {
40 | "size" : "40x40",
41 | "idiom" : "iphone",
42 | "filename" : "Icon-App-40x40@3x.png",
43 | "scale" : "3x"
44 | },
45 | {
46 | "size" : "60x60",
47 | "idiom" : "iphone",
48 | "filename" : "Icon-App-60x60@2x.png",
49 | "scale" : "2x"
50 | },
51 | {
52 | "size" : "60x60",
53 | "idiom" : "iphone",
54 | "filename" : "Icon-App-60x60@3x.png",
55 | "scale" : "3x"
56 | },
57 | {
58 | "size" : "20x20",
59 | "idiom" : "ipad",
60 | "filename" : "Icon-App-20x20@1x.png",
61 | "scale" : "1x"
62 | },
63 | {
64 | "size" : "20x20",
65 | "idiom" : "ipad",
66 | "filename" : "Icon-App-20x20@2x.png",
67 | "scale" : "2x"
68 | },
69 | {
70 | "size" : "29x29",
71 | "idiom" : "ipad",
72 | "filename" : "Icon-App-29x29@1x.png",
73 | "scale" : "1x"
74 | },
75 | {
76 | "size" : "29x29",
77 | "idiom" : "ipad",
78 | "filename" : "Icon-App-29x29@2x.png",
79 | "scale" : "2x"
80 | },
81 | {
82 | "size" : "40x40",
83 | "idiom" : "ipad",
84 | "filename" : "Icon-App-40x40@1x.png",
85 | "scale" : "1x"
86 | },
87 | {
88 | "size" : "40x40",
89 | "idiom" : "ipad",
90 | "filename" : "Icon-App-40x40@2x.png",
91 | "scale" : "2x"
92 | },
93 | {
94 | "size" : "76x76",
95 | "idiom" : "ipad",
96 | "filename" : "Icon-App-76x76@1x.png",
97 | "scale" : "1x"
98 | },
99 | {
100 | "size" : "76x76",
101 | "idiom" : "ipad",
102 | "filename" : "Icon-App-76x76@2x.png",
103 | "scale" : "2x"
104 | },
105 | {
106 | "size" : "83.5x83.5",
107 | "idiom" : "ipad",
108 | "filename" : "Icon-App-83.5x83.5@2x.png",
109 | "scale" : "2x"
110 | },
111 | {
112 | "size" : "1024x1024",
113 | "idiom" : "ios-marketing",
114 | "filename" : "Icon-App-1024x1024@1x.png",
115 | "scale" : "1x"
116 | }
117 | ],
118 | "info" : {
119 | "version" : 1,
120 | "author" : "xcode"
121 | }
122 | }
123 |
--------------------------------------------------------------------------------
/example/pubspec.yaml:
--------------------------------------------------------------------------------
1 | name: example
2 | description: A new Flutter project.
3 |
4 | # The following line prevents the package from being accidentally published to
5 | # pub.dev using `pub publish`. This is preferred for private packages.
6 | publish_to: 'none' # Remove this line if you wish to publish to pub.dev
7 |
8 | # The following defines the version and build number for your application.
9 | # A version number is three numbers separated by dots, like 1.2.43
10 | # followed by an optional build number separated by a +.
11 | # Both the version and the builder number may be overridden in flutter
12 | # build by specifying --build-name and --build-number, respectively.
13 | # In Android, build-name is used as versionName while build-number used as versionCode.
14 | # Read more about Android versioning at https://developer.android.com/studio/publish/versioning
15 | # In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
16 | # Read more about iOS versioning at
17 | # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
18 | version: 1.0.0+1
19 |
20 | environment:
21 | sdk: ">=3.5.3 <4.0.0"
22 | flutter: 3.24.3
23 |
24 | dependencies:
25 | flutter:
26 | sdk: flutter
27 |
28 |
29 | # The following adds the Cupertino Icons font to your application.
30 | # Use with the CupertinoIcons class for iOS style icons.
31 | cupertino_icons: ^1.0.2
32 | intl:
33 | flutter_colorpicker: ^1.1.0
34 | calendar_view:
35 | path: ../
36 |
37 | dev_dependencies:
38 | flutter_test:
39 | sdk: flutter
40 | lints:
41 | build_runner: ^2.0.6
42 | build_web_compilers: ^3.0.0
43 |
44 | # For information on the generic Dart part of this file, see the
45 | # following page: https://dart.dev/tools/pub/pubspec
46 |
47 | # The following section is specific to Flutter.
48 | flutter:
49 |
50 | # The following line ensures that the Material Icons font is
51 | # included with your application, so that you can use the icons in
52 | # the material Icons class.
53 | uses-material-design: true
54 |
55 | # To add assets to your application, add an assets section, like this:
56 | # assets:
57 | # - images/a_dot_burr.jpeg
58 | # - images/a_dot_ham.jpeg
59 |
60 | # An image asset can refer to one or more resolution-specific "variants", see
61 | # https://flutter.dev/assets-and-images/#resolution-aware.
62 |
63 | # For details regarding adding assets from package dependencies, see
64 | # https://flutter.dev/assets-and-images/#from-packages
65 |
66 | # To add custom fonts to your application, add a fonts section here,
67 | # in this "flutter" section. Each entry in this list should have a
68 | # "family" key with the font family name, and a "fonts" key with a
69 | # list giving the asset and other descriptors for the font. For
70 | # example:
71 | # fonts:
72 | # - family: Schyler
73 | # fonts:
74 | # - asset: fonts/Schyler-Regular.ttf
75 | # - asset: fonts/Schyler-Italic.ttf
76 | # style: italic
77 | # - family: Trajan Pro
78 | # fonts:
79 | # - asset: fonts/TrajanPro.ttf
80 | # - asset: fonts/TrajanPro_Bold.ttf
81 | # weight: 700
82 | #
83 | # For details regarding fonts from package dependencies,
84 | # see https://flutter.dev/custom-fonts/#from-packages
85 |
--------------------------------------------------------------------------------
/example/lib/widgets/day_view_widget.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../pages/event_details_page.dart';
5 |
6 | class DayViewWidget extends StatelessWidget {
7 | final GlobalKey? state;
8 | final double? width;
9 |
10 | const DayViewWidget({
11 | super.key,
12 | this.state,
13 | this.width,
14 | });
15 |
16 | @override
17 | Widget build(BuildContext context) {
18 | return DayView(
19 | key: state,
20 | width: width,
21 | startDuration: Duration(hours: 8),
22 | showHalfHours: true,
23 | heightPerMinute: 3,
24 | timeLineBuilder: _timeLineBuilder,
25 | scrollPhysics: const BouncingScrollPhysics(),
26 | eventArranger: SideEventArranger(maxWidth: 30),
27 | showQuarterHours: false,
28 | hourIndicatorSettings: HourIndicatorSettings(
29 | color: Theme.of(context).dividerColor,
30 | ),
31 | onTimestampTap: (date) {
32 | SnackBar snackBar = SnackBar(
33 | content: Text("On tap: ${date.hour} Hr : ${date.minute} Min"),
34 | );
35 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
36 | },
37 | onEventTap: (events, date) {
38 | Navigator.of(context).push(
39 | MaterialPageRoute(
40 | builder: (_) => DetailsPage(
41 | event: events.first,
42 | date: date,
43 | ),
44 | ),
45 | );
46 | },
47 | onEventLongTap: (events, date) {
48 | SnackBar snackBar = SnackBar(content: Text("on LongTap"));
49 | ScaffoldMessenger.of(context).showSnackBar(snackBar);
50 | },
51 | halfHourIndicatorSettings: HourIndicatorSettings(
52 | color: CalendarThemeProvider.of(context)
53 | .calendarTheme
54 | .dayViewTheme
55 | .hourLineColor,
56 | lineStyle: LineStyle.dashed,
57 | ),
58 | verticalLineOffset: 0,
59 | timeLineWidth: 65,
60 | showLiveTimeLineInAllDays: true,
61 | liveTimeIndicatorSettings: LiveTimeIndicatorSettings(
62 | color: Colors.redAccent,
63 | showBullet: false,
64 | showTime: true,
65 | showTimeBackgroundView: true,
66 | ),
67 | );
68 | }
69 |
70 | Widget _timeLineBuilder(DateTime date) {
71 | if (date.minute != 0) {
72 | return Stack(
73 | clipBehavior: Clip.none,
74 | children: [
75 | Positioned.fill(
76 | top: -8,
77 | right: 8,
78 | child: Text(
79 | "${date.hour}:${date.minute}",
80 | textAlign: TextAlign.right,
81 | style: TextStyle(
82 | color: Colors.grey,
83 | fontStyle: FontStyle.italic,
84 | fontSize: 12,
85 | ),
86 | ),
87 | ),
88 | ],
89 | );
90 | }
91 |
92 | final hour = ((date.hour - 1) % 12) + 1;
93 | return Stack(
94 | clipBehavior: Clip.none,
95 | children: [
96 | Positioned.fill(
97 | top: -8,
98 | right: 8,
99 | child: Text(
100 | "$hour ${date.hour ~/ 12 == 0 ? "am" : "pm"}",
101 | textAlign: TextAlign.right,
102 | ),
103 | ),
104 | ],
105 | );
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/lib/src/event_arrangers/event_arrangers.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'dart:math' as math;
6 |
7 | import 'package:flutter/cupertino.dart';
8 |
9 | import '../calendar_event_data.dart';
10 | import '../constants.dart';
11 | import '../extensions.dart';
12 |
13 | part 'merge_event_arranger.dart';
14 |
15 | part 'side_event_arranger.dart';
16 |
17 | /// {@template event_arranger_arrange_method_doc}
18 | /// This method will arrange all the events in and return List of
19 | /// [OrganizedCalendarEventData].
20 | ///
21 | /// {@endtemplate}
22 |
23 | abstract class EventArranger {
24 | /// [EventArranger] defines how simultaneous events will be arranged.
25 | /// Implement [arrange] method to define how events will be arranged.
26 | ///
27 | /// There are three predefined class that implements of [EventArranger].
28 | ///
29 | /// [_StackEventArranger], [SideEventArranger] and [MergeEventArranger].
30 | ///
31 | const EventArranger();
32 |
33 | /// {@macro event_arranger_arrange_method_doc}
34 | List> arrange({
35 | required List> events,
36 | required double height,
37 | required double width,
38 | required double heightPerMinute,
39 | required int startHour,
40 | required DateTime calendarViewDate,
41 | });
42 | }
43 |
44 | /// Provides event data with its [left], [right], [top], and [bottom] boundary.
45 | class OrganizedCalendarEventData {
46 | /// Top position from where event tile will start.
47 | final double top;
48 |
49 | /// End position from where event tile will end.
50 | final double bottom;
51 |
52 | /// Left position from where event tile will start.
53 | final double left;
54 |
55 | /// Right position where event tile will end.
56 | final double right;
57 |
58 | /// List of events to display in given tile.
59 | final List> events;
60 |
61 | /// Start duration of event/event list.
62 | final DateTime startDuration;
63 |
64 | /// End duration of event/event list.
65 | final DateTime endDuration;
66 |
67 | /// DateTime of the calendar view date.
68 | final DateTime calendarViewDate;
69 |
70 | /// Provides event data with its [left], [right], [top], and [bottom]
71 | /// boundary.
72 | OrganizedCalendarEventData({
73 | required this.startDuration,
74 | required this.endDuration,
75 | required this.top,
76 | required this.bottom,
77 | required this.left,
78 | required this.right,
79 | required this.events,
80 | required this.calendarViewDate,
81 | });
82 |
83 | OrganizedCalendarEventData.empty()
84 | : startDuration = DateTime.now(),
85 | endDuration = DateTime.now(),
86 | right = 0,
87 | left = 0,
88 | events = const [],
89 | top = 0,
90 | bottom = 0,
91 | calendarViewDate = DateTime.now();
92 |
93 | OrganizedCalendarEventData getWithUpdatedRight(double right) =>
94 | OrganizedCalendarEventData(
95 | top: top,
96 | bottom: bottom,
97 | endDuration: endDuration,
98 | events: events,
99 | left: left,
100 | right: right,
101 | startDuration: startDuration,
102 | calendarViewDate: calendarViewDate,
103 | );
104 | }
105 |
--------------------------------------------------------------------------------
/example/windows/runner/Runner.rc:
--------------------------------------------------------------------------------
1 | // Microsoft Visual C++ generated resource script.
2 | //
3 | #pragma code_page(65001)
4 | #include "resource.h"
5 |
6 | #define APSTUDIO_READONLY_SYMBOLS
7 | /////////////////////////////////////////////////////////////////////////////
8 | //
9 | // Generated from the TEXTINCLUDE 2 resource.
10 | //
11 | #include "winres.h"
12 |
13 | /////////////////////////////////////////////////////////////////////////////
14 | #undef APSTUDIO_READONLY_SYMBOLS
15 |
16 | /////////////////////////////////////////////////////////////////////////////
17 | // English (United States) resources
18 |
19 | #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
20 | LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
21 |
22 | #ifdef APSTUDIO_INVOKED
23 | /////////////////////////////////////////////////////////////////////////////
24 | //
25 | // TEXTINCLUDE
26 | //
27 |
28 | 1 TEXTINCLUDE
29 | BEGIN
30 | "resource.h\0"
31 | END
32 |
33 | 2 TEXTINCLUDE
34 | BEGIN
35 | "#include ""winres.h""\r\n"
36 | "\0"
37 | END
38 |
39 | 3 TEXTINCLUDE
40 | BEGIN
41 | "\r\n"
42 | "\0"
43 | END
44 |
45 | #endif // APSTUDIO_INVOKED
46 |
47 |
48 | /////////////////////////////////////////////////////////////////////////////
49 | //
50 | // Icon
51 | //
52 |
53 | // Icon with lowest ID value placed first to ensure application icon
54 | // remains consistent on all systems.
55 | IDI_APP_ICON ICON "resources\\app_icon.ico"
56 |
57 |
58 | /////////////////////////////////////////////////////////////////////////////
59 | //
60 | // Version
61 | //
62 |
63 | #ifdef FLUTTER_BUILD_NUMBER
64 | #define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
65 | #else
66 | #define VERSION_AS_NUMBER 1,0,0
67 | #endif
68 |
69 | #ifdef FLUTTER_BUILD_NAME
70 | #define VERSION_AS_STRING #FLUTTER_BUILD_NAME
71 | #else
72 | #define VERSION_AS_STRING "1.0.0"
73 | #endif
74 |
75 | VS_VERSION_INFO VERSIONINFO
76 | FILEVERSION VERSION_AS_NUMBER
77 | PRODUCTVERSION VERSION_AS_NUMBER
78 | FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
79 | #ifdef _DEBUG
80 | FILEFLAGS VS_FF_DEBUG
81 | #else
82 | FILEFLAGS 0x0L
83 | #endif
84 | FILEOS VOS__WINDOWS32
85 | FILETYPE VFT_APP
86 | FILESUBTYPE 0x0L
87 | BEGIN
88 | BLOCK "StringFileInfo"
89 | BEGIN
90 | BLOCK "040904e4"
91 | BEGIN
92 | VALUE "CompanyName", "com.calendar.page.example" "\0"
93 | VALUE "FileDescription", "A new Flutter project." "\0"
94 | VALUE "FileVersion", VERSION_AS_STRING "\0"
95 | VALUE "InternalName", "example" "\0"
96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.calendar.page.example. All rights reserved." "\0"
97 | VALUE "OriginalFilename", "example.exe" "\0"
98 | VALUE "ProductName", "example" "\0"
99 | VALUE "ProductVersion", VERSION_AS_STRING "\0"
100 | END
101 | END
102 | BLOCK "VarFileInfo"
103 | BEGIN
104 | VALUE "Translation", 0x409, 1252
105 | END
106 | END
107 |
108 | #endif // English (United States) resources
109 | /////////////////////////////////////////////////////////////////////////////
110 |
111 |
112 |
113 | #ifndef APSTUDIO_INVOKED
114 | /////////////////////////////////////////////////////////////////////////////
115 | //
116 | // Generated from the TEXTINCLUDE 3 resource.
117 | //
118 |
119 |
120 | /////////////////////////////////////////////////////////////////////////////
121 | #endif // not APSTUDIO_INVOKED
122 |
--------------------------------------------------------------------------------
/example/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
37 |
38 |
39 |
40 |
41 |
42 |
52 |
54 |
60 |
61 |
62 |
63 |
64 |
65 |
71 |
73 |
79 |
80 |
81 |
82 |
84 |
85 |
88 |
89 |
90 |
--------------------------------------------------------------------------------
/lib/src/typedefs.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/material.dart';
6 |
7 | import '../calendar_view.dart';
8 |
9 | typedef CellBuilder = Widget Function(
10 | DateTime date,
11 | List> event,
12 | bool isToday,
13 | bool isInMonth,
14 | bool hideDaysNotInMonth,
15 | );
16 |
17 | typedef EventTileBuilder = Widget Function(
18 | DateTime date,
19 | List> events,
20 | Rect boundary,
21 | DateTime startDuration,
22 | DateTime endDuration,
23 | );
24 |
25 | typedef DetectorBuilder = Widget Function({
26 | required DateTime date,
27 | required double height,
28 | required double width,
29 | required double heightPerMinute,
30 | required MinuteSlotSize minuteSlotSize,
31 | });
32 |
33 | typedef WeekDayBuilder = Widget Function(
34 | int day,
35 | );
36 |
37 | typedef DateWidgetBuilder = Widget Function(DateTime date);
38 |
39 | typedef HeaderTitleCallback = Future Function(DateTime date);
40 |
41 | typedef WeekNumberBuilder = Widget? Function(
42 | DateTime firstDayOfWeek,
43 | );
44 |
45 | typedef FullDayEventBuilder = Widget Function(
46 | List> events, DateTime date);
47 |
48 | typedef CalendarPageChangeCallBack = void Function(DateTime date, int page);
49 |
50 | typedef PageChangeCallback = void Function(
51 | DateTime date,
52 | CalendarEventData event,
53 | );
54 |
55 | typedef StringProvider = String Function(DateTime date,
56 | {DateTime? secondaryDate});
57 |
58 | typedef WeekPageHeaderBuilder = Widget Function(
59 | DateTime startDate,
60 | DateTime endDate,
61 | );
62 |
63 | typedef TileTapCallback = void Function(
64 | CalendarEventData event, DateTime date);
65 |
66 | typedef TileTapDetailsCallback = void Function(
67 | CalendarEventData event,
68 | DateTime date,
69 | TapUpDetails? tapDetails,
70 | );
71 |
72 | typedef TileLongTapDetailsCallback = void Function(
73 | CalendarEventData event,
74 | DateTime date,
75 | LongPressStartDetails? longPressDetails,
76 | );
77 |
78 | typedef TileDoubleTapDetailsCallback = void Function(
79 | CalendarEventData event,
80 | DateTime date,
81 | TapDownDetails? doubleTapDetails,
82 | );
83 |
84 | typedef CellTapCallback = void Function(
85 | List> events, DateTime date);
86 |
87 | typedef DatePressCallback = void Function(DateTime date);
88 |
89 | typedef DateTapCallback = void Function(DateTime date);
90 |
91 | typedef TimestampCallback = void Function(DateTime date);
92 |
93 | typedef EventFilter = List> Function(
94 | DateTime date, List> events);
95 |
96 | /// Comparator for sorting events.
97 | typedef EventSorter = int Function(
98 | CalendarEventData a, CalendarEventData b);
99 |
100 | typedef CustomHourLinePainter = CustomPainter Function(
101 | Color lineColor,
102 | double lineHeight,
103 | double offset,
104 | double minuteHeight,
105 | bool showVerticalLine,
106 | double verticalLineOffset,
107 | LineStyle lineStyle,
108 | double dashWidth,
109 | double dashSpaceWidth,
110 | double emulateVerticalOffsetBy,
111 | int startHour,
112 | int endHour,
113 | );
114 |
115 | typedef TestPredicate = bool Function(T element);
116 |
--------------------------------------------------------------------------------
/example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
32 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
54 |
56 |
62 |
63 |
64 |
65 |
66 |
67 |
73 |
75 |
81 |
82 |
83 |
84 |
86 |
87 |
90 |
91 |
92 |
--------------------------------------------------------------------------------
/test/custom_sort_test.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter_test/flutter_test.dart';
3 |
4 | void main() {
5 | group('Custom sort', () {
6 | final date = DateTime(2024, 01, 01);
7 | const oneHour = Duration(hours: 1);
8 |
9 | /// The bool value indicates if the event is "important" or "regular".
10 |
11 | final first = CalendarEventData(
12 | title: 'Regular event - first',
13 | event: false,
14 | date: date,
15 | startTime: date.add(oneHour),
16 | endTime: date.add(oneHour * 2),
17 | );
18 |
19 | final second = CalendarEventData(
20 | title: 'Important event - second',
21 | event: true,
22 | date: date,
23 | startTime: date.add(oneHour * 2),
24 | endTime: date.add(oneHour * 3),
25 | );
26 |
27 | final third = CalendarEventData(
28 | title: 'Important event - third',
29 | event: true,
30 | date: date,
31 | startTime: date.add(oneHour * 3),
32 | endTime: date.add(oneHour * 4),
33 | );
34 |
35 | final fourth = CalendarEventData(
36 | title: 'Regular event - fourth',
37 | event: false,
38 | date: date,
39 | startTime: date.add(oneHour * 4),
40 | endTime: date.add(oneHour * 5),
41 | );
42 |
43 | /// Events are in random order
44 | final events = >[
45 | first,
46 | third,
47 | fourth,
48 | second,
49 | ];
50 |
51 | late EventController controller;
52 |
53 | test('Should return events in startTimeWise order', () {
54 | controller = EventController();
55 | controller.addAll(events);
56 |
57 | final eventsOnDay = controller.getEventsOnDay(date);
58 |
59 | expect(eventsOnDay[0], first);
60 | expect(eventsOnDay[1], second);
61 | expect(eventsOnDay[2], third);
62 | expect(eventsOnDay[3], fourth);
63 | });
64 |
65 | group('with custom sorter', () {
66 | test('Should return events in custom order', () {
67 | final sorter = (CalendarEventData a, CalendarEventData b) {
68 | if (a.event == true && b.event == false) {
69 | return -1;
70 | } else if (a.event == false && b.event == true) {
71 | return 1;
72 | }
73 | return 0;
74 | };
75 |
76 | controller = EventController(
77 | eventSorter: sorter,
78 | );
79 | controller.addAll(events);
80 |
81 | final eventsOnDay = controller.getEventsOnDay(date);
82 |
83 | expect(eventsOnDay[0], second);
84 | expect(eventsOnDay[1], third);
85 | expect(eventsOnDay[2], first);
86 | expect(eventsOnDay[3], fourth);
87 | });
88 |
89 | test('Should fallback to default sorter if custom sorter returns 0', () {
90 | /// Sorter that will only sort the fourth event
91 | final sorter = (CalendarEventData a, CalendarEventData b) {
92 | if (a.title == 'Regular event - fourth') {
93 | return -1;
94 | }
95 | if (b.title == 'Regular event - fourth') {
96 | return 1;
97 | }
98 | return 0;
99 | };
100 |
101 | controller = EventController(
102 | eventSorter: sorter,
103 | );
104 | controller.addAll(events);
105 |
106 | final eventsOnDay = controller.getEventsOnDay(date);
107 |
108 | expect(eventsOnDay[0], fourth);
109 | expect(eventsOnDay[1], first);
110 | expect(eventsOnDay[2], second);
111 | expect(eventsOnDay[3], third);
112 | });
113 | });
114 | });
115 | }
116 |
--------------------------------------------------------------------------------
/example/windows/runner/win32_window.h:
--------------------------------------------------------------------------------
1 | #ifndef RUNNER_WIN32_WINDOW_H_
2 | #define RUNNER_WIN32_WINDOW_H_
3 |
4 | #include
5 |
6 | #include
7 | #include
8 | #include
9 |
10 | // A class abstraction for a high DPI-aware Win32 Window. Intended to be
11 | // inherited from by classes that wish to specialize with custom
12 | // rendering and input handling
13 | class Win32Window {
14 | public:
15 | struct Point {
16 | unsigned int x;
17 | unsigned int y;
18 | Point(unsigned int x, unsigned int y) : x(x), y(y) {}
19 | };
20 |
21 | struct Size {
22 | unsigned int width;
23 | unsigned int height;
24 | Size(unsigned int width, unsigned int height)
25 | : width(width), height(height) {}
26 | };
27 |
28 | Win32Window();
29 | virtual ~Win32Window();
30 |
31 | // Creates and shows a win32 window with |title| and position and size using
32 | // |origin| and |size|. New windows are created on the default monitor. Window
33 | // sizes are specified to the OS in physical pixels, hence to ensure a
34 | // consistent size to will treat the width height passed in to this function
35 | // as logical pixels and scale to appropriate for the default monitor. Returns
36 | // true if the window was created successfully.
37 | bool CreateAndShow(const std::wstring& title,
38 | const Point& origin,
39 | const Size& size);
40 |
41 | // Release OS resources associated with window.
42 | void Destroy();
43 |
44 | // Inserts |content| into the window tree.
45 | void SetChildContent(HWND content);
46 |
47 | // Returns the backing Window handle to enable clients to set icon and other
48 | // window properties. Returns nullptr if the window has been destroyed.
49 | HWND GetHandle();
50 |
51 | // If true, closing this window will quit the application.
52 | void SetQuitOnClose(bool quit_on_close);
53 |
54 | // Return a RECT representing the bounds of the current client area.
55 | RECT GetClientArea();
56 |
57 | protected:
58 | // Processes and route salient window messages for mouse handling,
59 | // size change and DPI. Delegates handling of these to member overloads that
60 | // inheriting classes can handle.
61 | virtual LRESULT MessageHandler(HWND window,
62 | UINT const message,
63 | WPARAM const wparam,
64 | LPARAM const lparam) noexcept;
65 |
66 | // Called when CreateAndShow is called, allowing subclass window-related
67 | // setup. Subclasses should return false if setup fails.
68 | virtual bool OnCreate();
69 |
70 | // Called when Destroy is called.
71 | virtual void OnDestroy();
72 |
73 | private:
74 | friend class WindowClassRegistrar;
75 |
76 | // OS callback called by message pump. Handles the WM_NCCREATE message which
77 | // is passed when the non-client area is being created and enables automatic
78 | // non-client DPI scaling so that the non-client area automatically
79 | // responsponds to changes in DPI. All other messages are handled by
80 | // MessageHandler.
81 | static LRESULT CALLBACK WndProc(HWND const window,
82 | UINT const message,
83 | WPARAM const wparam,
84 | LPARAM const lparam) noexcept;
85 |
86 | // Retrieves a class instance pointer for |window|
87 | static Win32Window* GetThisFromHandle(HWND const window) noexcept;
88 |
89 | bool quit_on_close_ = false;
90 |
91 | // window handle for top level window.
92 | HWND window_handle_ = nullptr;
93 |
94 | // window handle for hosted content.
95 | HWND child_content_ = nullptr;
96 | };
97 |
98 | #endif // RUNNER_WIN32_WINDOW_H_
99 |
--------------------------------------------------------------------------------
/example/windows/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 | project(example LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "example")
5 |
6 | cmake_policy(SET CMP0063 NEW)
7 |
8 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
9 |
10 | # Configure build options.
11 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
12 | if(IS_MULTICONFIG)
13 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release"
14 | CACHE STRING "" FORCE)
15 | else()
16 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
17 | set(CMAKE_BUILD_TYPE "Debug" CACHE
18 | STRING "Flutter build mode" FORCE)
19 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
20 | "Debug" "Profile" "Release")
21 | endif()
22 | endif()
23 |
24 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}")
25 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}")
26 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}")
27 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}")
28 |
29 | # Use Unicode for all projects.
30 | add_definitions(-DUNICODE -D_UNICODE)
31 |
32 | # Compilation settings that should be applied to most targets.
33 | function(APPLY_STANDARD_SETTINGS TARGET)
34 | target_compile_features(${TARGET} PUBLIC cxx_std_17)
35 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100")
36 | target_compile_options(${TARGET} PRIVATE /EHsc)
37 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0")
38 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>")
39 | endfunction()
40 |
41 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
42 |
43 | # Flutter library and tool build rules.
44 | add_subdirectory(${FLUTTER_MANAGED_DIR})
45 |
46 | # Application build
47 | add_subdirectory("runner")
48 |
49 | # Generated plugin build rules, which manage building the plugins and adding
50 | # them to the application.
51 | include(flutter/generated_plugins.cmake)
52 |
53 |
54 | # === Installation ===
55 | # Support files are copied into place next to the executable, so that it can
56 | # run in place. This is done instead of making a separate bundle (as on Linux)
57 | # so that building and running from within Visual Studio will work.
58 | set(BUILD_BUNDLE_DIR "$")
59 | # Make the "install" step default, as it's required to run.
60 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
61 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
62 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
63 | endif()
64 |
65 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
66 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}")
67 |
68 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
69 | COMPONENT Runtime)
70 |
71 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
72 | COMPONENT Runtime)
73 |
74 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
75 | COMPONENT Runtime)
76 |
77 | if(PLUGIN_BUNDLED_LIBRARIES)
78 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
79 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
80 | COMPONENT Runtime)
81 | endif()
82 |
83 | # Fully re-copy the assets directory on each build to avoid having stale files
84 | # from a previous install.
85 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
86 | install(CODE "
87 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
88 | " COMPONENT Runtime)
89 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
90 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
91 |
92 | # Install the AOT library on non-Debug builds only.
93 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
94 | CONFIGURATIONS Profile;Release
95 | COMPONENT Runtime)
96 |
--------------------------------------------------------------------------------
/lib/src/components/common_components.dart:
--------------------------------------------------------------------------------
1 | // Copyright (c) 2021 Simform Solutions. All rights reserved.
2 | // Use of this source code is governed by a MIT-style license
3 | // that can be found in the LICENSE file.
4 |
5 | import 'package:flutter/material.dart';
6 |
7 | import '../calendar_event_data.dart';
8 | import '../constants.dart';
9 | import '../enumerations.dart';
10 | import '../extensions.dart';
11 | import '../typedefs.dart';
12 | import 'components.dart';
13 |
14 | /// This will be used in day and week view
15 | class DefaultPressDetector extends StatelessWidget {
16 | /// default press detector builder used in week and day view
17 | const DefaultPressDetector({
18 | required this.date,
19 | required this.height,
20 | required this.width,
21 | required this.heightPerMinute,
22 | required this.minuteSlotSize,
23 | this.onDateTap,
24 | this.onDateLongPress,
25 | this.startHour = 0,
26 | });
27 |
28 | final DateTime date;
29 | final double height;
30 | final double width;
31 | final double heightPerMinute;
32 | final MinuteSlotSize minuteSlotSize;
33 | final DateTapCallback? onDateTap;
34 | final DatePressCallback? onDateLongPress;
35 | final int startHour;
36 |
37 | @override
38 | Widget build(BuildContext context) {
39 | final heightPerSlot = minuteSlotSize.minutes * heightPerMinute;
40 | final slots = (Constants.hoursADay * 60) ~/ minuteSlotSize.minutes;
41 |
42 | return SizedBox(
43 | height: height,
44 | width: width,
45 | child: Stack(
46 | children: [
47 | for (int i = 0; i < slots; i++)
48 | Positioned(
49 | top: heightPerSlot * i,
50 | left: 0,
51 | right: 0,
52 | bottom: height - (heightPerSlot * (i + 1)),
53 | child: GestureDetector(
54 | behavior: HitTestBehavior.translucent,
55 | onLongPress: () => onDateLongPress?.call(
56 | getSlotDateTime(i),
57 | ),
58 | onTap: () => onDateTap?.call(
59 | getSlotDateTime(i),
60 | ),
61 | child: SizedBox(
62 | width: width,
63 | height: heightPerSlot,
64 | ),
65 | ),
66 | ),
67 | ],
68 | ),
69 | );
70 | }
71 |
72 | DateTime getSlotDateTime(int slot) => DateTime(
73 | date.year,
74 | date.month,
75 | date.day,
76 | 0,
77 | (minuteSlotSize.minutes * slot) + (startHour * 60),
78 | );
79 | }
80 |
81 | /// This will be used in day and week view
82 | class DefaultEventTile extends StatelessWidget {
83 | const DefaultEventTile({
84 | required this.date,
85 | required this.events,
86 | required this.boundary,
87 | required this.startDuration,
88 | required this.endDuration,
89 | });
90 |
91 | final DateTime date;
92 | final List> events;
93 | final Rect boundary;
94 | final DateTime startDuration;
95 | final DateTime endDuration;
96 |
97 | @override
98 | Widget build(BuildContext context) {
99 | if (events.isNotEmpty) {
100 | final event = events[0];
101 | return RoundedEventTile(
102 | borderRadius: BorderRadius.circular(10.0),
103 | title: event.title,
104 | totalEvents: events.length - 1,
105 | description: event.description,
106 | padding: EdgeInsets.all(10.0),
107 | backgroundColor: event.color,
108 | margin: EdgeInsets.all(2.0),
109 | titleStyle: event.titleStyle,
110 | descriptionStyle: event.descriptionStyle,
111 | );
112 | } else {
113 | return SizedBox.shrink();
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/example/windows/flutter/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.15)
2 |
3 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral")
4 |
5 | # Configuration provided via flutter tool.
6 | include(${EPHEMERAL_DIR}/generated_config.cmake)
7 |
8 | # TODO: Move the rest of this into files in ephemeral. See
9 | # https://github.com/flutter/flutter/issues/57146.
10 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper")
11 |
12 | # === Flutter Library ===
13 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll")
14 |
15 | # Published to parent scope for install step.
16 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE)
17 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE)
18 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE)
19 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE)
20 |
21 | list(APPEND FLUTTER_LIBRARY_HEADERS
22 | "flutter_export.h"
23 | "flutter_windows.h"
24 | "flutter_messenger.h"
25 | "flutter_plugin_registrar.h"
26 | "flutter_texture_registrar.h"
27 | )
28 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/")
29 | add_library(flutter INTERFACE)
30 | target_include_directories(flutter INTERFACE
31 | "${EPHEMERAL_DIR}"
32 | )
33 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib")
34 | add_dependencies(flutter flutter_assemble)
35 |
36 | # === Wrapper ===
37 | list(APPEND CPP_WRAPPER_SOURCES_CORE
38 | "core_implementations.cc"
39 | "standard_codec.cc"
40 | )
41 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/")
42 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN
43 | "plugin_registrar.cc"
44 | )
45 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/")
46 | list(APPEND CPP_WRAPPER_SOURCES_APP
47 | "flutter_engine.cc"
48 | "flutter_view_controller.cc"
49 | )
50 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/")
51 |
52 | # Wrapper sources needed for a plugin.
53 | add_library(flutter_wrapper_plugin STATIC
54 | ${CPP_WRAPPER_SOURCES_CORE}
55 | ${CPP_WRAPPER_SOURCES_PLUGIN}
56 | )
57 | apply_standard_settings(flutter_wrapper_plugin)
58 | set_target_properties(flutter_wrapper_plugin PROPERTIES
59 | POSITION_INDEPENDENT_CODE ON)
60 | set_target_properties(flutter_wrapper_plugin PROPERTIES
61 | CXX_VISIBILITY_PRESET hidden)
62 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter)
63 | target_include_directories(flutter_wrapper_plugin PUBLIC
64 | "${WRAPPER_ROOT}/include"
65 | )
66 | add_dependencies(flutter_wrapper_plugin flutter_assemble)
67 |
68 | # Wrapper sources needed for the runner.
69 | add_library(flutter_wrapper_app STATIC
70 | ${CPP_WRAPPER_SOURCES_CORE}
71 | ${CPP_WRAPPER_SOURCES_APP}
72 | )
73 | apply_standard_settings(flutter_wrapper_app)
74 | target_link_libraries(flutter_wrapper_app PUBLIC flutter)
75 | target_include_directories(flutter_wrapper_app PUBLIC
76 | "${WRAPPER_ROOT}/include"
77 | )
78 | add_dependencies(flutter_wrapper_app flutter_assemble)
79 |
80 | # === Flutter tool backend ===
81 | # _phony_ is a non-existent file to force this command to run every time,
82 | # since currently there's no way to get a full input/output list from the
83 | # flutter tool.
84 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_")
85 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE)
86 | add_custom_command(
87 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS}
88 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN}
89 | ${CPP_WRAPPER_SOURCES_APP}
90 | ${PHONY_OUTPUT}
91 | COMMAND ${CMAKE_COMMAND} -E env
92 | ${FLUTTER_TOOL_ENVIRONMENT}
93 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat"
94 | windows-x64 $
95 | VERBATIM
96 | )
97 | add_custom_target(flutter_assemble DEPENDS
98 | "${FLUTTER_LIBRARY}"
99 | ${FLUTTER_LIBRARY_HEADERS}
100 | ${CPP_WRAPPER_SOURCES_CORE}
101 | ${CPP_WRAPPER_SOURCES_PLUGIN}
102 | ${CPP_WRAPPER_SOURCES_APP}
103 | )
104 |
--------------------------------------------------------------------------------
/example/linux/my_application.cc:
--------------------------------------------------------------------------------
1 | #include "my_application.h"
2 |
3 | #include
4 | #ifdef GDK_WINDOWING_X11
5 | #include
6 | #endif
7 |
8 | #include "flutter/generated_plugin_registrant.h"
9 |
10 | struct _MyApplication {
11 | GtkApplication parent_instance;
12 | char** dart_entrypoint_arguments;
13 | };
14 |
15 | G_DEFINE_TYPE(MyApplication, my_application, GTK_TYPE_APPLICATION)
16 |
17 | // Implements GApplication::activate.
18 | static void my_application_activate(GApplication* application) {
19 | MyApplication* self = MY_APPLICATION(application);
20 | GtkWindow* window =
21 | GTK_WINDOW(gtk_application_window_new(GTK_APPLICATION(application)));
22 |
23 | // Use a header bar when running in GNOME as this is the common style used
24 | // by applications and is the setup most users will be using (e.g. Ubuntu
25 | // desktop).
26 | // If running on X and not using GNOME then just use a traditional title bar
27 | // in case the window manager does more exotic layout, e.g. tiling.
28 | // If running on Wayland assume the header bar will work (may need changing
29 | // if future cases occur).
30 | gboolean use_header_bar = TRUE;
31 | #ifdef GDK_WINDOWING_X11
32 | GdkScreen *screen = gtk_window_get_screen(window);
33 | if (GDK_IS_X11_SCREEN(screen)) {
34 | const gchar* wm_name = gdk_x11_screen_get_window_manager_name(screen);
35 | if (g_strcmp0(wm_name, "GNOME Shell") != 0) {
36 | use_header_bar = FALSE;
37 | }
38 | }
39 | #endif
40 | if (use_header_bar) {
41 | GtkHeaderBar *header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
42 | gtk_widget_show(GTK_WIDGET(header_bar));
43 | gtk_header_bar_set_title(header_bar, "example");
44 | gtk_header_bar_set_show_close_button(header_bar, TRUE);
45 | gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
46 | }
47 | else {
48 | gtk_window_set_title(window, "example");
49 | }
50 |
51 | gtk_window_set_default_size(window, 1280, 720);
52 | gtk_widget_show(GTK_WIDGET(window));
53 |
54 | g_autoptr(FlDartProject) project = fl_dart_project_new();
55 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments);
56 |
57 | FlView* view = fl_view_new(project);
58 | gtk_widget_show(GTK_WIDGET(view));
59 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view));
60 |
61 | fl_register_plugins(FL_PLUGIN_REGISTRY(view));
62 |
63 | gtk_widget_grab_focus(GTK_WIDGET(view));
64 | }
65 |
66 | // Implements GApplication::local_command_line.
67 | static gboolean my_application_local_command_line(GApplication* application, gchar ***arguments, int *exit_status) {
68 | MyApplication* self = MY_APPLICATION(application);
69 | // Strip out the first argument as it is the binary name.
70 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1);
71 |
72 | g_autoptr(GError) error = nullptr;
73 | if (!g_application_register(application, nullptr, &error)) {
74 | g_warning("Failed to register: %s", error->message);
75 | *exit_status = 1;
76 | return TRUE;
77 | }
78 |
79 | g_application_activate(application);
80 | *exit_status = 0;
81 |
82 | return TRUE;
83 | }
84 |
85 | // Implements GObject::dispose.
86 | static void my_application_dispose(GObject *object) {
87 | MyApplication* self = MY_APPLICATION(object);
88 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev);
89 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object);
90 | }
91 |
92 | static void my_application_class_init(MyApplicationClass* klass) {
93 | G_APPLICATION_CLASS(klass)->activate = my_application_activate;
94 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line;
95 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose;
96 | }
97 |
98 | static void my_application_init(MyApplication* self) {}
99 |
100 | MyApplication* my_application_new() {
101 | return MY_APPLICATION(g_object_new(my_application_get_type(),
102 | "application-id", APPLICATION_ID,
103 | "flags", G_APPLICATION_NON_UNIQUE,
104 | nullptr));
105 | }
106 |
--------------------------------------------------------------------------------
/example/lib/extension.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 | import 'package:intl/intl.dart';
3 |
4 | import 'enumerations.dart';
5 | import 'theme/app_colors.dart';
6 | import 'theme/app_theme_extension.dart';
7 |
8 | enum TimeStampFormat { parse_12, parse_24 }
9 |
10 | extension NavigationExtension on State {
11 | void pushRoute(Widget page) =>
12 | Navigator.of(context).push(MaterialPageRoute(builder: (context) => page));
13 | }
14 |
15 | extension NavigatorExtention on BuildContext {
16 | Future pushRoute(Widget page) =>
17 | Navigator.of(this).push(MaterialPageRoute(builder: (context) => page));
18 |
19 | void pop([dynamic value]) => Navigator.of(this).pop(value);
20 |
21 | void showSnackBarWithText(String text) => ScaffoldMessenger.of(this)
22 | ..hideCurrentSnackBar()
23 | ..showSnackBar(SnackBar(content: Text(text)));
24 | }
25 |
26 | extension DateUtils on DateTime {
27 | String get weekdayToFullString {
28 | switch (weekday) {
29 | case DateTime.monday:
30 | return "Monday";
31 | case DateTime.tuesday:
32 | return "Tuesday";
33 | case DateTime.wednesday:
34 | return "Wednesday";
35 | case DateTime.thursday:
36 | return "Thursday";
37 | case DateTime.friday:
38 | return "Friday";
39 | case DateTime.saturday:
40 | return "Saturday";
41 | case DateTime.sunday:
42 | return "Sunday";
43 | default:
44 | return "Error";
45 | }
46 | }
47 |
48 | String get weekdayToAbbreviatedString {
49 | switch (weekday) {
50 | case DateTime.monday:
51 | return "M";
52 | case DateTime.tuesday:
53 | return "T";
54 | case DateTime.wednesday:
55 | return "W";
56 | case DateTime.thursday:
57 | return "T";
58 | case DateTime.friday:
59 | return "F";
60 | case DateTime.saturday:
61 | return "S";
62 | case DateTime.sunday:
63 | return "S";
64 | default:
65 | return "Err";
66 | }
67 | }
68 |
69 | int get totalMinutes => hour * 60 + minute;
70 |
71 | TimeOfDay get timeOfDay => TimeOfDay(hour: hour, minute: minute);
72 |
73 | DateTime copyWith({
74 | int? year,
75 | int? month,
76 | int? day,
77 | int? hour,
78 | int? minute,
79 | int? second,
80 | int? millisecond,
81 | int? microsecond,
82 | }) =>
83 | DateTime(
84 | year ?? this.year,
85 | month ?? this.month,
86 | day ?? this.day,
87 | hour ?? this.hour,
88 | minute ?? this.minute,
89 | second ?? this.second,
90 | millisecond ?? this.millisecond,
91 | microsecond ?? this.microsecond,
92 | );
93 |
94 | String dateToStringWithFormat({String format = 'y-M-d'}) {
95 | return DateFormat(format).format(this);
96 | }
97 |
98 | DateTime stringToDateWithFormat({
99 | required String format,
100 | required String dateString,
101 | }) =>
102 | DateFormat(format).parse(dateString);
103 |
104 | String getTimeInFormat(TimeStampFormat format) =>
105 | DateFormat('h:mm${format == TimeStampFormat.parse_12 ? " a" : ""}')
106 | .format(this)
107 | .toUpperCase();
108 |
109 | bool compareWithoutTime(DateTime date) =>
110 | day == date.day && month == date.month && year == date.year;
111 |
112 | bool compareTime(DateTime date) =>
113 | hour == date.hour && minute == date.minute && second == date.second;
114 | }
115 |
116 | extension ColorExtension on Color {
117 | /// TODO(Shubham): Update this getter as it uses `computeLuminance()`
118 | /// which is computationally expensive
119 | Color get accentColor {
120 | final brightness = ThemeData.estimateBrightnessForColor(this);
121 | return brightness == Brightness.light ? AppColors.black : AppColors.white;
122 | }
123 | }
124 |
125 | extension StringExt on String {
126 | String get capitalized => toBeginningOfSentenceCase(this) ?? "";
127 | }
128 |
129 | extension ViewNameExt on CalendarView {
130 | String get name => toString().split(".").last;
131 | }
132 |
133 | extension BuildContextExtension on BuildContext {
134 | AppThemeExtension get appColors =>
135 | Theme.of(this).extension() ??
136 | AppThemeExtension.light();
137 | }
138 |
--------------------------------------------------------------------------------
/example/linux/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.10)
2 | project(runner LANGUAGES CXX)
3 |
4 | set(BINARY_NAME "example")
5 | set(APPLICATION_ID "com.calendar.page.example.example")
6 |
7 | cmake_policy(SET CMP0063 NEW)
8 |
9 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib")
10 |
11 | # Root filesystem for cross-building.
12 | if(FLUTTER_TARGET_PLATFORM_SYSROOT)
13 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT})
14 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT})
15 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
16 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY)
17 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
18 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
19 | endif()
20 |
21 | # Configure build options.
22 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
23 | set(CMAKE_BUILD_TYPE "Debug" CACHE
24 | STRING "Flutter build mode" FORCE)
25 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
26 | "Debug" "Profile" "Release")
27 | endif()
28 |
29 | # Compilation settings that should be applied to most targets.
30 | function(APPLY_STANDARD_SETTINGS TARGET)
31 | target_compile_features(${TARGET} PUBLIC cxx_std_14)
32 | target_compile_options(${TARGET} PRIVATE -Wall -Werror)
33 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>")
34 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>")
35 | endfunction()
36 |
37 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter")
38 |
39 | # Flutter library and tool build rules.
40 | add_subdirectory(${FLUTTER_MANAGED_DIR})
41 |
42 | # System-level dependencies.
43 | find_package(PkgConfig REQUIRED)
44 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0)
45 |
46 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}")
47 |
48 | # Application build
49 | add_executable(${BINARY_NAME}
50 | "main.cc"
51 | "my_application.cc"
52 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc"
53 | )
54 | apply_standard_settings(${BINARY_NAME})
55 | target_link_libraries(${BINARY_NAME} PRIVATE flutter)
56 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK)
57 | add_dependencies(${BINARY_NAME} flutter_assemble)
58 | # Only the install-generated bundle's copy of the executable will launch
59 | # correctly, since the resources must in the right relative locations. To avoid
60 | # people trying to run the unbundled copy, put it in a subdirectory instead of
61 | # the default top-level location.
62 | set_target_properties(${BINARY_NAME}
63 | PROPERTIES
64 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run"
65 | )
66 |
67 | # Generated plugin build rules, which manage building the plugins and adding
68 | # them to the application.
69 | include(flutter/generated_plugins.cmake)
70 |
71 |
72 | # === Installation ===
73 | # By default, "installing" just makes a relocatable bundle in the build
74 | # directory.
75 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle")
76 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
77 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE)
78 | endif()
79 |
80 | # Start with a clean build bundle directory every time.
81 | install(CODE "
82 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\")
83 | " COMPONENT Runtime)
84 |
85 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data")
86 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib")
87 |
88 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}"
89 | COMPONENT Runtime)
90 |
91 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
92 | COMPONENT Runtime)
93 |
94 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
95 | COMPONENT Runtime)
96 |
97 | if(PLUGIN_BUNDLED_LIBRARIES)
98 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}"
99 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
100 | COMPONENT Runtime)
101 | endif()
102 |
103 | # Fully re-copy the assets directory on each build to avoid having stale files
104 | # from a previous install.
105 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets")
106 | install(CODE "
107 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\")
108 | " COMPONENT Runtime)
109 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
110 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime)
111 |
112 | # Install the AOT library on non-Debug builds only.
113 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug")
114 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}"
115 | COMPONENT Runtime)
116 | endif()
117 |
--------------------------------------------------------------------------------
/example/lib/theme/app_theme.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:example/constants.dart';
3 | import 'package:example/theme/app_colors.dart';
4 | import 'package:example/theme/app_theme_extension.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | import 'dark_app_colors.dart';
8 |
9 | class AppTheme {
10 | // Base InputDecorationTheme
11 | static final baseInputDecorationTheme = InputDecorationTheme(
12 | border: AppConstants.inputBorder,
13 | disabledBorder: AppConstants.inputBorder,
14 | errorBorder: AppConstants.inputBorder.copyWith(
15 | borderSide: const BorderSide(
16 | width: 2,
17 | color: AppColors.red,
18 | ),
19 | ),
20 | enabledBorder: AppConstants.inputBorder,
21 | focusedBorder: AppConstants.inputBorder.copyWith(
22 | borderSide: const BorderSide(
23 | width: 2,
24 | color: AppColors.outline,
25 | ),
26 | ),
27 | focusedErrorBorder: AppConstants.inputBorder,
28 | hintStyle: const TextStyle(
29 | color: AppColors.black,
30 | fontSize: 17,
31 | ),
32 | labelStyle: const TextStyle(
33 | color: AppColors.black,
34 | fontSize: 17,
35 | ),
36 | helperStyle: const TextStyle(
37 | color: AppColors.black,
38 | fontSize: 17,
39 | ),
40 | errorStyle: const TextStyle(
41 | color: AppColors.red,
42 | fontSize: 12,
43 | ),
44 | contentPadding: const EdgeInsets.symmetric(
45 | vertical: 10,
46 | horizontal: 20,
47 | ),
48 | );
49 |
50 | // Light colors
51 | static final _dayViewTheme = DayViewThemeData.light();
52 | static final _weekViewTheme = WeekViewThemeData.light();
53 | static final _multiDayViewTheme = MultiDayViewThemeData.light();
54 |
55 | // Dark colors
56 | static final _appDarkTheme = AppThemeExtension.dark();
57 | static final _monthViewDarkTheme = MonthViewThemeData.dark();
58 | static final _dayViewDarkTheme = DayViewThemeData.dark();
59 | static final _weekViewDarkTheme = WeekViewThemeData.dark();
60 | static final _multiDayViewDarkTheme = MultiDayViewThemeData.dark();
61 |
62 | // Light theme
63 | static final light = ThemeData.light().copyWith(
64 | elevatedButtonTheme: ElevatedButtonThemeData(
65 | style: ElevatedButton.styleFrom(
66 | backgroundColor: AppColors.primary,
67 | foregroundColor: AppColors.onPrimary,
68 | ),
69 | ),
70 | floatingActionButtonTheme: const FloatingActionButtonThemeData(
71 | backgroundColor: AppColors.primary,
72 | ),
73 | inputDecorationTheme: baseInputDecorationTheme,
74 | appBarTheme: const AppBarTheme(
75 | backgroundColor: AppColors.primary,
76 | foregroundColor: AppColors.onPrimary,
77 | ),
78 | radioTheme: RadioThemeData(
79 | fillColor: WidgetStateColor.resolveWith(
80 | (_) => AppColors.primary,
81 | ),
82 | ),
83 | extensions: [
84 | _dayViewTheme,
85 | _weekViewTheme,
86 | _multiDayViewTheme,
87 | ],
88 | );
89 |
90 | // Dark theme
91 | static final dark = ThemeData.dark().copyWith(
92 | appBarTheme: const AppBarTheme(
93 | backgroundColor: DarkAppColors.primary,
94 | foregroundColor: DarkAppColors.onPrimary,
95 | ),
96 | elevatedButtonTheme: ElevatedButtonThemeData(
97 | style: ElevatedButton.styleFrom(
98 | backgroundColor: DarkAppColors.primary,
99 | foregroundColor: DarkAppColors.onPrimary,
100 | ),
101 | ),
102 | inputDecorationTheme: baseInputDecorationTheme.copyWith(
103 | disabledBorder: AppConstants.inputBorder.copyWith(
104 | borderSide: const BorderSide(
105 | width: 2,
106 | color: DarkAppColors.outlineVariant,
107 | ),
108 | ),
109 | enabledBorder: AppConstants.inputBorder.copyWith(
110 | borderSide: const BorderSide(
111 | width: 2,
112 | color: DarkAppColors.outlineVariant,
113 | ),
114 | ),
115 | focusedBorder: AppConstants.inputBorder.copyWith(
116 | borderSide: const BorderSide(
117 | width: 2,
118 | color: DarkAppColors.outline,
119 | ),
120 | ),
121 | ),
122 | floatingActionButtonTheme: const FloatingActionButtonThemeData(
123 | backgroundColor: DarkAppColors.primary,
124 | ),
125 | radioTheme: RadioThemeData(
126 | fillColor: WidgetStateColor.resolveWith(
127 | (_) => DarkAppColors.primary,
128 | ),
129 | ),
130 | // TODO(Shubham): Test dark theme update
131 | extensions: [
132 | _appDarkTheme,
133 | _monthViewDarkTheme,
134 | _dayViewDarkTheme,
135 | _weekViewDarkTheme,
136 | _multiDayViewDarkTheme,
137 | ],
138 | );
139 | }
140 |
--------------------------------------------------------------------------------
/example/lib/widgets/calendar_configs.dart:
--------------------------------------------------------------------------------
1 | import 'package:calendar_view/calendar_view.dart';
2 | import 'package:flutter/material.dart';
3 |
4 | import '../enumerations.dart';
5 | import '../extension.dart';
6 | import '../theme/app_colors.dart';
7 | import 'add_event_form.dart';
8 |
9 | class CalendarConfig extends StatefulWidget {
10 | final void Function(CalendarView view) onViewChange;
11 | final void Function(bool)? onThemeChange;
12 | final CalendarView currentView;
13 |
14 | const CalendarConfig({
15 | super.key,
16 | required this.onViewChange,
17 | this.onThemeChange,
18 | this.currentView = CalendarView.month,
19 | });
20 |
21 | @override
22 | State createState() => _CalendarConfigState();
23 | }
24 |
25 | class _CalendarConfigState extends State {
26 | bool isDarkMode = false;
27 |
28 | @override
29 | Widget build(BuildContext context) {
30 | final color = Theme.of(context).colorScheme;
31 |
32 | return Column(
33 | mainAxisSize: MainAxisSize.min,
34 | crossAxisAlignment: CrossAxisAlignment.start,
35 | children: [
36 | Padding(
37 | padding: EdgeInsets.only(left: 20, top: 20),
38 | child: Text(
39 | "Flutter Calendar Page",
40 | style: TextStyle(
41 | color: color.onSurface,
42 | fontSize: 30,
43 | ),
44 | ),
45 | ),
46 | Divider(
47 | color: AppColors.lightNavyBlue,
48 | ),
49 | Expanded(
50 | child: SingleChildScrollView(
51 | padding: EdgeInsets.symmetric(horizontal: 20, vertical: 20),
52 | child: Column(
53 | mainAxisSize: MainAxisSize.min,
54 | crossAxisAlignment: CrossAxisAlignment.start,
55 | children: [
56 | Row(
57 | mainAxisAlignment: MainAxisAlignment.end,
58 | children: [
59 | Text(
60 | 'Dark mode: ',
61 | style: TextStyle(
62 | fontSize: 20.0,
63 | color: color.onSurface,
64 | ),
65 | ),
66 | Switch(
67 | value: isDarkMode,
68 | onChanged: (value) {
69 | setState(() => isDarkMode = value);
70 | if (widget.onThemeChange != null) {
71 | widget.onThemeChange!(isDarkMode);
72 | }
73 | },
74 | ),
75 | ],
76 | ),
77 | Text(
78 | "Active View:",
79 | style: TextStyle(
80 | fontSize: 20.0,
81 | color: Theme.of(context).colorScheme.onSurface,
82 | ),
83 | ),
84 | Wrap(
85 | children: List.generate(
86 | CalendarView.values.length,
87 | (index) {
88 | final view = CalendarView.values[index];
89 | return GestureDetector(
90 | onTap: () => widget.onViewChange(view),
91 | child: Container(
92 | padding: EdgeInsets.symmetric(
93 | vertical: 10,
94 | horizontal: 40,
95 | ),
96 | margin: EdgeInsets.only(
97 | right: 20,
98 | top: 20,
99 | ),
100 | decoration: BoxDecoration(
101 | borderRadius: BorderRadius.circular(7),
102 | color: view == widget.currentView
103 | ? AppColors.navyBlue
104 | : AppColors.bluishGrey,
105 | ),
106 | child: Text(
107 | view.name.capitalized,
108 | style: TextStyle(
109 | color: view == widget.currentView
110 | ? AppColors.white
111 | : AppColors.black,
112 | fontSize: 17,
113 | ),
114 | ),
115 | ),
116 | );
117 | },
118 | ),
119 | ),
120 | SizedBox(
121 | height: 40,
122 | ),
123 | Text(
124 | "Add Event: ",
125 | style: TextStyle(
126 | fontSize: 20.0,
127 | color: color.onSurface,
128 | ),
129 | ),
130 | SizedBox(
131 | height: 20,
132 | ),
133 | AddOrEditEventForm(
134 | onEventAdd: (event) {
135 | CalendarControllerProvider.of(context)
136 | .controller
137 | .add(event);
138 | },
139 | ),
140 | ],
141 | ),
142 | ),
143 | ),
144 | ],
145 | );
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/doc/theme_guide.md:
--------------------------------------------------------------------------------
1 | ## **Customise theme**
2 | The default theme supports dark mode. Refer this colors to override it.
3 |
4 | | Name | Parameter | Default color |
5 | |-----------------------------------------------|------------------------|-------------------------------------|
6 | | `MonthView` Border color | Color? borderColor | colorScheme.surfaceContainerHigh |
7 | | `WeekView` Background color of week view page | Color? backgroundColor | colorScheme.surfaceContainerLowest |
8 | | `DayView` Default background color | Color? backgroundColor | colorScheme.surfaceContainerLow |
9 | | `FilledCell` Dates in month cell color | Color? backgroundColor | colorScheme.surfaceContainerLowest |
10 | | `FilledCell` Dates not in month cell color | Color? backgroundColor | colorScheme.surfaceContainerLow |
11 | | `WeekDayTile` Border color | Color? borderColor | colorScheme.secondaryContainer |
12 | | `WeekDayTile` Background color | Color? backgroundColor | colorScheme.surfaceContainerHigh |
13 | | `WeekDayTile` Text style color | TextStyle? textStyle | colorScheme.onSecondaryContainer |
14 |
15 | To customise `MonthView`, `DayView` & `WeekView` page header use `HeaderStyle`.
16 |
17 | ```dart
18 | headerStyle: HeaderStyle(
19 | leftIconConfig: IconDataConfig(color: Colors.red),
20 | rightIconConfig: IconDataConfig(color: Colors.red),
21 | decoration: BoxDecoration(
22 | color: Theme.of(context).highlightColor,
23 | ),
24 | ),
25 | ```
26 |
27 | ### Theme implementation approaches
28 |
29 | There are two main ways to customize the theme for calendar views:
30 |
31 | 1. **Using ThemeData extensions**:
32 | ```dart
33 | // Create custom theme
34 | final myMonthViewTheme = MonthViewTheme.light().copyWith(
35 | cellInMonthColor: Colors.blue.shade50,
36 | cellBorderColor: Colors.blue.shade300,
37 | );
38 |
39 | // Apply to your app theme
40 | final theme = ThemeData.light().copyWith(
41 | extensions: [
42 | myMonthViewTheme,
43 | DayViewTheme.light(),
44 | WeekViewTheme.light(),
45 | ],
46 | );
47 | ```
48 |
49 | 2. **Using CalendarThemeProvider**:
50 | ```dart
51 | CalendarThemeProvider(
52 | calendarTheme: CalendarTheme(
53 | monthViewTheme: MonthViewTheme.light().copyWith(
54 | cellInMonthColor: Colors.blue.shade50,
55 | ),
56 | dayViewTheme: DayViewTheme.light(),
57 | weekViewTheme: WeekViewTheme.light(),
58 | ),
59 | child: YourApp(),
60 | )
61 | ```
62 |
63 | ### Day view
64 | * Default timeline text color is `colorScheme.onSurface`.
65 | * Use `markingStyle` in `DefaultTimeLineMark` to give text style.
66 | * Default `LiveTimeIndicatorSettings` color `colorScheme.primaryColorLight`.
67 | * Use `liveTimeIndicatorSettings` to customise it.
68 | * Default hour, half hour & quarter color is `colorScheme.surfaceContainerHighest`.
69 | * Use `hourIndicatorSettings` to customise it.
70 |
71 | Default hour indicator settings.
72 | ```dart
73 | HourIndicatorSettings(
74 | height: widget.heightPerMinute,
75 | // Color of horizontal and vertical lines
76 | color: Theme.of(context).colorScheme.surfaceContainerHighest,
77 | offset: 5,
78 | );
79 | ```
80 |
81 | ### Week view
82 | * To customise week number & weekdays use `weekNumberBuilder` & `weekDayBuilder`.
83 | * Default week tile background color is `colorScheme.surfaceContainerHigh`.
84 | * Use `weekTitleBackgroundColor` to change background color.
85 | * Default page background color is `colorScheme.surfaceContainerLowest`.
86 | * Use `backgroundColor` to change background color.
87 | * Default timeline text color is `colorScheme.onSurface`. Use `markingStyle` in `DefaultTimeLineMark` to give text style.
88 | * To customise timeline use `timeLineBuilder`.
89 | * To change Hour lines color use `HourIndicatorSettings`.
90 | * To style hours, half hours & quarter hours use `HourIndicatorSettings`. Default color used is `surfaceContainerHighest`
91 |
92 | ```dart
93 | hourIndicatorSettings: HourIndicatorSettings(
94 | color: Colors.greenAccent,
95 | lineStyle: LineStyle.dashed,
96 | ),
97 | showHalfHours: true,
98 | halfHourIndicatorSettings: HourIndicatorSettings(
99 | color: Colors.redAccent,
100 | lineStyle: LineStyle.dashed,
101 | ),
102 | ```
103 |
104 | ### Month view
105 |
106 | * Default date cell color in month is `colorScheme.surfaceContainerLowest` and `colorScheme.surfaceContainerLow` for days not in month.
107 | * Use `cellBuilder` to completely customize the cell appearance:
108 |
109 | ```dart
110 | cellBuilder: (date, events, isToday, isInMonth, hideDaysNotInMonth) {
111 | return Container(
112 | decoration: BoxDecoration(
113 | color: isInMonth ? Colors.white : Colors.grey[200],
114 | border: Border.all(color: Colors.blue),
115 | ),
116 | child: Center(
117 | child: Text(
118 | date.day.toString(),
119 | style: TextStyle(
120 | color: isToday ? Colors.red : Colors.black,
121 | fontWeight: isToday ? FontWeight.bold : FontWeight.normal,
122 | ),
123 | ),
124 | ),
125 | );
126 | }
127 | ```
128 | * Use `showWeekTileBorder` to control week day title border visibility
129 | * Use `headerBuilder` to customize or completely replace the month header
130 |
--------------------------------------------------------------------------------
/example/lib/main.dart:
--------------------------------------------------------------------------------
1 | import 'dart:ui';
2 |
3 | import 'package:calendar_view/calendar_view.dart';
4 | import 'package:example/theme/app_theme.dart';
5 | import 'package:flutter/material.dart';
6 |
7 | import 'pages/home_page.dart';
8 | import 'theme/app_colors.dart';
9 |
10 | DateTime get _now => DateTime.now();
11 |
12 | void main() {
13 | runApp(MyApp());
14 | }
15 |
16 | class MyApp extends StatefulWidget {
17 | @override
18 | State createState() => _MyAppState();
19 | }
20 |
21 | class _MyAppState extends State {
22 | bool isDarkMode = false;
23 |
24 | // This widget is the root of your application.
25 | @override
26 | Widget build(BuildContext context) {
27 | return CalendarThemeProvider(
28 | calendarTheme: CalendarThemeData(
29 | monthViewTheme:
30 | isDarkMode ? MonthViewThemeData.dark() : MonthViewThemeData.light(),
31 | dayViewTheme: isDarkMode
32 | ? DayViewThemeData.dark()
33 | : DayViewThemeData.light()
34 | .copyWith(hourLineColor: AppColors.primary) as DayViewThemeData,
35 | weekViewTheme:
36 | isDarkMode ? WeekViewThemeData.dark() : WeekViewThemeData.light(),
37 | multiDayViewTheme: isDarkMode
38 | ? MultiDayViewThemeData.dark()
39 | : MultiDayViewThemeData.light(),
40 | ),
41 | child: CalendarControllerProvider(
42 | controller: EventController()..addAll(_events),
43 | child: MaterialApp(
44 | title: 'Flutter Calendar Page Demo',
45 | debugShowCheckedModeBanner: false,
46 | theme: AppTheme.light,
47 | darkTheme: AppTheme.dark,
48 | themeMode: isDarkMode ? ThemeMode.dark : ThemeMode.light,
49 | scrollBehavior: ScrollBehavior().copyWith(
50 | dragDevices: {
51 | PointerDeviceKind.trackpad,
52 | PointerDeviceKind.mouse,
53 | PointerDeviceKind.touch,
54 | },
55 | ),
56 | home: HomePage(
57 | onChangeTheme: (isDark) => setState(() => isDarkMode = isDark),
58 | ),
59 | ),
60 | ),
61 | );
62 | }
63 | }
64 |
65 | List _events = [
66 | CalendarEventData(
67 | date: _now,
68 | title: "Project meeting",
69 | description: "Today is project meeting.",
70 | startTime: DateTime(_now.year, _now.month, _now.day, 18, 30),
71 | endTime: DateTime(_now.year, _now.month, _now.day, 22),
72 | ),
73 | CalendarEventData(
74 | date: _now.subtract(Duration(days: 3)),
75 | recurrenceSettings: RecurrenceSettings.withCalculatedEndDate(
76 | startDate: _now.subtract(Duration(days: 3)),
77 | ),
78 | title: 'Leetcode Contest',
79 | description: 'Give leetcode contest',
80 | ),
81 | CalendarEventData(
82 | date: _now.subtract(Duration(days: 3)),
83 | recurrenceSettings: RecurrenceSettings.withCalculatedEndDate(
84 | startDate: _now.subtract(Duration(days: 3)),
85 | frequency: RepeatFrequency.daily,
86 | recurrenceEndOn: RecurrenceEnd.after,
87 | occurrences: 5,
88 | ),
89 | title: 'Physics test prep',
90 | description: 'Prepare for physics test',
91 | ),
92 | CalendarEventData(
93 | date: _now.add(Duration(days: 1)),
94 | startTime: DateTime(_now.year, _now.month, _now.day, 18),
95 | endTime: DateTime(_now.year, _now.month, _now.day, 19),
96 | recurrenceSettings: RecurrenceSettings(
97 | startDate: _now,
98 | endDate: _now.add(Duration(days: 5)),
99 | frequency: RepeatFrequency.daily,
100 | recurrenceEndOn: RecurrenceEnd.after,
101 | occurrences: 5,
102 | ),
103 | title: "Wedding anniversary",
104 | description: "Attend uncle's wedding anniversary.",
105 | ),
106 | CalendarEventData(
107 | date: _now,
108 | startTime: DateTime(_now.year, _now.month, _now.day, 14),
109 | endTime: DateTime(_now.year, _now.month, _now.day, 17),
110 | title: "Football Tournament",
111 | description: "Go to football tournament.",
112 | ),
113 | CalendarEventData(
114 | date: _now.add(Duration(days: 3)),
115 | startTime: DateTime(_now.add(Duration(days: 3)).year,
116 | _now.add(Duration(days: 3)).month, _now.add(Duration(days: 3)).day, 10),
117 | endTime: DateTime(_now.add(Duration(days: 3)).year,
118 | _now.add(Duration(days: 3)).month, _now.add(Duration(days: 3)).day, 14),
119 | title: "Sprint Meeting.",
120 | description: "Last day of project submission for last year.",
121 | ),
122 | CalendarEventData(
123 | date: _now.subtract(Duration(days: 2)),
124 | startTime: DateTime(
125 | _now.subtract(Duration(days: 2)).year,
126 | _now.subtract(Duration(days: 2)).month,
127 | _now.subtract(Duration(days: 2)).day,
128 | 14),
129 | endTime: DateTime(
130 | _now.subtract(Duration(days: 2)).year,
131 | _now.subtract(Duration(days: 2)).month,
132 | _now.subtract(Duration(days: 2)).day,
133 | 16),
134 | title: "Team Meeting",
135 | description: "Team Meeting",
136 | ),
137 | CalendarEventData(
138 | date: _now.subtract(Duration(days: 2)),
139 | startTime: DateTime(
140 | _now.subtract(Duration(days: 2)).year,
141 | _now.subtract(Duration(days: 2)).month,
142 | _now.subtract(Duration(days: 2)).day,
143 | 10),
144 | endTime: DateTime(
145 | _now.subtract(Duration(days: 2)).year,
146 | _now.subtract(Duration(days: 2)).month,
147 | _now.subtract(Duration(days: 2)).day,
148 | 12),
149 | title: "Chemistry Viva",
150 | description: "Today is Joe's birthday.",
151 | ),
152 | ];
153 |
--------------------------------------------------------------------------------
/lib/src/theme/day_view_theme_data.dart:
--------------------------------------------------------------------------------
1 | import 'package:flutter/material.dart';
2 |
3 | import 'dark_app_colors.dart';
4 | import 'light_app_colors.dart';
5 |
6 | class DayViewThemeData extends ThemeExtension {
7 | /// Define custom colors
8 | DayViewThemeData({
9 | required this.hourLineColor,
10 | required this.halfHourLineColor,
11 | required this.quarterHourLineColor,
12 | required this.pageBackgroundColor,
13 | required this.liveIndicatorColor,
14 | required this.headerIconColor,
15 | required this.headerTextColor,
16 | required this.headerBackgroundColor,
17 | required this.timelineTextColor,
18 | });
19 |
20 | // Hour line properties
21 | final Color hourLineColor;
22 | final Color halfHourLineColor;
23 | final Color quarterHourLineColor;
24 |
25 | // Calendar page header
26 | final Color headerIconColor;
27 | final Color headerTextColor;
28 | final Color headerBackgroundColor;
29 |
30 | // Other properties
31 | final Color pageBackgroundColor;
32 | final Color liveIndicatorColor;
33 |
34 | // Timeline property
35 | final Color timelineTextColor;
36 |
37 | /// Get pre-defined colors for light theme
38 | DayViewThemeData.light()
39 | : hourLineColor = LightAppColors.surfaceContainerHighest,
40 | halfHourLineColor = LightAppColors.surfaceContainerHighest,
41 | quarterHourLineColor = LightAppColors.surfaceContainerHighest,
42 | pageBackgroundColor = LightAppColors.surfaceContainerLowest,
43 | liveIndicatorColor = LightAppColors.primary,
44 | headerIconColor = LightAppColors.onPrimary,
45 | headerTextColor = LightAppColors.onPrimary,
46 | headerBackgroundColor = LightAppColors.primary,
47 | timelineTextColor = LightAppColors.onSurface;
48 |
49 | /// Get pre-defined colors for dark theme
50 | DayViewThemeData.dark()
51 | : hourLineColor = DarkAppColors.surfaceContainerHighest,
52 | halfHourLineColor = DarkAppColors.surfaceContainerHighest,
53 | quarterHourLineColor = DarkAppColors.surfaceContainerHighest,
54 | pageBackgroundColor = DarkAppColors.surfaceContainerLowest,
55 | liveIndicatorColor = DarkAppColors.primary,
56 | headerIconColor = DarkAppColors.onPrimary,
57 | headerTextColor = DarkAppColors.onPrimary,
58 | headerBackgroundColor = DarkAppColors.primary,
59 | timelineTextColor = DarkAppColors.onSurface;
60 |
61 | @override
62 | ThemeExtension copyWith({
63 | Color? hourLineColor,
64 | Color? halfHourLineColor,
65 | Color? quarterHourLineColor,
66 | Color? pageBackgroundColor,
67 | Color? liveIndicatorColor,
68 | Color? headerIconColor,
69 | Color? headerTextColor,
70 | Color? headerBackgroundColor,
71 | Color? timelineTextColor,
72 | }) {
73 | return DayViewThemeData(
74 | hourLineColor: hourLineColor ?? this.hourLineColor,
75 | halfHourLineColor: halfHourLineColor ?? this.halfHourLineColor,
76 | quarterHourLineColor: quarterHourLineColor ?? this.quarterHourLineColor,
77 | pageBackgroundColor: pageBackgroundColor ?? this.pageBackgroundColor,
78 | liveIndicatorColor: liveIndicatorColor ?? this.liveIndicatorColor,
79 | headerIconColor: headerIconColor ?? this.headerIconColor,
80 | headerTextColor: headerTextColor ?? this.headerTextColor,
81 | headerBackgroundColor:
82 | headerBackgroundColor ?? this.headerBackgroundColor,
83 | timelineTextColor: timelineTextColor ?? this.timelineTextColor,
84 | );
85 | }
86 |
87 | @override
88 | ThemeExtension lerp(
89 | covariant ThemeExtension? other,
90 | double t,
91 | ) {
92 | if (other is! DayViewThemeData) {
93 | return this;
94 | }
95 | return DayViewThemeData(
96 | hourLineColor:
97 | Color.lerp(hourLineColor, other.hourLineColor, t) ?? hourLineColor,
98 | halfHourLineColor:
99 | Color.lerp(halfHourLineColor, other.halfHourLineColor, t) ??
100 | halfHourLineColor,
101 | quarterHourLineColor:
102 | Color.lerp(quarterHourLineColor, other.quarterHourLineColor, t) ??
103 | quarterHourLineColor,
104 | pageBackgroundColor:
105 | Color.lerp(pageBackgroundColor, other.pageBackgroundColor, t) ??
106 | pageBackgroundColor,
107 | liveIndicatorColor:
108 | Color.lerp(liveIndicatorColor, other.liveIndicatorColor, t) ??
109 | liveIndicatorColor,
110 | headerIconColor: Color.lerp(headerIconColor, other.headerIconColor, t) ??
111 | headerIconColor,
112 | headerTextColor: Color.lerp(headerTextColor, other.headerTextColor, t) ??
113 | headerTextColor,
114 | headerBackgroundColor:
115 | Color.lerp(headerBackgroundColor, other.headerBackgroundColor, t) ??
116 | headerBackgroundColor,
117 | timelineTextColor:
118 | Color.lerp(timelineTextColor, other.timelineTextColor, t) ??
119 | timelineTextColor,
120 | );
121 | }
122 |
123 | /// Merges another `DayViewThemeData` into this one.
124 | ThemeExtension merge(DayViewThemeData? other) {
125 | if (other == null) return this;
126 |
127 | return copyWith(
128 | hourLineColor: other.hourLineColor,
129 | halfHourLineColor: other.halfHourLineColor,
130 | quarterHourLineColor: other.quarterHourLineColor,
131 | pageBackgroundColor: other.pageBackgroundColor,
132 | liveIndicatorColor: other.liveIndicatorColor,
133 | headerIconColor: other.headerIconColor,
134 | headerTextColor: other.headerTextColor,
135 | headerBackgroundColor: other.headerBackgroundColor,
136 | timelineTextColor: other.timelineTextColor,
137 | );
138 | }
139 | }
140 |
--------------------------------------------------------------------------------