diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..5c98b42
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,2 @@
+# Default ignored files
+/workspace.xml
\ No newline at end of file
diff --git a/.idea/calendarro.iml b/.idea/calendarro.iml
new file mode 100644
index 0000000..ef03246
--- /dev/null
+++ b/.idea/calendarro.iml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/codeStyles/Project.xml b/.idea/codeStyles/Project.xml
new file mode 100644
index 0000000..681f41a
--- /dev/null
+++ b/.idea/codeStyles/Project.xml
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ xmlns:android
+
+ ^$
+
+
+
+
+
+
+
+
+ xmlns:.*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*:id
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ .*:name
+
+ http://schemas.android.com/apk/res/android
+
+
+
+
+
+
+
+
+ name
+
+ ^$
+
+
+
+
+
+
+
+
+ style
+
+ ^$
+
+
+
+
+
+
+
+
+ .*
+
+ ^$
+
+
+ BY_NAME
+
+
+
+
+
+
+ .*
+
+ http://schemas.android.com/apk/res/android
+
+
+ ANDROID_ATTRIBUTE_ORDER
+
+
+
+
+
+
+ .*
+
+ .*
+
+
+ BY_NAME
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Dart_Packages.xml b/.idea/libraries/Dart_Packages.xml
new file mode 100644
index 0000000..965d931
--- /dev/null
+++ b/.idea/libraries/Dart_Packages.xml
@@ -0,0 +1,188 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Dart_SDK.xml b/.idea/libraries/Dart_SDK.xml
new file mode 100644
index 0000000..e852ff3
--- /dev/null
+++ b/.idea/libraries/Dart_SDK.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/libraries/Flutter_Plugins.xml b/.idea/libraries/Flutter_Plugins.xml
new file mode 100644
index 0000000..b0f6971
--- /dev/null
+++ b/.idea/libraries/Flutter_Plugins.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..aa84e03
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..35eb1dd
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/ios/Flutter/.last_build_id b/example/ios/Flutter/.last_build_id
new file mode 100644
index 0000000..64c5c41
--- /dev/null
+++ b/example/ios/Flutter/.last_build_id
@@ -0,0 +1 @@
+00ef326ece8f422830c8ec2e0c41fd4c
\ No newline at end of file
diff --git a/example/ios/Flutter/Flutter.podspec b/example/ios/Flutter/Flutter.podspec
new file mode 100644
index 0000000..5ca3041
--- /dev/null
+++ b/example/ios/Flutter/Flutter.podspec
@@ -0,0 +1,18 @@
+#
+# NOTE: This podspec is NOT to be published. It is only used as a local source!
+#
+
+Pod::Spec.new do |s|
+ s.name = 'Flutter'
+ s.version = '1.0.0'
+ s.summary = 'High-performance, high-fidelity mobile apps.'
+ s.description = <<-DESC
+Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.
+ DESC
+ s.homepage = 'https://flutter.io'
+ s.license = { :type => 'MIT' }
+ s.author = { 'Flutter Dev Team' => 'flutter-dev@googlegroups.com' }
+ s.source = { :git => 'https://github.com/flutter/engine', :tag => s.version.to_s }
+ s.ios.deployment_target = '8.0'
+ s.vendored_frameworks = 'Flutter.framework'
+end
diff --git a/example/ios/Flutter/flutter_export_environment.sh b/example/ios/Flutter/flutter_export_environment.sh
new file mode 100755
index 0000000..87dd5e1
--- /dev/null
+++ b/example/ios/Flutter/flutter_export_environment.sh
@@ -0,0 +1,15 @@
+#!/bin/sh
+# This is a generated file; do not edit or check into version control.
+export "FLUTTER_ROOT=/Users/ebey/Desktop/flutter"
+export "FLUTTER_APPLICATION_PATH=/Users/ebey/Desktop/Github/calendarro/example"
+export "FLUTTER_TARGET=/Users/ebey/Desktop/Github/calendarro/example/lib/main.dart"
+export "FLUTTER_BUILD_DIR=build"
+export "SYMROOT=${SOURCE_ROOT}/../build/ios"
+export "OTHER_LDFLAGS=$(inherited) -framework Flutter"
+export "FLUTTER_FRAMEWORK_DIR=/Users/ebey/Desktop/flutter/bin/cache/artifacts/engine/ios"
+export "FLUTTER_BUILD_NAME=1.0.0"
+export "FLUTTER_BUILD_NUMBER=1"
+export "DART_DEFINES=flutter.inspector.structuredErrors%3Dtrue"
+export "DART_OBFUSCATION=false"
+export "TRACK_WIDGET_CREATION=true"
+export "TREE_SHAKE_ICONS=false"
diff --git a/example/ios/Runner.xcodeproj/project.pbxproj b/example/ios/Runner.xcodeproj/project.pbxproj
index 896e575..4170033 100644
--- a/example/ios/Runner.xcodeproj/project.pbxproj
+++ b/example/ios/Runner.xcodeproj/project.pbxproj
@@ -9,10 +9,6 @@
/* Begin PBXBuildFile section */
1498D2341E8E89220040F4C2 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */; };
3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */; };
- 3B80C3941E831B6300D905FE /* App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; };
- 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 3B80C3931E831B6300D905FE /* App.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
- 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; };
- 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = 9740EEBA1CF902C7004384FC /* Flutter.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB21CF90195004384FC /* Debug.xcconfig */; };
9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */ = {isa = PBXBuildFile; fileRef = 9740EEB31CF90195004384FC /* Generated.xcconfig */; };
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
@@ -29,8 +25,6 @@
dstPath = "";
dstSubfolderSpec = 10;
files = (
- 3B80C3951E831B6300D905FE /* App.framework in Embed Frameworks */,
- 9705A1C71CF904A300538489 /* Flutter.framework in Embed Frameworks */,
);
name = "Embed Frameworks";
runOnlyForDeploymentPostprocessing = 0;
@@ -41,13 +35,11 @@
1498D2321E8E86230040F4C2 /* GeneratedPluginRegistrant.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GeneratedPluginRegistrant.h; sourceTree = ""; };
1498D2331E8E89220040F4C2 /* GeneratedPluginRegistrant.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedPluginRegistrant.m; sourceTree = ""; };
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = AppFrameworkInfo.plist; path = Flutter/AppFrameworkInfo.plist; sourceTree = ""; };
- 3B80C3931E831B6300D905FE /* App.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = App.framework; path = Flutter/App.framework; sourceTree = ""; };
7AFA3C8E1D35360C0083082E /* Release.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; name = Release.xcconfig; path = Flutter/Release.xcconfig; sourceTree = ""; };
7AFFD8ED1D35381100E5BB4D /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; };
7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; };
9740EEB21CF90195004384FC /* Debug.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Debug.xcconfig; path = Flutter/Debug.xcconfig; sourceTree = ""; };
9740EEB31CF90195004384FC /* Generated.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = Generated.xcconfig; path = Flutter/Generated.xcconfig; sourceTree = ""; };
- 9740EEBA1CF902C7004384FC /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Flutter.framework; path = Flutter/Flutter.framework; sourceTree = ""; };
97C146EE1CF9000F007C117D /* Runner.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Runner.app; sourceTree = BUILT_PRODUCTS_DIR; };
97C146F21CF9000F007C117D /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; };
97C146FB1CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; };
@@ -61,8 +53,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
- 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */,
- 3B80C3941E831B6300D905FE /* App.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -72,9 +62,7 @@
9740EEB11CF90186004384FC /* Flutter */ = {
isa = PBXGroup;
children = (
- 3B80C3931E831B6300D905FE /* App.framework */,
3B3967151E833CAA004F5970 /* AppFrameworkInfo.plist */,
- 9740EEBA1CF902C7004384FC /* Flutter.framework */,
9740EEB21CF90195004384FC /* Debug.xcconfig */,
7AFA3C8E1D35360C0083082E /* Release.xcconfig */,
9740EEB31CF90195004384FC /* Generated.xcconfig */,
@@ -208,7 +196,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
- shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin";
+ shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed_and_thin";
};
9740EEB61CF901F6004384FC /* Run Script */ = {
isa = PBXShellScriptBuildPhase;
@@ -261,7 +249,6 @@
/* Begin XCBuildConfiguration section */
97C147031CF9000F007C117D /* Debug */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
@@ -315,7 +302,6 @@
};
97C147041CF9000F007C117D /* Release */ = {
isa = XCBuildConfiguration;
- baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_ANALYZER_NONNULL = YES;
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 96ad596..afa1e4a 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -2,58 +2,235 @@ import 'package:calendarro/date_utils.dart';
import 'package:flutter/material.dart';
import 'package:calendarro/calendarro.dart';
+import 'package:calendarro/date_utils.dart';
+import 'package:intl/intl.dart';
+
+List months = ["January","February","March","April","May","June","July","August","September","October","November","December"];
+
+var now = new DateTime.now();
+
void main() => runApp(new MyApp());
-class MyApp extends StatelessWidget {
+class CustomDayTileBuilder extends DayTileBuilder{
+
+ CustomDayTileBuilder();
+
+ @override
+ Widget build(BuildContext context, DateTime date, onTap) {
+ return CustomCalenderDayItem(date: date, calendarroState: Calendarro.of(context), onTap: onTap,);
+ }
+
+}
+
+class CustomCalenderDayItem extends StatelessWidget {
+ CustomCalenderDayItem({this.date, this.calendarroState, this.onTap});
+
+ DateTime date;
+ CalendarroState calendarroState;
+ DateTimeCallback onTap;
+
+ @override
+ Widget build(BuildContext context) {
+ bool isWeekend = DateUtils.isWeekend(date);
+ var textColor = isWeekend ? Colors.grey : Colors.black;
+ bool isToday = DateUtils.isToday(date);
+ calendarroState = Calendarro.of(context);
+
+ bool daySelected = calendarroState.isDateSelected(date);
+
+ BoxDecoration boxDecoration;
+ if (daySelected) {
+ boxDecoration = BoxDecoration(color: Colors.blue, shape: BoxShape.circle);
+ } else if (isToday) {
+ boxDecoration = BoxDecoration(
+ border: Border.all(
+ color: Colors.white,
+ width: 1.0,
+ ),
+ shape: BoxShape.circle);
+ }
+
+ return Expanded(
+ child: GestureDetector(
+ child: Column(
+ children: [
+ Container(
+ height: 20.0,
+ decoration: boxDecoration,
+ child: Center(
+ child: Text(
+ "${date.day}",
+ textAlign: TextAlign.center,
+ style: TextStyle(color: textColor),
+ ))),
+ Container(
+ height: 20.0,
+ child: Image.network("https://www.netclipart.com/pp/m/138-1388728_cloudy-day-outlined-cloudy-weather-icon-png.png"),
+ )
+ ],
+ ),
+ onTap: handleTap,
+ behavior: HitTestBehavior.translucent,
+ ));
+ }
+ void handleTap() {
+ if (onTap != null) {
+ onTap(date);
+ }
+
+ calendarroState.setSelectedDate(date);
+ calendarroState.setCurrentDate(date);
+ }
+}
+
+
+class MyApp extends StatefulWidget {
+ @override
+ _MyAppState createState() => _MyAppState();
+}
+
+class _MyAppState extends State {
@override
Widget build(BuildContext context) {
- return new MaterialApp(
- title: 'Calendarro Demo',
- theme: new ThemeData(
- primarySwatch: Colors.orange,
+ return MaterialApp(
+ title: "Demo",
+ home: Scaffold(
+ appBar: AppBar(
+ title: Text("Demo"),
+ ),
+ body: Container(
+ height: 3000,
+ child: Calender(),
+ ),
),
- home: new MyHomePage(title: 'Calendarro Demo'),
);
}
}
-class MyHomePage extends StatelessWidget {
- final String title;
- Calendarro monthCalendarro;
-
- MyHomePage({Key key, this.title}) : super(key: key);
+class Calender extends StatefulWidget {
+ @override
+ _CalenderState createState() => _CalenderState();
+}
+class _CalenderState extends State {
+ var currentMonth = now.month;
+ var startDate = DateUtils.getFirstDayOfCurrentMonth();
+ var endDate = DateTime(2021);
+ List selectedDates = [];
+ DateTime singleSelectedDate;
+ Calendarro monthCalendarro;
@override
Widget build(BuildContext context) {
- var startDate = DateUtils.getFirstDayOfCurrentMonth();
- var endDate = DateUtils.getLastDayOfNextMonth();
+
+ print("Current month: $currentMonth");
+ print("Selected Dates : $selectedDates");
monthCalendarro = Calendarro(
- startDate: startDate,
- endDate: endDate,
- displayMode: DisplayMode.MONTHS,
- selectionMode: SelectionMode.MULTI,
- weekdayLabelsRow: CustomWeekdayLabelsRow(),
- onTap: (date) {
- print("onTap: $date");
+ dayTileBuilder: CustomDayTileBuilder(),
+ startDate: startDate,
+ endDate: endDate,
+ displayMode: DisplayMode.MONTHS,
+ selectionMode: SelectionMode.SINGLE,
+ selectedDates: selectedDates,
+ selectedSingleDate: singleSelectedDate,
+ weekdayLabelsRow: CustomWeekdayLabelsRow(),
+ onPageSelected: (nextStartDate, nextEndDate){
+ print("Selected $nextStartDate - $nextEndDate");
+ setState(() {
+ currentMonth = nextStartDate.month;
+ //startDate = nextStartDate;
+ //endDate = nextEndDate;
});
- return new Scaffold(
- appBar: new AppBar(
- title: new Text(title),
- ),
- body: Column(
- children: [
- Container(
- color: Colors.orange,
- child: Calendarro(),
+ print(currentMonth);
+ },
+ onTap: (date){
+ print("Tapped $date");
+ setState(() {
+ //selectedDates = selectedDates;
+ });
+ },
+ );
+ return Column(
+ children: [
+ Container(
+ color: Colors.red,
+ child: Text(
+ months[currentMonth-1],
+ textAlign: TextAlign.center,
),
- Container(height: 32.0),
- monthCalendarro
- ],
- ),
+ ),
+ monthCalendarro,
+ Container(
+ child: Text("$selectedDates"),
+ ),
+ ],
);
}
}
+
+
+
+//class MyApp extends StatelessWidget {
+// @override
+// Widget build(BuildContext context) {
+// return new MaterialApp(
+// title: 'Calendarro Demo',
+// theme: new ThemeData(
+// primarySwatch: Colors.orange,
+// ),
+// home: new MyHomePage(title: 'Calender Demo'),
+// );
+// }
+//}
+//
+//class MyHomePage extends StatelessWidget {
+// final String title;
+// var currentMonth = 0;
+// Calendarro monthCalendarro;
+//
+// MyHomePage({Key key, this.title}) : super(key: key);
+//
+// @override
+// Widget build(BuildContext context) {
+// var startDate = DateUtils.getFirstDayOfCurrentMonth();
+// var endDate = DateUtils.getLastDayOfNextMonth();
+// var now = new DateTime.now();
+// currentMonth = now.month;
+// monthCalendarro = Calendarro(
+// startDate: startDate,
+// endDate: endDate,
+// displayMode: DisplayMode.MONTHS,
+// selectionMode: SelectionMode.MULTI,
+// weekdayLabelsRow: CustomWeekdayLabelsRow(),
+// onPageSelected: (startDate,endDate){
+// print("Selected $startDate : $endDate");
+// currentMonth =startDate.month;
+// print(currentMonth);
+// },
+// onTap: (date) {
+// print("onTap: $date");
+// });
+//
+// return new Scaffold(
+// appBar: new AppBar(
+// title: new Text(title),
+// ),
+// body: Column(
+// children: [
+// Container(
+// color: Colors.red,
+// child: Text(
+// months[currentMonth+1],
+// textAlign: TextAlign.center,
+// ),
+// height: 32.0),
+// monthCalendarro
+// ],
+// ),
+// );
+// }
+//}
+
class CustomWeekdayLabelsRow extends StatelessWidget {
@override
Widget build(BuildContext context) {
diff --git a/example/pubspec.lock b/example/pubspec.lock
index e92c641..d9ca0e9 100644
--- a/example/pubspec.lock
+++ b/example/pubspec.lock
@@ -7,35 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.2.0"
+ version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ version: "2.0.0"
calendarro:
dependency: "direct dev"
description:
path: ".."
relative: true
source: path
- version: "1.0.1"
+ version: "1.2.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.2"
+ version: "1.1.3"
+ clock:
+ dependency: transitive
+ description:
+ name: clock
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.11"
+ version: "1.14.12"
cupertino_icons:
dependency: "direct main"
description:
@@ -43,6 +50,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "0.1.2"
+ fake_async:
+ dependency: transitive
+ description:
+ name: fake_async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@@ -53,41 +67,34 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
+ intl:
+ dependency: "direct main"
+ description:
+ name: intl
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "0.16.1"
matcher:
dependency: transitive
description:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.5"
+ version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.1.8"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.2"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
version: "1.7.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
@@ -99,7 +106,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.5"
+ version: "1.7.0"
stack_trace:
dependency: transitive
description:
@@ -120,7 +127,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ version: "1.0.5"
term_glyph:
dependency: transitive
description:
@@ -134,7 +141,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.5"
+ version: "0.2.16"
typed_data:
dependency: transitive
description:
@@ -150,4 +157,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
- dart: ">=2.2.2 <3.0.0"
+ dart: ">=2.7.0 <3.0.0"
diff --git a/example/pubspec.yaml b/example/pubspec.yaml
index b7de302..2e783ef 100644
--- a/example/pubspec.yaml
+++ b/example/pubspec.yaml
@@ -8,6 +8,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.2
+ intl: ^0.16.1
dev_dependencies:
flutter_test:
diff --git a/lib/calendarro.dart b/lib/calendarro.dart
index 07eff6d..281652a 100644
--- a/lib/calendarro.dart
+++ b/lib/calendarro.dart
@@ -48,6 +48,8 @@ class Calendarro extends StatefulWidget {
this.onTap,
this.onPageSelected,
this.weekdayLabelsRow,
+ this.dayTileHeight,
+ this.dayLabelHeight
}) : super(key: key) {
if (startDate == null) {
startDate = DateUtils.getFirstDayOfCurrentMonth();
@@ -150,6 +152,7 @@ class CalendarroState extends State {
setState(() {
switch (widget.selectionMode) {
case SelectionMode.SINGLE:
+ print("setting single date");
selectedSingleDate = date;
break;
case SelectionMode.MULTI:
@@ -204,6 +207,7 @@ class CalendarroState extends State {
widgetHeight = widget.dayLabelHeight
+ maxWeeksNumber * widget.dayTileHeight;
}
+ //print(widgetHeight);
return Container(
height: widgetHeight,
diff --git a/lib/date_utils.dart b/lib/date_utils.dart
index 78de495..3db2239 100644
--- a/lib/date_utils.dart
+++ b/lib/date_utils.dart
@@ -71,8 +71,20 @@ class DateUtils {
return firstDayOfCurrentMonth;
}
+ static DateTime subtractMonths(DateTime fromMonth, int months) {
+ DateTime firstDayOfCurrentMonth = fromMonth;
+ for (int i = 0; i < months; i++) {
+ firstDayOfCurrentMonth =
+ getFirstDayOfMonth(firstDayOfCurrentMonth)
+ .subtract(Duration(days: 1));
+ }
+
+ return firstDayOfCurrentMonth;
+ }
+
static DateTime getFirstDayOfMonth(DateTime month) {
- return DateTime(month.year, month.month);
+ //print(month);
+ return DateTime(month.year, month.month,1);
}
static DateTime getLastDayOfMonth(DateTime month) {
@@ -98,11 +110,13 @@ class DateUtils {
DateTime endDate) {
int monthsNumber = calculateMonthsDifference(startDate, endDate);
+ //print("monthNumber: $monthsNumber");
List weeksNumbersMonthly = List();
-
+ //print("$startDate,$endDate");
if (monthsNumber == 0) {
+ //print("HERE");
return calculateWeeksNumber(startDate, endDate);
} else {
weeksNumbersMonthly.add(
@@ -112,6 +126,8 @@ class DateUtils {
DateTime firstDateOfMonth = getFirstDayOfMonth(startDate);
for (int i = 1; i <= monthsNumber - 2; i++) {
firstDateOfMonth = firstDateOfMonth.add(Duration(days: 31));
+ firstDateOfMonth = getFirstDayOfMonth(firstDateOfMonth);
+ //print("firstDateofMonth :$firstDateOfMonth");
weeksNumbersMonthly.add(
calculateWeeksNumber(
firstDateOfMonth,
@@ -123,6 +139,8 @@ class DateUtils {
calculateWeeksNumber(getFirstDayOfMonth(endDate), endDate)
);
+ //print(weeksNumbersMonthly);
+
weeksNumbersMonthly.sort((a, b) => b.compareTo(a));
return weeksNumbersMonthly[0];
}
diff --git a/pubspec.lock b/pubspec.lock
index 7642229..bd50f82 100644
--- a/pubspec.lock
+++ b/pubspec.lock
@@ -7,28 +7,42 @@ packages:
name: async
url: "https://pub.dartlang.org"
source: hosted
- version: "2.2.0"
+ version: "2.4.1"
boolean_selector:
dependency: transitive
description:
name: boolean_selector
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ version: "2.0.0"
charcode:
dependency: transitive
description:
name: charcode
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.2"
+ version: "1.1.3"
+ clock:
+ dependency: transitive
+ description:
+ name: clock
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.0.1"
collection:
dependency: transitive
description:
name: collection
url: "https://pub.dartlang.org"
source: hosted
- version: "1.14.11"
+ version: "1.14.12"
+ fake_async:
+ dependency: transitive
+ description:
+ name: fake_async
+ url: "https://pub.dartlang.org"
+ source: hosted
+ version: "1.1.0"
flutter:
dependency: "direct main"
description: flutter
@@ -45,35 +59,21 @@ packages:
name: matcher
url: "https://pub.dartlang.org"
source: hosted
- version: "0.12.5"
+ version: "0.12.6"
meta:
dependency: transitive
description:
name: meta
url: "https://pub.dartlang.org"
source: hosted
- version: "1.1.6"
+ version: "1.1.8"
path:
dependency: transitive
description:
name: path
url: "https://pub.dartlang.org"
source: hosted
- version: "1.6.2"
- pedantic:
- dependency: transitive
- description:
- name: pedantic
- url: "https://pub.dartlang.org"
- source: hosted
version: "1.7.0"
- quiver:
- dependency: transitive
- description:
- name: quiver
- url: "https://pub.dartlang.org"
- source: hosted
- version: "2.0.3"
sky_engine:
dependency: transitive
description: flutter
@@ -85,7 +85,7 @@ packages:
name: source_span
url: "https://pub.dartlang.org"
source: hosted
- version: "1.5.5"
+ version: "1.7.0"
stack_trace:
dependency: transitive
description:
@@ -106,7 +106,7 @@ packages:
name: string_scanner
url: "https://pub.dartlang.org"
source: hosted
- version: "1.0.4"
+ version: "1.0.5"
term_glyph:
dependency: transitive
description:
@@ -120,7 +120,7 @@ packages:
name: test_api
url: "https://pub.dartlang.org"
source: hosted
- version: "0.2.5"
+ version: "0.2.16"
typed_data:
dependency: transitive
description:
@@ -136,4 +136,4 @@ packages:
source: hosted
version: "2.0.8"
sdks:
- dart: ">=2.2.2 <3.0.0"
+ dart: ">=2.7.0 <3.0.0"