-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
yeayy
- Loading branch information
Showing
28 changed files
with
347 additions
and
100 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
5 changes: 5 additions & 0 deletions
5
android/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android"> | ||
<background android:drawable="@color/ic_launcher_background"/> | ||
<foreground android:drawable="@mipmap/ic_launcher_foreground"/> | ||
</adaptive-icon> |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<resources> | ||
<color name="ic_launcher_background">#FFFEEE</color> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
import 'package:albiruni/albiruni.dart'; | ||
import 'package:flutter/cupertino.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_iium_schedule/browser_view.dart'; | ||
|
||
class Browser extends StatefulWidget { | ||
const Browser({Key? key}) : super(key: key); | ||
|
||
@override | ||
_BrowserState createState() => _BrowserState(); | ||
} | ||
|
||
class _BrowserState extends State<Browser> { | ||
String session = "2020/2021"; | ||
int semester = 1; | ||
String? selectedKulliyah; | ||
List<String> kulliyahs = [ | ||
"AED", | ||
"BRIDG", | ||
"CFL", | ||
"CCAC", | ||
"EDUC", | ||
"ENGIN", | ||
"ECONS", | ||
"KICT", | ||
"IRKHS", | ||
"KLM", | ||
"LAWS" | ||
]; | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: const Text('Course Browser'), | ||
), | ||
body: Padding( | ||
padding: const EdgeInsets.all(18), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.stretch, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 16.0), | ||
child: DropdownButtonFormField( | ||
decoration: const InputDecoration(border: OutlineInputBorder()), | ||
value: selectedKulliyah, | ||
hint: const Text('Select kulliyyah'), | ||
items: kulliyahs | ||
.map((e) => DropdownMenuItem( | ||
child: Text(e), | ||
value: e, | ||
)) | ||
.toList(), | ||
onChanged: (String? value) { | ||
setState(() { | ||
selectedKulliyah = value; | ||
}); | ||
}, | ||
), | ||
), | ||
const SizedBox(height: 10), | ||
CupertinoSegmentedControl( | ||
groupValue: session, | ||
children: const { | ||
"2020/2021": Text("2020/2021"), | ||
"2021/2022": Text("2021/2022") | ||
}, | ||
onValueChanged: (String value) { | ||
setState(() { | ||
session = value; | ||
}); | ||
}), | ||
const SizedBox(height: 10), | ||
CupertinoSegmentedControl( | ||
groupValue: semester - 1, | ||
children: List.generate( | ||
3, | ||
(index) => Text("Sem ${index + 1}"), | ||
).asMap(), | ||
onValueChanged: (int value) { | ||
setState(() { | ||
semester = value + 1; | ||
}); | ||
print(semester); | ||
}), | ||
Padding( | ||
padding: const EdgeInsets.symmetric(horizontal: 14, vertical: 10), | ||
child: CupertinoButton.filled( | ||
child: const Text('Get'), | ||
onPressed: selectedKulliyah == null | ||
? null | ||
: () { | ||
Albiruni albiruni = Albiruni( | ||
kulliyah: selectedKulliyah!, | ||
semester: semester, | ||
session: session); | ||
Navigator.push( | ||
context, | ||
MaterialPageRoute( | ||
builder: (_) => BrowserView(albiruni: albiruni), | ||
), | ||
); | ||
}, | ||
), | ||
) | ||
], | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
import 'package:albiruni/albiruni.dart'; | ||
import 'package:and/and.dart'; | ||
import 'package:flutter/foundation.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_iium_schedule/util/enums.dart'; | ||
import 'package:recase/recase.dart'; | ||
|
||
class BrowserView extends StatefulWidget { | ||
const BrowserView({Key? key, required this.albiruni}) : super(key: key); | ||
|
||
final Albiruni albiruni; | ||
|
||
@override | ||
_BrowserViewState createState() => _BrowserViewState(); | ||
} | ||
|
||
class _BrowserViewState extends State<BrowserView> { | ||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
appBar: AppBar( | ||
title: Text( | ||
"${widget.albiruni.kulliyah} ${widget.albiruni.session} Sem ${widget.albiruni.semester}"), | ||
), | ||
body: FutureBuilder( | ||
future: widget.albiruni.fetch(), | ||
builder: (BuildContext context, AsyncSnapshot<List<Subject>> snapshot) { | ||
if (snapshot.connectionState == ConnectionState.waiting) { | ||
{ | ||
return Center( | ||
child: Column(mainAxisSize: MainAxisSize.min, children: const [ | ||
Text('Please wait...'), | ||
SizedBox(height: 10), | ||
SizedBox( | ||
width: 30, | ||
height: 30, | ||
child: CircularProgressIndicator(), | ||
) | ||
]), | ||
); | ||
} | ||
} | ||
|
||
if (snapshot.hasError) { | ||
return Center(child: Text(snapshot.error.toString())); | ||
} | ||
|
||
return ListView.builder( | ||
itemCount: snapshot.data?.length, | ||
itemBuilder: (context, index) { | ||
return ExpansionTile( | ||
title: Text( | ||
ReCase(snapshot.data![index].title).titleCase, | ||
), | ||
subtitle: Text( | ||
"Section ${snapshot.data![index].sect}", | ||
), | ||
leading: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Text(snapshot.data![index].code | ||
.toString() | ||
.replaceAll(" ", "\n")) | ||
]), | ||
childrenPadding: | ||
const EdgeInsets.symmetric(horizontal: 24, vertical: 12), | ||
backgroundColor: Colors.grey.shade100, | ||
children: [ | ||
InkWell( | ||
splashColor: Colors.purple.shade100, | ||
onTap: () { | ||
// TODO: Make another screen for details | ||
ScaffoldMessenger.of(context).removeCurrentSnackBar(); | ||
ScaffoldMessenger.of(context).showSnackBar( | ||
const SnackBar(content: Text('Not implemented'))); | ||
}, | ||
child: Column( | ||
children: [ | ||
Row( | ||
children: [ | ||
const Icon( | ||
Icons.date_range_outlined, | ||
), | ||
const SizedBox(width: 5), | ||
// Whoaa a lot going on here | ||
// First, from the snapshot data, | ||
// convert to Day String, then, | ||
// Change to title case | ||
// Then, render the list properly | ||
// Minus 1 on the day because list start with 0, | ||
// meanwhile in datetime, first day start with 1 | ||
Builder(builder: (_) { | ||
if (snapshot.data![index].dayTime.isEmpty) { | ||
return const Opacity( | ||
opacity: 0.6, | ||
child: Text( | ||
'No day and time specified', | ||
style: TextStyle( | ||
fontStyle: FontStyle.italic), | ||
)); | ||
} else { | ||
return Text( | ||
and( | ||
snapshot.data![index].dayTime | ||
.map((e) => ReCase( | ||
describeEnum( | ||
(Day.values[e!.day - 1]), | ||
), | ||
).titleCase) | ||
.toList(), | ||
), | ||
); | ||
} | ||
}), | ||
], | ||
), | ||
Row( | ||
children: [ | ||
const Icon( | ||
Icons.person_outline_outlined, | ||
), | ||
const SizedBox(width: 5), | ||
Builder(builder: (_) { | ||
if (snapshot.data![index].lect.length > 1) { | ||
return Text( | ||
'Multiple lecturers (${snapshot.data![index].lect.length})', | ||
style: const TextStyle( | ||
fontStyle: FontStyle.italic), | ||
); | ||
} else { | ||
return Text( | ||
ReCase(snapshot.data![index].lect.first) | ||
.titleCase); | ||
} | ||
}) | ||
], | ||
), | ||
Row( | ||
children: [ | ||
const Icon( | ||
Icons.meeting_room_outlined, | ||
), | ||
const SizedBox(width: 5), | ||
Builder(builder: (_) { | ||
if (snapshot.data![index].venue == null) { | ||
return const Opacity( | ||
opacity: 0.6, | ||
child: Text( | ||
'Venue not specified', | ||
style: TextStyle( | ||
fontStyle: FontStyle.italic), | ||
)); | ||
} else { | ||
return Text(snapshot.data![index].venue!); | ||
} | ||
}) | ||
], | ||
), | ||
Row( | ||
children: [ | ||
const Icon( | ||
Icons.class__outlined, | ||
), | ||
const SizedBox(width: 5), | ||
// https://stackoverflow.com/a/55173692 | ||
Text(snapshot.data![index].chr | ||
.toString() | ||
.replaceAll(RegExp(r"([.]*0)(?!.*\d)"), "")), | ||
], | ||
), | ||
], | ||
), | ||
), | ||
], | ||
); | ||
}); | ||
}, | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.