|
|
|
|
@ -18,6 +18,7 @@ import '../provider/TimeProvider.dart';
|
|
|
|
|
import '../setting/Setting.dart';
|
|
|
|
|
|
|
|
|
|
class TimetableWidget extends StatefulWidget {
|
|
|
|
|
TimetableWidget({required Key key}) : super(key: key);
|
|
|
|
|
final double deviceWidth = Setting.deviceWidth;
|
|
|
|
|
@override
|
|
|
|
|
State<StatefulWidget> createState() =>
|
|
|
|
|
@ -85,30 +86,36 @@ class TimetableWidgetState extends State<TimetableWidget> {
|
|
|
|
|
|
|
|
|
|
TimetableWidgetState({required this.deviceWidth});
|
|
|
|
|
|
|
|
|
|
updateDateByWeekCount() {}
|
|
|
|
|
|
|
|
|
|
Future<void> futureDo() async {
|
|
|
|
|
print('开始futureDo');
|
|
|
|
|
Future<void> localFutureDo() async {
|
|
|
|
|
print('开始localFutureDo');
|
|
|
|
|
|
|
|
|
|
//获取数据库课程表
|
|
|
|
|
courseList = await courseController.getCourses();
|
|
|
|
|
taskList = await taskController.getTasks();
|
|
|
|
|
workList = await teamController.getWorks();
|
|
|
|
|
|
|
|
|
|
dataCaculateAfterFutherDo();
|
|
|
|
|
|
|
|
|
|
print('localFutureDo 完成');
|
|
|
|
|
setState(() {});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> serverFutureDo() async {
|
|
|
|
|
print('开始serverFutureDo');
|
|
|
|
|
|
|
|
|
|
//获取数据库课程表
|
|
|
|
|
workList = await teamController.getWorks();
|
|
|
|
|
|
|
|
|
|
dataCaculateAfterFutherDo();
|
|
|
|
|
|
|
|
|
|
print('serverFutureDo 完成');
|
|
|
|
|
setState(() {});
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//执行初始化,将需要的数值进行加工
|
|
|
|
|
@override
|
|
|
|
|
initState() {
|
|
|
|
|
super.initState();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
// Setting.saveInitFlag(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataInitAfterFutherDo() {
|
|
|
|
|
//初始化
|
|
|
|
|
timeBlockWeekMap = {};
|
|
|
|
|
timeBlockList = [];
|
|
|
|
|
@ -117,27 +124,53 @@ class TimetableWidgetState extends State<TimetableWidget> {
|
|
|
|
|
currentWeek = timetableWidgetController.getWeekCount();
|
|
|
|
|
showWeek = currentWeek;
|
|
|
|
|
// showWeek = 1;
|
|
|
|
|
//
|
|
|
|
|
showMonth = DateTime.now().month;
|
|
|
|
|
|
|
|
|
|
dataCaculateAfterFutherDo();
|
|
|
|
|
|
|
|
|
|
serverFutureDo();
|
|
|
|
|
localFutureDo();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
dispose() {
|
|
|
|
|
super.dispose();
|
|
|
|
|
// Setting.saveInitFlag(false);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
dataCaculateAfterFutherDo() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
timeBlockWeekMap = {};
|
|
|
|
|
timeBlockList = [];
|
|
|
|
|
timeBlockList.addAll(courseList);
|
|
|
|
|
timeBlockList.addAll(taskList);
|
|
|
|
|
timeBlockList.addAll(workList);
|
|
|
|
|
timeBlockWeekMap =
|
|
|
|
|
timetableWidgetController.transformCourseMap(timeBlockList);
|
|
|
|
|
|
|
|
|
|
//获取本周星期一是几号
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var mondayTime = timetableWidgetController.getmondayTime();
|
|
|
|
|
|
|
|
|
|
//showMon
|
|
|
|
|
showMonth = mondayTime.add(Duration(days: 7 * (showWeek - currentWeek))).month;
|
|
|
|
|
|
|
|
|
|
//更新初始化日期列表
|
|
|
|
|
dateListstr = [];
|
|
|
|
|
for (int i = 0; i < 7; i++) {
|
|
|
|
|
dateListstr.add((mondayTime.day + i).toString());
|
|
|
|
|
if ((mondayTime.day + i) == DateTime.now().day) {
|
|
|
|
|
currentWeekDayIndex = i + 1;
|
|
|
|
|
}
|
|
|
|
|
dateListstr.add(mondayTime
|
|
|
|
|
.add(Duration(days: i + 7 * (showWeek - currentWeek)))
|
|
|
|
|
.day
|
|
|
|
|
.toString()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//调用函数初始化时间轴的绝对坐标
|
|
|
|
|
positions =
|
|
|
|
|
timetableWidgetController.convertTimeList(timePoints, deviceWidth);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateAfterFutherDo() {
|
|
|
|
|
@ -172,267 +205,267 @@ class TimetableWidgetState extends State<TimetableWidget> {
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext contexvoidt) {
|
|
|
|
|
// if (firstInit == 0) {
|
|
|
|
|
// //第一次初始化
|
|
|
|
|
// dataInitAfterFutherDo();
|
|
|
|
|
// firstInit = 1;
|
|
|
|
|
// } else {
|
|
|
|
|
// //更新
|
|
|
|
|
// updateAfterFutherDo();
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// print('dataCaculateAfterFutherDo');
|
|
|
|
|
// dataCaculateAfterFutherDo();
|
|
|
|
|
return Consumer<TimeProvider>(builder: (ctx, timePro, child) {
|
|
|
|
|
print('Rebuild timePro');
|
|
|
|
|
return FutureBuilder<void>(
|
|
|
|
|
future: futureDo(),
|
|
|
|
|
builder: (BuildContext context, AsyncSnapshot snapshot) {
|
|
|
|
|
// 请求已结束
|
|
|
|
|
if (snapshot.connectionState == ConnectionState.done) {
|
|
|
|
|
if (firstInit == 0) {
|
|
|
|
|
//第一次初始化
|
|
|
|
|
dataInitAfterFutherDo();
|
|
|
|
|
firstInit = 1;
|
|
|
|
|
} else {
|
|
|
|
|
//更新
|
|
|
|
|
updateAfterFutherDo();
|
|
|
|
|
}
|
|
|
|
|
return RefreshIndicator(
|
|
|
|
|
onRefresh: () {
|
|
|
|
|
print('下拉refresh');
|
|
|
|
|
return futureDo().then((value){
|
|
|
|
|
Provider.of<TimeProvider>(context, listen: false).updateTimetable(); // 更新时间表页面操作
|
|
|
|
|
|
|
|
|
|
return RefreshIndicator(
|
|
|
|
|
onRefresh: () {
|
|
|
|
|
print('下拉refresh');
|
|
|
|
|
return serverFutureDo().then((value){
|
|
|
|
|
// Provider.of<TimeProvider>(context, listen: false).updateTimetable(); // 更新时间表页面操作
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
onHorizontalDragEnd: (details) {
|
|
|
|
|
teamController.getWorks().then((value){
|
|
|
|
|
workList = value;
|
|
|
|
|
setState(() {
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
if (details.primaryVelocity! > 0) {
|
|
|
|
|
// 右滑
|
|
|
|
|
setState(() {
|
|
|
|
|
showWeek--;
|
|
|
|
|
// updateDateByWeekCount();
|
|
|
|
|
});
|
|
|
|
|
} else if (details.primaryVelocity! < 0) {
|
|
|
|
|
// 左滑
|
|
|
|
|
setState(() {
|
|
|
|
|
showWeek++;
|
|
|
|
|
// updateDateByWeekCount();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: GestureDetector(
|
|
|
|
|
onHorizontalDragEnd: (details) {
|
|
|
|
|
if (details.primaryVelocity! > 0) {
|
|
|
|
|
// 右滑
|
|
|
|
|
setState(() {
|
|
|
|
|
showWeek--;
|
|
|
|
|
updateDateByWeekCount();
|
|
|
|
|
});
|
|
|
|
|
} else if (details.primaryVelocity! < 0) {
|
|
|
|
|
// 左滑
|
|
|
|
|
setState(() {
|
|
|
|
|
showWeek++;
|
|
|
|
|
updateDateByWeekCount();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, //垂直方向居中对齐
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
//顶部的周数和日期
|
|
|
|
|
//显示第一行的周天数和日期
|
|
|
|
|
child: GridView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
//解决无限高度问题
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
//禁用滑动事件
|
|
|
|
|
itemCount: 8,
|
|
|
|
|
gridDelegate:
|
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 8, childAspectRatio: 1 / 1),
|
|
|
|
|
//每行显示的数量
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
//构建每个item的样式
|
|
|
|
|
return Container(
|
|
|
|
|
color: index == this.currentWeekDayIndex
|
|
|
|
|
? Color(0xf7f7f7) //如果是当前周,就显示灰色
|
|
|
|
|
: Colors.white,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: index == 0
|
|
|
|
|
? Column(
|
|
|
|
|
//第一行显示第几周
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
// height: 10,
|
|
|
|
|
// width: 6,
|
|
|
|
|
child: Text(
|
|
|
|
|
'第' +
|
|
|
|
|
showWeek.toString() +
|
|
|
|
|
'周', //显示周数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: currentWeek ==
|
|
|
|
|
showWeek //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.amber
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// height: 10,
|
|
|
|
|
// width: 6,
|
|
|
|
|
child: Text(
|
|
|
|
|
showMonth.toString() + '月', //显示月数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: currentWeek ==
|
|
|
|
|
showWeek //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.amber
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(weekList[index - 1], //显示周数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: index ==
|
|
|
|
|
currentWeekDayIndex //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.lightBlue
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
Text(dateListstr[index - 1], //显示日期
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: index ==
|
|
|
|
|
currentWeekDayIndex //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.lightBlue
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
child: Column(
|
|
|
|
|
mainAxisAlignment: MainAxisAlignment.start, //垂直方向居中对齐
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
//顶部的周数和日期
|
|
|
|
|
//显示第一行的周天数和日期
|
|
|
|
|
child: GridView.builder(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
//解决无限高度问题
|
|
|
|
|
physics: NeverScrollableScrollPhysics(),
|
|
|
|
|
//禁用滑动事件
|
|
|
|
|
itemCount: 8,
|
|
|
|
|
gridDelegate:
|
|
|
|
|
SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
|
crossAxisCount: 8, childAspectRatio: 1 / 1),
|
|
|
|
|
//每行显示的数量
|
|
|
|
|
itemBuilder: (BuildContext context, int index) {
|
|
|
|
|
//构建每个item的样式
|
|
|
|
|
return Container(
|
|
|
|
|
color: index == this.currentWeekDayIndex
|
|
|
|
|
? Color(0xf7f7f7) //如果是当前周,就显示灰色
|
|
|
|
|
: Colors.white,
|
|
|
|
|
child: Center(
|
|
|
|
|
child: index == 0
|
|
|
|
|
? Column(
|
|
|
|
|
//第一行显示第几周
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
// height: 10,
|
|
|
|
|
// width: 6,
|
|
|
|
|
child: Text(
|
|
|
|
|
'第' +
|
|
|
|
|
showWeek.toString() +
|
|
|
|
|
'周', //显示周数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: currentWeek ==
|
|
|
|
|
showWeek //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.amber
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
// height: 10,
|
|
|
|
|
// width: 6,
|
|
|
|
|
child: Text(
|
|
|
|
|
showMonth.toString() + '月', //显示月数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: currentWeek ==
|
|
|
|
|
showWeek //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.amber
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
)
|
|
|
|
|
: Column(
|
|
|
|
|
mainAxisAlignment:
|
|
|
|
|
MainAxisAlignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
Text(weekList[index - 1], //显示周数
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 14,
|
|
|
|
|
color: index ==
|
|
|
|
|
currentWeekDayIndex //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.lightBlue
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
SizedBox(
|
|
|
|
|
height: 5,
|
|
|
|
|
),
|
|
|
|
|
Text(dateListstr[index - 1], //显示日期
|
|
|
|
|
style: TextStyle(
|
|
|
|
|
fontSize: 12,
|
|
|
|
|
color: index ==
|
|
|
|
|
currentWeekDayIndex //如果是当前周,就显示蓝色
|
|
|
|
|
? Colors.lightBlue
|
|
|
|
|
: Colors.black87)),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
//显示下面的界面中的两个stack,一个下层的时间轴,一个是上层课程或者人物的方块
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
//借助两个stack重叠,实现效果
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth,
|
|
|
|
|
height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
// 第一个Stack
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: deviceWidth,
|
|
|
|
|
height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
//根据时间轴的长度,生成对应的时间轴
|
|
|
|
|
positions.length,
|
|
|
|
|
(index) => Positioned(
|
|
|
|
|
top: positions[index].dy,
|
|
|
|
|
left: positions[index].dx,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
timePoints[index]
|
|
|
|
|
.hour
|
|
|
|
|
.toString()
|
|
|
|
|
.padLeft(2, '0') +
|
|
|
|
|
':' +
|
|
|
|
|
timePoints[index]
|
|
|
|
|
.minute
|
|
|
|
|
.toString()
|
|
|
|
|
.padLeft(2, '0'),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth * 0.04,
|
|
|
|
|
height: 10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.amber,
|
|
|
|
|
width: 2,
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}),
|
|
|
|
|
),
|
|
|
|
|
//显示下面的界面中的两个stack,一个下层的时间轴,一个是上层课程或者人物的方块
|
|
|
|
|
Expanded(
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
//借助两个stack重叠,实现效果
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth,
|
|
|
|
|
height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
alignment: Alignment.center,
|
|
|
|
|
children: [
|
|
|
|
|
// 第一个Stack
|
|
|
|
|
Positioned(
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
child: Container(
|
|
|
|
|
width: deviceWidth,
|
|
|
|
|
height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
//根据时间轴的长度,生成对应的时间轴
|
|
|
|
|
positions.length,
|
|
|
|
|
(index) => Positioned(
|
|
|
|
|
top: positions[index].dy,
|
|
|
|
|
left: positions[index].dx,
|
|
|
|
|
child: Row(
|
|
|
|
|
children: [
|
|
|
|
|
Text(
|
|
|
|
|
timePoints[index]
|
|
|
|
|
.hour
|
|
|
|
|
.toString()
|
|
|
|
|
.padLeft(2, '0') +
|
|
|
|
|
':' +
|
|
|
|
|
timePoints[index]
|
|
|
|
|
.minute
|
|
|
|
|
.toString()
|
|
|
|
|
.padLeft(2, '0'),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth * 0.04,
|
|
|
|
|
height: 10,
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
shape: BoxShape.circle,
|
|
|
|
|
border: Border.all(
|
|
|
|
|
color: Colors.amber,
|
|
|
|
|
width: 2,
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth * 0.84,
|
|
|
|
|
height: 2,
|
|
|
|
|
color: Colors.lightBlue
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
Container(
|
|
|
|
|
width: deviceWidth * 0.84,
|
|
|
|
|
height: 2,
|
|
|
|
|
color: Colors.lightBlue
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
)),
|
|
|
|
|
//第二个Stack
|
|
|
|
|
Container(
|
|
|
|
|
constraints: BoxConstraints
|
|
|
|
|
.expand(), // 使用constraints来自适应
|
|
|
|
|
// width: 390,
|
|
|
|
|
// height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
timeBlockWeekMap
|
|
|
|
|
.containsKey(showWeek)
|
|
|
|
|
? timeBlockWeekMap[showWeek]!
|
|
|
|
|
.length
|
|
|
|
|
: 0,
|
|
|
|
|
(index) {
|
|
|
|
|
var currentItem = timeBlockWeekMap[
|
|
|
|
|
showWeek]![index];
|
|
|
|
|
return Positioned(
|
|
|
|
|
top: timetableWidgetController
|
|
|
|
|
.getdy(currentItem),
|
|
|
|
|
left: timetableWidgetController
|
|
|
|
|
.getdx(currentItem) +
|
|
|
|
|
deviceWidth * 0.15,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: deviceWidth * 0.115,
|
|
|
|
|
height:
|
|
|
|
|
timetableWidgetController
|
|
|
|
|
.getHeight(
|
|
|
|
|
currentItem),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: getItemColor(
|
|
|
|
|
)),
|
|
|
|
|
//第二个Stack
|
|
|
|
|
Container(
|
|
|
|
|
constraints: BoxConstraints
|
|
|
|
|
.expand(), // 使用constraints来自适应
|
|
|
|
|
// width: 390,
|
|
|
|
|
// height: 2000,
|
|
|
|
|
child: Stack(
|
|
|
|
|
children: List.generate(
|
|
|
|
|
timeBlockWeekMap
|
|
|
|
|
.containsKey(showWeek)
|
|
|
|
|
? timeBlockWeekMap[showWeek]!
|
|
|
|
|
.length
|
|
|
|
|
: 0,
|
|
|
|
|
(index) {
|
|
|
|
|
var currentItem = timeBlockWeekMap[
|
|
|
|
|
showWeek]![index];
|
|
|
|
|
return Positioned(
|
|
|
|
|
top: timetableWidgetController
|
|
|
|
|
.getdy(currentItem),
|
|
|
|
|
left: timetableWidgetController
|
|
|
|
|
.getdx(currentItem) +
|
|
|
|
|
deviceWidth * 0.15,
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Container(
|
|
|
|
|
width: deviceWidth * 0.115,
|
|
|
|
|
height:
|
|
|
|
|
timetableWidgetController
|
|
|
|
|
.getHeight(
|
|
|
|
|
currentItem),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(
|
|
|
|
|
Radius.circular(10.0),
|
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
|
color: getItemColor(
|
|
|
|
|
currentItem),
|
|
|
|
|
borderRadius:
|
|
|
|
|
BorderRadius.all(
|
|
|
|
|
Radius.circular(10.0),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (currentItem
|
|
|
|
|
is Course)
|
|
|
|
|
CouresBlockContenWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
if (currentItem is Task)
|
|
|
|
|
TaskBlockContentWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
if (currentItem is Work)
|
|
|
|
|
WorkBlockContentWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
],
|
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
|
child: Column(
|
|
|
|
|
children: [
|
|
|
|
|
if (currentItem
|
|
|
|
|
is Course)
|
|
|
|
|
CouresBlockContenWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
if (currentItem is Task)
|
|
|
|
|
TaskBlockContentWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
if (currentItem is Work)
|
|
|
|
|
WorkBlockContentWidget(
|
|
|
|
|
currentItem:
|
|
|
|
|
currentItem),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
);
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
))
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
} else {
|
|
|
|
|
return Center(
|
|
|
|
|
child: CircularProgressIndicator(),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
;
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|