lvxinquan
LRC 3 years ago
parent 69312c16c2
commit 4983638625

@ -98,6 +98,17 @@
</key>
</component>
<component name="RunManager" selected="Flutter.main.dart">
<configuration default="true" type="ArquillianJUnit" factoryName="" nameIsGenerated="true">
<option name="arquillianRunConfiguration">
<value>
<option name="containerStateName" value="" />
</value>
</option>
<option name="TEST_OBJECT" value="class" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
<configuration name="GetCourseByLogin.dart" type="DartCommandLineRunConfigurationType" factoryName="Dart Command Line Application" temporary="true" nameIsGenerated="true">
<option name="filePath" value="$PROJECT_DIR$/lib/util/GetCourseByLogin.dart" />
<option name="workingDirectory" value="$PROJECT_DIR$" />
@ -136,8 +147,8 @@
<list>
<item itemvalue="Flutter.main.dart" />
<item itemvalue="Dart Command Line App.main.dart" />
<item itemvalue="Dart Command Line App.test.dart" />
<item itemvalue="Dart Command Line App.GetCourseByLogin.dart" />
<item itemvalue="Dart Command Line App.test.dart" />
<item itemvalue="Dart Command Line App.curse_test.dart" />
</list>
</recent_temporary>
@ -174,6 +185,10 @@
<workItem from="1695518589469" duration="335000" />
<workItem from="1695519007728" duration="8319000" />
<workItem from="1695535233798" duration="528000" />
<workItem from="1695536532445" duration="349000" />
<workItem from="1695721283440" duration="1068000" />
<workItem from="1695727139040" duration="13000" />
<workItem from="1695729103403" duration="8100000" />
</task>
<servers />
</component>

@ -1 +1 @@
2packages/cupertino_icons/assets/CupertinoIcons.ttf  asset2packages/cupertino_icons/assets/CupertinoIcons.ttf
 assets/pythoncode/getschedule.py  asset assets/pythoncode/getschedule.pyassets/pythoncode/zfn_api.py  assetassets/pythoncode/zfn_api.py2packages/cupertino_icons/assets/CupertinoIcons.ttf  asset2packages/cupertino_icons/assets/CupertinoIcons.ttf

@ -1 +1 @@
{"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}
{"assets/pythoncode/getschedule.py":["assets/pythoncode/getschedule.py"],"assets/pythoncode/zfn_api.py":["assets/pythoncode/zfn_api.py"],"packages/cupertino_icons/assets/CupertinoIcons.ttf":["packages/cupertino_icons/assets/CupertinoIcons.ttf"]}

@ -59,7 +59,7 @@ class CourseController {
start: startDate,
end: endDate,
credit: courseForm.getCredit(),
remark: 'useradd'
remark: courseForm.getNote()
);
courseListToInsert.add(course);
}
@ -103,8 +103,8 @@ class CourseController {
return result;
}
Future<int> autoImportCours() async {
List<Course> courseList = await GetCourseByLogin().run();
Future<int> autoImportCours(String jsonstr) async {
List<Course> courseList = await GetCourseByLogin().dealRawString(jsonstr);
return await insertCourseList(courseList);
}

@ -4,7 +4,7 @@ import 'package:timemanagerapp/entity/Course.dart';
import 'package:timemanagerapp/setting/Setting.dart';
class CourseWidgetController{
final double pixelToMinuteRatio = 0.9;
final double pixelToMinuteRatio = 0.9*Setting.pixelToMinuteRatio_ratio; //old:0.9
late List<Course> courseList;
late DateTime mondayTime;
late int weekCount;
@ -126,7 +126,7 @@ class CourseWidgetController{
Map<int,List<Course>> transformCourseMap(List<Course> courseList){
Map<int,List<Course>> courseMap = {};
for (var course in courseList) {
int weekCount = course.start.difference(termStartDate).inDays ~/ 7 + 1;
int weekCount = course.start.difference(termStartDate).inDays ~/ 7 + 1; //
if (courseMap.containsKey(weekCount)) {
courseMap[weekCount]!.add(course);
} else {

@ -33,7 +33,7 @@ class CourseDao {
VALUES(${course.userId},${course.courseId},"${course.name}",${course.credit},"${course.teacher}","${course.location}","${course.remark}","${course.start}","${course.end}")
''');
});
print("课程插入 : " + course.toString());
// print("课程插入 : " + course.toString());
}
return result;
}

@ -1,3 +1,5 @@
import 'package:timemanagerapp/setting/Setting.dart';
class Course {
int? id;
int? userId;
@ -38,11 +40,11 @@ class Course {
}
//x
var weekListPixel=[0,50,100,150,200,250,295];
var weekListPixel=[0,50,100,150,200,250,300];
// Course(this.name, this.teacher, this.location, this.start, this.end);
double getdy()
{
double y=((start.hour-7)*60+start.minute)*0.9;
double y=(((start.hour-7)*60+start.minute)*0.9)*Setting.pixelToMinuteRatio_ratio;
return y;
}
double getdx()
@ -51,7 +53,7 @@ class Course {
return weekListPixel[x].toDouble();
}
double getHeight(){
return ((end.hour-7)*60+end.minute)*0.9-this.getdy();
return (((end.hour-7)*60+end.minute)*0.9-this.getdy())*Setting.pixelToMinuteRatio_ratio;
}

@ -9,6 +9,7 @@ class Setting {
static DateTime startdate_init = DateTime(2023, 8, 28);
static late DateTime startdate;
static late User? user;
static double pixelToMinuteRatio_ratio = 1;
static init() async {
//

@ -1,171 +0,0 @@
/*
import 'package:flutter/material.dart';
import 'package:timemanagerapp/wighets/AddCourseFormWidget.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: Text('添加课程'),
),
body: AddCourseFormWidget(),
),
);
}
}
*/
import 'package:flutter/material.dart';
import 'package:sqflite/sqflite.dart';
import 'package:timemanagerapp/controller/CourseController.dart';
import 'package:timemanagerapp/controller/UserController.dart';
import 'package:timemanagerapp/entity/Course.dart';
import 'package:timemanagerapp/entity/User.dart';
import 'package:timemanagerapp/database/MyDatebase.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'SQLite Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
late UserController userController;
late CourseController courseController;
@override
void initState() {
super.initState();
MyDatabase.initDatabase();
userController = UserController.getInstance();
courseController = CourseController.getInstance();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('SQLite Demo'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: userController.deleteAllUsers,
child: Text('删除用户'),
),
ElevatedButton(
onPressed: () => userController.insertUser(User(
teamId: 3231,
username: "嘉豪急啊急啊",
password: "23243",
role: 2341)),
child: Text('插入用户'),
),
ElevatedButton(
onPressed: () {
userController.getUsers().then((users) {
userController.getUsers().then((courses) {
print(courses.length);
});
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('用户列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: users
.map((user) => ListTile(
title: Text(user['username']),
subtitle: Text(user.toString()),
))
.toList(),
),
),
);
},
);
});
},
child: Text('获取用户列表'),
),
ElevatedButton(
onPressed: courseController.deleteAllCourses,
child: Text('删除课程'),
),
ElevatedButton(
onPressed: () => courseController.autoImportCours(),
child: Text('导入课程(待开发)'),
),
ElevatedButton(
onPressed: () => courseController.insertCourse(Course(
userId: 1,
courseId: 2,
name: "courstest",
credit: 3,
teacher: "嘉豪",
location: "638",
remark: "威威",
start: DateTime.now(),
end: DateTime.now())),
child: Text('插入课程'),
),
ElevatedButton(
onPressed: () {
courseController.getCourses().then((courses) {
print(courses.length);
});
courseController.getCourses().then((courses) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('课程列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: courses
.map((course) => ListTile(
title: Text(course.getName),
subtitle: Text(course.toString()),
))
.toList(),
),
),
);
},
);
});
},
child: Text('获取课程列表'),
),
],
),
),
);
}
}

@ -6,8 +6,8 @@ import 'package:timemanagerapp/setting/Setting.dart';
import 'package:timemanagerapp/util/dataUtil.dart';
class GetCourseByLogin {
String id = ""; //
String passwd = ""; //
String id = "210340156"; //
String passwd = "123111@qaq"; //
String year = "2022"; //
String term = "1"; //
DateTime termstartdate = Setting.startdate;
@ -18,14 +18,14 @@ class GetCourseByLogin {
//
final List<List<String>> raspiyane = [
["8:00", "8:45"], //1
["8:50", "9:35"], //2
["10:05", "10:50"], //3
["10:55", "11:40"], //4
["8:50", "9:35"], //2
["10:05", "10:50"], //3
["10:55", "11:40"], //4
["13:30", "14:15"], //5
["14:20", "15:05"], //6
["15:35", "16:20"], //7
["16:25", "17:10"], //8
["13:30", "14:15"], //5
["14:20", "15:05"], //6
["15:35", "16:20"], //7
["16:25", "17:10"], //8
["18:30", "19:11"],
["19:20", "20:05"],
@ -44,11 +44,9 @@ class GetCourseByLogin {
'': 7,
};
var pythonScriptPath =
"/assets/pythoncode/getschedule.py";
var pythonScriptPath = "/assets/pythoncode/getschedule.py";
Future<String> getRawString() async {
// var documentsDirectory = (await getApplicationDocumentsDirectory()).list();
// print("path = " + documentsDirectory.list().map((event) => event.path.toString()).toString());
@ -95,9 +93,7 @@ class GetCourseByLogin {
final courseTitle = courseData['title'];
//
final timeRegex = RegExp(
r'星期([一二三四五六日])第(\d)-(\d)节\{([^{}]+)\}'
);
final timeRegex = RegExp(r'星期([一二三四五六日])第(\d)-(\d)节\{([^{}]+)\}');
final match = timeRegex.firstMatch(courseTime);
if (match != null) {
final weekday = weekdayMap[match.group(1)!];
@ -122,14 +118,16 @@ class GetCourseByLogin {
//
for (var week = startWeek; week <= endWeek; week++) {
//
if (week % 2 == 0 && weekType == '' || week % 2 == 1 && weekType == '') {
if (week % 2 == 0 && weekType == '' ||
week % 2 == 1 && weekType == '') {
continue;
}
//
final startdate = termstartdate.add(Duration(
days: (7 * (week - 1) + weekday! - 1),
hours: int.parse(raspiyane[startSection - 1][0].split(':')[0]),
minutes: int.parse(raspiyane[startSection - 1][0].split(':')[1]),
minutes:
int.parse(raspiyane[startSection - 1][0].split(':')[1]),
));
final endDate = termstartdate.add(Duration(
@ -140,8 +138,8 @@ class GetCourseByLogin {
// Course
final course = Course(
id: courseId,
userId: Setting.user != null?Setting.user!.id:null,
id: int.parse(courseId),
userId: Setting.user != null ? Setting.user!.id : null,
courseId: generateId(),
name: courseTitle,
credit: courseData['credit'],
@ -181,18 +179,16 @@ class GetCourseByLogin {
//
// courses.add(course);
// }
}
}
}
}
}
// return courses;
return courses;
}
run() async {
String rawStr = await getRawString();
String rawStr = await getRawString();
await dealRawString(rawStr);
// printcourseinfo();
return courses;
@ -210,13 +206,11 @@ class GetCourseByLogin {
print("start = " + course.start.toString());
print("end = " + course.end.toString());
}
}else{
} else {
print("null");
}
}
String _extractValue(String source, String key) {
final startIndex = source.indexOf(key) + key.length;
final endIndex = source.indexOf("'", startIndex);

@ -57,125 +57,191 @@ class _HomePageState extends State<TestWidget> {
@override
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: userController.deleteAllUsers,
child: Text('删除用户'),
),
ElevatedButton(
onPressed: () => userController.insertUser(User(
teamId: 3231,
username: "嘉豪急啊急啊",
password: "23243",
role: 2341)),
child: Text('插入用户'),
),
ElevatedButton(
onPressed: () {
userController.getUsers().then((users) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('用户列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: users
.map((user) => ListTile(
title: Text(user['username']),
subtitle: Text(user.toString()),
))
.toList(),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: userController.deleteAllUsers,
child: Text('删除所有用户'),
),
ElevatedButton(
onPressed: () => userController.insertUser(User(
teamId: 3231, username: "测试用户", password: "23243", role: 1)),
child: Text('插入一个测试用户'),
),
ElevatedButton(
onPressed: () {
userController.getUsers().then((users) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('用户列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: users
.map((user) => ListTile(
title: Text(user['username']),
subtitle: Text(user.toString()),
))
.toList(),
),
);
},
);
});
},
child: Text('获取用户列表'),
),
ElevatedButton(
onPressed: courseController.deleteAllCourses,
child: Text('删除课程'),
),
ElevatedButton(
onPressed: () => courseController.autoImportCours(),
child: Text('导入课程(待开发)'),
),
ElevatedButton(
onPressed: () => courseController.insertCourse(Course(
userId: 1,
courseId: 2,
name: "测试课",
credit: 3,
teacher: "嘉豪",
location: "638",
remark: "happy",
start: DateTime.now(),
end: DateTime.now().add(Duration(hours: 2)))),
child: Text('插入课程'),
),
ElevatedButton(
onPressed: () {
// AddCourseFormWidget
Navigator.push(
context,
MaterialPageRoute(builder: (context){
),
);
},
);
});
},
child: Text('显示用户列表'),
),
ElevatedButton(
onPressed: courseController.deleteAllCourses,
child: Text('删除所有课程'),
),
// ElevatedButton(
// onPressed: () => courseController.autoImportCours(jsonstr),
// child: Text('导入课程(待开发)'),
// ),
ElevatedButton(
onPressed: () => courseController.insertCourse(Course(
userId: 1,
courseId: 2,
name: "测试课",
credit: 3,
teacher: "嘉豪",
location: "638",
remark: "happy",
start: DateTime.now(),
end: DateTime.now().add(Duration(hours: 2)))),
child: Text('插入一个测试课程'),
),
ElevatedButton(
onPressed: () {
// AddCourseFormWidget
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return AddCourseRoute();
},
),
},
),
);
},
child: Text('添加自定义课程'),
),
ElevatedButton(
onPressed: () {
courseController.getCourses().then((courses) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('课程列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: courses
.map((course) => ListTile(
title: Text(course.getName),
subtitle: Text(course.toString()),
))
.toList(),
),
),
);
},
);
},
child: Text('添加自定义课程'),
),
ElevatedButton(
});
},
child: Text('显示课程列表'),
),
ElevatedButton(
onPressed: () {
// AddCourseFormWidget
Navigator.push(
context,
MaterialPageRoute(
builder: (context) {
return TimetableRoute();
},
),
);
},
child: Text('查看时间表'),
),
AddCourseButton(
onCourseAdded: (jsonstr) {
// addCourse()
courseController.autoImportCours(jsonstr);
}
)
],
),
);
}
}
//string
class AddCourseButton extends StatefulWidget {
final Function(String jsonstr) onCourseAdded;
AddCourseButton({required this.onCourseAdded});
@override
_AddCourseButtonState createState() => _AddCourseButtonState();
}
class _AddCourseButtonState extends State<AddCourseButton> {
TextEditingController _jsonstrController = TextEditingController();
void _showAddCourseDialog(BuildContext context) {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('json导入课程'),
content: TextField(
controller: _jsonstrController,
decoration: InputDecoration(labelText: '请输入json字符串'),
),
actions: <Widget>[
TextButton(
child: Text('取消'),
onPressed: () {
courseController.getCourses().then((courses) {
print(courses.length);
});
courseController.getCourses().then((courses) {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text('课程列表'),
content: SingleChildScrollView(
child: Column(
mainAxisSize: MainAxisSize.min,
children: courses
.map((course) => ListTile(
title: Text(course.getName),
subtitle: Text(course.toString()),
))
.toList(),
),
),
);
},
);
});
Navigator.of(context).pop();
},
child: Text('获取课程列表'),
),
ElevatedButton(
TextButton(
child: Text('确定'),
onPressed: () {
// AddCourseFormWidget
Navigator.push(
context,
MaterialPageRoute(builder: (context){
return TimetableRoute();
},
),
);
final jsonstr = _jsonstrController.text;
if (jsonstr.isNotEmpty) {
widget.onCourseAdded(jsonstr);
Navigator.of(context).pop();
}
},
child: Text('查看时间表'),
)
),
],
),
);
);
},
);
}
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: () {
_showAddCourseDialog(context);
},
child: Text('json导入课程'),
);
}
@override
void dispose() {
_jsonstrController.dispose();
super.dispose();
}
}

@ -65,8 +65,10 @@ class PageState extends State<TimetableWidget> {
var mondayTime = courseWidgetController.getmondayTime();
//
for (int i = 0; i < 7; i++) {
dateListstr[i] =
(mondayTime.day + i + 7 * (weekCount - currentWeek)).toString();
dateListstr[i] = mondayTime
.add(Duration(days: i + 7 * (weekCount - currentWeek)))
.day
.toString();
}
}
@ -75,44 +77,36 @@ class PageState extends State<TimetableWidget> {
initState() {
super.initState();
courseController.getCourses().then(
(res){
courseList = res;
courseController.getCourses().then((res) {
courseList = res;
for(var course in res){
print(course.toString());
}
//
//
// courseList = await courseController.getCourses();
//
var mondayTime = courseWidgetController.getmondayTime();
currentWeek = courseWidgetController.getWeekCount();
weekCount = currentWeek;
// courseList = CourseWidgetController.testcourseList;
weekCount = courseWidgetController.getWeekCount();
courseWeekMap = courseWidgetController.transformCourseMap(courseList);
//
for (int i = 0; i < 7; i++) {
dateListstr.add((mondayTime.day + i).toString());
if ((mondayTime.day + i) == DateTime.now().day) {
currentWeekDayIndex = i + 1;
}
}
// print('Recent monday '+DateTime.now().day.toString());
//
//
// courseList = await courseController.getCourses();
//
var mondayTime = courseWidgetController.getmondayTime();
currentWeek = courseWidgetController.getWeekCount();
weekCount = currentWeek;
// courseList = CourseWidgetController.testcourseList;
weekCount = courseWidgetController.getWeekCount();
courseWeekMap = courseWidgetController.transformCourseMap(courseList);
//
positions = courseWidgetController.convertTimeList(timePoints);
setState(() {
loading = false;
});
//
for (int i = 0; i < 7; i++) {
dateListstr.add((mondayTime.day + i).toString());
if ((mondayTime.day + i) == DateTime.now().day) {
currentWeekDayIndex = i + 1;
}
);
}
// print('Recent monday '+DateTime.now().day.toString());
//
positions = courseWidgetController.convertTimeList(timePoints);
setState(() {
loading = false;
});
});
}
@override
@ -158,45 +152,45 @@ class PageState extends State<TimetableWidget> {
child: Center(
child: index == 0
? Column(
//
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: 10,
// width: 6,
child: Text(
'' + weekCount.toString() + '', //
style: TextStyle(
fontSize: 12,
color: currentWeek ==
weekCount //
? Colors.amber
: Colors.black87)),
),
],
)
//
mainAxisAlignment: MainAxisAlignment.center,
children: [
Container(
// height: 10,
// width: 6,
child: Text(
'' + weekCount.toString() + '', //
style: TextStyle(
fontSize: 12,
color: currentWeek ==
weekCount //
? 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)),
],
),
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)),
],
),
),
);
}),
@ -204,135 +198,184 @@ class PageState extends State<TimetableWidget> {
//stack
Expanded(
child: SingleChildScrollView(
child: Row(
children: [
//stack
Container(
width: 390,
height: 2000,
child: Stack(
alignment: Alignment.center,
children: [
// Stack
Positioned(
top: 0,
left: 0,
child: Container(
width: 390,
height: 2000,
child: Stack(
children: List.generate(
//
positions.length,
(index) =>
Positioned(
top: positions[index].dy,
left: positions[index].dx,
child: Row(
child: Row(
children: [
//stack
Container(
width: 390,
height: 2000,
child: Stack(
alignment: Alignment.center,
children: [
// Stack
Positioned(
top: 0,
left: 0,
child: Container(
width: 390,
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'),
),
SizedBox(width: 5),
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.amber,
width: 2,
),
),
),
Container(
width: 315,
height: 2,
color: const Color.fromARGB(
255, 136, 61, 61),
),
],
),
),
),
),
)),
//Stack
Container(
constraints:
BoxConstraints.expand(), // 使constraints
// width: 390,
// height: 2000,
child: Stack(
children: List.generate(
//
courseWeekMap.containsKey(weekCount)
? courseWeekMap[weekCount]!.length
: 0,
((index) => Positioned(
top: courseWeekMap[weekCount]![index]
.getdy() +
10,
left: courseWeekMap[weekCount]![index]
.getdx() +
50,
child: Container(
//
width: 40,
height:
courseWeekMap[weekCount]![index]
.getHeight(),
decoration: BoxDecoration(
color: Colors.tealAccent,
//
borderRadius: BorderRadius.all(
Radius.circular(10.0)), //
),
child: ClipRect(
child: Column(
//
children: [
Text(
timePoints[index]
.hour
.toString()
.padLeft(2, '0') +
courseWeekMap[weekCount]![
index]
.name,
style: TextStyle(
fontSize: 10,
fontWeight:
FontWeight.bold),
overflow: TextOverflow
.clip, //name
),
Text(
courseWeekMap[weekCount]![
index]
.teacher,
style: TextStyle(fontSize: 8),
overflow: TextOverflow.clip,
),
Text(
courseWeekMap[weekCount]![
index]
.location,
style:
TextStyle(fontSize: 10),
overflow: TextOverflow.clip,
),
Text(
courseWeekMap[weekCount]![
index]
.start
.hour
.toString() +
':' +
timePoints[index]
courseWeekMap[weekCount]![
index]
.start
.minute
.toString()
.padLeft(2, '0'),
.toString(),
style:
TextStyle(fontSize: 10),
overflow: TextOverflow.clip,
),
SizedBox(width: 5),
Container(
width: 10,
height: 10,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Colors.amber,
width: 2,
),
),
Text(
courseWeekMap[weekCount]![
index]
.end
.hour
.toString() +
':' +
courseWeekMap[weekCount]![
index]
.end
.minute
.toString(),
style:
TextStyle(fontSize: 10),
overflow: TextOverflow.clip,
),
Container(
width: 315,
height: 2,
color: const Color.fromARGB(
255, 136, 61, 61),
Text(
courseWeekMap[weekCount]![
index]
.remark,
style:
TextStyle(fontSize: 10),
overflow: TextOverflow.clip,
),
],
),
),
),
),
)),
//Stack
Container(
constraints:
BoxConstraints.expand(), // 使constraints
// width: 390,
// height: 2000,
child: Stack(
children: List.generate(
//
courseWeekMap.containsKey(weekCount)
? courseWeekMap[weekCount]!.length
: 0,
((index) =>
Positioned(
top: courseWeekMap[weekCount]![index]
.getdy(),
left: courseList[index].getdx() +
60,
child: Container(
//
width: 40,
height: courseWeekMap[weekCount]![index]
.getHeight(),
decoration: BoxDecoration(
color: Colors.tealAccent,
//
borderRadius: BorderRadius.all(
Radius.circular(
10.0)), //
),
child: Column(
//
children: [
Text(
courseWeekMap[weekCount]![index]
.name,
style: TextStyle(
fontSize: 10,
fontWeight:
FontWeight
.bold), //name
),
Text(
courseWeekMap[weekCount]![index]
.teacher,
style: TextStyle(
fontSize: 8)),
Text(
courseWeekMap[weekCount]![index]
.location,
style: TextStyle(
fontSize: 10)),
],
),
),
))),
))
],
),
),
],
),
))),
))
],
),
),
))
],
),
))
],
),
);
}
return Container(
return Container(
child: Text('加载中'),
);
}

Loading…
Cancel
Save