-
Notifications
You must be signed in to change notification settings - Fork 53
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
25 changed files
with
1,510 additions
and
99 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
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,5 +1,5 @@ | ||
connectorId: movies | ||
generate: | ||
dartSdk: | ||
outputDir: ../lib/movies_connector | ||
outputDir: ../../lib/movies_connector | ||
package: movies_connector |
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
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,93 @@ | ||
import 'package:dataconnect/movies_connector/movies.dart'; | ||
import 'package:flutter/material.dart'; | ||
|
||
class ActorDetail extends StatefulWidget { | ||
const ActorDetail({super.key, required this.actorId}); | ||
|
||
final String actorId; | ||
|
||
@override | ||
State<ActorDetail> createState() => _ActorDetailState(); | ||
} | ||
|
||
class _ActorDetailState extends State<ActorDetail> { | ||
bool loading = true; | ||
GetActorByIdActor? actor; | ||
@override | ||
void initState() { | ||
super.initState(); | ||
MoviesConnector.instance | ||
.getActorById(id: widget.actorId) | ||
.execute() | ||
.then((value) { | ||
setState(() { | ||
loading = false; | ||
actor = value.data.actor; | ||
}); | ||
}); | ||
} | ||
|
||
_buildActorInfo() { | ||
return [ | ||
Align( | ||
alignment: Alignment.centerLeft, | ||
child: Container( | ||
child: Text( | ||
actor!.name, | ||
style: const TextStyle(fontSize: 30), | ||
), | ||
)), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.start, | ||
crossAxisAlignment: CrossAxisAlignment.start, | ||
children: [ | ||
Expanded( | ||
child: AspectRatio( | ||
aspectRatio: 9 / 16, // 9:16 aspect ratio for the image | ||
child: Image.network( | ||
actor!.imageUrl, | ||
fit: BoxFit.cover, | ||
), | ||
), | ||
), | ||
Expanded( | ||
child: Padding( | ||
padding: const EdgeInsets.fromLTRB(15, 0, 0, 0), | ||
// child: Column(children: [Text(actor!.info!)]), | ||
)) | ||
]), | ||
Row( | ||
mainAxisAlignment: MainAxisAlignment.spaceBetween, | ||
children: [ | ||
// TODO(mtewani): Check if the movie has been watched by the user | ||
OutlinedButton.icon( | ||
onPressed: () { | ||
// TODO(mtewani): Check if user is logged in. | ||
}, | ||
icon: const Icon(Icons.favorite), | ||
label: const Text('Add To Favorites'), | ||
) | ||
], | ||
) | ||
]; | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return Scaffold( | ||
body: SafeArea( | ||
child: actor == null | ||
? const Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
crossAxisAlignment: CrossAxisAlignment.center, | ||
children: [CircularProgressIndicator()], | ||
) | ||
: Padding( | ||
padding: const EdgeInsets.all(30), | ||
child: SingleChildScrollView( | ||
child: Column( | ||
children: [..._buildActorInfo()], | ||
)))), | ||
); | ||
} | ||
} |
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,22 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
class Destination { | ||
const Destination({required this.label, required this.icon}); | ||
final String label; | ||
final IconData icon; | ||
} | ||
|
||
class Route { | ||
Route({required this.path, required this.label, required this.iconData}); | ||
final String path; | ||
final String label; | ||
final IconData iconData; | ||
} | ||
|
||
var homePath = Route(path: '/home', label: 'Home', iconData: Icons.home); | ||
var genrePath = Route(path: '/genres', label: 'Genres', iconData: Icons.list); | ||
var searchPath = | ||
Route(path: '/search', label: 'Search', iconData: Icons.search); | ||
var profilePath = | ||
Route(path: '/profile', label: 'Profile', iconData: Icons.person); | ||
var paths = [homePath, genrePath, searchPath, profilePath]; |
Oops, something went wrong.