├── example ├── linux │ ├── .gitignore │ ├── main.cc │ ├── flutter │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ ├── my_application.h │ ├── 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 ├── macos │ ├── Flutter │ │ ├── Flutter-Debug.xcconfig │ │ ├── Flutter-Release.xcconfig │ │ └── GeneratedPluginRegistrant.swift │ ├── Runner │ │ ├── Configs │ │ │ ├── Debug.xcconfig │ │ │ ├── Release.xcconfig │ │ │ ├── Warnings.xcconfig │ │ │ └── AppInfo.xcconfig │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ ├── app_icon_128.png │ │ │ │ ├── app_icon_16.png │ │ │ │ ├── app_icon_256.png │ │ │ │ ├── app_icon_32.png │ │ │ │ ├── app_icon_512.png │ │ │ │ ├── app_icon_64.png │ │ │ │ ├── app_icon_1024.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 ├── web │ ├── favicon.png │ ├── icons │ │ ├── Icon-192.png │ │ ├── Icon-512.png │ │ ├── Icon-maskable-192.png │ │ └── Icon-maskable-512.png │ ├── manifest.json │ └── index.html ├── 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 │ │ │ │ │ │ └── example │ │ │ │ │ │ └── example │ │ │ │ │ │ └── MainActivity.kt │ │ │ │ └── AndroidManifest.xml │ │ │ ├── debug │ │ │ │ └── AndroidManifest.xml │ │ │ └── profile │ │ │ │ └── AndroidManifest.xml │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ └── gradle-wrapper.properties │ ├── .gitignore │ ├── settings.gradle │ └── build.gradle ├── windows │ ├── runner │ │ ├── resources │ │ │ └── app_icon.ico │ │ ├── resource.h │ │ ├── utils.h │ │ ├── runner.exe.manifest │ │ ├── flutter_window.h │ │ ├── main.cpp │ │ ├── CMakeLists.txt │ │ ├── utils.cpp │ │ ├── flutter_window.cpp │ │ ├── Runner.rc │ │ ├── win32_window.h │ │ └── win32_window.cpp │ ├── flutter │ │ ├── generated_plugin_registrant.cc │ │ ├── generated_plugin_registrant.h │ │ ├── generated_plugins.cmake │ │ └── CMakeLists.txt │ ├── .gitignore │ └── CMakeLists.txt ├── README.md ├── .gitignore ├── test │ └── widget_test.dart ├── analysis_options.yaml ├── .metadata ├── pubspec.yaml ├── pubspec.lock └── lib │ └── main.dart ├── analysis_options.yaml ├── test └── clean_calendar_test.dart ├── .metadata ├── lib ├── src │ ├── utils │ │ ├── simulate_tap_on_an_offset.dart │ │ ├── get_widget_center_offset_info.dart │ │ ├── get_suitable_dates_on_tap.dart │ │ ├── get_end_weekday_from_start_weekday.dat.dart │ │ ├── get_suitable_dates_properties.dart │ │ ├── get_suitable_calendar_general_date_widget.dart │ │ ├── get_weekdays_symbols_and_properties_based_on_starting_weekday.dart │ │ ├── get_suitable_calendar_streak_date_widget.dart │ │ └── space_fixer.dart │ ├── models │ │ ├── weekdays_decoration.dart │ │ ├── month_year_decoration.dart │ │ ├── header_properties.dart │ │ ├── navigator_decoration.dart │ │ ├── dates_properties.dart │ │ ├── weekdays_model.dart │ │ ├── months_model.dart │ │ ├── dates_decoration.dart │ │ └── weekdays_properties.dart │ ├── ui │ │ ├── calendar_dates_section │ │ │ ├── gridview_elements.dart │ │ │ ├── calendar_dates_section.dart │ │ │ └── pageview_builders.dart │ │ ├── calendar_weekday_header_section.dart │ │ ├── calendar_view.dart │ │ └── calendar_navigator_header_section.dart │ ├── size_provider.dart │ ├── state │ │ └── page_controller.dart │ └── clean_calendar.dart └── clean_calendar.dart ├── .gitignore ├── LICENSE ├── pubspec.yaml └── CHANGELOG.md /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/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/web/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/web/favicon.png -------------------------------------------------------------------------------- /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/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/chaudharydeepanshu/clean_calendar/HEAD/example/web/icons/Icon-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/web/icons/Icon-512.png -------------------------------------------------------------------------------- /example/macos/.gitignore: -------------------------------------------------------------------------------- 1 | # Flutter-related 2 | **/Flutter/ephemeral/ 3 | **/Pods/ 4 | 5 | # Xcode-related 6 | **/dgph 7 | **/xcuserdata/ 8 | -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/web/icons/Icon-maskable-192.png -------------------------------------------------------------------------------- /example/web/icons/Icon-maskable-512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/web/icons/Icon-maskable-512.png -------------------------------------------------------------------------------- /example/windows/runner/resources/app_icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/windows/runner/resources/app_icon.ico -------------------------------------------------------------------------------- /analysis_options.yaml: -------------------------------------------------------------------------------- 1 | include: package:flutter_lints/flutter.yaml 2 | 3 | # Additional information about this file can be found at 4 | # https://dart.dev/guides/language/analysis-options 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_128.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_16.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_256.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_32.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_512.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/HEAD/example/ios/Runner/Assets.xcassets/LaunchImage.imageset/LaunchImage@3x.png -------------------------------------------------------------------------------- /example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/HEAD/example/macos/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_1024.png -------------------------------------------------------------------------------- /example/android/app/src/main/kotlin/com/example/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.example.example 2 | 3 | import io.flutter.embedding.android.FlutterActivity 4 | 5 | class MainActivity: FlutterActivity() { 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-20x20@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-76x76@2x.png -------------------------------------------------------------------------------- /example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-1024x1024@1x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/chaudharydeepanshu/clean_calendar/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/chaudharydeepanshu/clean_calendar/HEAD/example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Icon-App-83.5x83.5@2x.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/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/macos/Runner.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /example/macos/Flutter/GeneratedPluginRegistrant.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | import FlutterMacOS 6 | import Foundation 7 | 8 | 9 | func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { 10 | } 11 | -------------------------------------------------------------------------------- /example/linux/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void fl_register_plugins(FlPluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip 6 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.cc: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #include "generated_plugin_registrant.h" 8 | 9 | 10 | void RegisterPlugins(flutter::PluginRegistry* registry) { 11 | } 12 | -------------------------------------------------------------------------------- /test/clean_calendar_test.dart: -------------------------------------------------------------------------------- 1 | void main() { 2 | // test('adds one to input values', () { 3 | // final calculator = Calculator(); 4 | // expect(calculator.addOne(2), 3); 5 | // expect(calculator.addOne(-7), -6); 6 | // expect(calculator.addOne(0), 1); 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/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 | -------------------------------------------------------------------------------- /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/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 | -------------------------------------------------------------------------------- /.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 and should not be manually edited. 5 | 6 | version: 7 | revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 8 | channel: beta 9 | 10 | project_type: package 11 | -------------------------------------------------------------------------------- /lib/src/utils/simulate_tap_on_an_offset.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/gestures.dart'; 2 | 3 | void simulateTapOnAnOffset(Offset offset) { 4 | GestureBinding.instance.handlePointerEvent(PointerDownEvent( 5 | position: offset, 6 | )); 7 | 8 | GestureBinding.instance.handlePointerEvent(PointerUpEvent( 9 | position: offset, 10 | )); 11 | } 12 | -------------------------------------------------------------------------------- /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 | **/*.keystore 13 | **/*.jks 14 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/utils/get_widget_center_offset_info.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | Offset getWidgetCenterOffsetInfo(GlobalKey widgetKey) { 4 | final RenderBox renderBox = 5 | widgetKey.currentContext?.findRenderObject() as RenderBox; 6 | 7 | final Offset offset = renderBox.localToGlobal(Offset.zero); 8 | 9 | return Offset((offset.dx), (offset.dy)); 10 | } 11 | -------------------------------------------------------------------------------- /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/linux/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void fl_register_plugins(FlPluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugin_registrant.h: -------------------------------------------------------------------------------- 1 | // 2 | // Generated file. Do not edit. 3 | // 4 | 5 | // clang-format off 6 | 7 | #ifndef GENERATED_PLUGIN_REGISTRANT_ 8 | #define GENERATED_PLUGIN_REGISTRANT_ 9 | 10 | #include 11 | 12 | // Registers Flutter plugins. 13 | void RegisterPlugins(flutter::PluginRegistry* registry); 14 | 15 | #endif // GENERATED_PLUGIN_REGISTRANT_ 16 | -------------------------------------------------------------------------------- /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/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/app/src/profile/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /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/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | 3 | def localPropertiesFile = new File(rootProject.projectDir, "local.properties") 4 | def properties = new Properties() 5 | 6 | assert localPropertiesFile.exists() 7 | localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) } 8 | 9 | def flutterSdkPath = properties.getProperty("flutter.sdk") 10 | assert flutterSdkPath != null, "flutter.sdk not set in local.properties" 11 | apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle" 12 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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://docs.flutter.dev/get-started/codelab) 12 | - [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook) 13 | 14 | For help getting started with Flutter development, view the 15 | [online documentation](https://docs.flutter.dev/), which offers tutorials, 16 | samples, guidance on mobile development, and a full API reference. 17 | -------------------------------------------------------------------------------- /lib/src/utils/get_suitable_dates_on_tap.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | 3 | Function()? getSuitableDatesOnTap({ 4 | required CalendarProperties calendarProperties, 5 | required DateTime pageViewElementDate, 6 | }) { 7 | if (calendarProperties.dateSelectionMode == DatePickerSelectionMode.disable) { 8 | return null; 9 | } 10 | if (calendarProperties.dateSelectionMode == 11 | DatePickerSelectionMode.singleOrMultiple) { 12 | return () { 13 | calendarProperties.onSelectedDates?.call([pageViewElementDate]); 14 | }; 15 | } else { 16 | return null; 17 | } 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 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | # Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock. 26 | /pubspec.lock 27 | **/doc/api/ 28 | .dart_tool/ 29 | .packages 30 | build/ 31 | -------------------------------------------------------------------------------- /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.example.example 12 | 13 | // The copyright displayed in application information 14 | PRODUCT_COPYRIGHT = Copyright © 2022 com.example. All rights reserved. 15 | -------------------------------------------------------------------------------- /example/ios/.gitignore: -------------------------------------------------------------------------------- 1 | **/dgph 2 | *.mode1v3 3 | *.mode2v3 4 | *.moved-aside 5 | *.pbxuser 6 | *.perspectivev3 7 | **/*sync/ 8 | .sconsign.dblite 9 | .tags* 10 | **/.vagrant/ 11 | **/DerivedData/ 12 | Icon? 13 | **/Pods/ 14 | **/.symlinks/ 15 | profile 16 | xcuserdata 17 | **/.generated/ 18 | Flutter/App.framework 19 | Flutter/Flutter.framework 20 | Flutter/Flutter.podspec 21 | Flutter/Generated.xcconfig 22 | Flutter/ephemeral/ 23 | Flutter/app.flx 24 | Flutter/app.zip 25 | Flutter/flutter_assets/ 26 | Flutter/flutter_export_environment.sh 27 | ServiceDefinitions.json 28 | Runner/GeneratedPluginRegistrant.* 29 | 30 | # Exceptions to above rules. 31 | !default.mode1v3 32 | !default.mode2v3 33 | !default.pbxuser 34 | !default.perspectivev3 35 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.kotlin_version = '1.6.10' 3 | repositories { 4 | google() 5 | mavenCentral() 6 | } 7 | 8 | dependencies { 9 | classpath 'com.android.tools.build:gradle:7.1.2' 10 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 11 | } 12 | } 13 | 14 | allprojects { 15 | repositories { 16 | google() 17 | mavenCentral() 18 | } 19 | } 20 | 21 | rootProject.buildDir = '../build' 22 | subprojects { 23 | project.buildDir = "${rootProject.buildDir}/${project.name}" 24 | } 25 | subprojects { 26 | project.evaluationDependsOn(':app') 27 | } 28 | 29 | task clean(type: Delete) { 30 | delete rootProject.buildDir 31 | } 32 | -------------------------------------------------------------------------------- /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/linux/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/linux plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/linux plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/windows/flutter/generated_plugins.cmake: -------------------------------------------------------------------------------- 1 | # 2 | # Generated file, do not edit. 3 | # 4 | 5 | list(APPEND FLUTTER_PLUGIN_LIST 6 | ) 7 | 8 | list(APPEND FLUTTER_FFI_PLUGIN_LIST 9 | ) 10 | 11 | set(PLUGIN_BUNDLED_LIBRARIES) 12 | 13 | foreach(plugin ${FLUTTER_PLUGIN_LIST}) 14 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${plugin}/windows plugins/${plugin}) 15 | target_link_libraries(${BINARY_NAME} PRIVATE ${plugin}_plugin) 16 | list(APPEND PLUGIN_BUNDLED_LIBRARIES $) 17 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${plugin}_bundled_libraries}) 18 | endforeach(plugin) 19 | 20 | foreach(ffi_plugin ${FLUTTER_FFI_PLUGIN_LIST}) 21 | add_subdirectory(flutter/ephemeral/.plugin_symlinks/${ffi_plugin}/windows plugins/${ffi_plugin}) 22 | list(APPEND PLUGIN_BUNDLED_LIBRARIES ${${ffi_plugin}_bundled_libraries}) 23 | endforeach(ffi_plugin) 24 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # Miscellaneous 2 | *.class 3 | *.log 4 | *.pyc 5 | *.swp 6 | .DS_Store 7 | .atom/ 8 | .buildlog/ 9 | .history 10 | .svn/ 11 | migrate_working_dir/ 12 | 13 | # IntelliJ related 14 | *.iml 15 | *.ipr 16 | *.iws 17 | .idea/ 18 | 19 | # The .vscode folder contains launch configuration and tasks you configure in 20 | # VS Code which you may wish to be included in version control, so this line 21 | # is commented out by default. 22 | #.vscode/ 23 | 24 | # Flutter/Dart/Pub related 25 | **/doc/api/ 26 | **/ios/Flutter/.last_build_id 27 | .dart_tool/ 28 | .flutter-plugins 29 | .flutter-plugins-dependencies 30 | .packages 31 | .pub-cache/ 32 | .pub/ 33 | /build/ 34 | 35 | # Symbolication related 36 | app.*.symbols 37 | 38 | # Obfuscation related 39 | app.*.map.json 40 | 41 | # Android Studio will place build artifacts here 42 | /android/app/debug 43 | /android/app/profile 44 | /android/app/release 45 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/clean_calendar.dart: -------------------------------------------------------------------------------- 1 | export 'src/clean_calendar.dart' show CleanCalendar; 2 | 3 | export 'src/models/months_model.dart' show Months; 4 | 5 | export 'src/models/weekdays_model.dart' show Weekdays; 6 | 7 | export 'src/models/weekdays_properties.dart' show WeekdaysProperties; 8 | 9 | export 'src/models/weekdays_decoration.dart' show WeekdaysDecoration; 10 | 11 | export 'src/models/calendar_properties.dart' 12 | show 13 | WeekDay, 14 | DatePickerCalendarView, 15 | DatePickerSelectionMode, 16 | CalendarProperties; 17 | 18 | export 'src/models/dates_decoration.dart' show DatesDecoration; 19 | 20 | export 'src/models/dates_properties.dart' show DatesProperties; 21 | 22 | export 'src/models/header_properties.dart' show HeaderProperties; 23 | 24 | export 'src/models/month_year_decoration.dart' show MonthYearDecoration; 25 | 26 | export 'src/models/navigator_decoration.dart' show NavigatorDecoration; 27 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /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 | "src": "icons/Icon-maskable-192.png", 24 | "sizes": "192x192", 25 | "type": "image/png", 26 | "purpose": "maskable" 27 | }, 28 | { 29 | "src": "icons/Icon-maskable-512.png", 30 | "sizes": "512x512", 31 | "type": "image/png", 32 | "purpose": "maskable" 33 | } 34 | ] 35 | } 36 | -------------------------------------------------------------------------------- /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 "win32_window.h" 10 | 11 | // A window that does nothing but host a Flutter view. 12 | class FlutterWindow : public Win32Window { 13 | public: 14 | // Creates a new FlutterWindow hosting a Flutter view running |project|. 15 | explicit FlutterWindow(const flutter::DartProject& project); 16 | virtual ~FlutterWindow(); 17 | 18 | protected: 19 | // Win32Window: 20 | bool OnCreate() override; 21 | void OnDestroy() override; 22 | LRESULT MessageHandler(HWND window, UINT const message, WPARAM const wparam, 23 | LPARAM const lparam) noexcept override; 24 | 25 | private: 26 | // The project to run. 27 | flutter::DartProject project_; 28 | 29 | // The Flutter instance hosted by this window. 30 | std::unique_ptr flutter_controller_; 31 | }; 32 | 33 | #endif // RUNNER_FLUTTER_WINDOW_H_ 34 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/models/weekdays_decoration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class WeekdaysDecoration { 4 | /// - weekdayTextColor, changes the weekday text color. 5 | final Color? weekdayTextColor; 6 | 7 | /// - weekdayTextStyle, changes the weekday text style. 8 | final TextStyle? weekdayTextStyle; 9 | 10 | WeekdaysDecoration({ 11 | this.weekdayTextColor, 12 | this.weekdayTextStyle, 13 | }); 14 | 15 | @override 16 | bool operator ==(Object other) => 17 | identical(this, other) || 18 | other is WeekdaysDecoration && 19 | runtimeType == other.runtimeType && 20 | weekdayTextColor == other.weekdayTextColor && 21 | weekdayTextStyle == other.weekdayTextStyle; 22 | 23 | @override 24 | int get hashCode => weekdayTextColor.hashCode ^ weekdayTextStyle.hashCode; 25 | 26 | // Implement toString to make it easier to see information 27 | // when using the print statement. 28 | @override 29 | String toString() { 30 | return 'WeekdaysDecoration{weekdayTextColor: $weekdayTextColor, weekdayTextStyle: $weekdayTextStyle}'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /lib/src/models/month_year_decoration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class MonthYearDecoration { 4 | /// - monthYearTextColor, changes the month and year text color. 5 | final Color? monthYearTextColor; 6 | 7 | /// - monthYearTextStyle, changes the month and year text style. 8 | final TextStyle? monthYearTextStyle; 9 | 10 | MonthYearDecoration({ 11 | this.monthYearTextColor, 12 | this.monthYearTextStyle, 13 | }); 14 | 15 | @override 16 | bool operator ==(Object other) => 17 | identical(this, other) || 18 | other is MonthYearDecoration && 19 | runtimeType == other.runtimeType && 20 | monthYearTextColor == other.monthYearTextColor && 21 | monthYearTextStyle == other.monthYearTextStyle; 22 | 23 | @override 24 | int get hashCode => monthYearTextColor.hashCode ^ monthYearTextStyle.hashCode; 25 | 26 | // Implement toString to make it easier to see information 27 | // when using the print statement. 28 | @override 29 | String toString() { 30 | return 'MonthYearDecoration{monthYearTextColor: $monthYearTextColor, monthYearTextStyle: $monthYearTextStyle}'; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /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:flutter/material.dart'; 9 | import 'package:flutter_test/flutter_test.dart'; 10 | 11 | import 'package:example/main.dart'; 12 | 13 | void main() { 14 | testWidgets('Counter increments smoke test', (WidgetTester tester) async { 15 | // Build our app and trigger a frame. 16 | await tester.pumpWidget(const MyApp()); 17 | 18 | // Verify that our counter starts at 0. 19 | expect(find.text('0'), findsOneWidget); 20 | expect(find.text('1'), findsNothing); 21 | 22 | // Tap the '+' icon and trigger a frame. 23 | await tester.tap(find.byIcon(Icons.add)); 24 | await tester.pump(); 25 | 26 | // Verify that our counter has incremented. 27 | expect(find.text('0'), findsNothing); 28 | expect(find.text('1'), findsOneWidget); 29 | }); 30 | } 31 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/utils/get_end_weekday_from_start_weekday.dat.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | 3 | int getEndWeekdayFromStartWeekday({required int startWeekday}) { 4 | final int endWeekday; 5 | int temp = startWeekday; 6 | for (int i = 2; i <= 7; i++) { 7 | temp = temp + 1; 8 | if (temp == 7 && i != 7) { 9 | temp = 0; 10 | } 11 | } 12 | endWeekday = temp; 13 | return endWeekday; 14 | } 15 | 16 | WeekDay getWeekdayFromInt(int weekDayInt) { 17 | if (weekDayInt == 1) { 18 | return WeekDay.monday; 19 | } else if (weekDayInt == 2) { 20 | return WeekDay.tuesday; 21 | } else if (weekDayInt == 3) { 22 | return WeekDay.wednesday; 23 | } else if (weekDayInt == 4) { 24 | return WeekDay.thursday; 25 | } else if (weekDayInt == 5) { 26 | return WeekDay.friday; 27 | } else if (weekDayInt == 6) { 28 | return WeekDay.saturday; 29 | } else { 30 | return WeekDay.sunday; 31 | } 32 | } 33 | 34 | int getIntFromWeekday(WeekDay weekday) { 35 | if (weekday == WeekDay.monday) { 36 | return 1; 37 | } else if (weekday == WeekDay.tuesday) { 38 | return 2; 39 | } else if (weekday == WeekDay.wednesday) { 40 | return 3; 41 | } else if (weekday == WeekDay.thursday) { 42 | return 4; 43 | } else if (weekday == WeekDay.friday) { 44 | return 5; 45 | } else if (weekday == WeekDay.saturday) { 46 | return 6; 47 | } else { 48 | return 7; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/ui/calendar_dates_section/gridview_elements.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/utils/get_suitable_calendar_general_date_widget.dart'; 3 | import 'package:clean_calendar/src/utils/get_suitable_calendar_streak_date_widget.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class CalendarDateWidget extends StatelessWidget { 7 | const CalendarDateWidget( 8 | {super.key, 9 | required this.calendarProperties, 10 | required this.pageViewElementDate, 11 | required this.pageViewDate}); 12 | 13 | final CalendarProperties calendarProperties; 14 | final DateTime pageViewElementDate; 15 | final DateTime pageViewDate; 16 | 17 | @override 18 | Widget build(BuildContext context) { 19 | if (calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 20 | return GetSuitableCalendarStreakDateWidget( 21 | calendarProperties: calendarProperties, 22 | pageViewElementDate: pageViewElementDate, 23 | pageViewDate: pageViewDate); 24 | } 25 | if (!calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 26 | return GetSuitableCalendarGeneralDateWidget( 27 | calendarProperties: calendarProperties, 28 | pageViewElementDate: pageViewElementDate, 29 | pageViewDate: pageViewDate, 30 | ); 31 | } else { 32 | return const SizedBox(); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /example/windows/runner/main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include "flutter_window.h" 6 | #include "utils.h" 7 | 8 | int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev, 9 | _In_ wchar_t *command_line, _In_ int show_command) { 10 | // Attach to console when present (e.g., 'flutter run') or create a 11 | // new console when running with a debugger. 12 | if (!::AttachConsole(ATTACH_PARENT_PROCESS) && ::IsDebuggerPresent()) { 13 | CreateAndAttachConsole(); 14 | } 15 | 16 | // Initialize COM, so that it is available for use in the library and/or 17 | // plugins. 18 | ::CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED); 19 | 20 | flutter::DartProject project(L"data"); 21 | 22 | std::vector command_line_arguments = 23 | GetCommandLineArguments(); 24 | 25 | project.set_dart_entrypoint_arguments(std::move(command_line_arguments)); 26 | 27 | FlutterWindow window(project); 28 | Win32Window::Point origin(10, 10); 29 | Win32Window::Size size(1280, 720); 30 | if (!window.CreateAndShow(L"example", origin, size)) { 31 | return EXIT_FAILURE; 32 | } 33 | window.SetQuitOnClose(true); 34 | 35 | ::MSG msg; 36 | while (::GetMessage(&msg, nullptr, 0, 0)) { 37 | ::TranslateMessage(&msg); 38 | ::DispatchMessage(&msg); 39 | } 40 | 41 | ::CoUninitialize(); 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2013 Deepanshu Chaudhary 2 | 3 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 4 | 5 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 6 | 7 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 8 | 9 | 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. 10 | 11 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- /lib/src/size_provider.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | 3 | class DateSectionSizeProvider { 4 | // Private constructor 5 | DateSectionSizeProvider._internal(); 6 | 7 | // Singleton instance 8 | static final DateSectionSizeProvider _instance = 9 | DateSectionSizeProvider._internal(); 10 | 11 | // Getter to access the instance 12 | static DateSectionSizeProvider get instance => _instance; 13 | 14 | double _width = 0; 15 | double _height = 0; 16 | 17 | double get width => _width; 18 | double get height => _height; 19 | 20 | void updateSize( 21 | double width, 22 | double height, 23 | ) { 24 | _width = width; 25 | _height = height; 26 | } 27 | 28 | double maxHeightOfDateView( 29 | double? calendarDatesSectionMaxHeight, 30 | ) { 31 | return calendarDatesSectionMaxHeight == double.infinity || 32 | calendarDatesSectionMaxHeight == null 33 | ? _height == double.infinity 34 | ? 240 35 | : _height 36 | : calendarDatesSectionMaxHeight; 37 | } 38 | 39 | double maxHeightOfDate( 40 | double? heightOfDateView, 41 | DatePickerCalendarView datePickerCalendarView, 42 | ) { 43 | if (datePickerCalendarView == DatePickerCalendarView.weekView) { 44 | return maxHeightOfDateView(heightOfDateView); 45 | } 46 | return maxHeightOfDateView(heightOfDateView) / 6; 47 | } 48 | 49 | double get widthOfDate { 50 | return (_width / 7) > 40 ? 40 : _width / 7; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /lib/src/models/header_properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/month_year_decoration.dart'; 2 | import 'package:clean_calendar/src/models/navigator_decoration.dart'; 3 | 4 | class HeaderProperties { 5 | /// - monthYearDecoration, changes the decoration of all months and years decoration in the header area of calendar. 6 | final MonthYearDecoration? monthYearDecoration; 7 | 8 | /// - navigatorDecoration, changes the decoration of navigator. 9 | final NavigatorDecoration? navigatorDecoration; 10 | 11 | HeaderProperties({ 12 | this.monthYearDecoration, 13 | this.navigatorDecoration, 14 | }); 15 | 16 | Map toMap() { 17 | return { 18 | 'monthYearDecoration': monthYearDecoration, 19 | 'navigatorDecoration': navigatorDecoration, 20 | }; 21 | } 22 | 23 | @override 24 | bool operator ==(Object other) => 25 | identical(this, other) || 26 | other is HeaderProperties && 27 | runtimeType == other.runtimeType && 28 | monthYearDecoration == other.monthYearDecoration && 29 | navigatorDecoration == other.navigatorDecoration; 30 | 31 | @override 32 | int get hashCode => 33 | monthYearDecoration.hashCode ^ navigatorDecoration.hashCode; 34 | 35 | // Implement toString to make it easier to see information 36 | // when using the print statement. 37 | @override 38 | String toString() { 39 | return 'HeaderProperties{monthYearDecoration: $monthYearDecoration, navigatorDecoration: $navigatorDecoration}'; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /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:flutter_lints/flutter.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 | -------------------------------------------------------------------------------- /lib/src/models/navigator_decoration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class NavigatorDecoration { 4 | /// - navigateLeftButtonIcon, changes the Icon widget for left navigation icon. 5 | final Icon? navigateLeftButtonIcon; 6 | 7 | /// - navigateRightButtonIcon, changes the Icon widget for right navigation icon. 8 | final Icon? navigateRightButtonIcon; 9 | 10 | /// - navigatorResetButtonIcon, changes the Icon widget for right navigation icon. 11 | final Icon? navigatorResetButtonIcon; 12 | 13 | NavigatorDecoration({ 14 | this.navigateLeftButtonIcon, 15 | this.navigateRightButtonIcon, 16 | this.navigatorResetButtonIcon, 17 | }); 18 | 19 | @override 20 | bool operator ==(Object other) => 21 | identical(this, other) || 22 | other is NavigatorDecoration && 23 | runtimeType == other.runtimeType && 24 | navigateLeftButtonIcon == other.navigateLeftButtonIcon && 25 | navigateRightButtonIcon == other.navigateRightButtonIcon && 26 | navigatorResetButtonIcon == other.navigatorResetButtonIcon; 27 | 28 | @override 29 | int get hashCode => 30 | navigateLeftButtonIcon.hashCode ^ 31 | navigateRightButtonIcon.hashCode ^ 32 | navigatorResetButtonIcon.hashCode; 33 | 34 | // Implement toString to make it easier to see information 35 | // when using the print statement. 36 | @override 37 | String toString() { 38 | return 'NavigatorDecoration{navigateLeftButtonIcon: $navigateLeftButtonIcon, navigateRightButtonIcon: $navigateRightButtonIcon, navigatorResetButtonIcon: $navigatorResetButtonIcon}'; 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /lib/src/models/dates_properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/dates_decoration.dart'; 2 | 3 | class DatesProperties { 4 | /// - datesDecoration, changes the dates decoration. 5 | final DatesDecoration? datesDecoration; 6 | 7 | /// - disable, disable dates. 8 | final bool? disable; 9 | 10 | /// - hide, hide dates. 11 | final bool? hide; 12 | 13 | DatesProperties({ 14 | this.datesDecoration, 15 | this.disable, 16 | this.hide, 17 | }); 18 | 19 | /// Creates copy of DatesProperties object with the given 20 | /// values replaced with new values. 21 | DatesProperties copyWith({ 22 | DatesDecoration? datesDecoration, 23 | bool? disable, 24 | bool? hide, 25 | }) { 26 | return DatesProperties( 27 | datesDecoration: datesDecoration ?? this.datesDecoration, 28 | disable: disable ?? this.disable, 29 | hide: hide ?? this.hide, 30 | ); 31 | } 32 | 33 | @override 34 | bool operator ==(Object other) => 35 | identical(this, other) || 36 | other is DatesProperties && 37 | runtimeType == other.runtimeType && 38 | datesDecoration == other.datesDecoration && 39 | disable == other.disable && 40 | hide == other.hide; 41 | 42 | @override 43 | int get hashCode => 44 | datesDecoration.hashCode ^ disable.hashCode ^ hide.hashCode; 45 | 46 | // Implement toString to make it easier to see information 47 | // when using the print statement. 48 | @override 49 | String toString() { 50 | return 'DatesProperties{decorationProperties: $datesDecoration, disable: $disable, hide: $hide}'; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/utils/get_suitable_dates_properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/models/dates_properties.dart'; 3 | 4 | DatesProperties getSuitableDatesProperties({ 5 | required CalendarProperties calendarProperties, 6 | required DateTime pageViewElementDate, 7 | required DateTime pageViewDate, 8 | }) { 9 | if (calendarProperties.selectedDates.contains(pageViewElementDate)) { 10 | return calendarProperties.selectedDatesProperties; 11 | } 12 | if (pageViewElementDate.month != pageViewDate.month) { 13 | return calendarProperties.leadingTrailingDatesProperties; 14 | } 15 | if (pageViewElementDate == calendarProperties.currentDateOfCalendar) { 16 | if (calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 17 | return calendarProperties.streakDatesProperties.copyWith( 18 | datesDecoration: calendarProperties 19 | .streakDatesProperties.datesDecoration 20 | ?.copyWith( 21 | datesTextColor: calendarProperties 22 | .currentDateProperties.datesDecoration?.datesTextColor, 23 | datesBorderColor: calendarProperties 24 | .currentDateProperties.datesDecoration?.datesBorderColor, 25 | datesTextStyle: calendarProperties 26 | .currentDateProperties.datesDecoration?.datesTextStyle, 27 | )); 28 | } else { 29 | return calendarProperties.currentDateProperties; 30 | } 31 | } 32 | if (calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 33 | return calendarProperties.streakDatesProperties; 34 | } else { 35 | return calendarProperties.generalDatesProperties; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /lib/src/utils/get_suitable_calendar_general_date_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/ui/calendar_dates_section/grid_view_elements/calendar_general_date_widgets.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class GetSuitableCalendarGeneralDateWidget extends StatelessWidget { 6 | const GetSuitableCalendarGeneralDateWidget( 7 | {super.key, 8 | required this.calendarProperties, 9 | required this.pageViewElementDate, 10 | required this.pageViewDate}); 11 | 12 | final CalendarProperties calendarProperties; 13 | final DateTime pageViewElementDate; 14 | final DateTime pageViewDate; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | if (calendarProperties.enableDenseViewForDates && 19 | calendarProperties.enableDenseSplashForDates) { 20 | return CalendarGeneralDenseSplashDate( 21 | calendarProperties: calendarProperties, 22 | pageViewElementDate: pageViewElementDate, 23 | pageViewDate: pageViewDate, 24 | ); 25 | } 26 | if (calendarProperties.enableDenseViewForDates) { 27 | return CalendarGeneralDenseDate( 28 | calendarProperties: calendarProperties, 29 | pageViewElementDate: pageViewElementDate, 30 | pageViewDate: pageViewDate, 31 | ); 32 | } 33 | if (!calendarProperties.enableDenseViewForDates) { 34 | return CalendarGeneralExpandedDate( 35 | calendarProperties: calendarProperties, 36 | pageViewElementDate: pageViewElementDate, 37 | pageViewDate: pageViewDate, 38 | ); 39 | } else { 40 | return const SizedBox(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/ui/calendar_dates_section/calendar_dates_section.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/size_provider.dart'; 3 | import 'package:clean_calendar/src/state/page_controller.dart'; 4 | import 'package:clean_calendar/src/ui/calendar_dates_section/pageview_builders.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class CalendarDatesSection extends StatelessWidget { 8 | const CalendarDatesSection( 9 | {super.key, 10 | required this.calendarProperties, 11 | required this.pageControllerState}); 12 | 13 | final CalendarProperties calendarProperties; 14 | final PageControllerState pageControllerState; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | if (calendarProperties.dateSelectionMode == 19 | DatePickerSelectionMode.singleOrMultiple || 20 | calendarProperties.dateSelectionMode == 21 | DatePickerSelectionMode.disable) { 22 | return LayoutBuilder(builder: (context, constraints) { 23 | DateSectionSizeProvider.instance.updateSize( 24 | constraints.maxWidth, 25 | constraints.maxHeight, 26 | ); 27 | return ConstrainedBox( 28 | constraints: BoxConstraints( 29 | maxHeight: DateSectionSizeProvider.instance.maxHeightOfDateView( 30 | calendarProperties.calendarDatesSectionMaxHeight, 31 | ), 32 | ), 33 | child: ScrollablePageViewBuilder( 34 | calendarProperties: calendarProperties, 35 | pageControllerState: pageControllerState, 36 | ), 37 | ); 38 | }); 39 | } else { 40 | return const SizedBox(); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 7 | 15 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 30 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /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: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 8 | channel: beta 9 | 10 | project_type: app 11 | 12 | # Tracks metadata for the flutter migrate command 13 | migration: 14 | platforms: 15 | - platform: root 16 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 17 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 18 | - platform: android 19 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 20 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 21 | - platform: ios 22 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 23 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 24 | - platform: linux 25 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 26 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 27 | - platform: macos 28 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 29 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 30 | - platform: web 31 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 32 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 33 | - platform: windows 34 | create_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 35 | base_revision: d952ca86d64772b1b9b0df27cf9ea145e80c38e5 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 | -------------------------------------------------------------------------------- /lib/src/models/weekdays_model.dart: -------------------------------------------------------------------------------- 1 | class Weekdays { 2 | final String monday; 3 | final String tuesday; 4 | final String wednesday; 5 | final String thursday; 6 | final String friday; 7 | final String saturday; 8 | final String sunday; 9 | 10 | const Weekdays({ 11 | required this.monday, 12 | required this.tuesday, 13 | required this.wednesday, 14 | required this.thursday, 15 | required this.friday, 16 | required this.saturday, 17 | required this.sunday, 18 | }); 19 | 20 | Map toMap() { 21 | return { 22 | 'monday': monday, 23 | 'tuesday': tuesday, 24 | 'wednesday': wednesday, 25 | 'thursday': thursday, 26 | 'friday': friday, 27 | 'saturday': saturday, 28 | 'sunday': sunday, 29 | }; 30 | } 31 | 32 | @override 33 | bool operator ==(Object other) => 34 | identical(this, other) || 35 | other is Weekdays && 36 | runtimeType == other.runtimeType && 37 | monday == other.monday && 38 | tuesday == other.tuesday && 39 | wednesday == other.wednesday && 40 | thursday == other.thursday && 41 | friday == other.friday && 42 | saturday == other.saturday && 43 | sunday == other.sunday; 44 | 45 | @override 46 | int get hashCode => 47 | monday.hashCode ^ 48 | tuesday.hashCode ^ 49 | wednesday.hashCode ^ 50 | thursday.hashCode ^ 51 | friday.hashCode ^ 52 | saturday.hashCode ^ 53 | sunday.hashCode; 54 | 55 | // Implement toString to make it easier to see information 56 | // when using the print statement. 57 | @override 58 | String toString() { 59 | return 'Weekdays{monday: $monday, tuesday: $tuesday, wednesday: $wednesday, thursday: $thursday, friday: $friday, saturday: $saturday, sunday: $sunday}'; 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /example/windows/runner/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14) 2 | project(runner LANGUAGES CXX) 3 | 4 | # Define the application target. To change its name, change BINARY_NAME in the 5 | # top-level CMakeLists.txt, not the value here, or `flutter run` will no longer 6 | # work. 7 | # 8 | # Any new source files that you add to the application should be added here. 9 | add_executable(${BINARY_NAME} WIN32 10 | "flutter_window.cpp" 11 | "main.cpp" 12 | "utils.cpp" 13 | "win32_window.cpp" 14 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 15 | "Runner.rc" 16 | "runner.exe.manifest" 17 | ) 18 | 19 | # Apply the standard set of build settings. This can be removed for applications 20 | # that need different build settings. 21 | apply_standard_settings(${BINARY_NAME}) 22 | 23 | # Add preprocessor definitions for the build version. 24 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"") 25 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}") 26 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}") 27 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}") 28 | target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}") 29 | 30 | # Disable Windows macros that collide with C++ standard library functions. 31 | target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX") 32 | 33 | # Add dependency libraries and include directories. Add any application-specific 34 | # dependencies here. 35 | target_link_libraries(${BINARY_NAME} PRIVATE flutter flutter_wrapper_app) 36 | target_include_directories(${BINARY_NAME} PRIVATE "${CMAKE_SOURCE_DIR}") 37 | 38 | # Run the Flutter tool portions of the build. This must not be removed. 39 | add_dependencies(${BINARY_NAME} flutter_assemble) 40 | -------------------------------------------------------------------------------- /example/ios/Runner/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleDisplayName 8 | Example 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 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIMainStoryboardFile 30 | Main 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | UIViewControllerBasedStatusBarAppearance 45 | 46 | CADisableMinimumFrameDurationOnPhone 47 | 48 | UIApplicationSupportsIndirectInputEvents 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /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 | std::string utf8_string; 52 | if (target_length == 0 || target_length > utf8_string.max_size()) { 53 | return utf8_string; 54 | } 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 | -------------------------------------------------------------------------------- /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(const flutter::DartProject& project) 8 | : project_(project) {} 9 | 10 | FlutterWindow::~FlutterWindow() {} 11 | 12 | bool FlutterWindow::OnCreate() { 13 | if (!Win32Window::OnCreate()) { 14 | return false; 15 | } 16 | 17 | RECT frame = GetClientArea(); 18 | 19 | // The size here must match the window dimensions to avoid unnecessary surface 20 | // creation / destruction in the startup path. 21 | flutter_controller_ = std::make_unique( 22 | frame.right - frame.left, frame.bottom - frame.top, project_); 23 | // Ensure that basic setup of the controller was successful. 24 | if (!flutter_controller_->engine() || !flutter_controller_->view()) { 25 | return false; 26 | } 27 | RegisterPlugins(flutter_controller_->engine()); 28 | SetChildContent(flutter_controller_->view()->GetNativeWindow()); 29 | return true; 30 | } 31 | 32 | void FlutterWindow::OnDestroy() { 33 | if (flutter_controller_) { 34 | flutter_controller_ = nullptr; 35 | } 36 | 37 | Win32Window::OnDestroy(); 38 | } 39 | 40 | LRESULT 41 | FlutterWindow::MessageHandler(HWND hwnd, UINT const message, 42 | WPARAM const wparam, 43 | LPARAM const lparam) noexcept { 44 | // Give Flutter, including plugins, an opportunity to handle window messages. 45 | if (flutter_controller_) { 46 | std::optional result = 47 | flutter_controller_->HandleTopLevelWindowProc(hwnd, message, wparam, 48 | lparam); 49 | if (result) { 50 | return *result; 51 | } 52 | } 53 | 54 | switch (message) { 55 | case WM_FONTCHANGE: 56 | flutter_controller_->engine()->ReloadSystemFonts(); 57 | break; 58 | } 59 | 60 | return Win32Window::MessageHandler(hwnd, message, wparam, lparam); 61 | } 62 | -------------------------------------------------------------------------------- /pubspec.yaml: -------------------------------------------------------------------------------- 1 | name: clean_calendar 2 | description: A brand-new Flutter calendar package that enables you to make a simple, lovely, and customizable calendar. 3 | version: 2.0.0 4 | homepage: https://github.com/chaudharydeepanshu/clean_calendar 5 | repository: https://github.com/chaudharydeepanshu/clean_calendar 6 | issue_tracker: https://github.com/chaudharydeepanshu/clean_calendar/issues 7 | 8 | environment: 9 | sdk: '>=2.17.0 <4.0.0' 10 | flutter: ">=1.17.0" 11 | 12 | dependencies: 13 | flutter: 14 | sdk: flutter 15 | 16 | dev_dependencies: 17 | flutter_test: 18 | sdk: flutter 19 | flutter_lints: ^4.0.0 20 | 21 | # For information on the generic Dart part of this file, see the 22 | # following page: https://dart.dev/tools/pub/pubspec 23 | 24 | # The following section is specific to Flutter packages. 25 | flutter: 26 | 27 | # To add assets to your package, add an assets section, like this: 28 | # assets: 29 | # - images/a_dot_burr.jpeg 30 | # - images/a_dot_ham.jpeg 31 | # 32 | # For details regarding assets in packages, see 33 | # https://flutter.dev/assets-and-images/#from-packages 34 | # 35 | # An image asset can refer to one or more resolution-specific "variants", see 36 | # https://flutter.dev/assets-and-images/#resolution-aware 37 | 38 | # To add custom fonts to your package, add a fonts section here, 39 | # in this "flutter" section. Each entry in this list should have a 40 | # "family" key with the font family name, and a "fonts" key with a 41 | # list giving the asset and other descriptors for the font. For 42 | # example: 43 | # fonts: 44 | # - family: Schyler 45 | # fonts: 46 | # - asset: fonts/Schyler-Regular.ttf 47 | # - asset: fonts/Schyler-Italic.ttf 48 | # style: italic 49 | # - family: Trajan Pro 50 | # fonts: 51 | # - asset: fonts/TrajanPro.ttf 52 | # - asset: fonts/TrajanPro_Bold.ttf 53 | # weight: 700 54 | # 55 | # For details regarding fonts in packages, see 56 | # https://flutter.dev/custom-fonts/#from-packages 57 | -------------------------------------------------------------------------------- /example/web/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | example 33 | 34 | 35 | 39 | 40 | 41 | 42 | 43 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /lib/src/utils/get_weekdays_symbols_and_properties_based_on_starting_weekday.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/clean_calendar.dart'; 2 | import 'package:clean_calendar/src/utils/get_end_weekday_from_start_weekday.dat.dart'; 3 | 4 | List getWeekdaysSymbolsListBasedOnStartingWeekday( 5 | {required WeekDay startWeekday, required Weekdays weekdaysSymbol}) { 6 | List weekdaysSymbolList = []; 7 | weekdaysSymbol.toMap().forEach((key, value) => weekdaysSymbolList.add(value)); 8 | 9 | List updatedWeekdaysSymbolList = []; 10 | 11 | int startWeekDayIndex = getIntFromWeekday(startWeekday) - 1; 12 | if (startWeekDayIndex != 0) { 13 | List startWeekdayBeforeWeekdaysSymbolList = 14 | weekdaysSymbolList.getRange(0, startWeekDayIndex).toList(); 15 | 16 | weekdaysSymbolList.removeRange(0, startWeekDayIndex); 17 | 18 | weekdaysSymbolList.addAll(startWeekdayBeforeWeekdaysSymbolList); 19 | } 20 | updatedWeekdaysSymbolList = weekdaysSymbolList; 21 | 22 | return updatedWeekdaysSymbolList; 23 | } 24 | 25 | List getWeekdaysDecorationListBasedOnStartingWeekday( 26 | {required WeekDay startWeekday, 27 | required WeekdaysProperties weekdaysProperties}) { 28 | List weekdaysPropertiesList = []; 29 | weekdaysProperties 30 | .toMap() 31 | .forEach((key, value) => weekdaysPropertiesList.add(value)); 32 | // Removing generalWeekdaysDecoration as not required. 33 | weekdaysPropertiesList.removeAt(0); 34 | 35 | List updatedWeekdaysPropertiesList = []; 36 | 37 | int startWeekDayIndex = getIntFromWeekday(startWeekday) - 1; 38 | if (startWeekDayIndex != 0) { 39 | List startWeekdayBeforeWeekdaysSymbolList = 40 | weekdaysPropertiesList.getRange(0, startWeekDayIndex).toList(); 41 | 42 | weekdaysPropertiesList.removeRange(0, startWeekDayIndex); 43 | 44 | weekdaysPropertiesList.addAll(startWeekdayBeforeWeekdaysSymbolList); 45 | } 46 | 47 | updatedWeekdaysPropertiesList = weekdaysPropertiesList; 48 | 49 | return updatedWeekdaysPropertiesList; 50 | } 51 | -------------------------------------------------------------------------------- /lib/src/ui/calendar_weekday_header_section.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/models/weekdays_decoration.dart'; 3 | import 'package:clean_calendar/src/utils/get_weekdays_symbols_and_properties_based_on_starting_weekday.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class CalendarWeekdayHeaderSection extends StatelessWidget { 7 | const CalendarWeekdayHeaderSection( 8 | {super.key, required this.calendarProperties}); 9 | 10 | final CalendarProperties calendarProperties; 11 | 12 | @override 13 | Widget build(BuildContext context) { 14 | List weekdaysSymbolsList = 15 | getWeekdaysSymbolsListBasedOnStartingWeekday( 16 | startWeekday: calendarProperties.startWeekday, 17 | weekdaysSymbol: calendarProperties.weekdaysSymbol); 18 | List weekdaysDecorationsList = 19 | getWeekdaysDecorationListBasedOnStartingWeekday( 20 | startWeekday: calendarProperties.startWeekday, 21 | weekdaysProperties: calendarProperties.weekdaysProperties); 22 | return GridView.builder( 23 | gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( 24 | childAspectRatio: 1, 25 | crossAxisCount: 7, 26 | mainAxisExtent: 40, 27 | ), 28 | itemCount: calendarProperties.weekdaysSymbol.toMap().length, 29 | physics: const NeverScrollableScrollPhysics(), 30 | shrinkWrap: true, 31 | itemBuilder: (context, index) => CalendarWeekdaySymbol( 32 | symbol: weekdaysSymbolsList[index], 33 | weekdayDecoration: weekdaysDecorationsList[index], 34 | ), 35 | ); 36 | } 37 | } 38 | 39 | class CalendarWeekdaySymbol extends StatelessWidget { 40 | const CalendarWeekdaySymbol( 41 | {super.key, required this.symbol, required this.weekdayDecoration}); 42 | 43 | final String symbol; 44 | 45 | final WeekdaysDecoration? weekdayDecoration; 46 | 47 | @override 48 | Widget build(BuildContext context) { 49 | return Center( 50 | child: Text( 51 | symbol.toString(), 52 | style: weekdayDecoration?.weekdayTextStyle 53 | ?.copyWith(color: weekdayDecoration?.weekdayTextColor) ?? 54 | const TextStyle() 55 | .copyWith(color: weekdayDecoration?.weekdayTextColor), 56 | maxLines: 1, 57 | overflow: TextOverflow.clip, 58 | ), 59 | ); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | def localProperties = new Properties() 2 | def localPropertiesFile = rootProject.file('local.properties') 3 | if (localPropertiesFile.exists()) { 4 | localPropertiesFile.withReader('UTF-8') { reader -> 5 | localProperties.load(reader) 6 | } 7 | } 8 | 9 | def flutterRoot = localProperties.getProperty('flutter.sdk') 10 | if (flutterRoot == null) { 11 | throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.") 12 | } 13 | 14 | def flutterVersionCode = localProperties.getProperty('flutter.versionCode') 15 | if (flutterVersionCode == null) { 16 | flutterVersionCode = '1' 17 | } 18 | 19 | def flutterVersionName = localProperties.getProperty('flutter.versionName') 20 | if (flutterVersionName == null) { 21 | flutterVersionName = '1.0' 22 | } 23 | 24 | apply plugin: 'com.android.application' 25 | apply plugin: 'kotlin-android' 26 | apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle" 27 | 28 | android { 29 | compileSdkVersion flutter.compileSdkVersion 30 | ndkVersion flutter.ndkVersion 31 | 32 | compileOptions { 33 | sourceCompatibility JavaVersion.VERSION_1_8 34 | targetCompatibility JavaVersion.VERSION_1_8 35 | } 36 | 37 | kotlinOptions { 38 | jvmTarget = '1.8' 39 | } 40 | 41 | sourceSets { 42 | main.java.srcDirs += 'src/main/kotlin' 43 | } 44 | 45 | defaultConfig { 46 | // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html). 47 | applicationId "com.example.example" 48 | // You can update the following values to match your application needs. 49 | // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration. 50 | minSdkVersion flutter.minSdkVersion 51 | targetSdkVersion flutter.targetSdkVersion 52 | versionCode flutterVersionCode.toInteger() 53 | versionName flutterVersionName 54 | } 55 | 56 | buildTypes { 57 | release { 58 | // TODO: Add your own signing config for the release build. 59 | // Signing with the debug keys for now, so `flutter run --release` works. 60 | signingConfig signingConfigs.debug 61 | } 62 | } 63 | } 64 | 65 | flutter { 66 | source '../..' 67 | } 68 | 69 | dependencies { 70 | implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" 71 | } 72 | -------------------------------------------------------------------------------- /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 | -------------------------------------------------------------------------------- /lib/src/models/months_model.dart: -------------------------------------------------------------------------------- 1 | class Months { 2 | final String january; 3 | final String february; 4 | final String march; 5 | final String april; 6 | final String may; 7 | final String june; 8 | final String july; 9 | final String august; 10 | final String september; 11 | final String october; 12 | final String november; 13 | final String december; 14 | 15 | const Months({ 16 | required this.january, 17 | required this.february, 18 | required this.march, 19 | required this.april, 20 | required this.may, 21 | required this.june, 22 | required this.july, 23 | required this.august, 24 | required this.september, 25 | required this.october, 26 | required this.november, 27 | required this.december, 28 | }); 29 | 30 | Map toMap() { 31 | return { 32 | 'january': january, 33 | 'february': february, 34 | 'march': march, 35 | 'april': april, 36 | 'may': may, 37 | 'june': june, 38 | 'july': july, 39 | 'august': august, 40 | 'september': september, 41 | 'october': october, 42 | 'november': november, 43 | 'december': december, 44 | }; 45 | } 46 | 47 | @override 48 | bool operator ==(Object other) => 49 | identical(this, other) || 50 | other is Months && 51 | runtimeType == other.runtimeType && 52 | january == other.january && 53 | february == other.february && 54 | march == other.march && 55 | april == other.april && 56 | may == other.may && 57 | june == other.june && 58 | july == other.july && 59 | august == other.august && 60 | september == other.september && 61 | october == other.october && 62 | november == other.november && 63 | december == other.december; 64 | 65 | @override 66 | int get hashCode => 67 | january.hashCode ^ 68 | february.hashCode ^ 69 | march.hashCode ^ 70 | april.hashCode ^ 71 | may.hashCode ^ 72 | june.hashCode ^ 73 | july.hashCode ^ 74 | august.hashCode ^ 75 | september.hashCode ^ 76 | october.hashCode ^ 77 | november.hashCode ^ 78 | december.hashCode; 79 | 80 | // Implement toString to make it easier to see information 81 | // when using the print statement. 82 | @override 83 | String toString() { 84 | return 'Months{january: $january, february: $february, march: $march, april: $april, may: $may, june: $june, july: $july, august: $august, september: $september, october: $october, november: $november, december: $december}'; 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /lib/src/models/dates_decoration.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class DatesDecoration { 4 | /// - datesBackgroundColor, changes the dates background color. 5 | final Color? datesBackgroundColor; 6 | 7 | /// - datesTextColor, changes the dates text color. 8 | final Color? datesTextColor; 9 | 10 | /// - datesTextStyle, changes the dates text style. 11 | final TextStyle? datesTextStyle; 12 | 13 | /// - datesBorderColor, changes the dates border color. 14 | final Color? datesBorderColor; 15 | 16 | /// - datesBorderRadius, changes the dates border radius. 17 | final double? datesBorderRadius; 18 | 19 | DatesDecoration({ 20 | this.datesBackgroundColor, 21 | this.datesTextColor, 22 | this.datesTextStyle, 23 | this.datesBorderColor, 24 | this.datesBorderRadius, 25 | }); 26 | 27 | /// Creates copy of DatesDecoration object with the given 28 | /// values replaced with new values. 29 | DatesDecoration copyWith({ 30 | Color? datesBackgroundColor, 31 | Color? datesTextColor, 32 | TextStyle? datesTextStyle, 33 | Color? datesBorderColor, 34 | double? datesBorderRadius, 35 | }) { 36 | return DatesDecoration( 37 | datesBackgroundColor: datesBackgroundColor ?? this.datesBackgroundColor, 38 | datesTextColor: datesTextColor ?? this.datesTextColor, 39 | datesTextStyle: datesTextStyle ?? this.datesTextStyle, 40 | datesBorderColor: datesBorderColor ?? this.datesBorderColor, 41 | datesBorderRadius: datesBorderRadius ?? this.datesBorderRadius, 42 | ); 43 | } 44 | 45 | @override 46 | bool operator ==(Object other) => 47 | identical(this, other) || 48 | other is DatesDecoration && 49 | runtimeType == other.runtimeType && 50 | datesBackgroundColor == other.datesBackgroundColor && 51 | datesTextColor == other.datesTextColor && 52 | datesTextStyle == other.datesTextStyle && 53 | datesBorderColor == other.datesBorderColor && 54 | datesBorderRadius == other.datesBorderRadius; 55 | 56 | @override 57 | int get hashCode => 58 | datesBackgroundColor.hashCode ^ 59 | datesTextColor.hashCode ^ 60 | datesTextStyle.hashCode ^ 61 | datesBorderColor.hashCode ^ 62 | datesBorderRadius.hashCode; 63 | 64 | // Implement toString to make it easier to see information 65 | // when using the print statement. 66 | @override 67 | String toString() { 68 | return 'DatesDecoration{datesBackgroundColor: $datesBackgroundColor, datesTextColor: $datesTextColor, datesTextStyle: $datesTextStyle, datesBorderColor: $datesBorderColor, datesBorderRadius: $datesBorderRadius}'; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /lib/src/ui/calendar_view.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/state/page_controller.dart'; 3 | import 'package:clean_calendar/src/ui/calendar_navigator_header_section.dart'; 4 | import 'package:clean_calendar/src/ui/calendar_dates_section/calendar_dates_section.dart'; 5 | import 'package:clean_calendar/src/ui/calendar_weekday_header_section.dart'; 6 | import 'package:flutter/material.dart'; 7 | 8 | class Calendar extends StatelessWidget { 9 | const Calendar({super.key, required this.calendarProperties}); 10 | 11 | final CalendarProperties calendarProperties; 12 | 13 | @override 14 | Widget build(BuildContext context) { 15 | return CalendarView(calendarProperties: calendarProperties); 16 | } 17 | } 18 | 19 | class CalendarView extends StatefulWidget { 20 | const CalendarView({super.key, required this.calendarProperties}); 21 | 22 | final CalendarProperties calendarProperties; 23 | 24 | @override 25 | State createState() => _CalendarViewState(); 26 | } 27 | 28 | class _CalendarViewState extends State { 29 | late PageControllerState pageControllerState; 30 | 31 | @override 32 | void initState() { 33 | pageControllerState = PageControllerState(widget.calendarProperties) 34 | ..init(); 35 | super.initState(); 36 | } 37 | 38 | @override 39 | void didUpdateWidget(covariant CalendarView oldWidget) { 40 | if (oldWidget.calendarProperties.initialViewMonthDateTime != 41 | widget.calendarProperties.initialViewMonthDateTime || 42 | oldWidget.calendarProperties.startDateOfCalendar != 43 | widget.calendarProperties.startDateOfCalendar || 44 | oldWidget.calendarProperties.endDateOfCalendar != 45 | widget.calendarProperties.endDateOfCalendar || 46 | oldWidget.calendarProperties.datePickerCalendarView != 47 | widget.calendarProperties.datePickerCalendarView) { 48 | setState(() { 49 | pageControllerState = PageControllerState(widget.calendarProperties) 50 | ..init(); 51 | }); 52 | } 53 | super.didUpdateWidget(oldWidget); 54 | } 55 | 56 | @override 57 | Widget build(BuildContext context) { 58 | return Column( 59 | children: [ 60 | CalendarNavigatorHeaderSection( 61 | calendarProperties: widget.calendarProperties, 62 | pageControllerState: pageControllerState), 63 | CalendarWeekdayHeaderSection( 64 | calendarProperties: widget.calendarProperties), 65 | CalendarDatesSection( 66 | calendarProperties: widget.calendarProperties, 67 | pageControllerState: pageControllerState), 68 | ], 69 | ); 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /example/linux/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.10) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | 12 | # Serves the same purpose as list(TRANSFORM ... PREPEND ...), 13 | # which isn't available in 3.10. 14 | function(list_prepend LIST_NAME PREFIX) 15 | set(NEW_LIST "") 16 | foreach(element ${${LIST_NAME}}) 17 | list(APPEND NEW_LIST "${PREFIX}${element}") 18 | endforeach(element) 19 | set(${LIST_NAME} "${NEW_LIST}" PARENT_SCOPE) 20 | endfunction() 21 | 22 | # === Flutter Library === 23 | # System-level dependencies. 24 | find_package(PkgConfig REQUIRED) 25 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 26 | pkg_check_modules(GLIB REQUIRED IMPORTED_TARGET glib-2.0) 27 | pkg_check_modules(GIO REQUIRED IMPORTED_TARGET gio-2.0) 28 | 29 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/libflutter_linux_gtk.so") 30 | 31 | # Published to parent scope for install step. 32 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 33 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 34 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 35 | set(AOT_LIBRARY "${PROJECT_DIR}/build/lib/libapp.so" PARENT_SCOPE) 36 | 37 | list(APPEND FLUTTER_LIBRARY_HEADERS 38 | "fl_basic_message_channel.h" 39 | "fl_binary_codec.h" 40 | "fl_binary_messenger.h" 41 | "fl_dart_project.h" 42 | "fl_engine.h" 43 | "fl_json_message_codec.h" 44 | "fl_json_method_codec.h" 45 | "fl_message_codec.h" 46 | "fl_method_call.h" 47 | "fl_method_channel.h" 48 | "fl_method_codec.h" 49 | "fl_method_response.h" 50 | "fl_plugin_registrar.h" 51 | "fl_plugin_registry.h" 52 | "fl_standard_message_codec.h" 53 | "fl_standard_method_codec.h" 54 | "fl_string_codec.h" 55 | "fl_value.h" 56 | "fl_view.h" 57 | "flutter_linux.h" 58 | ) 59 | list_prepend(FLUTTER_LIBRARY_HEADERS "${EPHEMERAL_DIR}/flutter_linux/") 60 | add_library(flutter INTERFACE) 61 | target_include_directories(flutter INTERFACE 62 | "${EPHEMERAL_DIR}" 63 | ) 64 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}") 65 | target_link_libraries(flutter INTERFACE 66 | PkgConfig::GTK 67 | PkgConfig::GLIB 68 | PkgConfig::GIO 69 | ) 70 | add_dependencies(flutter flutter_assemble) 71 | 72 | # === Flutter tool backend === 73 | # _phony_ is a non-existent file to force this command to run every time, 74 | # since currently there's no way to get a full input/output list from the 75 | # flutter tool. 76 | add_custom_command( 77 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 78 | ${CMAKE_CURRENT_BINARY_DIR}/_phony_ 79 | COMMAND ${CMAKE_COMMAND} -E env 80 | ${FLUTTER_TOOL_ENVIRONMENT} 81 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.sh" 82 | ${FLUTTER_TARGET_PLATFORM} ${CMAKE_BUILD_TYPE} 83 | VERBATIM 84 | ) 85 | add_custom_target(flutter_assemble DEPENDS 86 | "${FLUTTER_LIBRARY}" 87 | ${FLUTTER_LIBRARY_HEADERS} 88 | ) 89 | -------------------------------------------------------------------------------- /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/ios/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 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /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 | #if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD) 64 | #define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD 65 | #else 66 | #define VERSION_AS_NUMBER 1,0,0,0 67 | #endif 68 | 69 | #if defined(FLUTTER_VERSION) 70 | #define VERSION_AS_STRING FLUTTER_VERSION 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.example" "\0" 93 | VALUE "FileDescription", "example" "\0" 94 | VALUE "FileVersion", VERSION_AS_STRING "\0" 95 | VALUE "InternalName", "example" "\0" 96 | VALUE "LegalCopyright", "Copyright (C) 2022 com.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/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/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 | } else { 47 | gtk_window_set_title(window, "example"); 48 | } 49 | 50 | gtk_window_set_default_size(window, 1280, 720); 51 | gtk_widget_show(GTK_WIDGET(window)); 52 | 53 | g_autoptr(FlDartProject) project = fl_dart_project_new(); 54 | fl_dart_project_set_dart_entrypoint_arguments(project, self->dart_entrypoint_arguments); 55 | 56 | FlView* view = fl_view_new(project); 57 | gtk_widget_show(GTK_WIDGET(view)); 58 | gtk_container_add(GTK_CONTAINER(window), GTK_WIDGET(view)); 59 | 60 | fl_register_plugins(FL_PLUGIN_REGISTRY(view)); 61 | 62 | gtk_widget_grab_focus(GTK_WIDGET(view)); 63 | } 64 | 65 | // Implements GApplication::local_command_line. 66 | static gboolean my_application_local_command_line(GApplication* application, gchar*** arguments, int* exit_status) { 67 | MyApplication* self = MY_APPLICATION(application); 68 | // Strip out the first argument as it is the binary name. 69 | self->dart_entrypoint_arguments = g_strdupv(*arguments + 1); 70 | 71 | g_autoptr(GError) error = nullptr; 72 | if (!g_application_register(application, nullptr, &error)) { 73 | g_warning("Failed to register: %s", error->message); 74 | *exit_status = 1; 75 | return TRUE; 76 | } 77 | 78 | g_application_activate(application); 79 | *exit_status = 0; 80 | 81 | return TRUE; 82 | } 83 | 84 | // Implements GObject::dispose. 85 | static void my_application_dispose(GObject* object) { 86 | MyApplication* self = MY_APPLICATION(object); 87 | g_clear_pointer(&self->dart_entrypoint_arguments, g_strfreev); 88 | G_OBJECT_CLASS(my_application_parent_class)->dispose(object); 89 | } 90 | 91 | static void my_application_class_init(MyApplicationClass* klass) { 92 | G_APPLICATION_CLASS(klass)->activate = my_application_activate; 93 | G_APPLICATION_CLASS(klass)->local_command_line = my_application_local_command_line; 94 | G_OBJECT_CLASS(klass)->dispose = my_application_dispose; 95 | } 96 | 97 | static void my_application_init(MyApplication* self) {} 98 | 99 | MyApplication* my_application_new() { 100 | return MY_APPLICATION(g_object_new(my_application_get_type(), 101 | "application-id", APPLICATION_ID, 102 | "flags", G_APPLICATION_NON_UNIQUE, 103 | nullptr)); 104 | } 105 | -------------------------------------------------------------------------------- /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 `flutter 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 is 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 | # In Windows, build-name is used as the major, minor, and patch parts 19 | # of the product and file versions while build-number is used as the build suffix. 20 | version: 1.0.0+1 21 | 22 | environment: 23 | sdk: '>=2.17.0 <4.0.0' 24 | 25 | # Dependencies specify other packages that your package needs in order to work. 26 | # To automatically upgrade your package dependencies to the latest versions 27 | # consider running `flutter pub upgrade --major-versions`. Alternatively, 28 | # dependencies can be manually updated by changing the version numbers below to 29 | # the latest version available on pub.dev. To see which dependencies have newer 30 | # versions available, run `flutter pub outdated`. 31 | dependencies: 32 | flutter: 33 | sdk: flutter 34 | 35 | clean_calendar: 36 | path: ../ 37 | 38 | # The following adds the Cupertino Icons font to your application. 39 | # Use with the CupertinoIcons class for iOS style icons. 40 | cupertino_icons: ^1.0.8 41 | 42 | dev_dependencies: 43 | flutter_test: 44 | sdk: flutter 45 | 46 | # The "flutter_lints" package below contains a set of recommended lints to 47 | # encourage good coding practices. The lint set provided by the package is 48 | # activated in the `analysis_options.yaml` file located at the root of your 49 | # package. See that file for information about deactivating specific lint 50 | # rules and activating additional ones. 51 | flutter_lints: ^4.0.0 52 | 53 | # For information on the generic Dart part of this file, see the 54 | # following page: https://dart.dev/tools/pub/pubspec 55 | 56 | # The following section is specific to Flutter packages. 57 | flutter: 58 | 59 | # The following line ensures that the Material Icons font is 60 | # included with your application, so that you can use the icons in 61 | # the material Icons class. 62 | uses-material-design: true 63 | 64 | # To add assets to your application, add an assets section, like this: 65 | # assets: 66 | # - images/a_dot_burr.jpeg 67 | # - images/a_dot_ham.jpeg 68 | 69 | # An image asset can refer to one or more resolution-specific "variants", see 70 | # https://flutter.dev/assets-and-images/#resolution-aware 71 | 72 | # For details regarding adding assets from package dependencies, see 73 | # https://flutter.dev/assets-and-images/#from-packages 74 | 75 | # To add custom fonts to your application, add a fonts section here, 76 | # in this "flutter" section. Each entry in this list should have a 77 | # "family" key with the font family name, and a "fonts" key with a 78 | # list giving the asset and other descriptors for the font. For 79 | # example: 80 | # fonts: 81 | # - family: Schyler 82 | # fonts: 83 | # - asset: fonts/Schyler-Regular.ttf 84 | # - asset: fonts/Schyler-Italic.ttf 85 | # style: italic 86 | # - family: Trajan Pro 87 | # fonts: 88 | # - asset: fonts/TrajanPro.ttf 89 | # - asset: fonts/TrajanPro_Bold.ttf 90 | # weight: 700 91 | # 92 | # For details regarding fonts from package dependencies, 93 | # see https://flutter.dev/custom-fonts/#from-packages 94 | -------------------------------------------------------------------------------- /example/windows/flutter/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # This file controls Flutter-level build steps. It should not be edited. 2 | cmake_minimum_required(VERSION 3.14) 3 | 4 | set(EPHEMERAL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ephemeral") 5 | 6 | # Configuration provided via flutter tool. 7 | include(${EPHEMERAL_DIR}/generated_config.cmake) 8 | 9 | # TODO: Move the rest of this into files in ephemeral. See 10 | # https://github.com/flutter/flutter/issues/57146. 11 | set(WRAPPER_ROOT "${EPHEMERAL_DIR}/cpp_client_wrapper") 12 | 13 | # Set fallback configurations for older versions of the flutter tool. 14 | if (NOT DEFINED FLUTTER_TARGET_PLATFORM) 15 | set(FLUTTER_TARGET_PLATFORM "windows-x64") 16 | endif() 17 | 18 | # === Flutter Library === 19 | set(FLUTTER_LIBRARY "${EPHEMERAL_DIR}/flutter_windows.dll") 20 | 21 | # Published to parent scope for install step. 22 | set(FLUTTER_LIBRARY ${FLUTTER_LIBRARY} PARENT_SCOPE) 23 | set(FLUTTER_ICU_DATA_FILE "${EPHEMERAL_DIR}/icudtl.dat" PARENT_SCOPE) 24 | set(PROJECT_BUILD_DIR "${PROJECT_DIR}/build/" PARENT_SCOPE) 25 | set(AOT_LIBRARY "${PROJECT_DIR}/build/windows/app.so" PARENT_SCOPE) 26 | 27 | list(APPEND FLUTTER_LIBRARY_HEADERS 28 | "flutter_export.h" 29 | "flutter_windows.h" 30 | "flutter_messenger.h" 31 | "flutter_plugin_registrar.h" 32 | "flutter_texture_registrar.h" 33 | ) 34 | list(TRANSFORM FLUTTER_LIBRARY_HEADERS PREPEND "${EPHEMERAL_DIR}/") 35 | add_library(flutter INTERFACE) 36 | target_include_directories(flutter INTERFACE 37 | "${EPHEMERAL_DIR}" 38 | ) 39 | target_link_libraries(flutter INTERFACE "${FLUTTER_LIBRARY}.lib") 40 | add_dependencies(flutter flutter_assemble) 41 | 42 | # === Wrapper === 43 | list(APPEND CPP_WRAPPER_SOURCES_CORE 44 | "core_implementations.cc" 45 | "standard_codec.cc" 46 | ) 47 | list(TRANSFORM CPP_WRAPPER_SOURCES_CORE PREPEND "${WRAPPER_ROOT}/") 48 | list(APPEND CPP_WRAPPER_SOURCES_PLUGIN 49 | "plugin_registrar.cc" 50 | ) 51 | list(TRANSFORM CPP_WRAPPER_SOURCES_PLUGIN PREPEND "${WRAPPER_ROOT}/") 52 | list(APPEND CPP_WRAPPER_SOURCES_APP 53 | "flutter_engine.cc" 54 | "flutter_view_controller.cc" 55 | ) 56 | list(TRANSFORM CPP_WRAPPER_SOURCES_APP PREPEND "${WRAPPER_ROOT}/") 57 | 58 | # Wrapper sources needed for a plugin. 59 | add_library(flutter_wrapper_plugin STATIC 60 | ${CPP_WRAPPER_SOURCES_CORE} 61 | ${CPP_WRAPPER_SOURCES_PLUGIN} 62 | ) 63 | apply_standard_settings(flutter_wrapper_plugin) 64 | set_target_properties(flutter_wrapper_plugin PROPERTIES 65 | POSITION_INDEPENDENT_CODE ON) 66 | set_target_properties(flutter_wrapper_plugin PROPERTIES 67 | CXX_VISIBILITY_PRESET hidden) 68 | target_link_libraries(flutter_wrapper_plugin PUBLIC flutter) 69 | target_include_directories(flutter_wrapper_plugin PUBLIC 70 | "${WRAPPER_ROOT}/include" 71 | ) 72 | add_dependencies(flutter_wrapper_plugin flutter_assemble) 73 | 74 | # Wrapper sources needed for the runner. 75 | add_library(flutter_wrapper_app STATIC 76 | ${CPP_WRAPPER_SOURCES_CORE} 77 | ${CPP_WRAPPER_SOURCES_APP} 78 | ) 79 | apply_standard_settings(flutter_wrapper_app) 80 | target_link_libraries(flutter_wrapper_app PUBLIC flutter) 81 | target_include_directories(flutter_wrapper_app PUBLIC 82 | "${WRAPPER_ROOT}/include" 83 | ) 84 | add_dependencies(flutter_wrapper_app flutter_assemble) 85 | 86 | # === Flutter tool backend === 87 | # _phony_ is a non-existent file to force this command to run every time, 88 | # since currently there's no way to get a full input/output list from the 89 | # flutter tool. 90 | set(PHONY_OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/_phony_") 91 | set_source_files_properties("${PHONY_OUTPUT}" PROPERTIES SYMBOLIC TRUE) 92 | add_custom_command( 93 | OUTPUT ${FLUTTER_LIBRARY} ${FLUTTER_LIBRARY_HEADERS} 94 | ${CPP_WRAPPER_SOURCES_CORE} ${CPP_WRAPPER_SOURCES_PLUGIN} 95 | ${CPP_WRAPPER_SOURCES_APP} 96 | ${PHONY_OUTPUT} 97 | COMMAND ${CMAKE_COMMAND} -E env 98 | ${FLUTTER_TOOL_ENVIRONMENT} 99 | "${FLUTTER_ROOT}/packages/flutter_tools/bin/tool_backend.bat" 100 | ${FLUTTER_TARGET_PLATFORM} $ 101 | VERBATIM 102 | ) 103 | add_custom_target(flutter_assemble DEPENDS 104 | "${FLUTTER_LIBRARY}" 105 | ${FLUTTER_LIBRARY_HEADERS} 106 | ${CPP_WRAPPER_SOURCES_CORE} 107 | ${CPP_WRAPPER_SOURCES_PLUGIN} 108 | ${CPP_WRAPPER_SOURCES_APP} 109 | ) 110 | -------------------------------------------------------------------------------- /lib/src/models/weekdays_properties.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/weekdays_decoration.dart'; 2 | 3 | class WeekdaysProperties { 4 | /// - generalWeekdaysDecoration, changes the decoration of all weekdays except for which user has provided specific weekday decoration. 5 | final WeekdaysDecoration? generalWeekdaysDecoration; 6 | 7 | /// - mondayDecoration, changes the decoration of only monday weekday. 8 | final WeekdaysDecoration? mondayDecoration; 9 | 10 | /// - tuesdayDecoration, changes the decoration of only tuesday weekday. 11 | final WeekdaysDecoration? tuesdayDecoration; 12 | 13 | /// - wednesdayDecoration, changes the decoration of only wednesday weekday. 14 | final WeekdaysDecoration? wednesdayDecoration; 15 | 16 | /// - thursdayDecoration, changes the decoration of only thursday weekday. 17 | final WeekdaysDecoration? thursdayDecoration; 18 | 19 | /// - fridayDecoration, changes the decoration of only friday weekday. 20 | final WeekdaysDecoration? fridayDecoration; 21 | 22 | /// - saturdayDecoration, changes the decoration of only saturday weekday. 23 | final WeekdaysDecoration? saturdayDecoration; 24 | 25 | /// - sundayDecoration, changes the decoration of only sunday weekday. 26 | final WeekdaysDecoration? sundayDecoration; 27 | 28 | WeekdaysProperties({ 29 | this.generalWeekdaysDecoration, 30 | WeekdaysDecoration? mondayDecoration, 31 | WeekdaysDecoration? tuesdayDecoration, 32 | WeekdaysDecoration? wednesdayDecoration, 33 | WeekdaysDecoration? thursdayDecoration, 34 | WeekdaysDecoration? fridayDecoration, 35 | WeekdaysDecoration? saturdayDecoration, 36 | WeekdaysDecoration? sundayDecoration, 37 | }) : mondayDecoration = mondayDecoration ?? generalWeekdaysDecoration, 38 | tuesdayDecoration = tuesdayDecoration ?? generalWeekdaysDecoration, 39 | wednesdayDecoration = wednesdayDecoration ?? generalWeekdaysDecoration, 40 | thursdayDecoration = thursdayDecoration ?? generalWeekdaysDecoration, 41 | fridayDecoration = fridayDecoration ?? generalWeekdaysDecoration, 42 | saturdayDecoration = saturdayDecoration ?? generalWeekdaysDecoration, 43 | sundayDecoration = sundayDecoration ?? generalWeekdaysDecoration; 44 | 45 | Map toMap() { 46 | return { 47 | 'generalWeekdaysDecoration': generalWeekdaysDecoration, 48 | 'mondayDecoration': mondayDecoration, 49 | 'tuesdayDecoration': tuesdayDecoration, 50 | 'wednesdayDecoration': wednesdayDecoration, 51 | 'thursdayDecoration': thursdayDecoration, 52 | 'fridayDecoration': fridayDecoration, 53 | 'saturdayDecoration': saturdayDecoration, 54 | 'sundayDecoration': sundayDecoration, 55 | }; 56 | } 57 | 58 | @override 59 | bool operator ==(Object other) => 60 | identical(this, other) || 61 | other is WeekdaysProperties && 62 | runtimeType == other.runtimeType && 63 | generalWeekdaysDecoration == other.generalWeekdaysDecoration && 64 | mondayDecoration == other.mondayDecoration && 65 | tuesdayDecoration == other.tuesdayDecoration && 66 | wednesdayDecoration == other.wednesdayDecoration && 67 | thursdayDecoration == other.thursdayDecoration && 68 | fridayDecoration == other.fridayDecoration && 69 | saturdayDecoration == other.saturdayDecoration && 70 | sundayDecoration == other.sundayDecoration; 71 | 72 | @override 73 | int get hashCode => 74 | generalWeekdaysDecoration.hashCode ^ 75 | mondayDecoration.hashCode ^ 76 | tuesdayDecoration.hashCode ^ 77 | wednesdayDecoration.hashCode ^ 78 | thursdayDecoration.hashCode ^ 79 | fridayDecoration.hashCode ^ 80 | saturdayDecoration.hashCode ^ 81 | sundayDecoration.hashCode; 82 | 83 | // Implement toString to make it easier to see information 84 | // when using the print statement. 85 | @override 86 | String toString() { 87 | return 'WeekdaysProperties{generalWeekdaysDecoration: $generalWeekdaysDecoration, mondayDecoration: $mondayDecoration, tuesdayDecoration: $tuesdayDecoration, wednesdayDecoration: $wednesdayDecoration, thursdayDecoration: $thursdayDecoration, fridayDecoration: $fridayDecoration, saturdayDecoration: $saturdayDecoration, sundayDecoration: $sundayDecoration}'; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /example/windows/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.14) 3 | project(example LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | 9 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 10 | # versions of CMake. 11 | cmake_policy(SET CMP0063 NEW) 12 | 13 | # Define build configuration option. 14 | get_property(IS_MULTICONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) 15 | if(IS_MULTICONFIG) 16 | set(CMAKE_CONFIGURATION_TYPES "Debug;Profile;Release" 17 | CACHE STRING "" FORCE) 18 | else() 19 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 20 | set(CMAKE_BUILD_TYPE "Debug" CACHE 21 | STRING "Flutter build mode" FORCE) 22 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 23 | "Debug" "Profile" "Release") 24 | endif() 25 | endif() 26 | # Define settings for the Profile build mode. 27 | set(CMAKE_EXE_LINKER_FLAGS_PROFILE "${CMAKE_EXE_LINKER_FLAGS_RELEASE}") 28 | set(CMAKE_SHARED_LINKER_FLAGS_PROFILE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE}") 29 | set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_RELEASE}") 30 | set(CMAKE_CXX_FLAGS_PROFILE "${CMAKE_CXX_FLAGS_RELEASE}") 31 | 32 | # Use Unicode for all projects. 33 | add_definitions(-DUNICODE -D_UNICODE) 34 | 35 | # Compilation settings that should be applied to most targets. 36 | # 37 | # Be cautious about adding new options here, as plugins use this function by 38 | # default. In most cases, you should add new options to specific targets instead 39 | # of modifying this function. 40 | function(APPLY_STANDARD_SETTINGS TARGET) 41 | target_compile_features(${TARGET} PUBLIC cxx_std_17) 42 | target_compile_options(${TARGET} PRIVATE /W4 /WX /wd"4100") 43 | target_compile_options(${TARGET} PRIVATE /EHsc) 44 | target_compile_definitions(${TARGET} PRIVATE "_HAS_EXCEPTIONS=0") 45 | target_compile_definitions(${TARGET} PRIVATE "$<$:_DEBUG>") 46 | endfunction() 47 | 48 | # Flutter library and tool build rules. 49 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 50 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 51 | 52 | # Application build; see runner/CMakeLists.txt. 53 | add_subdirectory("runner") 54 | 55 | # Generated plugin build rules, which manage building the plugins and adding 56 | # them to the application. 57 | include(flutter/generated_plugins.cmake) 58 | 59 | 60 | # === Installation === 61 | # Support files are copied into place next to the executable, so that it can 62 | # run in place. This is done instead of making a separate bundle (as on Linux) 63 | # so that building and running from within Visual Studio will work. 64 | set(BUILD_BUNDLE_DIR "$") 65 | # Make the "install" step default, as it's required to run. 66 | set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) 67 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 68 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 69 | endif() 70 | 71 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 72 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}") 73 | 74 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 75 | COMPONENT Runtime) 76 | 77 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 78 | COMPONENT Runtime) 79 | 80 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 81 | COMPONENT Runtime) 82 | 83 | if(PLUGIN_BUNDLED_LIBRARIES) 84 | install(FILES "${PLUGIN_BUNDLED_LIBRARIES}" 85 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 86 | COMPONENT Runtime) 87 | endif() 88 | 89 | # Fully re-copy the assets directory on each build to avoid having stale files 90 | # from a previous install. 91 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 92 | install(CODE " 93 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 94 | " COMPONENT Runtime) 95 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 96 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 97 | 98 | # Install the AOT library on non-Debug builds only. 99 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 100 | CONFIGURATIONS Profile;Release 101 | COMPONENT Runtime) 102 | -------------------------------------------------------------------------------- /lib/src/ui/calendar_navigator_header_section.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/state/page_controller.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class CalendarNavigatorHeaderSection extends StatelessWidget { 6 | const CalendarNavigatorHeaderSection( 7 | {super.key, 8 | required this.calendarProperties, 9 | required this.pageControllerState}); 10 | 11 | final CalendarProperties calendarProperties; 12 | final PageControllerState pageControllerState; 13 | 14 | @override 15 | Widget build(BuildContext context) { 16 | return AnimatedBuilder( 17 | animation: pageControllerState, 18 | builder: (BuildContext context, Widget? child) { 19 | final DateTime pageViewDateTime = pageControllerState.pageViewDateTime; 20 | final List monthsSymbolsList = []; 21 | calendarProperties.monthsSymbol.toMap().forEach((key, value) { 22 | monthsSymbolsList.add(value); 23 | }); 24 | 25 | bool shouldShowResetButton = calendarProperties 26 | .datePickerCalendarView == 27 | DatePickerCalendarView.weekView 28 | ? DateUtils.dateOnly(calendarProperties.initialViewMonthDateTime) != 29 | DateUtils.dateOnly(pageViewDateTime) 30 | : DateUtils.dateOnly(calendarProperties.initialViewMonthDateTime 31 | .copyWith(day: 1)) != 32 | DateUtils.dateOnly(pageViewDateTime.copyWith(day: 1)); 33 | 34 | Icon navigatorResetButtonIcon = calendarProperties.headerProperties 35 | .navigatorDecoration?.navigatorResetButtonIcon ?? 36 | const Icon( 37 | Icons.calendar_today, 38 | ); 39 | 40 | Icon navigateLeftButtonIcon = calendarProperties 41 | .headerProperties.navigatorDecoration?.navigateLeftButtonIcon ?? 42 | const Icon( 43 | Icons.arrow_back_ios, 44 | size: 12, 45 | ); 46 | 47 | Icon navigateRightButtonIcon = calendarProperties.headerProperties 48 | .navigatorDecoration?.navigateRightButtonIcon ?? 49 | const Icon( 50 | Icons.arrow_forward_ios, 51 | size: 12, 52 | ); 53 | 54 | Color? monthYearTextColor = calendarProperties 55 | .headerProperties.monthYearDecoration?.monthYearTextColor; 56 | 57 | TextStyle? monthYearTextStyle = calendarProperties 58 | .headerProperties.monthYearDecoration?.monthYearTextStyle ?? 59 | Theme.of(context).textTheme.titleSmall; 60 | 61 | return Container( 62 | margin: const EdgeInsets.only(left: 24, right: 8), 63 | child: Row( 64 | mainAxisAlignment: MainAxisAlignment.spaceBetween, 65 | children: [ 66 | Flexible( 67 | child: Text( 68 | "${monthsSymbolsList[pageViewDateTime.month - 1]} ${pageViewDateTime.year}", 69 | overflow: TextOverflow.ellipsis, 70 | style: monthYearTextColor != null 71 | ? monthYearTextStyle?.copyWith(color: monthYearTextColor) 72 | : monthYearTextStyle, 73 | ), 74 | ), 75 | Flexible( 76 | child: Row( 77 | children: [ 78 | shouldShowResetButton 79 | ? Expanded( 80 | child: IconButton( 81 | onPressed: () { 82 | pageControllerState.pageController 83 | .animateToPage( 84 | pageControllerState.initialIndex, 85 | duration: kTabScrollDuration, 86 | curve: Curves.ease); 87 | }, 88 | padding: EdgeInsets.zero, 89 | icon: navigatorResetButtonIcon, 90 | ), 91 | ) 92 | : const Expanded(child: SizedBox()), 93 | Expanded( 94 | child: IconButton( 95 | onPressed: () { 96 | pageControllerState.pageController.previousPage( 97 | duration: kTabScrollDuration, curve: Curves.ease); 98 | }, 99 | padding: EdgeInsets.zero, 100 | icon: navigateLeftButtonIcon, 101 | ), 102 | ), 103 | Expanded( 104 | child: IconButton( 105 | onPressed: () { 106 | pageControllerState.pageController.nextPage( 107 | duration: kTabScrollDuration, curve: Curves.ease); 108 | }, 109 | padding: EdgeInsets.zero, 110 | icon: navigateRightButtonIcon, 111 | ), 112 | ), 113 | ], 114 | ), 115 | ), 116 | ], 117 | ), 118 | ); 119 | }, 120 | ); 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## 2.0.0 2 | * **Note:** After this update we will try to rework the package from scratch to make it more efficient and easy to use. So, if you have any suggestions and ideas please feel free to open an issue. 3 | 4 | * **BREAKING:** Now the height of date section is not limited. If you want to limit use `calendarDatesSectionMaxHeight` property. Otherwise it will take available height or 240px if available height is infinite. 5 | 6 | To use the previous default size set `calendarDatesSectionMaxHeight: 40` if using `datePickerCalendarView: DatePickerCalendarView.weekView` or `calendarDatesSectionMaxHeight: 240` if `datePickerCalendarView: DatePickerCalendarView.monthView`. 7 | 8 | * Fixes overflow issues on low height and width screens. 9 | 10 | ## 1.1.0 11 | 12 | * Added ```headerProperties``` for changing properties of header section. [#1](https://github.com/chaudharydeepanshu/clean_calendar/issues/1) 13 | 14 | This includes customization of month and year color and text style, and customization for navigator buttons icon. 15 | 16 | ## 1.0.2 17 | 18 | * Fixed 'copyWith' isn't defined for 'DateTime' error when using flutter stable channel. [#5](https://github.com/chaudharydeepanshu/clean_calendar/issues/5) 19 | 20 | ## 1.0.1 21 | 22 | * Fixed loading wrong initial week for weekly calendar view due to the changes made in v1.0.0. 23 | * Fixed calendar reset button to not becoming visible when changing from initial week. 24 | 25 | ## 1.0.0 26 | 27 | * **BREAKING:** `DatePickerSelectionMode.single` is removed as it was buggy and didn't provide the developer better control on date picking. 28 | 29 | For easy migration to `DatePickerSelectionMode.singleOrMultiple` see documentation [date-selection](https://web.archive.org/web/20221129220956/https://github.com/chaudharydeepanshu/clean_calendar/blob/master/README.md#date-selection) section or updated example. 30 | 31 | * Fixed issue of delayed update in month name when swiping calendar. 32 | * Fixed issue with unable to disable picking on some dates. 33 | * Fixed logic issue in calendar reset button which sometime not resets the month-year header correctly. 34 | * No longer depends on flutter_riverpod as its recent updates were causing many issues eventually delaying updates to this package. 35 | * Note: You can notice lags in debug mode(I will soon work on performance) but there should be no lags in release mode. 36 | 37 | ## 0.6.2 38 | 39 | * **BREAKING:** Updated flutter_riverpod dependency to ^2.0.2 40 | * Updated minimum required Flutter SDK version to 3.0.0 41 | * Updated minimum required Dart SDK version to 2.17.0 42 | 43 | ## 0.6.1 44 | 45 | * **BREAKING:** ```DecorationProperties``` is now ```DatesDecoration```. 46 | * **BREAKING:** ```decorationProperties``` is now ```datesDecoration```. 47 | * **BREAKING:** Now ```monthsSymbol``` takes ```Months``` instead of ```List```. 48 | * **BREAKING:** Now ```weekdaysSymbol``` takes ```Weekdays``` instead of ```List```. 49 | * Added decoration properties for weekdays. [#1](https://github.com/chaudharydeepanshu/clean_calendar/issues/1) 50 | * Updated documentation. 51 | 52 | ## 0.5.4 53 | 54 | * Fixes unwanted spacing in Streak Days after version 0.5.1. [#3](https://github.com/chaudharydeepanshu/clean_calendar/issues/3) 55 | 56 | ## 0.5.3 57 | 58 | * Fixes few overflow and ink issues. 59 | * Added note about dense mode under customisations in documentation. 60 | 61 | ## 0.5.2 62 | 63 | * Updated documentation for weekdaysSymbol, monthsSymbol and startWeekday. 64 | 65 | ## 0.5.1 66 | 67 | * Added support for custom month symbols. [#2](https://github.com/chaudharydeepanshu/clean_calendar/issues/2) 68 | * Added support for custom weekday symbols. [#2](https://github.com/chaudharydeepanshu/clean_calendar/issues/2) 69 | * Added support for setting start weekday for both month and week view. [#2](https://github.com/chaudharydeepanshu/clean_calendar/issues/2) 70 | 71 | ## 0.4.1 72 | 73 | * Moved to stable flutter SDK. 74 | 75 | ## 0.3.1-dev.1 76 | 77 | * Fixed lots of performance issues due to unnecessary rebuilds. 78 | 79 | ## 0.3.0-dev.2 80 | 81 | * Ran ```flutter format .``` to fix analyzer formatting issues. 82 | 83 | ## 0.3.0-dev.1 84 | 85 | * Added weekly calendar view. 86 | * Added ```onCalendarViewDate``` callback to listen for change in calendar view date. 87 | * Updated example to showcase weekly calendar view and ```onCalendarViewDate```. 88 | * Note - For weekly calendar view the default theme properties for leading-trailing dates is same as general dates default theme properties. 89 | 90 | ## 0.2.0-dev.2 91 | 92 | * Fixed README.md tables structure. 93 | 94 | ## 0.2.0-dev.1 95 | 96 | * Removed weird logs from package. 97 | * Optimized calendar scrolling and loading time tremendously. 98 | * Disable and hide different types of dates through their properties. 99 | * Customise dates look and feel by changing its properties. 100 | * Single date selection with customized behaviour. 101 | * Access selected dates. 102 | * Provide pre-selected dates. 103 | * Provide start and end dates for calendar view. 104 | * Provide initial month view for calendar view. 105 | * Provide current date for calendar view. 106 | * Improved documentation. 107 | 108 | ## 0.0.1-dev.3 109 | 110 | * Now, showing only public methods and classes. 111 | 112 | ## 0.0.1-dev.2 113 | 114 | * Updated and fixed typo in Readme.md. 115 | 116 | ## 0.0.1-dev.1 117 | 118 | * Initial development release. -------------------------------------------------------------------------------- /lib/src/ui/calendar_dates_section/pageview_builders.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/state/page_controller.dart'; 3 | import 'package:clean_calendar/src/ui/calendar_dates_section/gridview_builders.dart'; 4 | import 'package:flutter/material.dart'; 5 | 6 | class ScrollablePageViewBuilder extends StatelessWidget { 7 | const ScrollablePageViewBuilder( 8 | {super.key, 9 | required this.calendarProperties, 10 | required this.pageControllerState}); 11 | 12 | final CalendarProperties calendarProperties; 13 | final PageControllerState pageControllerState; 14 | 15 | @override 16 | Widget build(BuildContext context) { 17 | if (calendarProperties.datePickerCalendarView == 18 | DatePickerCalendarView.monthView) { 19 | return MonthViewScrollablePageViewBuilder( 20 | calendarProperties: calendarProperties, 21 | pageControllerState: pageControllerState, 22 | ); 23 | } 24 | if (calendarProperties.datePickerCalendarView == 25 | DatePickerCalendarView.weekView) { 26 | return WeekViewScrollablePageViewBuilder( 27 | calendarProperties: calendarProperties, 28 | pageControllerState: pageControllerState, 29 | ); 30 | } else { 31 | return const SizedBox(); 32 | } 33 | } 34 | } 35 | 36 | class MonthViewScrollablePageViewBuilder extends StatelessWidget { 37 | const MonthViewScrollablePageViewBuilder( 38 | {super.key, 39 | required this.calendarProperties, 40 | required this.pageControllerState}); 41 | 42 | final CalendarProperties calendarProperties; 43 | final PageControllerState pageControllerState; 44 | 45 | @override 46 | Widget build(BuildContext context) { 47 | return PageView.custom( 48 | controller: pageControllerState.pageController, 49 | childrenDelegate: SliverChildBuilderDelegate( 50 | (BuildContext context, int index) { 51 | return KeepAlive( 52 | data: CalendarGridViewBuilder( 53 | calendarProperties: calendarProperties, 54 | pageControllerState: pageControllerState, 55 | pageViewDate: calendarProperties.initialViewMonthDateTime.copyWith( 56 | month: calendarProperties.initialViewMonthDateTime.month + 57 | pageControllerState 58 | .listOfIntegersFromStartToAndEndDateWithInitialAs0[ 59 | index], 60 | day: 1), 61 | ), 62 | key: ValueKey(pageControllerState 63 | .listOfIntegersFromStartToAndEndDateWithInitialAs0[index]), 64 | ); 65 | }, 66 | childCount: pageControllerState 67 | .listOfIntegersFromStartToAndEndDateWithInitialAs0.length, 68 | findChildIndexCallback: (Key key) { 69 | final ValueKey valueKey = key as ValueKey; 70 | final int data = valueKey.value; 71 | return pageControllerState 72 | .listOfIntegersFromStartToAndEndDateWithInitialAs0 73 | .indexOf(data); 74 | }), 75 | ); 76 | } 77 | } 78 | 79 | class WeekViewScrollablePageViewBuilder extends StatelessWidget { 80 | const WeekViewScrollablePageViewBuilder( 81 | {super.key, 82 | required this.calendarProperties, 83 | required this.pageControllerState}); 84 | 85 | final CalendarProperties calendarProperties; 86 | final PageControllerState pageControllerState; 87 | 88 | @override 89 | Widget build(BuildContext context) { 90 | return PageView.custom( 91 | controller: pageControllerState.pageController, 92 | childrenDelegate: SliverChildBuilderDelegate( 93 | (BuildContext context, int index) { 94 | return KeepAlive( 95 | data: CalendarGridViewBuilder( 96 | calendarProperties: calendarProperties, 97 | pageControllerState: pageControllerState, 98 | pageViewDate: calendarProperties.initialViewMonthDateTime.copyWith( 99 | day: calendarProperties.initialViewMonthDateTime.day + 100 | pageControllerState 101 | .listOfIntegersFromStartToAndEndDateWithInitialAs0[ 102 | index] * 103 | 7), 104 | ), 105 | key: ValueKey(pageControllerState 106 | .listOfIntegersFromStartToAndEndDateWithInitialAs0[index]), 107 | ); 108 | }, 109 | childCount: pageControllerState 110 | .listOfIntegersFromStartToAndEndDateWithInitialAs0.length, 111 | findChildIndexCallback: (Key key) { 112 | final ValueKey valueKey = key as ValueKey; 113 | final int data = valueKey.value; 114 | return pageControllerState 115 | .listOfIntegersFromStartToAndEndDateWithInitialAs0 116 | .indexOf(data); 117 | }), 118 | ); 119 | } 120 | } 121 | 122 | class KeepAlive extends StatefulWidget { 123 | const KeepAlive({super.key, required this.data}); 124 | 125 | final Widget data; 126 | 127 | @override 128 | State createState() => _KeepAliveState(); 129 | } 130 | 131 | class _KeepAliveState extends State 132 | with AutomaticKeepAliveClientMixin { 133 | @override 134 | bool get wantKeepAlive => true; 135 | 136 | @override 137 | Widget build(BuildContext context) { 138 | super.build(context); 139 | return widget.data; 140 | } 141 | } 142 | -------------------------------------------------------------------------------- /example/linux/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Project-level configuration. 2 | cmake_minimum_required(VERSION 3.10) 3 | project(runner LANGUAGES CXX) 4 | 5 | # The name of the executable created for the application. Change this to change 6 | # the on-disk name of your application. 7 | set(BINARY_NAME "example") 8 | # The unique GTK application identifier for this application. See: 9 | # https://wiki.gnome.org/HowDoI/ChooseApplicationID 10 | set(APPLICATION_ID "com.example.example") 11 | 12 | # Explicitly opt in to modern CMake behaviors to avoid warnings with recent 13 | # versions of CMake. 14 | cmake_policy(SET CMP0063 NEW) 15 | 16 | # Load bundled libraries from the lib/ directory relative to the binary. 17 | set(CMAKE_INSTALL_RPATH "$ORIGIN/lib") 18 | 19 | # Root filesystem for cross-building. 20 | if(FLUTTER_TARGET_PLATFORM_SYSROOT) 21 | set(CMAKE_SYSROOT ${FLUTTER_TARGET_PLATFORM_SYSROOT}) 22 | set(CMAKE_FIND_ROOT_PATH ${CMAKE_SYSROOT}) 23 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 24 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 25 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 26 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 27 | endif() 28 | 29 | # Define build configuration options. 30 | if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) 31 | set(CMAKE_BUILD_TYPE "Debug" CACHE 32 | STRING "Flutter build mode" FORCE) 33 | set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS 34 | "Debug" "Profile" "Release") 35 | endif() 36 | 37 | # Compilation settings that should be applied to most targets. 38 | # 39 | # Be cautious about adding new options here, as plugins use this function by 40 | # default. In most cases, you should add new options to specific targets instead 41 | # of modifying this function. 42 | function(APPLY_STANDARD_SETTINGS TARGET) 43 | target_compile_features(${TARGET} PUBLIC cxx_std_14) 44 | target_compile_options(${TARGET} PRIVATE -Wall -Werror) 45 | target_compile_options(${TARGET} PRIVATE "$<$>:-O3>") 46 | target_compile_definitions(${TARGET} PRIVATE "$<$>:NDEBUG>") 47 | endfunction() 48 | 49 | # Flutter library and tool build rules. 50 | set(FLUTTER_MANAGED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/flutter") 51 | add_subdirectory(${FLUTTER_MANAGED_DIR}) 52 | 53 | # System-level dependencies. 54 | find_package(PkgConfig REQUIRED) 55 | pkg_check_modules(GTK REQUIRED IMPORTED_TARGET gtk+-3.0) 56 | 57 | add_definitions(-DAPPLICATION_ID="${APPLICATION_ID}") 58 | 59 | # Define the application target. To change its name, change BINARY_NAME above, 60 | # not the value here, or `flutter run` will no longer work. 61 | # 62 | # Any new source files that you add to the application should be added here. 63 | add_executable(${BINARY_NAME} 64 | "main.cc" 65 | "my_application.cc" 66 | "${FLUTTER_MANAGED_DIR}/generated_plugin_registrant.cc" 67 | ) 68 | 69 | # Apply the standard set of build settings. This can be removed for applications 70 | # that need different build settings. 71 | apply_standard_settings(${BINARY_NAME}) 72 | 73 | # Add dependency libraries. Add any application-specific dependencies here. 74 | target_link_libraries(${BINARY_NAME} PRIVATE flutter) 75 | target_link_libraries(${BINARY_NAME} PRIVATE PkgConfig::GTK) 76 | 77 | # Run the Flutter tool portions of the build. This must not be removed. 78 | add_dependencies(${BINARY_NAME} flutter_assemble) 79 | 80 | # Only the install-generated bundle's copy of the executable will launch 81 | # correctly, since the resources must in the right relative locations. To avoid 82 | # people trying to run the unbundled copy, put it in a subdirectory instead of 83 | # the default top-level location. 84 | set_target_properties(${BINARY_NAME} 85 | PROPERTIES 86 | RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/intermediates_do_not_run" 87 | ) 88 | 89 | # Generated plugin build rules, which manage building the plugins and adding 90 | # them to the application. 91 | include(flutter/generated_plugins.cmake) 92 | 93 | 94 | # === Installation === 95 | # By default, "installing" just makes a relocatable bundle in the build 96 | # directory. 97 | set(BUILD_BUNDLE_DIR "${PROJECT_BINARY_DIR}/bundle") 98 | if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) 99 | set(CMAKE_INSTALL_PREFIX "${BUILD_BUNDLE_DIR}" CACHE PATH "..." FORCE) 100 | endif() 101 | 102 | # Start with a clean build bundle directory every time. 103 | install(CODE " 104 | file(REMOVE_RECURSE \"${BUILD_BUNDLE_DIR}/\") 105 | " COMPONENT Runtime) 106 | 107 | set(INSTALL_BUNDLE_DATA_DIR "${CMAKE_INSTALL_PREFIX}/data") 108 | set(INSTALL_BUNDLE_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib") 109 | 110 | install(TARGETS ${BINARY_NAME} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}" 111 | COMPONENT Runtime) 112 | 113 | install(FILES "${FLUTTER_ICU_DATA_FILE}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" 114 | COMPONENT Runtime) 115 | 116 | install(FILES "${FLUTTER_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 117 | COMPONENT Runtime) 118 | 119 | foreach(bundled_library ${PLUGIN_BUNDLED_LIBRARIES}) 120 | install(FILES "${bundled_library}" 121 | DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 122 | COMPONENT Runtime) 123 | endforeach(bundled_library) 124 | 125 | # Fully re-copy the assets directory on each build to avoid having stale files 126 | # from a previous install. 127 | set(FLUTTER_ASSET_DIR_NAME "flutter_assets") 128 | install(CODE " 129 | file(REMOVE_RECURSE \"${INSTALL_BUNDLE_DATA_DIR}/${FLUTTER_ASSET_DIR_NAME}\") 130 | " COMPONENT Runtime) 131 | install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}" 132 | DESTINATION "${INSTALL_BUNDLE_DATA_DIR}" COMPONENT Runtime) 133 | 134 | # Install the AOT library on non-Debug builds only. 135 | if(NOT CMAKE_BUILD_TYPE MATCHES "Debug") 136 | install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_LIB_DIR}" 137 | COMPONENT Runtime) 138 | endif() 139 | -------------------------------------------------------------------------------- /lib/src/utils/get_suitable_calendar_streak_date_widget.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:clean_calendar/src/ui/calendar_dates_section/grid_view_elements/calendar_streak_date_widgets.dart'; 3 | import 'package:flutter/material.dart'; 4 | 5 | class GetSuitableCalendarStreakDateWidget extends StatelessWidget { 6 | const GetSuitableCalendarStreakDateWidget( 7 | {super.key, 8 | required this.calendarProperties, 9 | required this.pageViewElementDate, 10 | required this.pageViewDate}); 11 | 12 | final CalendarProperties calendarProperties; 13 | final DateTime pageViewElementDate; 14 | final DateTime pageViewDate; 15 | 16 | @override 17 | Widget build(BuildContext context) { 18 | /// Called when streak date have streak date just before and just after also. 19 | if (calendarProperties.datesForStreaks 20 | .contains(pageViewElementDate.add(const Duration(days: 1))) && 21 | calendarProperties.datesForStreaks 22 | .contains(pageViewElementDate.subtract(const Duration(days: 1))) && 23 | calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 24 | if (calendarProperties.enableDenseViewForDates && 25 | calendarProperties.enableDenseSplashForDates) { 26 | return CalendarStreakBetweenDenseSplashDate( 27 | calendarProperties: calendarProperties, 28 | pageViewElementDate: pageViewElementDate, 29 | pageViewDate: pageViewDate, 30 | ); 31 | } 32 | if (calendarProperties.enableDenseViewForDates) { 33 | return CalendarStreakBetweenExpandedDate( 34 | calendarProperties: calendarProperties, 35 | pageViewElementDate: pageViewElementDate, 36 | pageViewDate: pageViewDate, 37 | ); 38 | } 39 | if (!calendarProperties.enableDenseViewForDates) { 40 | return CalendarStreakBetweenExpandedDate( 41 | calendarProperties: calendarProperties, 42 | pageViewElementDate: pageViewElementDate, 43 | pageViewDate: pageViewDate, 44 | ); 45 | } else { 46 | return const SizedBox(); 47 | } 48 | } 49 | 50 | /// Called when streak date have a streak date just after. 51 | if (calendarProperties.datesForStreaks 52 | .contains(pageViewElementDate.add(const Duration(days: 1)))) { 53 | if (calendarProperties.enableDenseViewForDates && 54 | calendarProperties.enableDenseSplashForDates) { 55 | return CalendarStreakStartDenseSplashDate( 56 | calendarProperties: calendarProperties, 57 | pageViewElementDate: pageViewElementDate, 58 | pageViewDate: pageViewDate, 59 | ); 60 | } 61 | if (calendarProperties.enableDenseViewForDates) { 62 | return CalendarStreakStartDenseDate( 63 | calendarProperties: calendarProperties, 64 | pageViewElementDate: pageViewElementDate, 65 | pageViewDate: pageViewDate, 66 | ); 67 | } 68 | if (!calendarProperties.enableDenseViewForDates) { 69 | return CalendarStreakStartExpandedDate( 70 | calendarProperties: calendarProperties, 71 | pageViewElementDate: pageViewElementDate, 72 | pageViewDate: pageViewDate, 73 | ); 74 | } else { 75 | return const SizedBox(); 76 | } 77 | } 78 | 79 | /// Called when streak date have a streak date just before. 80 | if (calendarProperties.datesForStreaks 81 | .contains(pageViewElementDate.subtract(const Duration(days: 1)))) { 82 | if (calendarProperties.enableDenseViewForDates && 83 | calendarProperties.enableDenseSplashForDates) { 84 | return CalendarStreakEndDenseSplashDate( 85 | calendarProperties: calendarProperties, 86 | pageViewElementDate: pageViewElementDate, 87 | pageViewDate: pageViewDate, 88 | ); 89 | } 90 | if (calendarProperties.enableDenseViewForDates) { 91 | return CalendarStreakEndDenseDate( 92 | calendarProperties: calendarProperties, 93 | pageViewElementDate: pageViewElementDate, 94 | pageViewDate: pageViewDate, 95 | ); 96 | } 97 | if (!calendarProperties.enableDenseViewForDates) { 98 | return CalendarStreakEndExpandedDate( 99 | calendarProperties: calendarProperties, 100 | pageViewElementDate: pageViewElementDate, 101 | pageViewDate: pageViewDate, 102 | ); 103 | } else { 104 | return const SizedBox(); 105 | } 106 | } 107 | 108 | /// Called when streak date doesn't have streak date just before and just after also. 109 | if (calendarProperties.datesForStreaks.contains(pageViewElementDate)) { 110 | if (calendarProperties.enableDenseViewForDates && 111 | calendarProperties.enableDenseSplashForDates) { 112 | return CalendarStreakSingleDenseSplashDate( 113 | calendarProperties: calendarProperties, 114 | pageViewElementDate: pageViewElementDate, 115 | pageViewDate: pageViewDate, 116 | ); 117 | } 118 | if (calendarProperties.enableDenseViewForDates) { 119 | return CalendarStreakSingleDenseDate( 120 | calendarProperties: calendarProperties, 121 | pageViewElementDate: pageViewElementDate, 122 | pageViewDate: pageViewDate, 123 | ); 124 | } 125 | if (!calendarProperties.enableDenseViewForDates) { 126 | return CalendarStreakSingleExpandedDate( 127 | calendarProperties: calendarProperties, 128 | pageViewElementDate: pageViewElementDate, 129 | pageViewDate: pageViewDate, 130 | ); 131 | } else { 132 | return const SizedBox(); 133 | } 134 | } else { 135 | return const SizedBox(); 136 | } 137 | } 138 | } 139 | -------------------------------------------------------------------------------- /lib/src/state/page_controller.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/src/models/calendar_properties.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | class PageControllerState extends ChangeNotifier { 5 | PageControllerState(this.calendarProperties); 6 | 7 | final CalendarProperties calendarProperties; 8 | 9 | late DateTime initialViewMonthDateTime = 10 | calendarProperties.initialViewMonthDateTime; 11 | 12 | late DateTime startDateOfCalendar = calendarProperties.startDateOfCalendar; 13 | 14 | late DateTime endDateOfCalendar = calendarProperties.endDateOfCalendar; 15 | 16 | late DatePickerCalendarView datePickerCalendarView = 17 | calendarProperties.datePickerCalendarView; 18 | 19 | late PageController _pageController; 20 | PageController get pageController => _pageController; 21 | 22 | late DateTime _pageViewDateTime; 23 | DateTime get pageViewDateTime => _pageViewDateTime; 24 | 25 | late int initialIndex; 26 | 27 | late int _pageViewIndex; 28 | 29 | /// The list of integers form -ve to +ve index with initial date at 0 index. 30 | late List listOfIntegersFromStartToAndEndDateWithInitialAs0; 31 | 32 | init() { 33 | _pageViewDateTime = calendarProperties.initialViewMonthDateTime; 34 | 35 | int monthsCountBeforeInitialDateToStartDate = 36 | DateUtils.monthDelta(startDateOfCalendar, _pageViewDateTime); 37 | 38 | int monthsCountAfterInitialDateToStartDate = 39 | DateUtils.monthDelta(_pageViewDateTime, endDateOfCalendar); 40 | 41 | int startIndex = -1 * monthsCountBeforeInitialDateToStartDate; 42 | 43 | int endIndex = monthsCountAfterInitialDateToStartDate; 44 | 45 | listOfIntegersFromStartToAndEndDateWithInitialAs0 = [ 46 | for (var i = startIndex; i <= endIndex; i += 1) i 47 | ]; 48 | 49 | initialIndex = monthsCountBeforeInitialDateToStartDate; 50 | 51 | _pageViewIndex = initialIndex; 52 | 53 | _pageController = 54 | PageController(initialPage: _pageViewIndex, viewportFraction: 1); 55 | 56 | _pageController.addListener(() { 57 | // Get index according to the direction 58 | // _pageController.page! > _initialIndex => swiping to the right, going to the left / previous element 59 | // _pageController.page! < _initialIndex => swiping to the left, going to the right / next element 60 | 61 | int index = _pageController.page!.round() != _pageViewIndex 62 | ? _pageController.page!.round() 63 | : _pageViewIndex; 64 | 65 | if (index == _pageViewIndex) { 66 | return; 67 | } 68 | if (_pageController.page! < _pageViewIndex) { 69 | _prev(index); 70 | } else if (_pageController.page! > _pageViewIndex) { 71 | _next(index); 72 | } 73 | }); 74 | } 75 | 76 | // Update list and jump to the middle element 77 | void _next(int index) { 78 | if (datePickerCalendarView == DatePickerCalendarView.monthView) { 79 | _pageViewDateTime = initialViewMonthDateTime.copyWith( 80 | month: 81 | (initialViewMonthDateTime.month + (index - initialIndex)).toInt(), 82 | day: 1); 83 | 84 | calendarProperties.onCalendarViewDate?.call(_pageViewDateTime); 85 | 86 | _pageViewIndex = index; 87 | } 88 | if (datePickerCalendarView == DatePickerCalendarView.weekView) { 89 | _pageViewDateTime = initialViewMonthDateTime.copyWith( 90 | day: (initialViewMonthDateTime.day + ((index - initialIndex) * 7)) 91 | .toInt()); 92 | 93 | calendarProperties.onCalendarViewDate?.call(_pageViewDateTime); 94 | 95 | _pageViewIndex = index; 96 | } 97 | 98 | notifyListeners(); 99 | } 100 | 101 | // Update list and jump to the middle element 102 | void _prev(int index) { 103 | if (datePickerCalendarView == DatePickerCalendarView.monthView) { 104 | _pageViewDateTime = initialViewMonthDateTime.copyWith( 105 | month: 106 | (initialViewMonthDateTime.month - (initialIndex - index)).toInt(), 107 | day: 1); 108 | 109 | calendarProperties.onCalendarViewDate?.call(_pageViewDateTime); 110 | 111 | _pageViewIndex = index; 112 | } 113 | if (datePickerCalendarView == DatePickerCalendarView.weekView) { 114 | _pageViewDateTime = initialViewMonthDateTime.copyWith( 115 | day: (initialViewMonthDateTime.day - ((initialIndex - index) * 7)) 116 | .toInt()); 117 | 118 | calendarProperties.onCalendarViewDate?.call(_pageViewDateTime); 119 | 120 | _pageViewIndex = index; 121 | } 122 | 123 | notifyListeners(); 124 | } 125 | } 126 | 127 | // Todo: Remove after dart 2.19 in stable flutter channel due to introduction of copyWith in DateTime 128 | // https://github.com/dart-lang/sdk/issues/24644 129 | extension DateTimeExtension on DateTime { 130 | DateTime copy() { 131 | if (isUtc) { 132 | return DateTime.utc( 133 | year, 134 | month, 135 | day, 136 | hour, 137 | minute, 138 | second, 139 | millisecond, 140 | ); 141 | } 142 | return DateTime( 143 | year, 144 | month, 145 | day, 146 | hour, 147 | minute, 148 | second, 149 | millisecond, 150 | ); 151 | } 152 | 153 | DateTime copyWith({ 154 | int? year, 155 | int? month, 156 | int? day, 157 | int? hour, 158 | int? minute, 159 | int? second, 160 | int? millisecond, 161 | bool? isUtc, 162 | }) { 163 | if (isUtc ?? this.isUtc) { 164 | return DateTime.utc( 165 | year ?? this.year, 166 | month ?? this.month, 167 | day ?? this.day, 168 | hour ?? this.hour, 169 | minute ?? this.minute, 170 | second ?? this.second, 171 | millisecond ?? this.millisecond, 172 | ); 173 | } 174 | return DateTime( 175 | year ?? this.year, 176 | month ?? this.month, 177 | day ?? this.day, 178 | hour ?? this.hour, 179 | minute ?? this.minute, 180 | second ?? this.second, 181 | millisecond ?? this.millisecond, 182 | ); 183 | } 184 | } 185 | -------------------------------------------------------------------------------- /lib/src/clean_calendar.dart: -------------------------------------------------------------------------------- 1 | library clean_calendar; 2 | 3 | import 'package:clean_calendar/clean_calendar.dart'; 4 | import 'package:clean_calendar/src/ui/calendar_view.dart'; 5 | import 'package:flutter/material.dart'; 6 | 7 | class CleanCalendar extends StatelessWidget { 8 | /// - CleanCalendar, Shows a simple Calendar. 9 | const CleanCalendar({ 10 | super.key, 11 | this.datePickerCalendarView, 12 | this.headerProperties, 13 | this.weekdaysProperties, 14 | this.streakDatesProperties, 15 | this.currentDateProperties, 16 | this.generalDatesProperties, 17 | this.leadingTrailingDatesProperties, 18 | this.selectedDatesProperties, 19 | this.enableDenseViewForDates, 20 | this.enableDenseSplashForDates, 21 | this.startDateOfCalendar, 22 | this.endDateOfCalendar, 23 | this.dateSelectionMode, 24 | this.initialViewMonthDateTime, 25 | this.currentDateOfCalendar, 26 | this.datesForStreaks, 27 | this.selectedDates, 28 | this.onSelectedDates, 29 | this.onCalendarViewDate, 30 | this.startWeekday, 31 | this.weekdaysSymbol, 32 | this.monthsSymbol, 33 | this.calendarDatesSectionMaxHeight, 34 | }); 35 | 36 | /// - datePickerCalendarView, It takes calendar view type. 37 | final DatePickerCalendarView? datePickerCalendarView; 38 | 39 | /// - headerProperties, It takes customisation properties for calendar header. 40 | final HeaderProperties? headerProperties; 41 | 42 | /// - weekdaysProperties, It takes customisation properties for weekdays. 43 | final WeekdaysProperties? weekdaysProperties; 44 | 45 | /// - streakDatesProperties, It takes customisation properties for streak dates. 46 | final DatesProperties? streakDatesProperties; 47 | 48 | /// - currentDateProperties, It takes customisation properties for current dates. 49 | final DatesProperties? currentDateProperties; 50 | 51 | /// - generalDatesProperties, It takes customisation properties for general dates. 52 | final DatesProperties? generalDatesProperties; 53 | 54 | /// - leadingTrailingDatesProperties, It takes customisation properties for leading dates. 55 | final DatesProperties? leadingTrailingDatesProperties; 56 | 57 | /// - selectedDatesProperties, It takes customisation properties for selected dates. 58 | final DatesProperties? selectedDatesProperties; 59 | 60 | /// - enableDenseViewForDates, Set true to allow date boundary to shrink. 61 | final bool? enableDenseViewForDates; 62 | 63 | /// - enableDenseSplashForDates, Set true to allow date tap splash to shrink. 64 | final bool? enableDenseSplashForDates; 65 | 66 | /// - endDateOfCalendar, It takes start date for calendar view. 67 | final DateTime? startDateOfCalendar; 68 | 69 | /// - endDateOfCalendar, It takes end date for calendar view. 70 | final DateTime? endDateOfCalendar; 71 | 72 | /// - dateSelectionMode, It takes DatePickerSelectionMode which Provides different modes for date selection. 73 | final DatePickerSelectionMode? dateSelectionMode; 74 | 75 | /// - initialViewMonthDateTime, It takes initial month date for calendar view. 76 | /// Defaults to current date and if current is not between startDateOfCalendar and endDateOfCalendar then defaults to start date. 77 | final DateTime? initialViewMonthDateTime; 78 | 79 | /// - currentDateOfCalendar, It takes current or today date for calendar view. 80 | /// Defaults to DateTime.now(). 81 | final DateTime? currentDateOfCalendar; 82 | 83 | /// - datesForStreaks, It takes the list of dates to be shown as streaks. 84 | final List? datesForStreaks; 85 | 86 | /// - selectedDates, It takes the list of pre-selected dates to be shown as selected. 87 | final List? selectedDates; 88 | 89 | /// - onSelectedDates, A callback to get the current selected dates. 90 | final ValueChanged>? onSelectedDates; 91 | 92 | /// - onCalendarViewDate, A callback to get the current calendar view date. 93 | final ValueChanged? onCalendarViewDate; 94 | 95 | /// - startWeekday, It takes the weekday from which the calendar view should start. 96 | /// 97 | /// Defaults to sunday. 98 | final WeekDay? startWeekday; 99 | 100 | /// - weekdaysSymbol, It takes the weekdays symbols. 101 | /// 102 | /// Defaults symbols are Mo, Tu, We, Th, Fr, Sa, Su from monday to sunday. 103 | final Weekdays? weekdaysSymbol; 104 | 105 | /// - monthsSymbol, It takes the months symbols. 106 | /// 107 | /// Defaults symbols are January, February, March, April, May, June, July, August, September, October, November, December. 108 | final Months? monthsSymbol; 109 | 110 | /// - calendarDatesSectionMaxHeight, It takes the maximum height for the calendar dates section. 111 | /// 112 | /// If double.infinity, it will take the 240px height. 113 | /// If null, it will take the available height. 114 | final double? calendarDatesSectionMaxHeight; 115 | 116 | @override 117 | Widget build(BuildContext context) { 118 | return Calendar( 119 | calendarProperties: CalendarProperties( 120 | datePickerCalendarView: datePickerCalendarView, 121 | weekdaysProperties: weekdaysProperties, 122 | headerProperties: headerProperties, 123 | streakDatesProperties: streakDatesProperties, 124 | currentDateProperties: currentDateProperties, 125 | generalDatesProperties: generalDatesProperties, 126 | leadingTrailingDatesProperties: leadingTrailingDatesProperties, 127 | selectedDatesProperties: selectedDatesProperties, 128 | enableDenseViewForDates: enableDenseViewForDates, 129 | enableDenseSplashForDates: enableDenseSplashForDates, 130 | startDateOfCalendar: startDateOfCalendar, 131 | endDateOfCalendar: endDateOfCalendar, 132 | dateSelectionMode: dateSelectionMode, 133 | initialViewMonthDateTime: initialViewMonthDateTime, 134 | currentDateOfCalendar: currentDateOfCalendar, 135 | datesForStreaks: datesForStreaks, 136 | selectedDates: selectedDates, 137 | onSelectedDates: onSelectedDates, 138 | onCalendarViewDate: onCalendarViewDate, 139 | startWeekday: startWeekday, 140 | weekdaysSymbol: weekdaysSymbol, 141 | monthsSymbol: monthsSymbol, 142 | calendarDatesSectionMaxHeight: calendarDatesSectionMaxHeight, 143 | context: context), 144 | ); 145 | } 146 | } 147 | -------------------------------------------------------------------------------- /example/pubspec.lock: -------------------------------------------------------------------------------- 1 | # Generated by pub 2 | # See https://dart.dev/tools/pub/glossary#lockfile 3 | packages: 4 | async: 5 | dependency: transitive 6 | description: 7 | name: async 8 | sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" 9 | url: "https://pub.dev" 10 | source: hosted 11 | version: "2.11.0" 12 | boolean_selector: 13 | dependency: transitive 14 | description: 15 | name: boolean_selector 16 | sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" 17 | url: "https://pub.dev" 18 | source: hosted 19 | version: "2.1.1" 20 | characters: 21 | dependency: transitive 22 | description: 23 | name: characters 24 | sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" 25 | url: "https://pub.dev" 26 | source: hosted 27 | version: "1.3.0" 28 | clean_calendar: 29 | dependency: "direct main" 30 | description: 31 | path: ".." 32 | relative: true 33 | source: path 34 | version: "2.0.0" 35 | clock: 36 | dependency: transitive 37 | description: 38 | name: clock 39 | sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf 40 | url: "https://pub.dev" 41 | source: hosted 42 | version: "1.1.1" 43 | collection: 44 | dependency: transitive 45 | description: 46 | name: collection 47 | sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a 48 | url: "https://pub.dev" 49 | source: hosted 50 | version: "1.18.0" 51 | cupertino_icons: 52 | dependency: "direct main" 53 | description: 54 | name: cupertino_icons 55 | sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 56 | url: "https://pub.dev" 57 | source: hosted 58 | version: "1.0.8" 59 | fake_async: 60 | dependency: transitive 61 | description: 62 | name: fake_async 63 | sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" 64 | url: "https://pub.dev" 65 | source: hosted 66 | version: "1.3.1" 67 | flutter: 68 | dependency: "direct main" 69 | description: flutter 70 | source: sdk 71 | version: "0.0.0" 72 | flutter_lints: 73 | dependency: "direct dev" 74 | description: 75 | name: flutter_lints 76 | sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" 77 | url: "https://pub.dev" 78 | source: hosted 79 | version: "4.0.0" 80 | flutter_test: 81 | dependency: "direct dev" 82 | description: flutter 83 | source: sdk 84 | version: "0.0.0" 85 | leak_tracker: 86 | dependency: transitive 87 | description: 88 | name: leak_tracker 89 | sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" 90 | url: "https://pub.dev" 91 | source: hosted 92 | version: "10.0.5" 93 | leak_tracker_flutter_testing: 94 | dependency: transitive 95 | description: 96 | name: leak_tracker_flutter_testing 97 | sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" 98 | url: "https://pub.dev" 99 | source: hosted 100 | version: "3.0.5" 101 | leak_tracker_testing: 102 | dependency: transitive 103 | description: 104 | name: leak_tracker_testing 105 | sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" 106 | url: "https://pub.dev" 107 | source: hosted 108 | version: "3.0.1" 109 | lints: 110 | dependency: transitive 111 | description: 112 | name: lints 113 | sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" 114 | url: "https://pub.dev" 115 | source: hosted 116 | version: "4.0.0" 117 | matcher: 118 | dependency: transitive 119 | description: 120 | name: matcher 121 | sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb 122 | url: "https://pub.dev" 123 | source: hosted 124 | version: "0.12.16+1" 125 | material_color_utilities: 126 | dependency: transitive 127 | description: 128 | name: material_color_utilities 129 | sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec 130 | url: "https://pub.dev" 131 | source: hosted 132 | version: "0.11.1" 133 | meta: 134 | dependency: transitive 135 | description: 136 | name: meta 137 | sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 138 | url: "https://pub.dev" 139 | source: hosted 140 | version: "1.15.0" 141 | path: 142 | dependency: transitive 143 | description: 144 | name: path 145 | sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" 146 | url: "https://pub.dev" 147 | source: hosted 148 | version: "1.9.0" 149 | sky_engine: 150 | dependency: transitive 151 | description: flutter 152 | source: sdk 153 | version: "0.0.99" 154 | source_span: 155 | dependency: transitive 156 | description: 157 | name: source_span 158 | sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" 159 | url: "https://pub.dev" 160 | source: hosted 161 | version: "1.10.0" 162 | stack_trace: 163 | dependency: transitive 164 | description: 165 | name: stack_trace 166 | sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" 167 | url: "https://pub.dev" 168 | source: hosted 169 | version: "1.11.1" 170 | stream_channel: 171 | dependency: transitive 172 | description: 173 | name: stream_channel 174 | sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 175 | url: "https://pub.dev" 176 | source: hosted 177 | version: "2.1.2" 178 | string_scanner: 179 | dependency: transitive 180 | description: 181 | name: string_scanner 182 | sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" 183 | url: "https://pub.dev" 184 | source: hosted 185 | version: "1.2.0" 186 | term_glyph: 187 | dependency: transitive 188 | description: 189 | name: term_glyph 190 | sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 191 | url: "https://pub.dev" 192 | source: hosted 193 | version: "1.2.1" 194 | test_api: 195 | dependency: transitive 196 | description: 197 | name: test_api 198 | sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" 199 | url: "https://pub.dev" 200 | source: hosted 201 | version: "0.7.2" 202 | vector_math: 203 | dependency: transitive 204 | description: 205 | name: vector_math 206 | sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" 207 | url: "https://pub.dev" 208 | source: hosted 209 | version: "2.1.4" 210 | vm_service: 211 | dependency: transitive 212 | description: 213 | name: vm_service 214 | sha256: "5c5f338a667b4c644744b661f309fb8080bb94b18a7e91ef1dbd343bed00ed6d" 215 | url: "https://pub.dev" 216 | source: hosted 217 | version: "14.2.5" 218 | sdks: 219 | dart: ">=3.3.0 <4.0.0" 220 | flutter: ">=3.18.0-18.0.pre.54" 221 | -------------------------------------------------------------------------------- /example/lib/main.dart: -------------------------------------------------------------------------------- 1 | import 'package:clean_calendar/clean_calendar.dart'; 2 | import 'package:flutter/material.dart'; 3 | 4 | void main() => runApp(const MyApp()); 5 | 6 | class MyApp extends StatelessWidget { 7 | const MyApp({super.key}); 8 | 9 | @override 10 | Widget build(BuildContext context) { 11 | return MaterialApp( 12 | title: 'Calendar App', 13 | debugShowCheckedModeBanner: false, 14 | theme: ThemeData(useMaterial3: true), 15 | darkTheme: ThemeData.dark(useMaterial3: true), 16 | themeMode: ThemeMode.system, 17 | home: const Home(), 18 | ); 19 | } 20 | } 21 | 22 | class Home extends StatefulWidget { 23 | const Home({super.key}); 24 | 25 | @override 26 | State createState() => _HomeState(); 27 | } 28 | 29 | class _HomeState extends State { 30 | List selectedDates = []; 31 | 32 | @override 33 | Widget build(BuildContext context) { 34 | return Scaffold( 35 | appBar: AppBar( 36 | elevation: 2, 37 | title: const Text("Calendar"), 38 | ), 39 | body: Center( 40 | child: ListView( 41 | children: [ 42 | CleanCalendar( 43 | enableDenseViewForDates: true, 44 | enableDenseSplashForDates: true, 45 | datesForStreaks: [ 46 | DateTime(2023, 01, 5), 47 | DateTime(2023, 01, 6), 48 | DateTime(2023, 01, 7), 49 | DateTime(2023, 01, 9), 50 | DateTime(2023, 01, 10), 51 | DateTime(2023, 01, 11), 52 | DateTime(2023, 01, 13), 53 | DateTime(2023, 01, 20), 54 | DateTime(2023, 01, 21), 55 | DateTime(2023, 01, 23), 56 | DateTime(2023, 01, 24), 57 | DateTime(2023, 01, 25), 58 | ], 59 | dateSelectionMode: DatePickerSelectionMode.singleOrMultiple, 60 | startWeekday: WeekDay.wednesday, 61 | selectedDates: selectedDates, 62 | onCalendarViewDate: (DateTime calendarViewDate) { 63 | // print(calendarViewDate); 64 | }, 65 | onSelectedDates: (List value) { 66 | setState(() { 67 | if (selectedDates.contains(value.first)) { 68 | selectedDates.remove(value.first); 69 | } else { 70 | selectedDates.add(value.first); 71 | } 72 | }); 73 | // print(selectedDates); 74 | }, 75 | ), 76 | const SizedBox( 77 | height: 20, 78 | ), 79 | CleanCalendar( 80 | calendarDatesSectionMaxHeight: 40, 81 | datePickerCalendarView: DatePickerCalendarView.weekView, 82 | enableDenseViewForDates: true, 83 | enableDenseSplashForDates: true, 84 | datesForStreaks: [ 85 | DateTime(2023, 01, 5), 86 | DateTime(2023, 01, 6), 87 | DateTime(2023, 01, 7), 88 | DateTime(2023, 01, 9), 89 | DateTime(2023, 01, 10), 90 | DateTime(2023, 01, 11), 91 | DateTime(2023, 01, 13), 92 | DateTime(2023, 01, 20), 93 | DateTime(2023, 01, 21), 94 | DateTime(2023, 01, 23), 95 | DateTime(2023, 01, 24), 96 | DateTime(2023, 01, 25), 97 | ], 98 | dateSelectionMode: DatePickerSelectionMode.singleOrMultiple, 99 | onCalendarViewDate: (DateTime calendarViewDate) { 100 | // print(calendarViewDate); 101 | }, 102 | selectedDates: selectedDates, 103 | onSelectedDates: (List value) { 104 | setState(() { 105 | if (selectedDates.contains(value.first)) { 106 | selectedDates.remove(value.first); 107 | } else { 108 | selectedDates.add(value.first); 109 | } 110 | }); 111 | // print(selectedDates); 112 | }, 113 | ), 114 | CleanCalendar( 115 | calendarDatesSectionMaxHeight: 40, 116 | headerProperties: HeaderProperties( 117 | monthYearDecoration: MonthYearDecoration( 118 | monthYearTextColor: Colors.amber, 119 | monthYearTextStyle: Theme.of(context).textTheme.labelMedium, 120 | ), 121 | navigatorDecoration: NavigatorDecoration( 122 | navigatorResetButtonIcon: const Icon( 123 | Icons.restart_alt, 124 | color: Colors.amber, 125 | ), 126 | navigateLeftButtonIcon: const Icon( 127 | Icons.arrow_circle_left, 128 | color: Colors.amber, 129 | ), 130 | navigateRightButtonIcon: const Icon( 131 | Icons.arrow_circle_right, 132 | color: Colors.amber, 133 | ), 134 | ), 135 | ), 136 | datePickerCalendarView: DatePickerCalendarView.weekView, 137 | enableDenseViewForDates: true, 138 | enableDenseSplashForDates: true, 139 | datesForStreaks: [ 140 | DateTime(2023, 01, 5), 141 | DateTime(2023, 01, 6), 142 | DateTime(2023, 01, 7), 143 | DateTime(2023, 01, 9), 144 | DateTime(2023, 01, 10), 145 | DateTime(2023, 01, 11), 146 | DateTime(2023, 01, 13), 147 | DateTime(2023, 01, 20), 148 | DateTime(2023, 01, 21), 149 | DateTime(2023, 01, 23), 150 | DateTime(2023, 01, 24), 151 | DateTime(2023, 01, 25), 152 | ], 153 | dateSelectionMode: DatePickerSelectionMode.disable, 154 | onCalendarViewDate: (DateTime calendarViewDate) { 155 | // print(calendarViewDate); 156 | }, 157 | startWeekday: WeekDay.monday, 158 | weekdaysSymbol: const Weekdays( 159 | sunday: "s", 160 | monday: "m", 161 | tuesday: "t", 162 | wednesday: "w", 163 | thursday: "t", 164 | friday: "f", 165 | saturday: "s", 166 | ), 167 | monthsSymbol: const Months( 168 | january: "Jan", 169 | february: "Feb", 170 | march: "Mar", 171 | april: "Apr", 172 | may: "May", 173 | june: "Jun", 174 | july: "Jul", 175 | august: "Aug", 176 | september: "Sep", 177 | october: "Oct", 178 | november: "Nov", 179 | december: "Dec"), 180 | weekdaysProperties: WeekdaysProperties( 181 | generalWeekdaysDecoration: 182 | WeekdaysDecoration(weekdayTextColor: Colors.red), 183 | sundayDecoration: WeekdaysDecoration( 184 | weekdayTextColor: Colors.green, 185 | weekdayTextStyle: 186 | Theme.of(context).textTheme.headlineMedium), 187 | saturdayDecoration: WeekdaysDecoration( 188 | weekdayTextColor: Colors.green, 189 | weekdayTextStyle: 190 | Theme.of(context).textTheme.headlineMedium), 191 | ), 192 | ), 193 | ], 194 | ), 195 | ), 196 | ); 197 | } 198 | } 199 | -------------------------------------------------------------------------------- /example/windows/runner/win32_window.cpp: -------------------------------------------------------------------------------- 1 | #include "win32_window.h" 2 | 3 | #include 4 | 5 | #include "resource.h" 6 | 7 | namespace { 8 | 9 | constexpr const wchar_t kWindowClassName[] = L"FLUTTER_RUNNER_WIN32_WINDOW"; 10 | 11 | // The number of Win32Window objects that currently exist. 12 | static int g_active_window_count = 0; 13 | 14 | using EnableNonClientDpiScaling = BOOL __stdcall(HWND hwnd); 15 | 16 | // Scale helper to convert logical scaler values to physical using passed in 17 | // scale factor 18 | int Scale(int source, double scale_factor) { 19 | return static_cast(source * scale_factor); 20 | } 21 | 22 | // Dynamically loads the |EnableNonClientDpiScaling| from the User32 module. 23 | // This API is only needed for PerMonitor V1 awareness mode. 24 | void EnableFullDpiSupportIfAvailable(HWND hwnd) { 25 | HMODULE user32_module = LoadLibraryA("User32.dll"); 26 | if (!user32_module) { 27 | return; 28 | } 29 | auto enable_non_client_dpi_scaling = 30 | reinterpret_cast( 31 | GetProcAddress(user32_module, "EnableNonClientDpiScaling")); 32 | if (enable_non_client_dpi_scaling != nullptr) { 33 | enable_non_client_dpi_scaling(hwnd); 34 | FreeLibrary(user32_module); 35 | } 36 | } 37 | 38 | } // namespace 39 | 40 | // Manages the Win32Window's window class registration. 41 | class WindowClassRegistrar { 42 | public: 43 | ~WindowClassRegistrar() = default; 44 | 45 | // Returns the singleton registar instance. 46 | static WindowClassRegistrar* GetInstance() { 47 | if (!instance_) { 48 | instance_ = new WindowClassRegistrar(); 49 | } 50 | return instance_; 51 | } 52 | 53 | // Returns the name of the window class, registering the class if it hasn't 54 | // previously been registered. 55 | const wchar_t* GetWindowClass(); 56 | 57 | // Unregisters the window class. Should only be called if there are no 58 | // instances of the window. 59 | void UnregisterWindowClass(); 60 | 61 | private: 62 | WindowClassRegistrar() = default; 63 | 64 | static WindowClassRegistrar* instance_; 65 | 66 | bool class_registered_ = false; 67 | }; 68 | 69 | WindowClassRegistrar* WindowClassRegistrar::instance_ = nullptr; 70 | 71 | const wchar_t* WindowClassRegistrar::GetWindowClass() { 72 | if (!class_registered_) { 73 | WNDCLASS window_class{}; 74 | window_class.hCursor = LoadCursor(nullptr, IDC_ARROW); 75 | window_class.lpszClassName = kWindowClassName; 76 | window_class.style = CS_HREDRAW | CS_VREDRAW; 77 | window_class.cbClsExtra = 0; 78 | window_class.cbWndExtra = 0; 79 | window_class.hInstance = GetModuleHandle(nullptr); 80 | window_class.hIcon = 81 | LoadIcon(window_class.hInstance, MAKEINTRESOURCE(IDI_APP_ICON)); 82 | window_class.hbrBackground = 0; 83 | window_class.lpszMenuName = nullptr; 84 | window_class.lpfnWndProc = Win32Window::WndProc; 85 | RegisterClass(&window_class); 86 | class_registered_ = true; 87 | } 88 | return kWindowClassName; 89 | } 90 | 91 | void WindowClassRegistrar::UnregisterWindowClass() { 92 | UnregisterClass(kWindowClassName, nullptr); 93 | class_registered_ = false; 94 | } 95 | 96 | Win32Window::Win32Window() { 97 | ++g_active_window_count; 98 | } 99 | 100 | Win32Window::~Win32Window() { 101 | --g_active_window_count; 102 | Destroy(); 103 | } 104 | 105 | bool Win32Window::CreateAndShow(const std::wstring& title, 106 | const Point& origin, 107 | const Size& size) { 108 | Destroy(); 109 | 110 | const wchar_t* window_class = 111 | WindowClassRegistrar::GetInstance()->GetWindowClass(); 112 | 113 | const POINT target_point = {static_cast(origin.x), 114 | static_cast(origin.y)}; 115 | HMONITOR monitor = MonitorFromPoint(target_point, MONITOR_DEFAULTTONEAREST); 116 | UINT dpi = FlutterDesktopGetDpiForMonitor(monitor); 117 | double scale_factor = dpi / 96.0; 118 | 119 | HWND window = CreateWindow( 120 | window_class, title.c_str(), WS_OVERLAPPEDWINDOW | WS_VISIBLE, 121 | Scale(origin.x, scale_factor), Scale(origin.y, scale_factor), 122 | Scale(size.width, scale_factor), Scale(size.height, scale_factor), 123 | nullptr, nullptr, GetModuleHandle(nullptr), this); 124 | 125 | if (!window) { 126 | return false; 127 | } 128 | 129 | return OnCreate(); 130 | } 131 | 132 | // static 133 | LRESULT CALLBACK Win32Window::WndProc(HWND const window, 134 | UINT const message, 135 | WPARAM const wparam, 136 | LPARAM const lparam) noexcept { 137 | if (message == WM_NCCREATE) { 138 | auto window_struct = reinterpret_cast(lparam); 139 | SetWindowLongPtr(window, GWLP_USERDATA, 140 | reinterpret_cast(window_struct->lpCreateParams)); 141 | 142 | auto that = static_cast(window_struct->lpCreateParams); 143 | EnableFullDpiSupportIfAvailable(window); 144 | that->window_handle_ = window; 145 | } else if (Win32Window* that = GetThisFromHandle(window)) { 146 | return that->MessageHandler(window, message, wparam, lparam); 147 | } 148 | 149 | return DefWindowProc(window, message, wparam, lparam); 150 | } 151 | 152 | LRESULT 153 | Win32Window::MessageHandler(HWND hwnd, 154 | UINT const message, 155 | WPARAM const wparam, 156 | LPARAM const lparam) noexcept { 157 | switch (message) { 158 | case WM_DESTROY: 159 | window_handle_ = nullptr; 160 | Destroy(); 161 | if (quit_on_close_) { 162 | PostQuitMessage(0); 163 | } 164 | return 0; 165 | 166 | case WM_DPICHANGED: { 167 | auto newRectSize = reinterpret_cast(lparam); 168 | LONG newWidth = newRectSize->right - newRectSize->left; 169 | LONG newHeight = newRectSize->bottom - newRectSize->top; 170 | 171 | SetWindowPos(hwnd, nullptr, newRectSize->left, newRectSize->top, newWidth, 172 | newHeight, SWP_NOZORDER | SWP_NOACTIVATE); 173 | 174 | return 0; 175 | } 176 | case WM_SIZE: { 177 | RECT rect = GetClientArea(); 178 | if (child_content_ != nullptr) { 179 | // Size and position the child window. 180 | MoveWindow(child_content_, rect.left, rect.top, rect.right - rect.left, 181 | rect.bottom - rect.top, TRUE); 182 | } 183 | return 0; 184 | } 185 | 186 | case WM_ACTIVATE: 187 | if (child_content_ != nullptr) { 188 | SetFocus(child_content_); 189 | } 190 | return 0; 191 | } 192 | 193 | return DefWindowProc(window_handle_, message, wparam, lparam); 194 | } 195 | 196 | void Win32Window::Destroy() { 197 | OnDestroy(); 198 | 199 | if (window_handle_) { 200 | DestroyWindow(window_handle_); 201 | window_handle_ = nullptr; 202 | } 203 | if (g_active_window_count == 0) { 204 | WindowClassRegistrar::GetInstance()->UnregisterWindowClass(); 205 | } 206 | } 207 | 208 | Win32Window* Win32Window::GetThisFromHandle(HWND const window) noexcept { 209 | return reinterpret_cast( 210 | GetWindowLongPtr(window, GWLP_USERDATA)); 211 | } 212 | 213 | void Win32Window::SetChildContent(HWND content) { 214 | child_content_ = content; 215 | SetParent(content, window_handle_); 216 | RECT frame = GetClientArea(); 217 | 218 | MoveWindow(content, frame.left, frame.top, frame.right - frame.left, 219 | frame.bottom - frame.top, true); 220 | 221 | SetFocus(child_content_); 222 | } 223 | 224 | RECT Win32Window::GetClientArea() { 225 | RECT frame; 226 | GetClientRect(window_handle_, &frame); 227 | return frame; 228 | } 229 | 230 | HWND Win32Window::GetHandle() { 231 | return window_handle_; 232 | } 233 | 234 | void Win32Window::SetQuitOnClose(bool quit_on_close) { 235 | quit_on_close_ = quit_on_close; 236 | } 237 | 238 | bool Win32Window::OnCreate() { 239 | // No-op; provided for subclasses. 240 | return true; 241 | } 242 | 243 | void Win32Window::OnDestroy() { 244 | // No-op; provided for subclasses. 245 | } 246 | -------------------------------------------------------------------------------- /lib/src/utils/space_fixer.dart: -------------------------------------------------------------------------------- 1 | import 'package:flutter/material.dart'; 2 | 3 | class SpaceFixerHorizontalLine extends StatelessWidget { 4 | /// [SpaceFixerHorizontalLine] hides space or line between two same color non-ink widgets placed horizontally. 5 | /// 6 | /// ```dart 7 | /// SpaceFixerHorizontalLine( 8 | /// overflowHeight: 3, 9 | /// overflowColor: Colors.black, 10 | /// ), 11 | /// ``` 12 | /// 13 | const SpaceFixerHorizontalLine({ 14 | super.key, 15 | @Deprecated('Context is no longer required.') this.context, 16 | required this.overflowColor, 17 | this.width, 18 | required this.overflowHeight, 19 | this.border, 20 | }); 21 | 22 | final BuildContext? context; 23 | 24 | /// Use [overflowColor] to set color of [SpaceFixerVerticalLine]. 25 | final Color overflowColor; 26 | 27 | /// Use [overflowHeight] to set height of [SpaceFixerVerticalLine]. 28 | final double overflowHeight; 29 | 30 | /// Use [width] is used to provide custom width to the [SpaceFixerVerticalLine]. 31 | final double? width; 32 | 33 | /// Use [border] to set border to the [SpaceFixerVerticalLine]. 34 | final BoxBorder? border; 35 | 36 | @override 37 | Widget build(BuildContext context) { 38 | return LayoutBuilder( 39 | builder: (BuildContext buildContext, BoxConstraints boxConstraints) { 40 | final double width; 41 | width = this.width ?? 42 | boxConstraints.maxWidth; //MediaQuery.of(context).size.width - 1; 43 | return SizedBox( 44 | width: width, 45 | height: 0, 46 | child: Stack( 47 | clipBehavior: Clip.none, 48 | alignment: AlignmentDirectional.center, 49 | children: [ 50 | Positioned( 51 | width: width, 52 | height: overflowHeight, 53 | child: Container( 54 | width: width, 55 | height: overflowHeight, 56 | decoration: BoxDecoration( 57 | color: overflowColor, 58 | border: border, 59 | ), 60 | ), 61 | ), 62 | ], 63 | ), 64 | ); 65 | }, 66 | ); 67 | } 68 | } 69 | 70 | class SpaceFixerVerticalLine extends StatelessWidget { 71 | /// [SpaceFixerVerticalLine] hides space or line between two same color non-ink widgets placed vertically. 72 | /// 73 | /// ```dart 74 | /// SpaceFixerVerticalLine( 75 | /// overflowWidth: 3, 76 | /// overflowColor: Colors.black, 77 | /// ), 78 | /// ``` 79 | /// 80 | const SpaceFixerVerticalLine({ 81 | super.key, 82 | @Deprecated('Context is no longer required.') this.context, 83 | required this.overflowColor, 84 | this.overflowWidth = 2, 85 | this.height, 86 | this.border, 87 | }); 88 | 89 | final BuildContext? context; 90 | 91 | /// Use [overflowColor] to set color of [SpaceFixerVerticalLine]. 92 | final Color overflowColor; 93 | 94 | /// Use [overflowWidth] to set width of [SpaceFixerVerticalLine]. 95 | final double overflowWidth; 96 | 97 | /// Use [height] is used to provide custom height to the [SpaceFixerVerticalLine]. 98 | final double? height; 99 | 100 | /// Use [border] to set border to the [SpaceFixerVerticalLine]. 101 | final BoxBorder? border; 102 | 103 | @override 104 | Widget build(BuildContext context) { 105 | return LayoutBuilder( 106 | builder: (BuildContext buildContext, BoxConstraints boxConstraints) { 107 | final double height; 108 | height = this.height ?? 109 | boxConstraints.maxHeight; //MediaQuery.of(context).size.height; 110 | return SizedBox( 111 | width: 0, 112 | height: height, 113 | child: Stack( 114 | clipBehavior: Clip.none, 115 | alignment: AlignmentDirectional.center, 116 | children: [ 117 | Positioned( 118 | width: overflowWidth, 119 | height: height, 120 | child: Container( 121 | width: overflowWidth, 122 | height: height, 123 | decoration: BoxDecoration( 124 | color: overflowColor, 125 | border: border, 126 | ), 127 | ), 128 | ), 129 | ], 130 | ), 131 | ); 132 | }, 133 | ); 134 | } 135 | } 136 | 137 | class SpaceFixerHorizontalInkLine extends StatelessWidget { 138 | /// [SpaceFixerHorizontalInkLine] hides space or line between two same color ink widgets placed horizontally inside button. 139 | /// 140 | /// ```dart 141 | /// SpaceFixerHorizontalInkLine( 142 | /// overflowHeight: 3, 143 | /// overflowColor: Colors.black, 144 | /// ), 145 | /// ``` 146 | /// 147 | const SpaceFixerHorizontalInkLine({ 148 | super.key, 149 | required this.overflowColor, 150 | this.width, 151 | required this.overflowHeight, 152 | this.border, 153 | }); 154 | 155 | /// Use [overflowColor] to set color of [SpaceFixerVerticalLine]. 156 | final Color overflowColor; 157 | 158 | /// Use [overflowHeight] to set height of [SpaceFixerVerticalLine]. 159 | final double overflowHeight; 160 | 161 | /// Use [width] is used to provide custom width to the [SpaceFixerVerticalLine]. 162 | final double? width; 163 | 164 | /// Use [border] to set border to the [SpaceFixerVerticalLine]. 165 | final BoxBorder? border; 166 | 167 | @override 168 | Widget build(BuildContext context) { 169 | return LayoutBuilder( 170 | builder: (BuildContext buildContext, BoxConstraints boxConstraints) { 171 | final double width; 172 | width = this.width ?? 173 | boxConstraints.maxWidth; //MediaQuery.of(context).size.width - 1; 174 | return SizedBox( 175 | width: width, 176 | height: 0, 177 | child: Stack( 178 | clipBehavior: Clip.none, 179 | alignment: AlignmentDirectional.center, 180 | children: [ 181 | Positioned( 182 | width: width, 183 | height: overflowHeight, 184 | child: SizedBox( 185 | width: width, 186 | height: overflowHeight, 187 | child: Ink( 188 | decoration: BoxDecoration( 189 | color: overflowColor, 190 | border: border, 191 | ), 192 | ), 193 | ), 194 | ), 195 | ], 196 | ), 197 | ); 198 | }, 199 | ); 200 | } 201 | } 202 | 203 | class SpaceFixerVerticalInkLine extends StatelessWidget { 204 | /// [SpaceFixerVerticalInkLine] hides space or line between two same color ink widgets placed vertically inside button. 205 | /// 206 | /// ```dart 207 | /// SpaceFixerVerticalInkLine( 208 | /// overflowWidth: 3, 209 | /// overflowColor: Colors.black, 210 | /// ), 211 | /// ``` 212 | /// 213 | const SpaceFixerVerticalInkLine({ 214 | super.key, 215 | required this.overflowColor, 216 | this.overflowWidth = 2, 217 | this.height, 218 | this.border, 219 | }); 220 | 221 | /// Use [overflowColor] to set color of [SpaceFixerVerticalLine]. 222 | final Color overflowColor; 223 | 224 | /// Use [overflowWidth] to set width of [SpaceFixerVerticalLine]. 225 | final double overflowWidth; 226 | 227 | /// Use [height] is used to provide custom height to the [SpaceFixerVerticalLine]. 228 | final double? height; 229 | 230 | /// Use [border] to set border to the [SpaceFixerVerticalLine]. 231 | final BoxBorder? border; 232 | 233 | @override 234 | Widget build(BuildContext context) { 235 | return LayoutBuilder( 236 | builder: (BuildContext buildContext, BoxConstraints boxConstraints) { 237 | final double height; 238 | height = this.height ?? 239 | boxConstraints.maxHeight; //MediaQuery.of(context).size.height; 240 | return SizedBox( 241 | width: 0, 242 | height: height, 243 | child: Stack( 244 | clipBehavior: Clip.none, 245 | alignment: AlignmentDirectional.center, 246 | children: [ 247 | Positioned( 248 | width: overflowWidth, 249 | height: height, 250 | child: SizedBox( 251 | width: overflowWidth, 252 | height: height, 253 | child: Ink( 254 | decoration: BoxDecoration( 255 | color: overflowColor, 256 | border: border, 257 | ), 258 | ), 259 | ), 260 | ), 261 | ], 262 | ), 263 | ); 264 | }, 265 | ); 266 | } 267 | } 268 | --------------------------------------------------------------------------------