master
ifgyong 5 years ago
parent 5dccd93949
commit fe5c7e4480

@ -75,7 +75,7 @@
<entry key="flutter_custom_calendar"> <entry key="flutter_custom_calendar">
<value> <value>
<list> <list>
<option value="$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/flutter_custom_calendar-1.0.2/lib" /> <option value="$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/flutter_custom_calendar-1.0.4+0.2/lib" />
</list> </list>
</value> </value>
</entry> </entry>
@ -224,7 +224,7 @@
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/convert-2.1.1/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/convert-2.1.1/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.4/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/crypto-2.1.4/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/cupertino_icons-0.1.3/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/cupertino_icons-0.1.3/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/flutter_custom_calendar-1.0.2/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/flutter_custom_calendar-1.0.4+0.2/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/image-2.1.12/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/image-2.1.12/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.6/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/matcher-0.12.6/lib" />
<root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.8/lib" /> <root url="file://$USER_HOME$/flutterSDK/flutter1.17-stable/.pub-cache/hosted/pub.flutter-io.cn/meta-1.1.8/lib" />

@ -7,8 +7,15 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18463f0e-cf10-4ee2-975b-376476396e12" name="Default Changelist" comment=""> <list default="true" id="18463f0e-cf10-4ee2-975b-376476396e12" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/libraries/Dart_Packages.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" /> <change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.lock" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.lock" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/example/pubspec.yaml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/utils/lunar_util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/utils/lunar_util.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/utils/solar_term_util.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/utils/solar_term_util.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/lib/widget/month_view.dart" beforeDir="false" afterPath="$PROJECT_DIR$/lib/widget/month_view.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
</list> </list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" /> <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />

@ -60,7 +60,7 @@ import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';
### 动画演示 ### 动画演示
![](./img.gif) ![](https://github.com/ifgyong/flutter_custom_calendar/blob/master/img.gif)
### [查看API](https://github.com/ifgyong/flutter_custom_calendar/blob/master/API.md) ### [查看API](https://github.com/ifgyong/flutter_custom_calendar/blob/master/API.md)
### [查看一个例子 如何使用](https://github.com/ifgyong/flutter_custom_calendar/blob/master/example/lib/main.dart) ### [查看一个例子 如何使用](https://github.com/ifgyong/flutter_custom_calendar/blob/master/example/lib/main.dart)

@ -69,6 +69,11 @@ class _MyHomePageState extends State<MyHomePage> {
dayWidgetBuilder: (DateModel model) { dayWidgetBuilder: (DateModel model) {
double wd = (MediaQuery.of(context).size.width - 20) / 7; double wd = (MediaQuery.of(context).size.width - 20) / 7;
bool _isSelected = model.isSelected; bool _isSelected = model.isSelected;
if (_isSelected &&
CalendarSelectedMode.singleSelect ==
controller.calendarConfiguration.selectMode) {
_selectDate = model.toString();
}
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(wd / 2)), borderRadius: BorderRadius.all(Radius.circular(wd / 2)),
child: Container( child: Container(

@ -75,7 +75,7 @@ packages:
name: flutter_custom_calendar name: flutter_custom_calendar
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.2" version: "1.0.4+0.2"
flutter_test: flutter_test:
dependency: "direct dev" dependency: "direct dev"
description: flutter description: flutter

@ -29,7 +29,7 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^0.1.3 cupertino_icons: ^0.1.3
flutter_custom_calendar: ^1.0.2 flutter_custom_calendar: ^1.0.4+0.3
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

@ -1,9 +1,9 @@
import 'package:flutter_custom_calendar/flutter_custom_calendar.dart'; import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';
import 'package:flutter_custom_calendar/utils/solar_term_util.dart'; import 'package:flutter_custom_calendar/utils/solar_term_util.dart';
/** ///**
* ///*
*/ ///*/
class LunarUtil { class LunarUtil {
static List<int> LUNAR_MONTH_DAYS = [ static List<int> LUNAR_MONTH_DAYS = [
1887, 1887,
@ -461,14 +461,14 @@ class LunarUtil {
0x107e48 0x107e48
]; ];
/** ////**
* 24 ///* 24
*/ ///*/
static final Map<int, List<String>> SOLAR_TERMS = new Map(); static final Map<int, List<String>> SOLAR_TERMS = new Map();
/** ////**
* ///*
*/ ///*/
static List<String> SOLAR_CALENDAR = [ static List<String> SOLAR_CALENDAR = [
"0101元旦", "0101元旦",
"0214情人节", "0214情人节",

@ -3,14 +3,8 @@ import 'dart:math';
import 'package:flutter_custom_calendar/utils/math_util.dart'; import 'package:flutter_custom_calendar/utils/math_util.dart';
/**
* http://www.cnblogs.com/moodlxs/archive/2010/12/18/2345392.html
* 24
*/
class SolarTermUtil { class SolarTermUtil {
/** /// 24
* 24
*/
static List<String> SOLAR_TERMS = [ static List<String> SOLAR_TERMS = [
"春分", "春分",
"清明", "清明",
@ -38,25 +32,17 @@ class SolarTermUtil {
"惊蛰", "惊蛰",
]; ];
/** ///
*
*/
static final double SECOND_PER_RAD = 180 * 3600 / pi; static final double SECOND_PER_RAD = 180 * 3600 / pi;
/** ///
*
*/
static final double ANGLE_PER_RAD = 180 / pi; static final double ANGLE_PER_RAD = 180 / pi;
/** ///
* /// * 2000(2000-1-1)
* 2000(2000-1-1)
*/
static final double J2000 = 2451545; static final double J2000 = 2451545;
/** ///
*
*/
static final List<double> H_C_ANGLE_TABLE = [ static final List<double> H_C_ANGLE_TABLE = [
0, 0,
50287.92262, 50287.92262,
@ -68,9 +54,7 @@ class SolarTermUtil {
0.00001 0.00001
]; ];
/** ///
*
*/
static final List<double> DTS = [ static final List<double> DTS = [
-4000, -4000,
108371.7, 108371.7,

@ -249,6 +249,7 @@ class ItemContainerState extends State<ItemContainer> {
case CalendarSelectedMode.multiSelect: case CalendarSelectedMode.multiSelect:
if (calendarProvider.selectedDateList.contains(dateModel)) { if (calendarProvider.selectedDateList.contains(dateModel)) {
calendarProvider.selectedDateList.remove(dateModel); calendarProvider.selectedDateList.remove(dateModel);
_notifiCationUnCalendarSelect(dateModel);
} else { } else {
// //
if (calendarProvider.selectedDateList.length == if (calendarProvider.selectedDateList.length ==
@ -258,11 +259,14 @@ class ItemContainerState extends State<ItemContainer> {
} }
return; return;
} }
dateModel.isSelected = !dateModel.isSelected;
calendarProvider.selectedDateList.add(dateModel); calendarProvider.selectedDateList.add(dateModel);
// _notifiCationCalendarSelect(dateModel);
} }
// //
calendarProvider.selectDateModel = dateModel; calendarProvider.selectDateModel = dateModel;
print('多选:${calendarProvider.selectedDateList.toString()}');
break; break;
/// ///
@ -270,14 +274,9 @@ class ItemContainerState extends State<ItemContainer> {
/// ///
calendarProvider.selectedDateList.forEach((element) { calendarProvider.selectedDateList.forEach((element) {
if (configuration.unCalendarSelect != null) {
configuration.unCalendarSelect(element);
}
element.isSelected = false; element.isSelected = false;
_notifiCationUnCalendarSelect(element);
}); });
if (configuration.calendarSelect != null) {
configuration.calendarSelect(dateModel);
}
//item //item
if (calendarProvider.lastClickItemState != this) { if (calendarProvider.lastClickItemState != this) {
@ -285,9 +284,9 @@ class ItemContainerState extends State<ItemContainer> {
calendarProvider.lastClickItemState = this; calendarProvider.lastClickItemState = this;
} }
_notifiCationUnCalendarSelect(calendarProvider.selectDateModel); _notifiCationUnCalendarSelect(calendarProvider.selectDateModel);
dateModel.isSelected = true;
calendarProvider.selectDateModel = dateModel; calendarProvider.selectDateModel = dateModel;
_notifiCationCalendarSelect(dateModel);
setState(() {}); setState(() {});
break; break;
@ -332,6 +331,9 @@ class ItemContainerState extends State<ItemContainer> {
setState(() {}); setState(() {});
} }
break;
}
/// ///
if (configuration.calendarSelect != null && if (configuration.calendarSelect != null &&
calendarProvider.selectedDateList.length > 0) { calendarProvider.selectedDateList.length > 0) {
@ -339,8 +341,6 @@ class ItemContainerState extends State<ItemContainer> {
_notifiCationCalendarSelect(element); _notifiCationCalendarSelect(element);
}); });
} }
break;
}
refreshItem(!this.dateModel.isSelected); refreshItem(!this.dateModel.isSelected);
}, },

@ -1,6 +1,6 @@
name: flutter_custom_calendar name: flutter_custom_calendar
description: A calendar control of flutter that supports three selection modes。 description: A calendar control of flutter that supports three selection modes。
version: 1.0.4 version: 1.0.4+0.3
homepage: http://www.fgyong.cn homepage: http://www.fgyong.cn
author: fgyong author: fgyong
repository: https://github.com/ifgyong/flutter_custom_calendar repository: https://github.com/ifgyong/flutter_custom_calendar

Loading…
Cancel
Save