Skip to content

Commit

Permalink
UI improvements and lowered min API Level
Browse files Browse the repository at this point in the history
  • Loading branch information
GnikDroy committed May 10, 2022
1 parent 84077b0 commit 43a5179
Show file tree
Hide file tree
Showing 13 changed files with 78 additions and 46 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.anime_tv"
minSdkVersion 27
minSdkVersion 25
targetSdkVersion 31
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Binary file modified assets/cover_placeholder.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions lib/api/api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ class Api {
)
.where((e) => e.url.isNotEmpty && e.cover.isNotEmpty)
.toList();
recentEpisodes.forEach((e) {
e.cover = 'https:${e.cover}';
});
for (var ep in recentEpisodes) {
ep.cover = 'https:${ep.cover}';
}
return recentEpisodes;
} else {
log('Error: Fetch request returned status code ${response.statusCode}');
Expand Down
7 changes: 6 additions & 1 deletion lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ class AnimeTV extends StatelessWidget {
Widget build(BuildContext context) {
return MaterialApp(
title: 'Anime TV',
theme: ThemeData.dark(),
theme: ThemeData.from(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
brightness: Brightness.dark,
),
),
initialRoute: '/',
routes: {
'/': (context) => const Home(),
Expand Down
1 change: 0 additions & 1 deletion lib/models.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'dart:collection';
import 'dart:convert';
import 'package:flutter/cupertino.dart';
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/pages/home/favorite_shows.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:anime_tv/api/models.dart';
import 'package:anime_tv/models.dart';
import 'package:anime_tv/routes.dart';
import 'package:anime_tv/widgets/image_card.dart';
Expand Down
3 changes: 1 addition & 2 deletions lib/widgets/app_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class AnimeTVAppBar extends StatelessWidget implements PreferredSizeWidget {
fit: BoxFit.fitHeight,
height: 50,
),
// size: 35,
);
titleWidgets.add(const SizedBox(width: 15));
}
Expand All @@ -42,7 +41,7 @@ class AnimeTVAppBar extends StatelessWidget implements PreferredSizeWidget {
color: borderColor ?? Theme.of(context).colorScheme.primary,
),
),
elevation: 0,
elevation: 10,
backgroundColor: Theme.of(context).primaryColor,
title: title,
);
Expand Down
1 change: 0 additions & 1 deletion lib/widgets/better_player_custom_controls.dart
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@ class _CustomPlayerMaterialControlsState
} else {
Navigator.pop(context);
}
;
}),
const Spacer(),
if (_controlsConfiguration.enablePip)
Expand Down
1 change: 1 addition & 0 deletions lib/widgets/catalogue.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class _CatalogueState extends State<Catalogue>
catalogue[_filteredItemsIndices[index]].title,
style: const TextStyle(
fontSize: 16,
color: Colors.white,
),
),
),
Expand Down
30 changes: 21 additions & 9 deletions lib/widgets/episode_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ class EpisodeList extends StatelessWidget {
return PreferenceBuilder(
preference: watchedUrls.preference,
builder: (BuildContext context, _) {
final bool isWatched = watchedUrls.isPresent(ep.url);
final opacity = isWatched ? 0.6 : 1.0;
return Padding(
padding: const EdgeInsets.symmetric(vertical: 5),
padding: const EdgeInsets.all(5),
child: SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
Expand All @@ -36,16 +38,26 @@ class EpisodeList extends StatelessWidget {
arguments: ep.url,
);
},
icon: Icon(Icons.play_circle,
color: watchedUrls.isPresent(ep.url)
? Colors.grey
: Colors.white),
icon: Opacity(
opacity: opacity,
child: const Icon(
Icons.play_circle,
color: Colors.white,
),
),
label: Padding(
padding: const EdgeInsets.all(18),
child: Text(
ep.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
child: Align(
alignment: Alignment.centerLeft,
child: Opacity(
opacity: opacity,
child: Text(
ep.title,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: const TextStyle(color: Colors.white),
),
),
),
),
),
Expand Down
25 changes: 1 addition & 24 deletions lib/widgets/show_description.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter/material.dart';
import 'package:anime_tv/api/models.dart';
import 'package:provider/provider.dart';
import 'package:streaming_shared_preferences/streaming_shared_preferences.dart';
import 'package:anime_tv/utils.dart';

class ShowDescription extends StatefulWidget {
const ShowDescription({Key? key, required this.details}) : super(key: key);
Expand Down Expand Up @@ -33,7 +32,7 @@ class _ShowDescriptionState extends State<ShowDescription> {

final episodeText = widget.details.episodeList.isEmpty
? ''
: '${widget.details.episodeList.length} Episodes';
: 'Episodes: ${widget.details.episodeList.length}';

final controls = Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
Expand All @@ -59,29 +58,9 @@ class _ShowDescriptionState extends State<ShowDescription> {
);
});
}),
// IconButton(
// onPressed: () => {},
// icon: Icon(Icons.star, color: true ? Colors.amber : null),
// ),
],
);

final genreTags = Wrap(
spacing: 8,
runSpacing: 8,
children: widget.details.genreList
.map((x) => Chip(
backgroundColor: Colors
.primaries[x.hashCode % Colors.primaries.length]
.darken(),
label: Text(
x,
style: const TextStyle(color: Colors.white),
),
))
.toList(),
);

final plot = Text(
widget.details.description,
style: const TextStyle(fontSize: 16, height: 1.4),
Expand All @@ -96,8 +75,6 @@ class _ShowDescriptionState extends State<ShowDescription> {
controls,
const SizedBox(height: 15),
plot,
const SizedBox(height: 15),
genreTags,
],
),
);
Expand Down
45 changes: 43 additions & 2 deletions lib/widgets/show_detail.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import 'package:anime_tv/api/api.dart';
import 'package:anime_tv/api/models.dart';
import 'package:anime_tv/widgets/episode_list.dart';
import 'package:anime_tv/widgets/show_description.dart';
import 'package:anime_tv/utils.dart';

class ShowDetailView extends StatefulWidget {
final String url;
Expand Down Expand Up @@ -42,7 +43,7 @@ class _ShowDetailViewState extends State<ShowDetailView> {
builder: (context, AsyncSnapshot<Show> snapshot) {
if (snapshot.hasData) {
final cover = SizedBox(
height: MediaQuery.of(context).size.height / 2.0,
height: double.infinity,
width: double.infinity,
child: FadeInImage(
image: (snapshot.data!.image.isEmpty
Expand All @@ -53,14 +54,54 @@ class _ShowDetailViewState extends State<ShowDetailView> {
),
);

final genreTags = Wrap(
spacing: 8,
runSpacing: 8,
children: snapshot.data!.genreList
.map(
(genre) => Chip(
visualDensity: VisualDensity.compact,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
backgroundColor: Colors
.primaries[genre.hashCode % Colors.accents.length]
.darken(),
label: Text(
genre,
style: const TextStyle(color: Colors.white),
),
),
)
.toList(),
);

final stack = SizedBox(
width: double.infinity,
height: MediaQuery.of(context).size.height / 2.5,
child: Stack(
alignment: Alignment.bottomLeft,
children: [
cover,
Container(
height: double.infinity,
width: double.infinity,
color: Colors.black12,
),
Padding(
child: genreTags,
padding: const EdgeInsets.all(8),
),
],
),
);

return RefreshIndicator(
onRefresh: onRefresh,
child: ListView(
physics: const BouncingScrollPhysics(
parent: AlwaysScrollableScrollPhysics(),
),
children: [
cover,
stack,
ShowDescription(details: snapshot.data!),
EpisodeList(
details: snapshot.data!,
Expand Down
2 changes: 1 addition & 1 deletion lib/widgets/slant_gradient_container.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class SlantGradientBackgroundContainer extends StatelessWidget {
end: Alignment.bottomRight,
colors: colors ??
[
Theme.of(context).scaffoldBackgroundColor.lighten(0.05),
Theme.of(context).scaffoldBackgroundColor,
Theme.of(context).scaffoldBackgroundColor.darken(),
]),
),
child: child,
Expand Down

0 comments on commit 43a5179

Please sign in to comment.