Skip to content

Commit

Permalink
fixed theme and also loading issue
Browse files Browse the repository at this point in the history
some other minor bugs as well
  • Loading branch information
HenryQuan committed Jun 14, 2021
1 parent c06cd66 commit b62504d
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion animego/lib/core/Util.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Util {
Util(this.context);

bool isDarkMode() {
return MediaQuery.of(context).platformBrightness == Brightness.dark;
return Theme.of(context).brightness == Brightness.dark;
}

static bool isMobile() {
Expand Down
4 changes: 3 additions & 1 deletion animego/lib/core/model/AnimeDetailedInfo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ class AnimeDetailedInfo {
this.episodes.add(EpisodeSection(element, animeID));
}
});
lastEpisode = this.episodes.last.episodeEnd;

// Make sure it is not empty at least
if (this.episodes.length > 0) lastEpisode = this.episodes.last.episodeEnd;
}
}
3 changes: 2 additions & 1 deletion animego/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ class MyApp extends StatelessWidget {
final darkTheme = ThemeData(
brightness: Brightness.dark,
primarySwatch: Colors.orange,
accentColor: Colors.orange,
appBarTheme: AppBarTheme(
brightness: Brightness.dark,
),
Expand All @@ -36,7 +37,7 @@ class MyApp extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'AnimeGo Re',
theme: darkTheme,
theme: lightTheme,
darkTheme: darkTheme,
home: FutureBuilder(
future: Global().init(),
Expand Down
3 changes: 2 additions & 1 deletion animego/lib/ui/page/AnimeDetailPage.dart
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class _AnimeDetailPageState extends State<AnimeDetailPage> {
centeredListTile(
'Episode(s)', info?.lastEpisode ?? 'Unkown'),
ListTile(
title: Text('Catagory', textAlign: TextAlign.center),
title: Text('Category', textAlign: TextAlign.center),
// TODO: This button is very hidden so the user may not know about this
subtitle: AnimeFlatButton(
onPressed: () {
Navigator.pushReplacement(
Expand Down
4 changes: 2 additions & 2 deletions animego/lib/ui/widget/AnimeGrid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ class _AnimeGridState extends State<AnimeGrid> {

/// Increase page and load more data
void loadData({bool refresh = false}) {
// Reset page to 0
if (refresh) page = 0;
// Reset page to 1, start from 1 not ZERO
if (refresh) page = 1;

setState(() {
canLoadMore = false;
Expand Down

0 comments on commit b62504d

Please sign in to comment.