Commit 9bc54dee authored by wonko's avatar wonko

Vortragszeiten werden in datetimes umgewandelt

parent 09e1b7a7
......@@ -134,11 +134,11 @@ class Room {
}
class Lecture {
final String fs, name, teaser, time, room;
String _id;
final String fs, name, teaser, time, room, id;
final bool aufz;
bool _like = false;
SharedPreferences prefs;
final DateTime start, end;
bool get like => _like;
......@@ -164,27 +164,37 @@ class Lecture {
prefs.setBool(prefId, prefValue);
}
String get id => _id;
set id(String lectureID) {}
set id(String lectureID) {
if (lectureID != null && lectureID != "") {
_id = lectureID;
} else if (teaser != null) {
_id =
teaser.toLowerCase().replaceAll(new RegExp(r"\s+\b|\b\s|\s|\b"), "");
}
}
Lecture(final this.fs, final this.name, final this.teaser, final this.aufz,
final this.time, final this.room, lectureID) {
this.id = lectureID;
readLike(id);
}
Lecture(
final this.fs,
final this.name,
final this.teaser,
final this.aufz,
final this.time,
final this.room,
final this.start,
final this.end,
final this.id);
factory Lecture.fromJSON(Map<String, dynamic> json) {
if (json != null) {
String time = json['time'];
List<String> times = time.split('-');
String startTime = times[0].trim().replaceAll(".", ":");
String endTime = times[1].trim().replaceAll(".", ":");
DateTime start = DateTime.parse("2002-02-27T${startTime}:00Z");
DateTime end = DateTime.parse("2002-02-27T${endTime}:00Z");
String lectureID = json['id'];
if ((lectureID == null || lectureID == "") && json['teaser'] != null) {
lectureID = json["teaser"]
.toLowerCase()
.replaceAll(new RegExp(r"\s+\b|\b\s|\s|\b"), "");
}
Lecture l = Lecture(json['fs'], json['name'], json['teaser'],
json['aufz'], json['time'], json['room'], json['id']);
json['aufz'], time, json['room'], start, end, json['id']);
return l;
} else {
......
......@@ -59,6 +59,10 @@ class _ScheduleWidgetState extends State<ScheduleWidget>
List<Widget> roomViews() {
List<Widget> rv = [];
for (Room room in lectureData.data.rooms) {
rv.add(RoomSchedule(_scheduleScrollController, room));
}
return rv;
......@@ -69,24 +73,58 @@ class TimesSlider extends StatelessWidget {
final ScrollController _scrollController;
final Room room;
static int px_per_minute = 4;
static List<String> hours = List<String>.generate(17, (i) {
int hr = i + 17;
return "$hr";
});
TimesSlider(this._scrollController, this.room);
@override
Widget build(BuildContext context) {
return ListView.builder(
controller: this._scrollController,
itemExtent: 250,
itemCount: room.timeSlots.length,
//itemExtent: 250,
itemCount: 4 * 12,
itemBuilder: (context, index) => Column(children: <Widget>[
Divider(),
Align(
alignment: Alignment.topLeft,
child: Text(
room.timeSlots[index].name,
style: Theme.of(context).textTheme.overline,
textAlign: TextAlign.left,
)),
Expanded(child: Container())
Divider(height: 1),
SizedBox(
height: 62,
child: Align(
alignment: Alignment.topLeft,
child: Text(
hours[index],
style: Theme.of(context).textTheme.overline,
textAlign: TextAlign.left,
))),
SizedBox(
height: 62,
child: Align(
alignment: Alignment.topLeft,
child: Text(
hours[index],
style: Theme.of(context).textTheme.overline,
textAlign: TextAlign.left,
))),
SizedBox(
height: 62,
child: Align(
alignment: Alignment.topLeft,
child: Text(
hours[index],
style: Theme.of(context).textTheme.overline,
textAlign: TextAlign.left,
))),
SizedBox(
height: 62,
child: Align(
alignment: Alignment.topLeft,
child: Text(
hours[index],
style: Theme.of(context).textTheme.overline,
textAlign: TextAlign.left,
))),
]));
}
}
......@@ -107,19 +145,14 @@ class RoomSchedule extends StatelessWidget {
SliverAppBar(
pinned: true,
expandedHeight: 100.0,
flexibleSpace: FlexibleSpaceBar(
centerTitle: true,
title: Text(room.name),
)),
SliverFixedExtentList(
itemExtent: 250,
SliverList(
delegate: SliverChildBuilderDelegate(
(context, index) => Column(children: <Widget>[
Divider(),
Expanded(
child:
LectureCard(room.timeSlots[index].lecture))
LectureCard(room.timeSlots[index].lecture)
]),
childCount: room.timeSlots.length))
]));
......@@ -136,6 +169,7 @@ class _LectureCardState extends State<LectureCard> {
if (l != null) {
IconData ico = Fachschaften().getIcon(l.fs);
return Container(
height: 125,
padding:
EdgeInsets.only(left: 50.0, top: 10.0, right: 10.0, bottom: 10.0),
child: Card(
......@@ -151,7 +185,6 @@ class _LectureCardState extends State<LectureCard> {
),
title: Text(l.teaser),
subtitle: Text(l.name)),
Spacer(),
Padding(
padding: const EdgeInsets.only(left: 80.0),
child: Column(children: <Widget>[
......@@ -182,7 +215,7 @@ class _LectureCardState extends State<LectureCard> {
),
));
} else {
return Container();
return Container(height: 125);
}
}
}
......
......@@ -3,6 +3,7 @@
vcode=$(date +%s)
flutter build apk --release --build-name=2019.0.5 --build-number=$vcode
flutter build appbundle --build-name=2019.0.5 --build-number=$vcode
cp build/app/outputs/apk/release/app-release.apk ~/git/plumbing/fdroid-repo/repo/nos.apk
git -C ~/git/plumbing/fdroid-repo/repo add nos.apk
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment