Skip to content

Commit

Permalink
Fire onSelectedRangeChange when Expanded. Fix apptreesoftware#45
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldemarco committed Sep 14, 2019
1 parent 7b3ef33 commit 42f08de
Showing 1 changed file with 17 additions and 11 deletions.
28 changes: 17 additions & 11 deletions lib/flutter_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -185,17 +185,15 @@ class _CalendarState extends State<Calendar> {

if (isExpanded) {
final TextStyle body1StyleDisabled = body1Style.copyWith(
color: Color.fromARGB(
100,
body1Style.color.red,
body1Style.color.green,
body1Style.color.blue,
)
);

dateStyles = monthStarted && !monthEnded
? body1Style
: body1StyleDisabled;
color: Color.fromARGB(
100,
body1Style.color.red,
body1Style.color.green,
body1Style.color.blue,
));

dateStyles =
monthStarted && !monthEnded ? body1Style : body1StyleDisabled;
} else {
dateStyles = body1Style;
}
Expand Down Expand Up @@ -376,6 +374,14 @@ class _CalendarState extends State<Calendar> {

void toggleExpanded() {
if (widget.isExpandable) {
var firstDate = (isExpanded)
? Utils.firstDayOfWeek(_selectedDate)
: Utils.firstDayOfMonth(_selectedDate);
var lastDate = (isExpanded)
? Utils.lastDayOfWeek(_selectedDate)
: Utils.lastDayOfMonth(_selectedDate);
updateSelectedRange(firstDate, lastDate);

setState(() => isExpanded = !isExpanded);
}
}
Expand Down

0 comments on commit 42f08de

Please sign in to comment.