-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Arjun-Ingole <arjuningole38@gmail.com>
- Loading branch information
1 parent
6cc5240
commit 374b59a
Showing
24 changed files
with
1,553 additions
and
238 deletions.
There are no files selected for viewing
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,25 @@ | ||
{ | ||
// Use IntelliSense to learn about possible attributes. | ||
// Hover to view descriptions of existing attributes. | ||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{ | ||
"name": "Osiris", | ||
"request": "launch", | ||
"type": "dart", | ||
}, | ||
{ | ||
"name": "Osiris (profile mode)", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "profile" | ||
}, | ||
{ | ||
"name": "Osiris (release mode)", | ||
"request": "launch", | ||
"type": "dart", | ||
"flutterMode": "release" | ||
} | ||
] | ||
} |
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
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
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 |
---|---|---|
@@ -1,15 +1,230 @@ | ||
import 'package:flutter/services.dart'; | ||
import 'package:intl/intl.dart'; | ||
import 'package:flutter/material.dart'; | ||
import 'package:osiris/Models/PopularMovies.dart'; | ||
import 'package:osiris/Services/API.dart'; | ||
import 'package:osiris/Services/consts.dart'; | ||
import 'package:osiris/Widgets/CustomLists.dart'; | ||
import 'package:osiris/Widgets/LoadingScreen.dart'; | ||
import 'package:unicons/unicons.dart'; | ||
import 'package:osiris/Services/extraServices.dart'; | ||
import 'package:osiris/Widgets/DetailScreenComponents.dart'; | ||
|
||
class MovieScreen extends StatefulWidget { | ||
const MovieScreen({super.key}); | ||
MovieScreen(this.movieId, {super.key}); | ||
String movieId; | ||
|
||
@override | ||
State<MovieScreen> createState() => _MovieScreenState(); | ||
} | ||
|
||
class _MovieScreenState extends State<MovieScreen> { | ||
bool isLoading = true; | ||
late List<Results> recommendedMovies; | ||
|
||
Future<void> fetchData() async { | ||
recommendedMovies = await APIService().getRecommendedMovie(widget.movieId); | ||
setState(() { | ||
isLoading = false; | ||
}); | ||
} | ||
|
||
@override | ||
void initState() { | ||
super.initState(); | ||
fetchData(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Container(); | ||
var size = MediaQuery.of(context).size; | ||
return Scaffold( | ||
backgroundColor: background_primary, | ||
body: isLoading | ||
? LoadingScreen() | ||
: FutureBuilder( | ||
future: APIService().getMovieDetail(widget.movieId), | ||
builder: (context, AsyncSnapshot snapshot) { | ||
if (snapshot.hasData) { | ||
var status = snapshot.data!.status.toString(); | ||
var releaseDate = snapshot.data!.releaseDate.toString(); | ||
return ListView( | ||
scrollDirection: Axis.vertical, | ||
physics: const AlwaysScrollableScrollPhysics( | ||
parent: BouncingScrollPhysics()), | ||
padding: EdgeInsets.zero, | ||
shrinkWrap: true, | ||
children: [ | ||
Stack( | ||
children: [ | ||
Container( | ||
width: size.width, | ||
height: size.height * 0.40 > 300 | ||
? size.height * 0.40 | ||
: 300, | ||
decoration: BoxDecoration( | ||
image: DecorationImage( | ||
image: snapshot.data!.backdropPath == null | ||
? const AssetImage( | ||
"assets/LoadingImage.png") | ||
as ImageProvider | ||
: NetworkImage( | ||
"https://image.tmdb.org/t/p/original${snapshot.data!.backdropPath}", | ||
), | ||
fit: BoxFit.cover, | ||
), | ||
), | ||
), | ||
Container( | ||
width: size.width, | ||
height: size.height * 0.40 > 300 | ||
? size.height * 0.40 | ||
: 300, | ||
decoration: BoxDecoration( | ||
gradient: LinearGradient( | ||
begin: Alignment.topCenter, | ||
end: Alignment.bottomCenter, | ||
colors: [ | ||
Colors.transparent, | ||
Colors.transparent, | ||
background_primary.withOpacity(0.50), | ||
background_primary.withOpacity(0.75), | ||
background_primary.withOpacity(0.90), | ||
background_primary.withOpacity(1.00), | ||
]), | ||
), | ||
), | ||
Container( | ||
width: size.width, | ||
height: size.height * 0.35 > 300 | ||
? size.height * 0.35 | ||
: 300, | ||
margin: const EdgeInsets.all(8), | ||
child: Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
mainAxisAlignment: MainAxisAlignment.end, | ||
children: [ | ||
Text( | ||
snapshot.data!.voteAverage | ||
.toString() | ||
.substring(0, 3), | ||
style: const TextStyle( | ||
fontSize: 40, | ||
fontWeight: FontWeight.w500, | ||
color: Colors.white), | ||
), | ||
Text( | ||
snapshot.data!.title.toString(), | ||
overflow: TextOverflow.ellipsis, | ||
maxLines: 2, | ||
style: const TextStyle( | ||
fontSize: 24, | ||
fontWeight: FontWeight.w500, | ||
color: Colors.white), | ||
), | ||
Row( | ||
children: [ | ||
CircularButtons( | ||
UniconsLine.play, | ||
onTap: () { | ||
HapticFeedback.lightImpact(); | ||
APIService() | ||
.getTrailerLink( | ||
snapshot.data!.id.toString(), | ||
"movie") | ||
.then( | ||
(value) => LaunchUrl(value)); | ||
}, | ||
), | ||
CircularButtons( | ||
UniconsLine.plus, | ||
onTap: () { | ||
HapticFeedback.lightImpact(); | ||
pshowDialog( | ||
context, widget.movieId, "movie"); | ||
}, | ||
), | ||
Visibility( | ||
visible: snapshot.data!.adult, | ||
child: CircularButtons( | ||
UniconsLine.eighteen_plus, | ||
onTap: () {}, | ||
), | ||
) | ||
], | ||
) | ||
], | ||
), | ||
) | ||
], | ||
), | ||
FutureBuilder( | ||
future: APIService() | ||
.getMovieGenres(widget.movieId, "movie"), | ||
builder: (context, AsyncSnapshot snapshot) { | ||
if (snapshot.hasData) { | ||
return Container( | ||
height: 36, | ||
width: size.width, | ||
margin: const EdgeInsets.only(left: 8), | ||
child: ListView.builder( | ||
scrollDirection: Axis.horizontal, | ||
shrinkWrap: true, | ||
physics: const BouncingScrollPhysics(), | ||
itemCount: snapshot.data.length, | ||
itemBuilder: (context, index) { | ||
return TextContainer( | ||
snapshot.data![index].name.toString(), | ||
const EdgeInsets.only(right: 8), | ||
const Color(0xFF14303B)); | ||
}, | ||
), | ||
); | ||
} else { | ||
return TextContainer( | ||
"Loading", | ||
const EdgeInsets.all(8), | ||
const Color(0xFF14303B)); | ||
} | ||
}, | ||
), | ||
Column( | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
TitleText("Status"), | ||
Row( | ||
children: [ | ||
TextContainer( | ||
status, | ||
const EdgeInsets.only( | ||
left: 8, right: 8, bottom: 8), | ||
const Color(0xFF382E39)), | ||
TextContainer( | ||
"Release: ${DateFormat.yMMMMd().format(DateTime.parse(releaseDate))}", | ||
const EdgeInsets.only( | ||
left: 8, right: 8, bottom: 8), | ||
const Color(0xFF545551)), | ||
], | ||
), | ||
TitleText("Overview"), | ||
TextContainer( | ||
snapshot.data!.overview.toString().isEmpty || | ||
snapshot.data!.overview.toString() == | ||
"null" | ||
? "No overview available" | ||
: snapshot.data!.overview.toString(), | ||
const EdgeInsets.all(8), | ||
const Color(0xFF0F1D39)), | ||
TitleText("Recommendations"), | ||
CustomListMovie(recommendedMovies), | ||
], | ||
) | ||
]); | ||
} else { | ||
return const LoadingScreen(); | ||
} | ||
}, | ||
), | ||
); | ||
} | ||
} |
Oops, something went wrong.