feat:增加日程模块tab页面
This commit is contained in:
@@ -23,6 +23,7 @@ class CalendarPageState extends State<CalendarPage> {
|
||||
final CalendarService calendarService = CalendarService();
|
||||
final NotifyService notifyService = NotifyService();
|
||||
late List<Appointment> _appointments;
|
||||
CalendarTab _currentTab = CalendarTab.week;
|
||||
|
||||
void showAddDialog() {
|
||||
_showDialog(false, null);
|
||||
@@ -131,45 +132,46 @@ class CalendarPageState extends State<CalendarPage> {
|
||||
Widget build(BuildContext context) {
|
||||
final provider = Provider.of<CalendarProvider>(context, listen: false);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text('日程安排'),
|
||||
centerTitle: true,
|
||||
actions: [
|
||||
buildCalendarMenu(
|
||||
onSelected: (CalendarView value) {
|
||||
return Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: Column(
|
||||
children: [
|
||||
buildTabs(
|
||||
context: context,
|
||||
currentTab: _currentTab,
|
||||
onTabChanged: (value) {
|
||||
setState(() {
|
||||
_calendarController.view = value;
|
||||
_currentTab = value;
|
||||
_calendarController.view = value.view;
|
||||
});
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: buildCalendar(
|
||||
context: context,
|
||||
controller: _calendarController,
|
||||
dataSource: AppointmentDataSource(_appointments),
|
||||
onAdd: () {
|
||||
if (_calendarController.view == CalendarView.week) {
|
||||
_showDialog(true, provider.formItem);
|
||||
}
|
||||
},
|
||||
onEdit: (appointment) {
|
||||
final calendar = calendarService.getCalendarById(
|
||||
appointment.id as int,
|
||||
);
|
||||
_showDialog(true, calendar);
|
||||
},
|
||||
onDelete: (appointment) {
|
||||
final calendar = calendarService.getCalendarById(
|
||||
appointment.id as int,
|
||||
);
|
||||
_deleteCalendar(calendar);
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Padding(
|
||||
padding: EdgeInsets.all(10),
|
||||
child: buildCalendar(
|
||||
context: context,
|
||||
controller: _calendarController,
|
||||
dataSource: AppointmentDataSource(_appointments),
|
||||
onAdd: () {
|
||||
if (_calendarController.view == CalendarView.week) {
|
||||
_showDialog(true, provider.formItem);
|
||||
}
|
||||
},
|
||||
onEdit: (appointment) {
|
||||
final calendar = calendarService.getCalendarById(
|
||||
appointment.id as int,
|
||||
);
|
||||
_showDialog(true, calendar);
|
||||
},
|
||||
onDelete: (appointment) {
|
||||
final calendar = calendarService.getCalendarById(
|
||||
appointment.id as int,
|
||||
);
|
||||
_deleteCalendar(calendar);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user