Skip to content

Commit d28a878

Browse files
BonwayPRBaraiya
authored andcommitted
feat : update example
1 parent 2ca0468 commit d28a878

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

example/lib/widgets/multi_day_view_widget.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,17 @@ class MultiDayViewWidget extends StatelessWidget {
1313
Widget build(BuildContext context) {
1414
return MultiDayView(
1515
key: state,
16+
daysInView: 3,
1617
width: width,
17-
showWeekends: true,
1818
showLiveTimeLineInAllDays: true,
1919
eventArranger: SideEventArranger(maxWidth: 30),
2020
timeLineWidth: 65,
2121
scrollPhysics: const BouncingScrollPhysics(),
2222
liveTimeIndicatorSettings: LiveTimeIndicatorSettings(
2323
color: Colors.redAccent,
24-
showTime: true,
24+
// showTime: true,
25+
onlyShowToday: true,
2526
),
26-
// minDay: DateTime.now().subtract(Duration(days: 3 * 2)),
27-
// maxDay: DateTime.now().add(Duration(days: 3 * 2)),
28-
daysInView: 3,
2927
onTimestampTap: (date) {
3028
SnackBar snackBar = SnackBar(
3129
content: Text("On tap: ${date.hour} Hr : ${date.minute} Min"),

lib/src/multi_day_view/multi_day_view.dart

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
170170
///
171171
/// ex, if [showWeekends] is false and [weekDays] are monday, tuesday,
172172
/// saturday and sunday, only monday and tuesday will be visible in week view.
173-
final bool showWeekends;
173+
// final bool showWeekends;
174174

175175
/// Defines which days should be displayed in one week.
176176
///
@@ -180,7 +180,7 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
180180
/// Duplicate values will be removed from list.
181181
///
182182
/// ex, if there are two mondays in list it will display only one.
183-
final List<WeekDays> weekDays;
183+
// final List<WeekDays> weekDays;
184184

185185
/// This method will be called when user long press on calendar.
186186
final DatePressCallback? onDateLongPress;
@@ -197,7 +197,7 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
197197
/// Defines the day from which the week starts.
198198
///
199199
/// Default value is [WeekDays.monday].
200-
final WeekDays startDay;
200+
// final WeekDays startDay;
201201

202202
/// Defines size of the slots that provides long press callback on area
203203
/// where events are not there.
@@ -291,9 +291,9 @@ class MultiDayView<T extends Object?> extends StatefulWidget {
291291
this.onEventLongTap,
292292
this.onDateLongPress,
293293
this.onDateTap,
294-
this.weekDays = WeekDays.values,
295-
this.showWeekends = true,
296-
this.startDay = WeekDays.monday,
294+
// this.weekDays = WeekDays.values,
295+
// this.showWeekends = true,
296+
// this.startDay = WeekDays.monday,
297297
this.minuteSlotSize = MinuteSlotSize.minutes60,
298298
this.weekDetectorBuilder,
299299
this.headerStringBuilder,
@@ -643,13 +643,13 @@ class MultiDayViewState<T extends Object?> extends State<MultiDayView<T>> {
643643
}
644644

645645
void _setWeekDays() {
646-
_weekDays = widget.weekDays.toSet().toList();
646+
_weekDays = WeekDays.values.toSet().toList();
647647

648-
if (!widget.showWeekends) {
649-
_weekDays
650-
..remove(WeekDays.saturday)
651-
..remove(WeekDays.sunday);
652-
}
648+
// if (!widget.showWeekends) {
649+
// _weekDays
650+
// ..remove(WeekDays.saturday)
651+
// ..remove(WeekDays.sunday);
652+
// }
653653

654654
assert(
655655
_weekDays.isNotEmpty,
@@ -1007,7 +1007,7 @@ class MultiDayViewState<T extends Object?> extends State<MultiDayView<T>> {
10071007
throw "Invalid date selected.";
10081008
}
10091009
await _pageController.animateToPage(
1010-
_minDate.getWeekDifference(week, start: widget.startDay),
1010+
_minDate.getWeekDifference(week, start: WeekDays.monday),
10111011
duration: duration ?? widget.pageTransitionDuration,
10121012
curve: curve ?? widget.pageTransitionCurve,
10131013
);

0 commit comments

Comments
 (0)