创建configuration类,将配置的信息放到这里

引入provider状态管理,避免深层嵌套传递信息
周视图和月视图,联动
增加日志输出类LogUtil,方便查看调试
增加example例子
develop
xiaodong 5 years ago
parent 95f2ca12ac
commit 025be98263

@ -0,0 +1,225 @@
import 'package:flutter/material.dart';
import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';
import 'package:flutter_custom_calendar/style/style.dart';
import 'package:random_pk/random_pk.dart';
/**
*
*/
class CustomSignPage extends StatefulWidget {
CustomSignPage({Key key, this.title}) : super(key: key);
final String title;
@override
_CustomSignPageState createState() => _CustomSignPageState();
}
class _CustomSignPageState extends State<CustomSignPage> {
String text;
CalendarController controller;
Map<DateModel, String> customExtraData = {
DateModel.fromDateTime(DateTime.now().add(Duration(days: -1))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -2))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -3))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -4))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -5))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -6))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -7))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: -8))): "",
DateModel.fromDateTime(DateTime.now()): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 1))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 2))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 3))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 4))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 5))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 6))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 7))): "",
DateModel.fromDateTime(DateTime.now().add(Duration(days: 8))): "",
};
@override
void initState() {
text = "${DateTime.now().year}${DateTime.now().month}";
controller = new CalendarController(
weekBarItemWidgetBuilder: () {
return CustomStyleWeekBarItem();
},
dayWidgetBuilder: (dateModel) {
return CustomStyleDayWidget(dateModel);
},
extraDataMap: customExtraData);
controller.addMonthChangeListener(
(year, month) {
setState(() {
text = "$year$month";
});
},
);
controller.addOnCalendarSelectListener((dateModel) {
//
setState(() {});
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: new Container(
child: new Column(
children: <Widget>[
new Row(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
new IconButton(
icon: Icon(Icons.navigate_before),
onPressed: () {
controller.moveToPreviousMonth();
}),
new Text(text),
new IconButton(
icon: Icon(Icons.navigate_next),
onPressed: () {
controller.moveToNextMonth();
}),
],
),
CalendarViewWidget(
calendarController: controller,
),
new Text(
"自定义创建Item\n选中的时间:\n${controller.getSingleSelectCalendar().toString()}"),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
controller.toggleExpandStatus();
},
tooltip: 'Increment',
child: Icon(Icons.add),
), // This trailing comma makes auto-formatting nicer for build methods.
);
}
}
class CustomStyleWeekBarItem extends BaseWeekBar {
List<String> weekList = ["", "", "", "", "", "", ""];
@override
Widget getWeekBarItem(int index) {
return new Container(
child: new Center(
child: new Text(weekList[index]),
),
);
}
}
class CustomStyleDayWidget extends BaseCombineDayWidget {
CustomStyleDayWidget(DateModel dateModel) : super(dateModel);
@override
Widget getNormalWidget(DateModel dateModel) {
return Container(
margin: EdgeInsets.all(8),
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
//
new Expanded(
child: Center(
child: new Text(
dateModel.day.toString(),
style: currentMonthTextStyle,
),
),
),
//
new Expanded(
child: Center(
child: new Text(
"${dateModel.lunarString}",
style: lunarTextStyle,
),
),
),
],
),
dateModel.extraData != null
? Positioned(
child: Text(
"${dateModel.extraData}",
style: TextStyle(fontSize: 10, color: RandomColor.next()),
),
right: 0,
top: 0,
)
: Container()
],
),
);
}
@override
Widget getSelectedWidget(DateModel dateModel) {
return Container(
margin: EdgeInsets.all(8),
foregroundDecoration:
new BoxDecoration(border: Border.all(width: 2, color: Colors.blue)),
child: new Stack(
alignment: Alignment.center,
children: <Widget>[
new Column(
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
//
new Expanded(
child: Center(
child: new Text(
dateModel.day.toString(),
style: currentMonthTextStyle,
),
),
),
//
new Expanded(
child: Center(
child: new Text(
"${dateModel.lunarString}",
style: lunarTextStyle,
),
),
),
],
),
dateModel.extraData != null
? Positioned(
child: Text(
"${dateModel.extraData}",
style: TextStyle(fontSize: 10, color: RandomColor.next()),
),
right: 0,
top: 0,
)
: Container()
],
),
);
}
}

@ -1,4 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'custom_sign_page.dart';
import 'custom_style_page.dart'; import 'custom_style_page.dart';
import 'default_style_page.dart'; import 'default_style_page.dart';
import 'multi_select_style_page.dart'; import 'multi_select_style_page.dart';
@ -24,6 +25,9 @@ class MyApp extends StatelessWidget {
"/progress": (context) => ProgressStylePage( "/progress": (context) => ProgressStylePage(
title: "进度条风格+单选", title: "进度条风格+单选",
), ),
"/custom_sign": (context) => CustomSignPage(
title: "自定义额外数据,实现标记功能",
)
}, },
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
@ -64,6 +68,12 @@ class HomePage extends StatelessWidget {
}, },
child: new Text("进度条风格+单选"), child: new Text("进度条风格+单选"),
), ),
new RaisedButton(
onPressed: () {
Navigator.pushNamed(context, "/custom_sign");
},
child: new Text("自定义额外数据,实现标记功能"),
),
], ],
), ),
), ),

@ -81,8 +81,8 @@ class _MultiSelectStylePageState extends State<MultiSelectStylePage> {
CalendarViewWidget( CalendarViewWidget(
calendarController: controller, calendarController: controller,
), ),
new Text( // new Text(
"多选模式\n选中的时间:\n${controller.getMultiSelectCalendar().toString()}"), // "多选模式\n选中的时间:\n${controller.getMultiSelectCalendar().toString()}"),
], ],
), ),
), ),

@ -23,13 +23,13 @@ class _ProgressStylePageState extends State<ProgressStylePage> {
DateTime now = DateTime.now(); DateTime now = DateTime.now();
DateTime temp = DateTime(now.year, now.month, now.day); DateTime temp = DateTime(now.year, now.month, now.day);
Map<DateTime, int> progressMap = { Map<DateModel, int> progressMap = {
temp.add(Duration(days: 1)): 0, DateModel.fromDateTime(temp.add(Duration(days: 1))): 0,
temp.add(Duration(days: 2)): 20, DateModel.fromDateTime(temp.add(Duration(days: 2))): 20,
temp.add(Duration(days: 3)): 40, DateModel.fromDateTime(temp.add(Duration(days: 3))): 40,
temp.add(Duration(days: 4)): 60, DateModel.fromDateTime(temp.add(Duration(days: 4))): 60,
temp.add(Duration(days: 5)): 80, DateModel.fromDateTime(temp.add(Duration(days: 5))): 80,
temp.add(Duration(days: 6)): 100, DateModel.fromDateTime(temp.add(Duration(days: 6))): 100,
}; };
controller = new CalendarController( controller = new CalendarController(
@ -90,8 +90,8 @@ class _ProgressStylePageState extends State<ProgressStylePage> {
CalendarViewWidget( CalendarViewWidget(
calendarController: controller, calendarController: controller,
), ),
new Text( // new Text(
"单选模式\n选中的时间:\n${controller.getSingleSelectCalendar().toString()}"), // "单选模式\n选中的时间:\n${controller.getSingleSelectCalendar().toString()}"),
], ],
), ),
), ),

@ -1,5 +1,5 @@
# Generated by pub # Generated by pub
# See https://www.dartlang.org/tools/pub/glossary#lockfile # See https://dart.dev/tools/pub/glossary#lockfile
packages: packages:
async: async:
dependency: transitive dependency: transitive
@ -7,14 +7,14 @@ packages:
name: async name: async
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.3.0"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:
name: boolean_selector name: boolean_selector
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.4" version: "1.0.5"
charcode: charcode:
dependency: transitive dependency: transitive
description: description:
@ -66,28 +66,42 @@ packages:
name: meta name: meta
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.1.6" version: "1.1.7"
path: path:
dependency: transitive dependency: transitive
description: description:
name: path name: path
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.6.2" version: "1.6.4"
pedantic: pedantic:
dependency: transitive dependency: transitive
description: description:
name: pedantic name: pedantic
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.5.0" version: "1.8.0+1"
provider:
dependency: transitive
description:
name: provider
url: "https://pub.flutter-io.cn"
source: hosted
version: "3.0.0+1"
quiver: quiver:
dependency: transitive dependency: transitive
description: description:
name: quiver name: quiver
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.0.2" version: "2.0.5"
random_pk:
dependency: "direct main"
description:
name: random_pk
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.3"
sky_engine: sky_engine:
dependency: transitive dependency: transitive
description: flutter description: flutter
@ -120,7 +134,7 @@ packages:
name: string_scanner name: string_scanner
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.4" version: "1.0.5"
term_glyph: term_glyph:
dependency: transitive dependency: transitive
description: description:
@ -134,7 +148,7 @@ packages:
name: test_api name: test_api
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.2.4" version: "0.2.5"
typed_data: typed_data:
dependency: transitive dependency: transitive
description: description:
@ -150,4 +164,4 @@ packages:
source: hosted source: hosted
version: "2.0.8" version: "2.0.8"
sdks: sdks:
dart: ">=2.2.0 <3.0.0" dart: ">=2.2.2 <3.0.0"

@ -27,7 +27,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.2 cupertino_icons: ^0.1.2
random_pk: any
flutter_custom_calendar: flutter_custom_calendar:
path: ../ path: ../

@ -9,8 +9,8 @@ class CalendarConfiguration {
//,MODE_SINGLE_SELECTMODE_MULTI_SELECT //,MODE_SINGLE_SELECTMODE_MULTI_SELECT
int selectMode; int selectMode;
// bool defaultExpandStatus; //,truefalse
bool defaultExpandStatus; bool enableExpand; //
// //
int minYear; int minYear;
@ -35,13 +35,13 @@ class CalendarConfiguration {
Set<DateModel> defaultSelectedDateList = new Set(); // Set<DateModel> defaultSelectedDateList = new Set(); //
int maxMultiSelectCount; // int maxMultiSelectCount; //
Map<DateTime, Object> extraDataMap = new Map(); // Map<DateModel, Object> extraDataMap = new Map(); //
/** /**
* UI * UI
*/ */
double verticalSpacing; //item10 double verticalSpacing; //item10
BoxDecoration boxDecoration; //
// //
DayWidgetBuilder dayWidgetBuilder; //item DayWidgetBuilder dayWidgetBuilder; //item
@ -86,7 +86,8 @@ class CalendarConfiguration {
this.pageController, this.pageController,
this.weekController, this.weekController,
this.verticalSpacing, this.verticalSpacing,
bool defaultExpandStatus = true}) { this.enableExpand,
bool defaultExpandStatus}) {
this.defaultExpandStatus = defaultExpandStatus; this.defaultExpandStatus = defaultExpandStatus;
} }

@ -1,16 +1,13 @@
import 'dart:developer';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_custom_calendar/calendar_provider.dart'; import 'package:flutter_custom_calendar/calendar_provider.dart';
import 'package:flutter_custom_calendar/configuration.dart'; import 'package:flutter_custom_calendar/configuration.dart';
import 'package:flutter_custom_calendar/constants/constants.dart';
import 'package:flutter_custom_calendar/model/date_model.dart';
import 'package:flutter_custom_calendar/utils/LogUtil.dart'; import 'package:flutter_custom_calendar/utils/LogUtil.dart';
import 'package:flutter_custom_calendar/utils/date_util.dart'; import 'package:flutter_custom_calendar/utils/date_util.dart';
import 'package:flutter_custom_calendar/widget/default_combine_day_view.dart'; import 'package:flutter_custom_calendar/widget/default_combine_day_view.dart';
import 'package:flutter_custom_calendar/widget/default_custom_day_view.dart'; import 'package:flutter_custom_calendar/widget/default_custom_day_view.dart';
import 'package:flutter_custom_calendar/model/date_model.dart';
import 'package:flutter_custom_calendar/widget/default_week_bar.dart'; import 'package:flutter_custom_calendar/widget/default_week_bar.dart';
import 'package:flutter_custom_calendar/constants/constants.dart';
import 'package:provider/provider.dart';
/** /**
* controller * controller
@ -18,7 +15,7 @@ import 'package:provider/provider.dart';
class CalendarController { class CalendarController {
static const Set<DateTime> EMPTY_SET = {}; static const Set<DateTime> EMPTY_SET = {};
static const Map<DateTime, Object> EMPTY_MAP = {}; static const Map<DateModel, Object> EMPTY_MAP = {};
static const Duration DEFAULT_DURATION = const Duration(milliseconds: 500); static const Duration DEFAULT_DURATION = const Duration(milliseconds: 500);
CalendarConfiguration calendarConfiguration; CalendarConfiguration calendarConfiguration;
@ -54,7 +51,8 @@ class CalendarController {
DateModel selectDateModel, DateModel selectDateModel,
int maxMultiSelectCount = 9999, int maxMultiSelectCount = 9999,
double verticalSpacing = 10, double verticalSpacing = 10,
Map<DateTime, Object> extraDataMap = EMPTY_MAP}) { bool enableExpand = true,
Map<DateModel, Object> extraDataMap = EMPTY_MAP}) {
LogUtil.log(TAG: this.runtimeType, message: "init CalendarConfiguration"); LogUtil.log(TAG: this.runtimeType, message: "init CalendarConfiguration");
calendarConfiguration = CalendarConfiguration( calendarConfiguration = CalendarConfiguration(
selectMode: selectMode, selectMode: selectMode,
@ -70,7 +68,9 @@ class CalendarController {
maxSelectYear: maxSelectYear, maxSelectYear: maxSelectYear,
maxSelectMonth: maxSelectMonth, maxSelectMonth: maxSelectMonth,
defaultExpandStatus: expandStatus, defaultExpandStatus: expandStatus,
extraDataMap: extraDataMap,
maxSelectDay: maxSelectDay, maxSelectDay: maxSelectDay,
enableExpand: enableExpand,
verticalSpacing: verticalSpacing); verticalSpacing: verticalSpacing);
calendarConfiguration.dayWidgetBuilder = dayWidgetBuilder; calendarConfiguration.dayWidgetBuilder = dayWidgetBuilder;

@ -9,3 +9,4 @@ export 'package:flutter_custom_calendar/model/date_model.dart';
export 'package:flutter_custom_calendar/widget/default_combine_day_view.dart'; export 'package:flutter_custom_calendar/widget/default_combine_day_view.dart';
export 'package:flutter_custom_calendar/widget/default_custom_day_view.dart'; export 'package:flutter_custom_calendar/widget/default_custom_day_view.dart';
export 'package:flutter_custom_calendar/widget/default_week_bar.dart'; export 'package:flutter_custom_calendar/widget/default_week_bar.dart';
export 'package:flutter_custom_calendar/configuration.dart';

@ -17,10 +17,11 @@ class DateModel {
String gregorianFestival; // String gregorianFestival; //
String traditionFestival; // String traditionFestival; //
bool isCurrentMonth;//
bool isCurrentDay; // bool isCurrentDay; //
bool isLeapYear; // bool isLeapYear; //
bool isWeekend; // bool isWeekend; //
int leapMonth; // // int leapMonth; //
Object extraData; // Object extraData; //

@ -1,7 +1,5 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
//7 //7
TextStyle topWeekTextStyle = new TextStyle(fontSize: 12); TextStyle topWeekTextStyle = new TextStyle(fontSize: 12);
@ -16,3 +14,8 @@ new TextStyle(color: Colors.grey, fontSize: 18);
// //
TextStyle lunarTextStyle = new TextStyle(color: Colors.grey, fontSize: 12); TextStyle lunarTextStyle = new TextStyle(color: Colors.grey, fontSize: 12);
//
TextStyle notCurrentMonthTextStyle =
new TextStyle(color: Colors.grey, fontSize: 16);
TextStyle currentDayTextStyle = new TextStyle(color: Colors.red, fontSize: 16);

@ -65,8 +65,8 @@ class DateUtil {
* *
*/ */
static bool isCurrentDay(int year, int month, int day) { static bool isCurrentDay(int year, int month, int day) {
return new DateTime(year, month, day).difference(DateTime.now()).inDays == DateTime now = DateTime.now();
0; return now.year == year && now.month == month && now.day == day;
} }
/** /**
@ -113,7 +113,7 @@ class DateUtil {
int year, int month, DateTime currentDate, int weekStart, int year, int month, DateTime currentDate, int weekStart,
{DateModel minSelectDate, {DateModel minSelectDate,
DateModel maxSelectDate, DateModel maxSelectDate,
Map<DateTime, Object> extraDataMap}) { Map<DateModel, Object> extraDataMap}) {
weekStart = DateTime.monday; weekStart = DateTime.monday;
// //
int mPreDiff = getIndexOfFirstDayInMonth(new DateTime(year, month)); int mPreDiff = getIndexOfFirstDayInMonth(new DateTime(year, month));
@ -136,19 +136,22 @@ class DateUtil {
DateTime temp; DateTime temp;
DateModel dateModel; DateModel dateModel;
if (i < mPreDiff - 1) { if (i < mPreDiff - 1) {
//
temp = firstDayOfMonth.subtract(Duration(days: mPreDiff - i - 1)); temp = firstDayOfMonth.subtract(Duration(days: mPreDiff - i - 1));
dateModel = DateModel.fromDateTime(temp); dateModel = DateModel.fromDateTime(temp);
// dateModel.isCurrentMonth = false;
} else if (i >= monthDayCount + (mPreDiff - 1)) { } else if (i >= monthDayCount + (mPreDiff - 1)) {
//
temp = lastDayOfMonth temp = lastDayOfMonth
.add(Duration(days: i - mPreDiff - monthDayCount + 2)); .add(Duration(days: i - mPreDiff - monthDayCount + 2));
dateModel = DateModel.fromDateTime(temp); dateModel = DateModel.fromDateTime(temp);
// dateModel.isCurrentMonth = false;
} else { } else {
// //
temp = new DateTime(year, month, i - mPreDiff + 2); temp = new DateTime(year, month, i - mPreDiff + 2);
dateModel = DateModel.fromDateTime(temp); dateModel = DateModel.fromDateTime(temp);
dateModel.isCurrentMonth = true;
} }
// //
@ -160,9 +163,8 @@ class DateUtil {
} }
//model //model
if (extraDataMap != null && extraDataMap.isNotEmpty) { if (extraDataMap != null && extraDataMap.isNotEmpty) {
DateTime dateTime = dateModel.getDateTime(); if (extraDataMap.containsKey(dateModel)) {
if (extraDataMap.containsKey(dateTime)) { dateModel.extraData = extraDataMap[dateModel];
dateModel.extraData = extraDataMap[dateTime];
} }
} }
@ -197,7 +199,7 @@ class DateUtil {
int year, int month, DateTime currentDate, int weekStart, int year, int month, DateTime currentDate, int weekStart,
{DateModel minSelectDate, {DateModel minSelectDate,
DateModel maxSelectDate, DateModel maxSelectDate,
Map<DateTime, Object> extraDataMap}) { Map<DateModel, Object> extraDataMap}) {
LogUtil.log(TAG: "DateUtil", message: "initCalendarForWeekView"); LogUtil.log(TAG: "DateUtil", message: "initCalendarForWeekView");
List<DateModel> items = List(); List<DateModel> items = List();
@ -217,11 +219,16 @@ class DateUtil {
} else { } else {
dateModel.isInRange = false; dateModel.isInRange = false;
} }
if (month == dateModel.month) {
dateModel.isCurrentMonth = true;
} else {
dateModel.isCurrentMonth = false;
}
//model //model
if (extraDataMap != null && extraDataMap.isNotEmpty) { if (extraDataMap != null && extraDataMap.isNotEmpty) {
DateTime dateTime = dateModel.getDateTime(); if (extraDataMap.containsKey(dateModel)) {
if (extraDataMap.containsKey(dateTime)) { dateModel.extraData = extraDataMap[dateModel];
dateModel.extraData = extraDataMap[dateTime];
} }
} }

@ -766,16 +766,16 @@ class LunarUtil {
dateModel.isLeapYear = DateUtil.isLeapYear(year); dateModel.isLeapYear = DateUtil.isLeapYear(year);
dateModel.isCurrentDay = DateUtil.isCurrentDay(year, month, day); dateModel.isCurrentDay = DateUtil.isCurrentDay(year, month, day);
List<int> lunar = LunarUtil.solarToLunar(year, month, day); List<int> lunar = LunarUtil.solarToLunar(2020, 2, day);
dateModel.lunarYear = (lunar[0]); dateModel.lunarYear = (lunar[0]);
dateModel.lunarMonth = (lunar[1]); dateModel.lunarMonth = (lunar[1]);
dateModel.lunarDay = (lunar[2]); dateModel.lunarDay = (lunar[2]);
if (lunar[3] == 1) { // if (lunar[3] == 1) {
// // //
dateModel.leapMonth = lunar[1]; // dateModel.leapMonth = lunar[1];
} // }
//24 //24
String solarTerm = getSolarTerm(year, month, day); String solarTerm = getSolarTerm(year, month, day);
dateModel.solarTerm=solarTerm; dateModel.solarTerm=solarTerm;

@ -72,8 +72,11 @@ class DefaultCustomDayWidget extends BaseCustomDayWidget {
void defaultDrawNormal(DateModel dateModel, Canvas canvas, Size size) { void defaultDrawNormal(DateModel dateModel, Canvas canvas, Size size) {
// //
TextPainter dayTextPainter = new TextPainter() TextPainter dayTextPainter = new TextPainter()
..text = ..text = TextSpan(
TextSpan(text: dateModel.day.toString(), style: currentMonthTextStyle) text: dateModel.day.toString(),
style: dateModel.isCurrentDay
? currentDayTextStyle
: currentMonthTextStyle)
..textDirection = TextDirection.ltr ..textDirection = TextDirection.ltr
..textAlign = TextAlign.center; ..textAlign = TextAlign.center;

@ -18,7 +18,7 @@ class MonthView extends StatefulWidget {
final DateModel minSelectDate; final DateModel minSelectDate;
final DateModel maxSelectDate; final DateModel maxSelectDate;
final Map<DateTime, Object> extraDataMap; // final Map<DateModel, Object> extraDataMap; //
const MonthView({ const MonthView({
@required this.year, @required this.year,

@ -18,7 +18,7 @@ class WeekView extends StatefulWidget {
final DateModel minSelectDate; final DateModel minSelectDate;
final DateModel maxSelectDate; final DateModel maxSelectDate;
final Map<DateTime, Object> extraDataMap; // final Map<DateModel, Object> extraDataMap; //
const WeekView( const WeekView(
{@required this.year, {@required this.year,
@ -39,7 +39,7 @@ class _WeekViewState extends State<WeekView> {
void initState() { void initState() {
super.initState(); super.initState();
items = DateUtil.initCalendarForWeekView( items = DateUtil.initCalendarForWeekView(
2019, 9, widget.firstDayOfWeek.getDateTime(), 0, widget.year, widget.month, widget.firstDayOfWeek.getDateTime(), 0,
minSelectDate: widget.minSelectDate, minSelectDate: widget.minSelectDate,
maxSelectDate: widget.maxSelectDate, maxSelectDate: widget.maxSelectDate,
extraDataMap: widget.extraDataMap); extraDataMap: widget.extraDataMap);

Loading…
Cancel
Save