Skip to content

Commit

Permalink
Merge pull request #127 from dherediat97/devDavid
Browse files Browse the repository at this point in the history
Dev david
  • Loading branch information
dherediat97 authored Sep 29, 2023
2 parents 6e394c9 + a94b18a commit 139dc48
Show file tree
Hide file tree
Showing 12 changed files with 382 additions and 128 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/flutter_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 0.0.3
release_name: Version Release 0.0.3
tag_name: 0.0.4
release_name: Version Release 0.0.4
draft: false
prerelease: false

Expand Down
6 changes: 4 additions & 2 deletions lib/dto/credit_person.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,28 @@ part 'credit_person.g.dart';
class CreditPerson {
CreditPerson({
required this.id,
this.title,
this.originalTitle,
this.backdropPath,
this.adult,
this.genreIds,
this.overview,
this.posterPath,
this.originalLanguage,
// required this.releaseDate,
this.job,
this.character,
this.popularity,
});
int id;
String? title;
String? originalTitle;
String? backdropPath;
bool? adult;
List<int>? genreIds;
String? overview;
String? posterPath;
String? originalLanguage;
// String releaseDate;
String? job;
String? character;
double? popularity;

Expand Down
20 changes: 20 additions & 0 deletions lib/dto/credits_person.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import 'package:FilmFlu/dto/credit_person.dart';
import 'package:json_annotation/json_annotation.dart';

part 'credits_person.g.dart';

@JsonSerializable(explicitToJson: false, fieldRename: FieldRename.snake)
class CreditsPerson {
CreditsPerson({
required this.cast,
this.crew,
});

List<CreditPerson> cast;
List<CreditPerson>? crew;

factory CreditsPerson.fromJson(Map<String, dynamic> json) =>
_$CreditsPersonFromJson(json);

Map<String, dynamic> toJson() => _$CreditsPersonToJson(this);
}
10 changes: 4 additions & 6 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//Core Packages
import 'package:FilmFlu/ui/pages/main/main_screen.dart';
import 'package:FilmFlu/ui/pages/personDetails/actor_details.dart';
import 'package:FilmFlu/ui/pages/settings/settings_screen.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:responsive_framework/responsive_framework.dart';
import 'package:flutter/material.dart';
Expand All @@ -11,10 +7,12 @@ import 'package:flutter_gen/gen_l10n/app_localizations.dart';

//My Packages
import 'package:FilmFlu/ui/pages/login/login_page.dart';
import 'package:FilmFlu/ui/pages/splash/splash_screen.dart';
import 'package:FilmFlu/dto/base_arguments.dart';
import 'package:FilmFlu/ui/pages/movieDetails/movie_details.dart';
import 'package:FilmFlu/ui/theme/colors.dart';
import 'package:FilmFlu/ui/pages/main/main_screen.dart';
import 'package:FilmFlu/ui/pages/personDetails/actor_details.dart';
import 'package:FilmFlu/ui/pages/settings/settings_screen.dart';
import 'package:FilmFlu/ui/util/utilScroll.dart';

void main() {
Expand Down Expand Up @@ -107,7 +105,7 @@ class FilmFlu extends StatelessWidget {
screen = SettingsPage();
break;
default:
screen = !kIsWeb ? SplashScreen() : MainPage();
screen = MainPage();
break;
}
return MaterialPageRoute(builder: (context) {
Expand Down
15 changes: 11 additions & 4 deletions lib/network/client_api.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//Core Packages
import 'dart:convert';
import 'package:FilmFlu/dto/credit_person.dart';
import 'package:FilmFlu/dto/credits_person.dart';
import 'package:flutter/foundation.dart';
import 'package:http/http.dart';

Expand All @@ -23,6 +24,12 @@ class Api {
return parsed.map<Movie>((json) => Movie.fromJson(json)).toList();
}

CreditsPerson parseCreditsPerson(String responseBody) {
final parsed = jsonDecode(responseBody);
CreditsPerson credits = CreditsPerson.fromJson(parsed);
return credits;
}

Credits parseCredits(String responseBody) {
final parsed = jsonDecode(responseBody);
Credits credits = Credits.fromJson(parsed);
Expand All @@ -35,8 +42,8 @@ class Api {
return person;
}

List<CreditPerson> parsePersonCredits(String responseBody) {
final parsed = jsonDecode(responseBody)["cast"];
List<Credits> parsePersonCredits(String responseBody) {
final parsed = jsonDecode(responseBody);
return parsed
.map<CreditPerson>((json) => CreditPerson.fromJson(json))
.toList();
Expand Down Expand Up @@ -90,11 +97,11 @@ class Api {
return compute(parsePerson, response.body);
}

Future<List<CreditPerson>> fetchPersonCredits(int personId) async {
Future<CreditsPerson> fetchPersonCredits(int personId) async {
final response = await Client().get(
Uri.parse(
'$baseURL/person/${personId}/combined_credits?language=es-ES'),
headers: baseHeaders);
return compute(parsePersonCredits, response.body);
return compute(parseCreditsPerson, response.body);
}
}
6 changes: 3 additions & 3 deletions lib/ui/components/film_actor_cast_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class _FilmActorItemState extends State<FilmActorItem> {
child: ClipRRect(
borderRadius: BorderRadius.circular(32.0),
child: Image.network('$personImgBaseUrl${actor.profilePath}',
height: 220,
height: 160,
width: 150,
fit: BoxFit.cover, loadingBuilder: (BuildContext context,
Widget child, ImageChunkEvent? loadingProgress) {
Expand All @@ -50,14 +50,14 @@ class _FilmActorItemState extends State<FilmActorItem> {
if (actor.gender == 2) {
return SvgPicture.asset(
"assets/icons/actor_icon.svg",
height: 220,
height: 160,
fit: BoxFit.cover,
width: 150,
);
} else {
return SvgPicture.asset(
"assets/icons/actress_icon.svg",
height: 220,
height: 160,
fit: BoxFit.cover,
width: 150,
);
Expand Down
7 changes: 3 additions & 4 deletions lib/ui/components/film_worker_cast_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class _FilmWorkerItemState extends State<FilmWorkerItem> {
int index = widget.index;
List<FilmWorker> crew = widget.crew;
FilmWorker filmWorker = crew[index];
debugPrint(filmWorker.job);
return GridTile(
child: Column(
children: [
Expand All @@ -33,7 +32,7 @@ class _FilmWorkerItemState extends State<FilmWorkerItem> {
child: ClipRRect(
borderRadius: BorderRadius.circular(32.0),
child: Image.network('$personImgBaseUrl${filmWorker.profilePath}',
height: 220,
height: 160,
width: 150,
fit: BoxFit.cover, loadingBuilder: (BuildContext context,
Widget child, ImageChunkEvent? loadingProgress) {
Expand All @@ -50,14 +49,14 @@ class _FilmWorkerItemState extends State<FilmWorkerItem> {
if (filmWorker.gender == 2) {
return SvgPicture.asset(
"assets/icons/actor_icon.svg",
height: 220,
height: 160,
fit: BoxFit.cover,
width: 150,
);
} else {
return SvgPicture.asset(
"assets/icons/actress_icon.svg",
height: 220,
height: 160,
fit: BoxFit.cover,
width: 150,
);
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/components/movie_cast.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ class _FilmCastState extends State<FilmCast> {
shrinkWrap: true,
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
maxCrossAxisExtent: 150,
mainAxisSpacing: 20,
mainAxisSpacing: 0,
crossAxisSpacing: 40,
mainAxisExtent: 340,
mainAxisExtent: 250,
childAspectRatio: MediaQuery.of(context).size.aspectRatio,
),
itemCount: widget.isCast ? cast?.length : crew?.length,
Expand Down
25 changes: 18 additions & 7 deletions lib/ui/components/scaffold_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import 'dart:async';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:url_launcher/url_launcher.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
Expand Down Expand Up @@ -51,7 +52,23 @@ class _ScaffoldPageState extends State<ScaffoldPage> {
backgroundColor: Theme.of(context).colorScheme.onBackground,
appBar: widget.isLightsOn == true
? AppBar(
automaticallyImplyLeading: false,
leading: Padding(
padding: const EdgeInsets.all(12.0),
child: InkWell(
child: Image.asset(
'assets/images/transparent_logo.png',
height: 20,
width: 20,
fit: BoxFit.fitWidth,
),
onTap: () {
if (Navigator.canPop(context))
Navigator.pop(context);
else
SystemChannels.platform
.invokeMethod('SystemNavigator.pop');
}),
),
toolbarHeight: 100,
flexibleSpace: Padding(
padding: const EdgeInsets.only(left: 48, right: 48),
Expand Down Expand Up @@ -99,12 +116,6 @@ class _ScaffoldPageState extends State<ScaffoldPage> {
: Text(widget.routeName),
],
)))),
title: InkWell(
child: Image.asset('assets/images/transparent_logo.png',
height: 50),
onTap: () {
Navigator.pushNamed(context, "/");
}),
elevation: 1,
scrolledUnderElevation: 20,
backgroundColor: Theme.of(context).colorScheme.background,
Expand Down
19 changes: 16 additions & 3 deletions lib/ui/pages/movieDetails/movie_details.dart
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
//Core Packages;
import 'package:FilmFlu/ui/theme/colors.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:youtube_player_iframe/youtube_player_iframe.dart';
import 'package:auto_size_text/auto_size_text.dart';

//My Packages
import 'package:FilmFlu/dto/movie.dart';
import 'package:FilmFlu/ui/pages/splash/splash_screen.dart';
import 'package:FilmFlu/network/client_api.dart';
import 'package:FilmFlu/ui/components/scaffold_page.dart';
import 'package:FilmFlu/ui/components/movie_cast.dart';
Expand Down Expand Up @@ -59,7 +59,7 @@ class _MovieDetailsPageState extends State<MovieDetailsPage> {
isSearchVisible: true,
isLightsOn: !isTrailerSelected,
floatingActionButton: Padding(
padding: const EdgeInsets.all(16),
padding: const EdgeInsets.only(top: 24),
child: isTrailerSelected
? FloatingActionButton(
mini: true,
Expand All @@ -71,6 +71,12 @@ class _MovieDetailsPageState extends State<MovieDetailsPage> {
_trailerController.stopVideo();
_trailerController.close();
isTrailerSelected = false;
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitDown,
DeviceOrientation.portraitUp,
]);
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.edgeToEdge);
});
},
)
Expand Down Expand Up @@ -286,7 +292,10 @@ class _MovieDetailsPageState extends State<MovieDetailsPage> {
],
);
} else {
return SplashScreen();
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Center(child: CircularProgressIndicator()));
}
},
),
Expand All @@ -295,6 +304,10 @@ class _MovieDetailsPageState extends State<MovieDetailsPage> {
: FutureBuilder<List<String>>(
future: fetchMovieTrailers("es-ES"),
builder: (context, snapshot) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeRight,
DeviceOrientation.landscapeLeft,
]);
return YoutubePlayerScaffold(
controller: _trailerController,
builder: (context, player) {
Expand Down
Loading

0 comments on commit 139dc48

Please sign in to comment.