Skip to content

Commit

Permalink
Give inactiveDaysTextStyle prior to other text styles
Browse files Browse the repository at this point in the history
- Fixes #101
  • Loading branch information
hyochan committed Sep 14, 2019
1 parent 12a9d9c commit 5ddd75f
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 39 deletions.
15 changes: 12 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,8 @@ class _MyHomePageState extends State<MyHomePage> {
markedDateIconBuilder: (event) {
return event.icon;
},
minSelectedDate: _currentDate.subtract(Duration(days: 180)),
maxSelectedDate: _currentDate.add(Duration(days: 180)),
todayButtonColor: Colors.transparent,
todayBorderColor: Colors.green,
markedDateMoreShowTotal:
Expand Down Expand Up @@ -224,9 +226,16 @@ class _MyHomePageState extends State<MyHomePage> {
selectedDayTextStyle: TextStyle(
color: Colors.yellow,
),
minSelectedDate: _currentDate.subtract(Duration(days: 360)),
maxSelectedDate: _currentDate.add(Duration(days: 360)),
// inactiveDateColor: Colors.black12,
minSelectedDate: _currentDate.subtract(Duration(days: 180)),
maxSelectedDate: _currentDate.add(Duration(days: 180)),
prevDaysTextStyle: TextStyle(
fontSize: 16,
color: Colors.pinkAccent,
),
inactiveDaysTextStyle: TextStyle(
color: Colors.tealAccent,
fontSize: 16,
),
onCalendarChanged: (DateTime date) {
this.setState(() => _currentMonth = DateFormat.yMMM().format(date));
},
Expand Down
74 changes: 38 additions & 36 deletions lib/flutter_calendar_carousel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,9 @@ class _CalendarState<T> extends State<CalendarCarousel<T>> {
children: <Widget>[
Center(
child: DefaultTextStyle(
style: (_localeDate.dateSymbols.WEEKENDRANGE.contains(
style: !isSelectable
? defaultInactiveDaysTextStyle
: (_localeDate.dateSymbols.WEEKENDRANGE.contains(
(index - 1 + firstDayOfWeek) % 7)) && !isSelectedDay && !isToday
? (isPrevMonthDay
? defaultPrevDaysTextStyle
Expand All @@ -441,32 +443,30 @@ class _CalendarState<T> extends State<CalendarCarousel<T>> {
? defaultTodayTextStyle
: isSelectable && textStyle != null
? textStyle
: defaultTextStyle != null
? defaultTextStyle
: defaultInactiveDaysTextStyle,
child: Text(
'${now.day}',
style: (_localeDate.dateSymbols.WEEKENDRANGE.contains(
(index - 1 + firstDayOfWeek) % 7))
&& !isSelectedDay
&& isThisMonthDay
&& !isToday
? (isSelectable
? widget.weekendTextStyle
: widget.inactiveWeekendTextStyle)
: isPrevMonthDay
? widget.prevDaysTextStyle
: isNextMonthDay
? widget.nextDaysTextStyle
: isSelectedDay
? widget.selectedDayTextStyle
: isToday
? widget.todayTextStyle
: isSelectable
? widget.daysTextStyle
: widget.inactiveDaysTextStyle,
maxLines: 1,
),
: defaultTextStyle,
child: Text(
'${now.day}',
style: (_localeDate.dateSymbols.WEEKENDRANGE.contains(
(index - 1 + firstDayOfWeek) % 7))
&& !isSelectedDay
&& isThisMonthDay
&& !isToday
? (isSelectable
? widget.weekendTextStyle
: widget.inactiveWeekendTextStyle)
: !isSelectable
? widget.inactiveDaysTextStyle
: isPrevMonthDay
? widget.prevDaysTextStyle
: isNextMonthDay
? widget.nextDaysTextStyle
: isSelectedDay
? widget.selectedDayTextStyle
: isToday
? widget.todayTextStyle
: widget.daysTextStyle,
maxLines: 1,
),
),
),
widget.markedDatesMap != null
Expand Down Expand Up @@ -626,15 +626,17 @@ class _CalendarState<T> extends State<CalendarCarousel<T>> {
: defaultTextStyle,
child: Text(
'${now.day}',
style: (index % 7 == 0 || index % 7 == 6) &&
!isSelectedDay &&
!isToday
? widget.weekendTextStyle
: isToday
? widget.todayTextStyle
: isSelectable
? textStyle
: widget.inactiveDaysTextStyle,
style: !isSelectable && widget.inactiveDaysTextStyle != null
? widget.inactiveDaysTextStyle
: !isSelectable
? defaultInactiveDaysTextStyle
: (index % 7 == 0 || index % 7 == 6) &&
!isSelectedDay &&
!isToday
? widget.weekendTextStyle
: isToday
? widget.todayTextStyle
: textStyle,
maxLines: 1,
),
),
Expand Down

0 comments on commit 5ddd75f

Please sign in to comment.