==0.7.5-nightly 2021-11-16==
- added strapi connector - cleanup code - updated readme - TODO: - update license & copyright info - cleanup code - merge code parts to server side - complete settings - fix 11/12 - add caching - muuuuuuuch more...
This commit is contained in:
parent
11b8435734
commit
223414559e
@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
|
|||||||
class AppearanceSettings extends StatelessWidget {
|
class AppearanceSettings extends StatelessWidget {
|
||||||
const AppearanceSettings({Key? key}) : super(key: key);
|
const AppearanceSettings({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -15,9 +13,7 @@ class AppearanceSettings extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
||||||
children: [
|
children: [],
|
||||||
|
|
||||||
],
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -31,12 +31,12 @@ class DevSettings extends StatelessWidget {
|
|||||||
String apiKey = value;
|
String apiKey = value;
|
||||||
await prefs.setString('api_key', apiKey);
|
await prefs.setString('api_key', apiKey);
|
||||||
final snackBar = SnackBar(
|
final snackBar = SnackBar(
|
||||||
content: Text('Neuer API-Schlüssel gesetzt: $apiKey'));
|
content:
|
||||||
|
Text('Neuer API-Schlüssel gesetzt: $apiKey'));
|
||||||
|
|
||||||
// Find the ScaffoldMessenger in the widget tree
|
// Find the ScaffoldMessenger in the widget tree
|
||||||
// and use it to show a SnackBar.
|
// and use it to show a SnackBar.
|
||||||
ScaffoldMessenger.of(context)
|
ScaffoldMessenger.of(context).showSnackBar(snackBar);
|
||||||
.showSnackBar(snackBar);
|
|
||||||
})),
|
})),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
Padding(
|
Padding(
|
||||||
@ -49,8 +49,7 @@ class DevSettings extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text("Benutzerdaten neu laden"),
|
child: const Text("Benutzerdaten neu laden"),
|
||||||
)
|
))
|
||||||
)
|
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,6 @@ import 'package:MeinCantor/const.dart';
|
|||||||
class InfoSettings extends StatelessWidget {
|
class InfoSettings extends StatelessWidget {
|
||||||
const InfoSettings({Key? key}) : super(key: key);
|
const InfoSettings({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -20,8 +18,7 @@ class InfoSettings extends StatelessWidget {
|
|||||||
const ListTile(
|
const ListTile(
|
||||||
leading: Icon(Icons.info_outlined),
|
leading: Icon(Icons.info_outlined),
|
||||||
title: Text("Version"),
|
title: Text("Version"),
|
||||||
subtitle: Text(version)
|
subtitle: Text(version)),
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.settings_backup_restore_outlined),
|
leading: const Icon(Icons.settings_backup_restore_outlined),
|
||||||
title: const Text("Änderungsverlauf"),
|
title: const Text("Änderungsverlauf"),
|
||||||
@ -61,9 +58,12 @@ class InfoSettings extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => LicensePage(
|
MaterialPageRoute(
|
||||||
applicationIcon: Image.asset("assets/images/meincantor_r.png",
|
builder: (context) => LicensePage(
|
||||||
height: 64, width: 64),
|
applicationIcon: Image.asset(
|
||||||
|
"assets/images/meincantor_r.png",
|
||||||
|
height: 64,
|
||||||
|
width: 64),
|
||||||
applicationVersion: version,
|
applicationVersion: version,
|
||||||
)),
|
)),
|
||||||
);
|
);
|
||||||
|
@ -8,10 +8,10 @@ import 'package:cyclop/cyclop.dart';
|
|||||||
import 'package:MeinCantor/networking.dart';
|
import 'package:MeinCantor/networking.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
import '../../color_presets.dart';
|
import 'package:MeinCantor/presets/colors.dart';
|
||||||
import 'package:MeinCantor/subject_presets.dart';
|
import 'package:MeinCantor/presets/subjects.dart';
|
||||||
|
|
||||||
import '../../teacher_presets.dart';
|
import 'package:MeinCantor/presets/teachers.dart';
|
||||||
|
|
||||||
class PlanSettings extends StatefulWidget {
|
class PlanSettings extends StatefulWidget {
|
||||||
const PlanSettings({Key? key}) : super(key: key);
|
const PlanSettings({Key? key}) : super(key: key);
|
||||||
@ -39,7 +39,12 @@ Future<List<dynamic>> buildLessonsList() async {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PlanSettingsState extends State<PlanSettings> {
|
class _PlanSettingsState extends State<PlanSettings> {
|
||||||
Set<Color> swatches = {...Colors.primaries, ...Colors.accents, Palette.accent, Palette.primary};
|
Set<Color> swatches = {
|
||||||
|
...Colors.primaries,
|
||||||
|
...Colors.accents,
|
||||||
|
Palette.accent,
|
||||||
|
Palette.primary
|
||||||
|
};
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
@ -63,7 +68,8 @@ class _PlanSettingsState extends State<PlanSettings> {
|
|||||||
for (var element in (snapshot.data as List<dynamic>)) {
|
for (var element in (snapshot.data as List<dynamic>)) {
|
||||||
String subject = element['subject'];
|
String subject = element['subject'];
|
||||||
String teacher = element['teacher'];
|
String teacher = element['teacher'];
|
||||||
children.add(FutureBuilder(
|
children.add(
|
||||||
|
FutureBuilder(
|
||||||
future: buildPlanColors(subject),
|
future: buildPlanColors(subject),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (snapshot.hasData) {
|
if (snapshot.hasData) {
|
||||||
@ -83,31 +89,28 @@ class _PlanSettingsState extends State<PlanSettings> {
|
|||||||
setState(() {
|
setState(() {
|
||||||
color = value;
|
color = value;
|
||||||
});
|
});
|
||||||
SharedPreferences prefs = await SharedPreferences
|
SharedPreferences prefs =
|
||||||
|
await SharedPreferences
|
||||||
.getInstance();
|
.getInstance();
|
||||||
prefs.setInt(
|
prefs.setInt(
|
||||||
"color$subject", value.value);
|
"color$subject", value.value);
|
||||||
}
|
}),
|
||||||
),
|
title: Text(subjects[subject] ?? ""),
|
||||||
title: Text(names[subject] ?? ""),
|
|
||||||
subtitle: Text(teachers[teacher] ?? ""),
|
subtitle: Text(teachers[teacher] ?? ""),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (const LinearProgressIndicator());
|
return (const LinearProgressIndicator());
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Column(
|
return Column(
|
||||||
children: children,
|
children: children,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (const Center(
|
return (const Center(child: CircularProgressIndicator()));
|
||||||
child: CircularProgressIndicator()));
|
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
/*FutureBuilder(
|
/*FutureBuilder(
|
||||||
future: buildPlanColors("Mat"),
|
future: buildPlanColors("Mat"),
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
@ -171,7 +174,6 @@ class _PlanSettingsState extends State<PlanSettings> {
|
|||||||
}
|
}
|
||||||
),*/
|
),*/
|
||||||
],
|
],
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,8 +4,6 @@ import 'package:flutter/material.dart';
|
|||||||
class ServiceSettings extends StatelessWidget {
|
class ServiceSettings extends StatelessWidget {
|
||||||
const ServiceSettings({Key? key}) : super(key: key);
|
const ServiceSettings({Key? key}) : super(key: key);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
@ -15,9 +13,7 @@ class ServiceSettings extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
body: ListView(
|
body: ListView(
|
||||||
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
||||||
children: [
|
children: [],
|
||||||
|
|
||||||
],
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -17,7 +17,6 @@ class UserSettings extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
|
||||||
//TextEditingController nameController = TextEditingController(text: "Denys Konovalov");
|
//TextEditingController nameController = TextEditingController(text: "Denys Konovalov");
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -36,10 +35,8 @@ class UserSettings extends StatelessWidget {
|
|||||||
shape: BoxShape.circle,
|
shape: BoxShape.circle,
|
||||||
image: DecorationImage(
|
image: DecorationImage(
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
image: AssetImage("assets/images/meincantor_r.png")
|
image:
|
||||||
)
|
AssetImage("assets/images/meincantor_r.png")))),
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
FutureBuilder(
|
FutureBuilder(
|
||||||
future: getSettingsString("name"),
|
future: getSettingsString("name"),
|
||||||
@ -51,17 +48,16 @@ class UserSettings extends StatelessWidget {
|
|||||||
labelText: 'Name',
|
labelText: 'Name',
|
||||||
),
|
),
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
controller: TextEditingController(text: snapshot.data as String),
|
controller:
|
||||||
|
TextEditingController(text: snapshot.data as String),
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
return (const Center(child: CircularProgressIndicator()));
|
return (const Center(child: CircularProgressIndicator()));
|
||||||
}
|
}
|
||||||
}
|
}),
|
||||||
),
|
|
||||||
Padding(
|
Padding(
|
||||||
padding: const EdgeInsets.fromLTRB(5, 20, 5, 5),
|
padding: const EdgeInsets.fromLTRB(5, 20, 5, 5),
|
||||||
child: buildClassesChooser()
|
child: buildClassesChooser()),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,8 @@ class Settings extends StatelessWidget {
|
|||||||
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
padding: const EdgeInsets.fromLTRB(5, 5, 5, 5),
|
||||||
children: [
|
children: [
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(MdiIcons.accountSettingsOutline, color: Colors.cyan),
|
leading: const Icon(MdiIcons.accountSettingsOutline,
|
||||||
|
color: Colors.cyan),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
title: const Text("Benutzer"),
|
title: const Text("Benutzer"),
|
||||||
subtitle: const Text("Profilbild, Klasse & mehr"),
|
subtitle: const Text("Profilbild, Klasse & mehr"),
|
||||||
@ -35,7 +36,8 @@ class Settings extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(MdiIcons.timetable, color: Colors.orangeAccent),
|
leading:
|
||||||
|
const Icon(MdiIcons.timetable, color: Colors.orangeAccent),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
title: const Text("Plan"),
|
title: const Text("Plan"),
|
||||||
subtitle: const Text("Kurse/Fächer, Farben & mehr"),
|
subtitle: const Text("Kurse/Fächer, Farben & mehr"),
|
||||||
@ -47,14 +49,16 @@ class Settings extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.color_lens_outlined, color: Colors.pinkAccent),
|
leading: const Icon(Icons.color_lens_outlined,
|
||||||
|
color: Colors.pinkAccent),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
title: const Text("Aussehen"),
|
title: const Text("Aussehen"),
|
||||||
subtitle: const Text("Widgets, Design & mehr"),
|
subtitle: const Text("Widgets, Design & mehr"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const AppearanceSettings()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const AppearanceSettings()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
@ -66,12 +70,14 @@ class Settings extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const ServiceSettings()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const ServiceSettings()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.developer_mode_outlined, color: Colors.deepOrangeAccent),
|
leading: const Icon(Icons.developer_mode_outlined,
|
||||||
|
color: Colors.deepOrangeAccent),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
title: const Text("Entwickleroptionen"),
|
title: const Text("Entwickleroptionen"),
|
||||||
subtitle: const Text("API, Benutzerdaten & mehr"),
|
subtitle: const Text("API, Benutzerdaten & mehr"),
|
||||||
@ -83,7 +89,8 @@ class Settings extends StatelessWidget {
|
|||||||
},
|
},
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
leading: const Icon(Icons.info_outlined, color: Colors.greenAccent),
|
leading:
|
||||||
|
const Icon(Icons.info_outlined, color: Colors.greenAccent),
|
||||||
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
trailing: const Icon(Icons.arrow_forward_ios, size: 16),
|
||||||
title: const Text("Informationen"),
|
title: const Text("Informationen"),
|
||||||
subtitle: const Text("Version, Lizenzen & mehr"),
|
subtitle: const Text("Version, Lizenzen & mehr"),
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
//import 'package:MeinCantor/timetable.dart';
|
|
||||||
//import 'package:MeinCantor/main.dart';
|
|
||||||
import 'package:MeinCantor/raumuebersicht.dart';
|
import 'package:MeinCantor/raumuebersicht.dart';
|
||||||
import 'package:MeinCantor/schulbibliothek.dart';
|
import 'package:MeinCantor/schulbibliothek.dart';
|
||||||
import 'package:MeinCantor/schulcomputer.dart';
|
import 'package:MeinCantor/schulcomputer.dart';
|
||||||
|
import 'package:MeinCantor/schuelerzeitung.dart';
|
||||||
|
import 'package:MeinCantor/Settings/dashboard.dart';
|
||||||
|
|
||||||
|
import 'package:MeinCantor/main.dart';
|
||||||
|
import 'package:MeinCantor/networking.dart';
|
||||||
|
import 'package:MeinCantor/login.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:google_fonts/google_fonts.dart';
|
import 'package:google_fonts/google_fonts.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'Settings/dashboard.dart';
|
|
||||||
// import 'settings.dart';
|
|
||||||
import 'main.dart';
|
|
||||||
import 'networking.dart';
|
|
||||||
import 'login.dart';
|
|
||||||
import 'schuelerzeitung.dart';
|
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
class Dashboard extends StatefulWidget {
|
class Dashboard extends StatefulWidget {
|
||||||
@ -30,7 +29,6 @@ Future<String> getSettingsString(String key) async {
|
|||||||
if (value == null || value.isEmpty) {
|
if (value == null || value.isEmpty) {
|
||||||
value = "";
|
value = "";
|
||||||
}
|
}
|
||||||
print(value);
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,17 +53,14 @@ class _DashboardState extends State<Dashboard> with RestorationMixin {
|
|||||||
UserAccountsDrawerHeader(
|
UserAccountsDrawerHeader(
|
||||||
accountName: buildSettingsString('name', const TextStyle()),
|
accountName: buildSettingsString('name', const TextStyle()),
|
||||||
accountEmail: buildSettingsString('user', const TextStyle()),
|
accountEmail: buildSettingsString('user', const TextStyle()),
|
||||||
currentAccountPicture: Image.asset("assets/images/meincantor_r.png")
|
currentAccountPicture:
|
||||||
/*const CircularProgressIndicator(
|
Image.asset("assets/images/meincantor_r.png")),
|
||||||
backgroundColor: Colors.black,
|
|
||||||
),*/
|
|
||||||
),
|
|
||||||
ListTile(
|
ListTile(
|
||||||
title: const Text("Einstellungen"),
|
title: const Text("Einstellungen"),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => Settings()),
|
MaterialPageRoute(builder: (context) => const Settings()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
leading: const Icon(Icons.settings_outlined),
|
leading: const Icon(Icons.settings_outlined),
|
||||||
@ -90,12 +85,9 @@ class _DashboardState extends State<Dashboard> with RestorationMixin {
|
|||||||
label: "Startseite",
|
label: "Startseite",
|
||||||
),
|
),
|
||||||
const BottomNavigationBarItem(
|
const BottomNavigationBarItem(
|
||||||
icon: Icon(MdiIcons.timetable),
|
icon: Icon(MdiIcons.timetable), label: "Vertretungsplan"),
|
||||||
label: "Vertretungsplan"),
|
|
||||||
const BottomNavigationBarItem(
|
const BottomNavigationBarItem(
|
||||||
icon: Icon(Icons.notifications_outlined),
|
icon: Icon(Icons.notifications_outlined), label: "Hinweise"),
|
||||||
label: "Hinweise"
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
@ -115,7 +107,6 @@ class _DashboardState extends State<Dashboard> with RestorationMixin {
|
|||||||
setState(() {
|
setState(() {
|
||||||
_currentIndex.value = index;
|
_currentIndex.value = index;
|
||||||
});
|
});
|
||||||
//print(index);
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@ -139,7 +130,7 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
if (item.label == "Startseite") {
|
if (item.label == "Startseite") {
|
||||||
double _timeOfDayToDouble(TimeOfDay tod) => tod.hour + tod.minute / 60.0;
|
double _timeOfDayToDouble(TimeOfDay tod) => tod.hour + tod.minute / 60.0;
|
||||||
var lessonCount;
|
int lessonCount;
|
||||||
if (_timeOfDayToDouble(TimeOfDay.now()) <=
|
if (_timeOfDayToDouble(TimeOfDay.now()) <=
|
||||||
_timeOfDayToDouble(const TimeOfDay(hour: 7, minute: 30))) {
|
_timeOfDayToDouble(const TimeOfDay(hour: 7, minute: 30))) {
|
||||||
lessonCount = 1;
|
lessonCount = 1;
|
||||||
@ -187,20 +178,8 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
lessonCount = -1;
|
lessonCount = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
Widget timetable;
|
|
||||||
if (_timeOfDayToDouble(TimeOfDay.now()) >
|
|
||||||
_timeOfDayToDouble(const TimeOfDay(hour: , minute: 55))) {
|
|
||||||
timetable = buildClassTimetable();
|
|
||||||
} else {
|
|
||||||
timetable = buildTodayClassTimetable();
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
print(lessonCount);
|
|
||||||
var view = SingleChildScrollView(
|
var view = SingleChildScrollView(
|
||||||
child: Column(
|
child: Column(children: [
|
||||||
children: [
|
|
||||||
Row(
|
Row(
|
||||||
mainAxisSize: MainAxisSize.max,
|
mainAxisSize: MainAxisSize.max,
|
||||||
children: [
|
children: [
|
||||||
@ -285,8 +264,7 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
width: 175,
|
width: 175,
|
||||||
),
|
),
|
||||||
@ -323,8 +301,7 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -360,8 +337,7 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(
|
SizedBox(
|
||||||
@ -370,7 +346,8 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => const RoomOverview()),
|
MaterialPageRoute(
|
||||||
|
builder: (context) => const RoomOverview()),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: Card(
|
child: Card(
|
||||||
@ -397,188 +374,9 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)
|
)),
|
||||||
),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
/*GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => const SZ()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
//mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 10),
|
|
||||||
child: Icon(
|
|
||||||
MdiIcons.newspaper,
|
|
||||||
color: Palette.accent,
|
|
||||||
size: 48,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
//mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Align(
|
|
||||||
alignment: Alignment(0, 0),
|
|
||||||
child: Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(15, 50, 15, 15),
|
|
||||||
child: Text(
|
|
||||||
'Schülerzeitung',
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => const SB()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Center(
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 10),
|
|
||||||
child: Icon(
|
|
||||||
MdiIcons.libraryShelves,
|
|
||||||
color: Color(0xFFFFBC3B),
|
|
||||||
size: 48,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(15, 50, 15, 15),
|
|
||||||
child: Text(
|
|
||||||
'Schulbibliothek',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
)
|
|
||||||
),
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => const SC()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 10),
|
|
||||||
child: Icon(
|
|
||||||
MdiIcons.laptop,
|
|
||||||
color: Color(0xFFFFBC3B),
|
|
||||||
size: 48,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(15, 50, 15, 15),
|
|
||||||
child: Text(
|
|
||||||
'Schulcomputer',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
GestureDetector(
|
|
||||||
onTap: () async {
|
|
||||||
Navigator.push(
|
|
||||||
context,
|
|
||||||
MaterialPageRoute(builder: (context) => const RoomOverview()),
|
|
||||||
);
|
|
||||||
},
|
|
||||||
child: Card(
|
|
||||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
|
||||||
shape: RoundedRectangleBorder(
|
|
||||||
borderRadius: BorderRadius.circular(10),
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: [
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 10),
|
|
||||||
child: Icon(
|
|
||||||
MdiIcons.door,
|
|
||||||
color: Color(0xFFFFBC3B),
|
|
||||||
size: 48,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
mainAxisSize: MainAxisSize.max,
|
|
||||||
children: const [
|
|
||||||
Padding(
|
|
||||||
padding: EdgeInsets.fromLTRB(15, 50, 15, 15),
|
|
||||||
child: Text(
|
|
||||||
'Raumübersicht',
|
|
||||||
),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),*/
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -588,8 +386,8 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
} else if (item.label == "Vertretungsplan") {
|
} else if (item.label == "Vertretungsplan") {
|
||||||
return LayoutBuilder(builder: (context, constraints) {
|
return LayoutBuilder(builder: (context, constraints) {
|
||||||
double widgetWidth = constraints.maxWidth;
|
double widgetWidth = constraints.maxWidth;
|
||||||
// double widgetHeight = constraints.maxHeight;
|
|
||||||
var factor;
|
int factor;
|
||||||
|
|
||||||
if (widgetWidth <= 600) {
|
if (widgetWidth <= 600) {
|
||||||
factor = 1;
|
factor = 1;
|
||||||
@ -597,6 +395,8 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
factor = 2;
|
factor = 2;
|
||||||
} else if (widgetWidth <= 2000) {
|
} else if (widgetWidth <= 2000) {
|
||||||
factor = 3;
|
factor = 3;
|
||||||
|
} else {
|
||||||
|
factor = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// print(screenType);
|
// print(screenType);
|
||||||
@ -629,10 +429,6 @@ class _DashboardBottomNavView extends StatelessWidget {
|
|||||||
text: "Neuster Plan",
|
text: "Neuster Plan",
|
||||||
icon: Icon(CupertinoIcons.calendar),
|
icon: Icon(CupertinoIcons.calendar),
|
||||||
),
|
),
|
||||||
/*Tab(
|
|
||||||
text: "Archiv",
|
|
||||||
icon: Icon(CupertinoIcons.archivebox),
|
|
||||||
),*/
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@ -46,7 +46,8 @@ class App extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
),
|
),
|
||||||
darkTheme: ThemeData.from(
|
darkTheme: ThemeData.from(
|
||||||
colorScheme: const ColorScheme.dark(primary: Palette.accent, secondary: Palette.accent)),
|
colorScheme: const ColorScheme.dark(
|
||||||
|
primary: Palette.accent, secondary: Palette.accent)),
|
||||||
title: "GCG.MeinCantor",
|
title: "GCG.MeinCantor",
|
||||||
home: buildHomePage(),
|
home: buildHomePage(),
|
||||||
);
|
);
|
||||||
|
@ -5,9 +5,20 @@ import 'package:flutter/painting.dart';
|
|||||||
import 'package:http/http.dart' as http;
|
import 'package:http/http.dart' as http;
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'timetable.dart';
|
import 'package:MeinCantor/const.dart';
|
||||||
import 'login.dart';
|
import 'package:MeinCantor/timetable.dart';
|
||||||
import 'main.dart';
|
import 'package:MeinCantor/login.dart';
|
||||||
|
import 'package:MeinCantor/main.dart';
|
||||||
|
|
||||||
|
Future<http.Response> getArticles() async {
|
||||||
|
print("hjkl0");
|
||||||
|
var uri = Uri.https(szUrl["url"]!, "/articles");
|
||||||
|
print(uri.toString());
|
||||||
|
final response = await http.get(uri);
|
||||||
|
print("hji");
|
||||||
|
print(response);
|
||||||
|
return (response);
|
||||||
|
}
|
||||||
|
|
||||||
Future<http.Response> getToken(
|
Future<http.Response> getToken(
|
||||||
String user, String password, String otp, String devId) async {
|
String user, String password, String otp, String devId) async {
|
||||||
@ -47,7 +58,9 @@ Future<http.Response> fetchClassTimetable() async {
|
|||||||
var uri = Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum");
|
var uri = Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum");
|
||||||
var headers = {"x-api-key": "$apiKey"};
|
var headers = {"x-api-key": "$apiKey"};
|
||||||
print(uri);
|
print(uri);
|
||||||
final response = http.get(uri, headers: headers).onError((error, stackTrace) { return(http.Response("", 404)); } );
|
final response = http.get(uri, headers: headers).onError((error, stackTrace) {
|
||||||
|
return (http.Response("", 404));
|
||||||
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +78,9 @@ Future<http.Response> fetchTodayClassTimetable() async {
|
|||||||
Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum/today");
|
Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum/today");
|
||||||
var headers = {"x-api-key": "$apiKey"};
|
var headers = {"x-api-key": "$apiKey"};
|
||||||
print(uri);
|
print(uri);
|
||||||
final response = http.get(uri, headers: headers).onError((error, stackTrace) { return(http.Response("", 404)); } );
|
final response = http.get(uri, headers: headers).onError((error, stackTrace) {
|
||||||
|
return (http.Response("", 404));
|
||||||
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,7 +98,9 @@ Future<http.Response> fetchTomorrowClassTimetable() async {
|
|||||||
Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum/tomorrow");
|
Uri.https("mein.cantorgymnasium.de", "/api/timetable/$classNum/tomorrow");
|
||||||
var headers = {"x-api-key": "$apiKey"};
|
var headers = {"x-api-key": "$apiKey"};
|
||||||
print(uri);
|
print(uri);
|
||||||
final response = http.get(uri, headers: headers).onError((error, stackTrace) { return(http.Response("", 404)); } );
|
final response = http.get(uri, headers: headers).onError((error, stackTrace) {
|
||||||
|
return (http.Response("", 404));
|
||||||
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,7 +115,10 @@ fetchLessonList() async {
|
|||||||
var apiKey = prefs.getString('api_key');
|
var apiKey = prefs.getString('api_key');
|
||||||
var uri = Uri.https("mein.cantorgymnasium.de", "/api/lessons/$classNum");
|
var uri = Uri.https("mein.cantorgymnasium.de", "/api/lessons/$classNum");
|
||||||
var headers = {"x-api-key": "$apiKey"};
|
var headers = {"x-api-key": "$apiKey"};
|
||||||
final response = await http.get(uri, headers: headers).onError((error, stackTrace) { return(http.Response("", 404)); } );
|
final response =
|
||||||
|
await http.get(uri, headers: headers).onError((error, stackTrace) {
|
||||||
|
return (http.Response("", 404));
|
||||||
|
});
|
||||||
if (response.statusCode == 200) {
|
if (response.statusCode == 200) {
|
||||||
prefs.setString("lessons", utf8.decode(response.bodyBytes));
|
prefs.setString("lessons", utf8.decode(response.bodyBytes));
|
||||||
} else {
|
} else {
|
||||||
@ -106,8 +126,6 @@ fetchLessonList() async {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Widget buildClassTimetable() {
|
Widget buildClassTimetable() {
|
||||||
return FutureBuilder<http.Response>(
|
return FutureBuilder<http.Response>(
|
||||||
future: fetchClassTimetable(),
|
future: fetchClassTimetable(),
|
||||||
@ -117,7 +135,8 @@ Widget buildClassTimetable() {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
Widget timetableView = ClassTimetableBuilder.buildView(
|
Widget timetableView = ClassTimetableBuilder.buildView(
|
||||||
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
||||||
.view.child;
|
.view
|
||||||
|
.child;
|
||||||
return timetableView;
|
return timetableView;
|
||||||
} else if (statusCode == 400) {
|
} else if (statusCode == 400) {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
@ -125,12 +144,15 @@ Widget buildClassTimetable() {
|
|||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Es konnte kein Vertretungsplan gefunden werden.")),
|
child: Center(
|
||||||
|
child: Text("Es konnte kein Vertretungsplan gefunden werden.")),
|
||||||
);
|
);
|
||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Center(child: Text('Error $statusCode'));
|
return Center(child: Text('Error $statusCode'));
|
||||||
@ -152,23 +174,23 @@ Widget buildTodayClassTimetable() {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
Widget timetableView = ClassTimetableBuilder.buildView(
|
Widget timetableView = ClassTimetableBuilder.buildView(
|
||||||
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
||||||
.view.child;
|
.view
|
||||||
|
.child;
|
||||||
return timetableView;
|
return timetableView;
|
||||||
} else if (statusCode == 400) {
|
} else if (statusCode == 400) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (context) => Login()));
|
context, MaterialPageRoute(builder: (context) => Login()));
|
||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
var chars = Runes('Es konnte kein Vertretungsplan für heute gefunden werden. \u{1F937}');
|
var chars = Runes(
|
||||||
|
'Es konnte kein Vertretungsplan für heute gefunden werden. \u{1F937}');
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(String.fromCharCodes(chars),
|
title: Text(String.fromCharCodes(chars),
|
||||||
style: const TextStyle(color: Palette.primary)),
|
style: const TextStyle(color: Palette.primary)),
|
||||||
)
|
));
|
||||||
);
|
|
||||||
Card card = Card(
|
Card card = Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15.0),
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
|
|
||||||
),
|
),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -178,12 +200,13 @@ Widget buildTodayClassTimetable() {
|
|||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 20),
|
padding: EdgeInsets.fromLTRB(20, 20, 20, 20),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [card],
|
children: [card],
|
||||||
)
|
));
|
||||||
);
|
|
||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Center(child: Text('Error $statusCode'));
|
return Center(child: Text('Error $statusCode'));
|
||||||
@ -205,23 +228,23 @@ Widget buildTomorrowClassTimetable() {
|
|||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
Widget timetableView = ClassTimetableBuilder.buildView(
|
Widget timetableView = ClassTimetableBuilder.buildView(
|
||||||
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), context)
|
||||||
.view.child;
|
.view
|
||||||
|
.child;
|
||||||
return timetableView;
|
return timetableView;
|
||||||
} else if (statusCode == 400) {
|
} else if (statusCode == 400) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (context) => Login()));
|
context, MaterialPageRoute(builder: (context) => Login()));
|
||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
var chars = Runes('Es konnte kein Vertretungsplan für morgen gefunden werden. \u{1F937}');
|
var chars = Runes(
|
||||||
|
'Es konnte kein Vertretungsplan für morgen gefunden werden. \u{1F937}');
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(String.fromCharCodes(chars),
|
title: Text(String.fromCharCodes(chars),
|
||||||
style: const TextStyle(color: Palette.primary)),
|
style: const TextStyle(color: Palette.primary)),
|
||||||
)
|
));
|
||||||
);
|
|
||||||
Card card = Card(
|
Card card = Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15.0),
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
|
|
||||||
),
|
),
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
child: Column(
|
child: Column(
|
||||||
@ -231,8 +254,7 @@ Widget buildTomorrowClassTimetable() {
|
|||||||
padding: EdgeInsets.fromLTRB(20, 20, 20, 20),
|
padding: EdgeInsets.fromLTRB(20, 20, 20, 20),
|
||||||
child: ListView(
|
child: ListView(
|
||||||
children: [card],
|
children: [card],
|
||||||
)
|
));
|
||||||
);
|
|
||||||
/*return const Padding(
|
/*return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Es konnte kein Vertretungsplan für heute gefunden werden.")),
|
child: Center(child: Text("Es konnte kein Vertretungsplan für heute gefunden werden.")),
|
||||||
@ -240,7 +262,9 @@ Widget buildTomorrowClassTimetable() {
|
|||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support.")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Center(child: Text('Error $statusCode'));
|
return Center(child: Text('Error $statusCode'));
|
||||||
@ -261,19 +285,20 @@ Widget buildClassTimetableLesson(int count) {
|
|||||||
int statusCode = snapshot.data!.statusCode;
|
int statusCode = snapshot.data!.statusCode;
|
||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
List<Widget> lessons = LessonsListBuilder.buildList(
|
List<Widget> lessons = LessonsListBuilder.buildList(
|
||||||
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), count: count)
|
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)),
|
||||||
|
count: count)
|
||||||
.lessons;
|
.lessons;
|
||||||
return Column(children: lessons);
|
return Column(children: lessons);
|
||||||
} else if (statusCode == 400) {
|
} else if (statusCode == 400) {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context, MaterialPageRoute(builder: (context) => Login()));
|
context, MaterialPageRoute(builder: (context) => Login()));
|
||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
var chars = Runes('Es konnte kein Vertretungsplan für gefunden werden. \u{1F937}');
|
var chars = Runes(
|
||||||
|
'Es konnte kein Vertretungsplan für gefunden werden. \u{1F937}');
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(String.fromCharCodes(chars),
|
title: Text(String.fromCharCodes(chars),
|
||||||
style: const TextStyle(color: Palette.primary))
|
style: const TextStyle(color: Palette.primary))));
|
||||||
));
|
|
||||||
Card card = Card(
|
Card card = Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15.0),
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
@ -290,7 +315,9 @@ Widget buildClassTimetableLesson(int count) {
|
|||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Center(child: Text('Error $statusCode'));
|
return Center(child: Text('Error $statusCode'));
|
||||||
@ -311,17 +338,18 @@ Widget buildTodayClassTimetableLesson(int count) {
|
|||||||
int statusCode = snapshot.data!.statusCode;
|
int statusCode = snapshot.data!.statusCode;
|
||||||
if (statusCode == 200) {
|
if (statusCode == 200) {
|
||||||
List<Widget> lessons = LessonsListBuilder.buildList(
|
List<Widget> lessons = LessonsListBuilder.buildList(
|
||||||
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)), count: count)
|
jsonDecode(utf8.decode(snapshot.data!.bodyBytes)),
|
||||||
|
count: count)
|
||||||
.lessons;
|
.lessons;
|
||||||
if (lessons.isNotEmpty) {
|
if (lessons.isNotEmpty) {
|
||||||
return Column(children: lessons);
|
return Column(children: lessons);
|
||||||
} else {
|
} else {
|
||||||
var chars = Runes('Keine Stunden mehr gefunden. Sieht so aus als hättest du Schluss für heute \u{1F389}');
|
var chars = Runes(
|
||||||
|
'Keine Stunden mehr gefunden. Sieht so aus als hättest du Schluss für heute \u{1F389}');
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(String.fromCharCodes(chars),
|
title: Text(String.fromCharCodes(chars),
|
||||||
style: const TextStyle(color: Palette.primary))
|
style: const TextStyle(color: Palette.primary))));
|
||||||
));
|
|
||||||
Card card = Card(
|
Card card = Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15.0),
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
@ -336,18 +364,16 @@ Widget buildTodayClassTimetableLesson(int count) {
|
|||||||
Future.delayed(Duration.zero, () {
|
Future.delayed(Duration.zero, () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(builder: (context) => Login()),
|
||||||
builder: (context) =>
|
|
||||||
Login()),
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
var chars = Runes('Es konnte kein Vertretungsplan für heute gefunden werden. \u{1F937}');
|
var chars = Runes(
|
||||||
|
'Es konnte kein Vertretungsplan für heute gefunden werden. \u{1F937}');
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(String.fromCharCodes(chars),
|
title: Text(String.fromCharCodes(chars),
|
||||||
style: const TextStyle(color: Palette.primary))
|
style: const TextStyle(color: Palette.primary))));
|
||||||
));
|
|
||||||
Card card = Card(
|
Card card = Card(
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15.0),
|
borderRadius: BorderRadius.circular(15.0),
|
||||||
@ -364,7 +390,9 @@ Widget buildTodayClassTimetableLesson(int count) {
|
|||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Center(child: Text('Error $statusCode'));
|
return Center(child: Text('Error $statusCode'));
|
||||||
@ -383,7 +411,9 @@ Future<http.Response> fetchClassesList() async {
|
|||||||
var uri = Uri.https("mein.cantorgymnasium.de", "/api/classes");
|
var uri = Uri.https("mein.cantorgymnasium.de", "/api/classes");
|
||||||
var headers = {"x-api-key": "$apiKey"};
|
var headers = {"x-api-key": "$apiKey"};
|
||||||
print(uri);
|
print(uri);
|
||||||
final response = http.get(uri, headers: headers).onError((error, stackTrace) { return(http.Response("", 404)); } );
|
final response = http.get(uri, headers: headers).onError((error, stackTrace) {
|
||||||
|
return (http.Response("", 404));
|
||||||
|
});
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,12 +435,16 @@ Widget buildClassesChooser() {
|
|||||||
} else if (statusCode == 500) {
|
} else if (statusCode == 500) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Serverfehler. Bitte wende dich an den MeinCantor-Support.")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Serverfehler. Bitte wende dich an den MeinCantor-Support.")),
|
||||||
);
|
);
|
||||||
} else if (statusCode == 404) {
|
} else if (statusCode == 404) {
|
||||||
return const Padding(
|
return const Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: Center(child: Text("Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
child: Center(
|
||||||
|
child: Text(
|
||||||
|
"Keine Verbindung mit dem MeinCantor-Server möglich. Bitte prüfe deine Internetverbindung und deine DNS-Einstellungen oder wende dich an den MeinCantor-Support")),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return Text('$statusCode');
|
return Text('$statusCode');
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
dynamic names = {
|
dynamic subjects = {
|
||||||
|
'---': '---',
|
||||||
'Bio': 'Biologie',
|
'Bio': 'Biologie',
|
||||||
'Mat': 'Mathematik',
|
'Mat': 'Mathematik',
|
||||||
'matL1': 'Mathematik Leistungskurs 1',
|
'matL1': 'Mathematik Leistungskurs 1',
|
||||||
@ -15,7 +16,6 @@ dynamic names = {
|
|||||||
'frz2': 'Französisch 2',
|
'frz2': 'Französisch 2',
|
||||||
'frz3': 'Französisch 3',
|
'frz3': 'Französisch 3',
|
||||||
'Phy': 'Physik',
|
'Phy': 'Physik',
|
||||||
'---': '---',
|
|
||||||
'Spo': 'Sport',
|
'Spo': 'Sport',
|
||||||
'Deu': 'Deutsch',
|
'Deu': 'Deutsch',
|
||||||
'deu1': 'Deutsch 1',
|
'deu1': 'Deutsch 1',
|
@ -1,6 +1,12 @@
|
|||||||
|
import 'dart:convert';
|
||||||
|
|
||||||
|
import 'package:MeinCantor/networking.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:http/http.dart' as http;
|
||||||
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
|
|
||||||
class SZ extends StatelessWidget {
|
class SZ extends StatelessWidget {
|
||||||
const SZ({Key? key}) : super(key: key);
|
const SZ({Key? key}) : super(key: key);
|
||||||
|
|
||||||
@ -11,45 +17,93 @@ class SZ extends StatelessWidget {
|
|||||||
title: const Text("Schülerzeitung"),
|
title: const Text("Schülerzeitung"),
|
||||||
centerTitle: true,
|
centerTitle: true,
|
||||||
),
|
),
|
||||||
body: ListView(
|
body: FutureBuilder<http.Response>(
|
||||||
children: [
|
future: getArticles(),
|
||||||
Card(
|
builder: (context, snapshot) {
|
||||||
|
if (snapshot.hasData) {
|
||||||
|
int statusCode = snapshot.data!.statusCode;
|
||||||
|
if (statusCode == 200) {
|
||||||
|
String data = utf8.decode(snapshot.data!.bodyBytes);
|
||||||
|
List articles = jsonDecode(data);
|
||||||
|
List<Widget> articleTiles = [];
|
||||||
|
for (var element in articles) {
|
||||||
|
Card card = Card(
|
||||||
child: Column(children: [
|
child: Column(children: [
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.fromLTRB(10, 10, 10, 10),
|
padding: const EdgeInsets.fromLTRB(10, 10, 10, 10),
|
||||||
child: ListTile(
|
child: ListTile(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(builder: (context) => Article()),
|
MaterialPageRoute(builder: (context) => Article.fromData(element["title"], element["content"], element["author"], element["published_at"]).widget),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
title: const Text(
|
title: Text(element["title"],
|
||||||
"Schülersprecherwahl 2021: Kandidatenduos im Interview",
|
style: const TextStyle(fontWeight: FontWeight.bold)),
|
||||||
style: TextStyle(fontWeight: FontWeight.bold)),
|
subtitle: Text(
|
||||||
subtitle: const Text(
|
element["summary"])),
|
||||||
"17.09.2021, Halle(Saale) Drei Trios stellen sich dieses Jahr zur Wahl...")),
|
|
||||||
)
|
)
|
||||||
]),
|
]),
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
borderRadius: BorderRadius.circular(15),
|
borderRadius: BorderRadius.circular(15),
|
||||||
),
|
),
|
||||||
)
|
);
|
||||||
],
|
articleTiles.add(card);
|
||||||
)
|
}
|
||||||
/*const Center(
|
return ListView(
|
||||||
child: Text("Derzeit nichts hier..."),
|
children: articleTiles.reversed.toList(),
|
||||||
)*/
|
);
|
||||||
|
} else {
|
||||||
|
return(const Center(
|
||||||
|
child: Text("Uups... Irgendwas ist schief gelaufen")
|
||||||
|
));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return(const Center(
|
||||||
|
child: CircularProgressIndicator()
|
||||||
|
));
|
||||||
|
}
|
||||||
|
},
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Article extends StatelessWidget {
|
class Article {
|
||||||
const Article({Key? key}) : super(key: key);
|
Widget widget;
|
||||||
|
//const Article({Key? key}) : super(key: key);
|
||||||
@override
|
Article({required this.widget});
|
||||||
Widget build(BuildContext context) {
|
factory Article.fromData(String title, String content, String author, String publishDate, ) {
|
||||||
|
return Article(widget: Scaffold(
|
||||||
|
appBar: AppBar(
|
||||||
|
title: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.vertical,
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
scrollDirection: Axis.horizontal,
|
||||||
|
child: Text(title)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
centerTitle: true,
|
||||||
|
),
|
||||||
|
body: ListView(
|
||||||
|
padding: const EdgeInsets.fromLTRB(20, 20, 20, 20),
|
||||||
|
children: [
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(MdiIcons.accountOutline),
|
||||||
|
title: Text(author),
|
||||||
|
),
|
||||||
|
ListTile(
|
||||||
|
leading: Icon(MdiIcons.calendarOutline),
|
||||||
|
title: Text("${DateTime.parse(publishDate).day.toString()}.${DateTime.parse(publishDate).month.toString()}.${DateTime.parse(publishDate).year.toString()}"),
|
||||||
|
),
|
||||||
|
Text(content)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
//@override
|
||||||
|
/*Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
title: const Text(
|
title: const Text(
|
||||||
@ -70,5 +124,5 @@ class Article extends StatelessWidget {
|
|||||||
""")
|
""")
|
||||||
],
|
],
|
||||||
));
|
));
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,26 @@
|
|||||||
import 'package:MeinCantor/teacher_presets.dart';
|
import 'package:MeinCantor/presets/teachers.dart';
|
||||||
|
import 'package:MeinCantor/presets/subjects.dart';
|
||||||
|
import 'package:MeinCantor/presets/colors.dart';
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
import 'package:material_design_icons_flutter/material_design_icons_flutter.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'subject_presets.dart';
|
|
||||||
|
|
||||||
import 'color_presets.dart';
|
|
||||||
|
|
||||||
class ClassTimetableBuilder {
|
class ClassTimetableBuilder {
|
||||||
final RefreshIndicator view;
|
final RefreshIndicator view;
|
||||||
ClassTimetableBuilder({required this.view});
|
ClassTimetableBuilder({required this.view});
|
||||||
factory ClassTimetableBuilder.buildView(Map<String, dynamic> json, BuildContext context) {
|
factory ClassTimetableBuilder.buildView(
|
||||||
|
Map<String, dynamic> json, BuildContext context) {
|
||||||
List<Widget> list = LessonsListBuilder.buildList(json).lessons;
|
List<Widget> list = LessonsListBuilder.buildList(json).lessons;
|
||||||
String info = TimetableInfo.fromJson(json).info;
|
String info = TimetableInfo.fromJson(json).info;
|
||||||
if (info.isNotEmpty) {
|
if (info.isNotEmpty) {
|
||||||
list.insert(0, ListTile(title: Text("Informationen"), leading: Icon(MdiIcons.information), onTap: () {
|
list.insert(
|
||||||
|
0,
|
||||||
|
ListTile(
|
||||||
|
title: const Text("Informationen"),
|
||||||
|
leading: const Icon(MdiIcons.information),
|
||||||
|
onTap: () {
|
||||||
showModalBottomSheet<void>(
|
showModalBottomSheet<void>(
|
||||||
isScrollControlled: true,
|
isScrollControlled: true,
|
||||||
shape: RoundedRectangleBorder(
|
shape: RoundedRectangleBorder(
|
||||||
@ -22,15 +28,14 @@ class ClassTimetableBuilder {
|
|||||||
),
|
),
|
||||||
context: context,
|
context: context,
|
||||||
builder: (BuildContext context) {
|
builder: (BuildContext context) {
|
||||||
return Container(
|
return SizedBox(
|
||||||
height: 400,
|
height: 400,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
//mainAxisAlignment: MainAxisAlignment.center,
|
|
||||||
//mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("Informationen", style: TextStyle(fontWeight: FontWeight.bold)),
|
title: const Text("Informationen",
|
||||||
leading: Icon(Icons.arrow_back),
|
style: TextStyle(fontWeight: FontWeight.bold)),
|
||||||
|
leading: const Icon(Icons.arrow_back),
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
},
|
},
|
||||||
@ -39,18 +44,13 @@ class ClassTimetableBuilder {
|
|||||||
padding: const EdgeInsets.all(20),
|
padding: const EdgeInsets.all(20),
|
||||||
child: Text(info),
|
child: Text(info),
|
||||||
),
|
),
|
||||||
/*ElevatedButton(
|
|
||||||
child: const Text('Close BottomSheet'),
|
|
||||||
onPressed: () => Navigator.pop(context),
|
|
||||||
)*/
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
)
|
));
|
||||||
);
|
|
||||||
}
|
}
|
||||||
return ClassTimetableBuilder(
|
return ClassTimetableBuilder(
|
||||||
view: RefreshIndicator(
|
view: RefreshIndicator(
|
||||||
@ -58,7 +58,6 @@ class ClassTimetableBuilder {
|
|||||||
return Future.delayed(const Duration(seconds: 1));
|
return Future.delayed(const Duration(seconds: 1));
|
||||||
},
|
},
|
||||||
child: ListView(
|
child: ListView(
|
||||||
//shrinkWrap: true,
|
|
||||||
physics: const AlwaysScrollableScrollPhysics(),
|
physics: const AlwaysScrollableScrollPhysics(),
|
||||||
children: list,
|
children: list,
|
||||||
),
|
),
|
||||||
@ -80,11 +79,11 @@ Future<Color> buildLessonColor(String lesson) async {
|
|||||||
class LessonsListBuilder {
|
class LessonsListBuilder {
|
||||||
final List<Widget> lessons;
|
final List<Widget> lessons;
|
||||||
LessonsListBuilder({required this.lessons});
|
LessonsListBuilder({required this.lessons});
|
||||||
factory LessonsListBuilder.buildList(Map<String, dynamic> json, {int count: 0}) {
|
factory LessonsListBuilder.buildList(Map<String, dynamic> json,
|
||||||
|
{int count = 0}) {
|
||||||
List<Widget> children = [];
|
List<Widget> children = [];
|
||||||
ClassTimetable.fromJson(json).timetable.forEach((element) {
|
for (var element in ClassTimetable.fromJson(json).timetable) {
|
||||||
List<Widget> cardChildren = [];
|
List<Widget> cardChildren = [];
|
||||||
print(element.count.toString() + " " + count.toString());
|
|
||||||
if (element.count.toString() == count.toString() || count == 0) {
|
if (element.count.toString() == count.toString() || count == 0) {
|
||||||
cardChildren.add(ListTile(
|
cardChildren.add(ListTile(
|
||||||
title: Text(element.count.toString() + '.' + ' ' + element.name,
|
title: Text(element.count.toString() + '.' + ' ' + element.name,
|
||||||
@ -123,7 +122,7 @@ class LessonsListBuilder {
|
|||||||
);
|
);
|
||||||
children.add(card);
|
children.add(card);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
return LessonsListBuilder(lessons: children);
|
return LessonsListBuilder(lessons: children);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -140,55 +139,55 @@ class ClassTimetable {
|
|||||||
final List timetable;
|
final List timetable;
|
||||||
ClassTimetable({required this.timetable});
|
ClassTimetable({required this.timetable});
|
||||||
factory ClassTimetable.fromJson(Map<String, dynamic> json) {
|
factory ClassTimetable.fromJson(Map<String, dynamic> json) {
|
||||||
print(json);
|
|
||||||
List<TimetableLesson> lessons = [];
|
List<TimetableLesson> lessons = [];
|
||||||
json['courses'].forEach((value) {
|
json['courses'].forEach((value) {
|
||||||
var name;
|
String subject;
|
||||||
var teacher;
|
String teacher;
|
||||||
var room;
|
String room;
|
||||||
|
String info;
|
||||||
|
Color fontColor;
|
||||||
|
|
||||||
if (value['Fa'].runtimeType != String) {
|
if (value['Fa'].runtimeType != String) {
|
||||||
name = value['Fa']['#text'];
|
subject = value['Fa']['#text'];
|
||||||
} else {
|
} else {
|
||||||
name = value['Fa'];
|
subject = value['Fa'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value['Le'].runtimeType != String) {
|
if (value['Le'].runtimeType != String) {
|
||||||
teacher = value['Le']['#text'];
|
teacher = value['Le']['#text'];
|
||||||
} else {
|
} else {
|
||||||
teacher = value['Le'];
|
teacher = value['Le'];
|
||||||
}
|
}
|
||||||
print(value['Ra']);
|
|
||||||
if (value['Ra'].runtimeType != String && value['Ra'].runtimeType != int) {
|
if (value['Ra'].runtimeType != String && value['Ra'].runtimeType != int) {
|
||||||
if (value['Ra']['#text'] == ' ') {
|
if (value['Ra']['#text'] == ' ' || value['Ra']['#text'] == null) {
|
||||||
room = '';
|
|
||||||
} else if (value['Ra']['#text'] == null) {
|
|
||||||
room = '';
|
room = '';
|
||||||
} else {
|
} else {
|
||||||
room = value['Ra']['#text'];
|
room = value['Ra']['#text'].toString();
|
||||||
}
|
}
|
||||||
} else if (value['Ra'] == ' ') {
|
} else if (value['Ra'] == ' ') {
|
||||||
room = '';
|
room = '';
|
||||||
} else {
|
} else {
|
||||||
room = value['Ra'];
|
room = value['Ra'].toString();
|
||||||
}
|
}
|
||||||
Color fontColor;
|
|
||||||
if (name == '---') {
|
if (subject == '---') {
|
||||||
fontColor = Colors.red;
|
fontColor = Colors.red;
|
||||||
} else {
|
} else {
|
||||||
fontColor = Colors.white;
|
fontColor = Colors.white;
|
||||||
}
|
}
|
||||||
var info;
|
|
||||||
if (value['If'].runtimeType != String) {
|
if (value['If'].runtimeType != String) {
|
||||||
info = '';
|
info = '';
|
||||||
} else {
|
} else {
|
||||||
info = value['If'];
|
info = value['If'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<Color> lessonColor = buildLessonColor(name);
|
Future<Color> lessonColor = buildLessonColor(subject);
|
||||||
|
|
||||||
lessons.add(TimetableLesson(
|
lessons.add(TimetableLesson(
|
||||||
value['St'],
|
value['St'],
|
||||||
names[name] ?? name.toString(),
|
subjects[subject] ?? subject.toString(),
|
||||||
teachers[teacher] ?? teacher.toString(),
|
teachers[teacher] ?? teacher.toString(),
|
||||||
room.toString(),
|
room.toString(),
|
||||||
value['If'].toString(),
|
value['If'].toString(),
|
||||||
|
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 0.7.5-beta1.nightly2021-11-04
|
version: 0.7.5-beta1.nightly2021-11-16
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.12.0 <3.0.0"
|
sdk: ">=2.12.0 <3.0.0"
|
||||||
@ -36,10 +36,10 @@ dependencies:
|
|||||||
http: ^0.13.3
|
http: ^0.13.3
|
||||||
google_fonts: ^2.1.0
|
google_fonts: ^2.1.0
|
||||||
time: ^2.0.0
|
time: ^2.0.0
|
||||||
flutter_launcher_icons: "^0.9.1"
|
flutter_launcher_icons: ^0.9.1
|
||||||
fluttertoast: ^8.0.8
|
fluttertoast: ^8.0.8
|
||||||
flutter_colorpicker: ^0.6.0
|
flutter_colorpicker: ^0.6.0
|
||||||
material_design_icons_flutter: 5.0.5955-rc.1
|
material_design_icons_flutter: ^5.0.5955-rc.1
|
||||||
cyclop: ^0.5.2
|
cyclop: ^0.5.2
|
||||||
|
|
||||||
flutter_icons:
|
flutter_icons:
|
||||||
|
Reference in New Issue
Block a user