-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
669 additions
and
99 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,26 @@ | ||
import 'dart:convert'; | ||
import 'package:http/http.dart' as http; | ||
import 'package:uni/controller/networking/network_router.dart'; | ||
|
||
class BookThumbFetcher { | ||
Future<String> fetchBookThumb(String isbn) async { | ||
final url = Uri.https( | ||
'www.googleapis.com', | ||
'/books/v1/volumes', | ||
{'q': '+isbn:$isbn'}, | ||
); | ||
|
||
final response = | ||
await http.get(Uri.decodeComponent(url.toString()).toUri()); | ||
|
||
final bookInformation = ((json.decode(response.body) | ||
as Map<String, dynamic>)['items'] as List<dynamic>) | ||
.first as Map<String, dynamic>; | ||
|
||
final thumbnailURL = | ||
((bookInformation['volumeInfo'] as Map<String, dynamic>)['imageLinks'] | ||
as Map<String, dynamic>)['thumbnail']; | ||
|
||
return thumbnailURL.toString(); | ||
} | ||
} |
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
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
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,58 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:uni/controller/parsers/parser_course_unit_info.dart'; | ||
|
||
class Sheet { | ||
Sheet({ | ||
required this.professors, | ||
required this.content, | ||
required this.evaluation, | ||
required this.regents, | ||
required this.books, | ||
}); | ||
List<Professor> professors; | ||
List<Professor> regents; | ||
String content; | ||
String evaluation; | ||
List<Book> books; | ||
} | ||
|
||
class Book { | ||
Book({required this.title, required this.isbn}); | ||
|
||
String title; | ||
String isbn; | ||
} | ||
|
||
class Professor { | ||
Professor({ | ||
required this.code, | ||
required this.name, | ||
required this.classes, | ||
this.picture, | ||
}); | ||
|
||
factory Professor.fromJson(Map<String, dynamic> json) { | ||
return Professor( | ||
code: json['codigo'].toString(), | ||
name: shortName(json['nome'].toString()), | ||
classes: [], | ||
); | ||
} | ||
|
||
File? picture; | ||
String code; | ||
String name; | ||
List<String> classes; | ||
|
||
@override | ||
bool operator ==(Object other) { | ||
if (other is Professor) { | ||
return other.code == code; | ||
} | ||
return false; | ||
} | ||
|
||
@override | ||
int get hashCode => code.hashCode; | ||
} |
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
43 changes: 43 additions & 0 deletions
43
uni/lib/view/common_widgets/generic_animated_expandable.dart
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,43 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class AnimatedExpandable extends StatefulWidget { | ||
const AnimatedExpandable({ | ||
required this.firstChild, | ||
required this.secondChild, | ||
super.key, | ||
}); | ||
|
||
final Widget firstChild; | ||
final Widget secondChild; | ||
|
||
@override | ||
State<StatefulWidget> createState() { | ||
return AnimatedExpandableState(); | ||
} | ||
} | ||
|
||
class AnimatedExpandableState extends State<AnimatedExpandable> { | ||
bool _expanded = false; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return GestureDetector( | ||
behavior: HitTestBehavior.translucent, | ||
onTap: () { | ||
setState(() { | ||
_expanded = !_expanded; | ||
}); | ||
}, | ||
child: AnimatedCrossFade( | ||
firstCurve: Curves.easeInOutCubic, | ||
secondCurve: Curves.easeInOut, | ||
sizeCurve: Curves.easeInOut, | ||
duration: const Duration(milliseconds: 500), | ||
firstChild: widget.firstChild, | ||
secondChild: widget.secondChild, | ||
crossFadeState: | ||
_expanded ? CrossFadeState.showSecond : CrossFadeState.showFirst, | ||
), | ||
); | ||
} | ||
} |
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,40 @@ | ||
import 'package:expandable/expandable.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class GenericExpandable extends StatelessWidget { | ||
const GenericExpandable({ | ||
required this.title, | ||
required this.content, | ||
super.key, | ||
}); | ||
|
||
final String title; | ||
final Widget content; | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return ExpandablePanel( | ||
header: Align( | ||
alignment: Alignment.centerLeft, | ||
child: Text(title, style: const TextStyle(fontSize: 20)), | ||
), | ||
collapsed: ShaderMask( | ||
shaderCallback: (bounds) => const LinearGradient( | ||
colors: [Colors.black, Colors.transparent], | ||
stops: [0.7, 1.0], | ||
begin: Alignment.topCenter, | ||
end: Alignment.bottomCenter, | ||
).createShader(bounds), | ||
blendMode: BlendMode.dstIn, | ||
child: ClipRect( | ||
child: Align( | ||
alignment: Alignment.topCenter, | ||
heightFactor: 0.25, | ||
child: content, | ||
), | ||
), | ||
), | ||
expanded: content, | ||
); | ||
} | ||
} |
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
Oops, something went wrong.