movie and tvshow list
This commit is contained in:
@@ -18,6 +18,16 @@ class TVShowColumn {
|
||||
static int firstAired = 7;
|
||||
}
|
||||
|
||||
class MovieColumn {
|
||||
static int movieID = 0;
|
||||
static int movieState = 1;
|
||||
static int backdropPath = 2;
|
||||
static int title = 3;
|
||||
static int firstAired = 4;
|
||||
static int resolution = 5;
|
||||
static int overview = 6;
|
||||
}
|
||||
|
||||
class BoxColor {
|
||||
static Color backgroundColor = const Color.fromARGB(191, 255, 255, 255);
|
||||
static Color titleColor = Colors.white;
|
||||
|
||||
+30
-47
@@ -10,6 +10,16 @@ class Movie {
|
||||
DateTime releaseDate;
|
||||
int state;
|
||||
String resolution;
|
||||
String backdropPath;
|
||||
String languages;
|
||||
String productionCountries;
|
||||
String productionCompanies;
|
||||
double voteAverage;
|
||||
int voteCount;
|
||||
String cast;
|
||||
String crew;
|
||||
String genre;
|
||||
String localPath;
|
||||
|
||||
Movie({
|
||||
required this.movieID,
|
||||
@@ -18,6 +28,16 @@ class Movie {
|
||||
required this.releaseDate,
|
||||
required this.state,
|
||||
required this.resolution,
|
||||
required this.backdropPath,
|
||||
required this.languages,
|
||||
required this.productionCountries,
|
||||
required this.productionCompanies,
|
||||
required this.voteAverage,
|
||||
required this.voteCount,
|
||||
required this.cast,
|
||||
required this.crew,
|
||||
required this.genre,
|
||||
required this.localPath,
|
||||
});
|
||||
|
||||
factory Movie.fromJson(Map<String, dynamic> json) {
|
||||
@@ -28,53 +48,16 @@ class Movie {
|
||||
releaseDate: DateTime.parse(json['releaseDate']),
|
||||
state: int.parse(json['state']),
|
||||
resolution: json['resolution'] as String,
|
||||
backdropPath: json['backdropPath'] as String,
|
||||
languages: json['languages'],
|
||||
productionCountries: json['productionCountries'],
|
||||
productionCompanies: json['productionCompanies'],
|
||||
voteAverage: double.parse(json['voteAverage']),
|
||||
voteCount: int.parse(json['voteCount']),
|
||||
cast: json['cast'],
|
||||
crew: json['crew'],
|
||||
genre: json['genre'],
|
||||
localPath: json['localpath'],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class MovieDataSource extends DataGridSource {
|
||||
/// Creates the employee data source class with required details.
|
||||
MovieDataSource(this.movies) {
|
||||
buildDataGridRow();
|
||||
}
|
||||
|
||||
void buildDataGridRow() {
|
||||
_movieDataGridRows = movies
|
||||
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
||||
DataGridCell<int>(columnName: 'state', value: e.state),
|
||||
DataGridCell<String>(
|
||||
columnName: 'movieTitle', value: e.movieTitle),
|
||||
DataGridCell<String>(
|
||||
columnName: 'releaseDate',
|
||||
value: DateFormat('yyyy-MM-dd').format(e.releaseDate)),
|
||||
DataGridCell<String>(
|
||||
columnName: 'resolution', value: e.resolution),
|
||||
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||
]))
|
||||
.toList();
|
||||
}
|
||||
|
||||
List<Movie> movies = [];
|
||||
|
||||
List<DataGridRow> _movieDataGridRows = [];
|
||||
|
||||
@override
|
||||
List<DataGridRow> get rows => _movieDataGridRows;
|
||||
|
||||
@override
|
||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>((e) {
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(e.value.toString()),
|
||||
);
|
||||
}).toList());
|
||||
}
|
||||
|
||||
void updateDataGrid() {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsCastBox extends StatelessWidget {
|
||||
const MovieDetailsCastBox({super.key, required this.cast});
|
||||
|
||||
final String cast;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> castList = cast.split('|');
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Cast',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
bottom: BorderSide(), horizontalInside: BorderSide()),
|
||||
children: const [
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'Actor',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Role',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: ListView(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
for (var c in castList)
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.split(',').first),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(c.split(',').last),
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsCompaniesBox extends StatelessWidget {
|
||||
const MovieDetailsCompaniesBox({super.key, required this.companies});
|
||||
|
||||
final String companies;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> companiesList = companies.split(',');
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Production Companies',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
bottom: BorderSide(), horizontalInside: BorderSide()),
|
||||
children: const [
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: ListView(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
for (var c in companiesList)
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(c),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsCountriesBox extends StatelessWidget {
|
||||
const MovieDetailsCountriesBox({super.key, required this.countries});
|
||||
|
||||
final String countries;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> countriesList = countries.split(',');
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Production Countries',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
bottom: BorderSide(), horizontalInside: BorderSide()),
|
||||
children: const [
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: ListView(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
for (var c in countriesList)
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(c),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,140 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsCrewBox extends StatelessWidget {
|
||||
const MovieDetailsCrewBox({super.key, required this.crew});
|
||||
|
||||
final String crew;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> crewList = crew.split('|');
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Crew',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
bottom: BorderSide(), horizontalInside: BorderSide()),
|
||||
children: const [
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
'Crew',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: ListView(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
for (var c in crewList)
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.end,
|
||||
children: [
|
||||
Text(c.split(',').first),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(c.split(',').last),
|
||||
],
|
||||
),
|
||||
)
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,320 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
|
||||
import 'package:multimedia/data/movies.dart';
|
||||
|
||||
import 'package:multimedia/widgets/movies/details/castBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/crewBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/overviewBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/genreBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/companiesBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/countriesBox.dart';
|
||||
import 'package:multimedia/widgets/movies/details/settingsBox.dart';
|
||||
|
||||
class MovieDetailsScreen extends StatelessWidget {
|
||||
MovieDetailsScreen({
|
||||
super.key,
|
||||
required this.movie,
|
||||
});
|
||||
|
||||
final Movie movie;
|
||||
String firstAired = '?';
|
||||
|
||||
Widget generateLists(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
|
||||
if (width < 750) {
|
||||
return Table(
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCastBox(
|
||||
cast: movie.cast,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCrewBox(
|
||||
crew: movie.crew,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsGenreBox(
|
||||
genre: movie.genre,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCompaniesBox(
|
||||
companies: movie.productionCompanies,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 10.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCountriesBox(
|
||||
countries: movie.productionCountries,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
if (width < 1000) {
|
||||
return Table(
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCastBox(
|
||||
cast: movie.cast,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCrewBox(
|
||||
crew: movie.crew,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsGenreBox(
|
||||
genre: movie.genre,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCompaniesBox(
|
||||
companies: movie.productionCompanies,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 10.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCountriesBox(
|
||||
countries: movie.productionCountries,
|
||||
),
|
||||
),
|
||||
const Text(''),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return Table(
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCastBox(
|
||||
cast: movie.cast,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCrewBox(
|
||||
crew: movie.crew,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsGenreBox(
|
||||
genre: movie.genre,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCompaniesBox(
|
||||
companies: movie.productionCompanies,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 10.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsCountriesBox(
|
||||
countries: movie.productionCountries,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
bool save() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String url = 'http://image.tmdb.org/t/p/original${movie.backdropPath}';
|
||||
String releaseDate = DateFormat('yyyy-MM-dd').format(movie.releaseDate);
|
||||
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("${movie.movieTitle} ($releaseDate)"),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.check_circle_outline),
|
||||
tooltip: 'Save changes',
|
||||
onPressed: () {
|
||||
if (save()) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.highlight_off),
|
||||
tooltip: 'Revert changes',
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(url),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsOverviewBox(
|
||||
overview: movie.overview,
|
||||
),
|
||||
),
|
||||
generateLists(context),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: MovieDetailsSettingsBox(
|
||||
localPath: movie.localPath,
|
||||
resolution: movie.resolution,
|
||||
state: movie.state,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsGenreBox extends StatelessWidget {
|
||||
const MovieDetailsGenreBox({super.key, required this.genre});
|
||||
|
||||
final String genre;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
List<String> genreList = genre.split(',');
|
||||
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Genre',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: Table(
|
||||
border: const TableBorder(
|
||||
bottom: BorderSide(), horizontalInside: BorderSide()),
|
||||
children: const [
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(
|
||||
'Name',
|
||||
style: TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 0.0,
|
||||
bottom: 10.0,
|
||||
),
|
||||
child: SingleChildScrollView(
|
||||
child: SizedBox(
|
||||
height: 200,
|
||||
child: ListView(
|
||||
children: [
|
||||
Table(
|
||||
children: [
|
||||
for (var g in genreList)
|
||||
TableRow(children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 1, horizontal: 4),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
Text(g),
|
||||
],
|
||||
),
|
||||
),
|
||||
]),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsOverviewBox extends StatelessWidget {
|
||||
const MovieDetailsOverviewBox({super.key, required this.overview});
|
||||
|
||||
final String overview;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Overview',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 10, horizontal: 10),
|
||||
child: Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: Text(
|
||||
overview,
|
||||
style: const TextStyle(fontSize: 14.0),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
import 'package:multimedia/widgets/movies/details/settingsBoxLocalPath.dart';
|
||||
import 'package:multimedia/widgets/movies/details/settingsBoxResolution.dart';
|
||||
import 'package:multimedia/widgets/movies/details/stateBox.dart';
|
||||
|
||||
class MovieDetailsSettingsBox extends StatelessWidget {
|
||||
const MovieDetailsSettingsBox({
|
||||
super.key,
|
||||
required this.localPath,
|
||||
required this.resolution,
|
||||
required this.state,
|
||||
});
|
||||
|
||||
final String localPath;
|
||||
final String resolution;
|
||||
final int state;
|
||||
|
||||
Widget generateInputs(BuildContext context) {
|
||||
double width = MediaQuery.of(context).size.width;
|
||||
|
||||
if (width < 1000) {
|
||||
return Table(
|
||||
columnWidths: const {
|
||||
0: IntrinsicColumnWidth(),
|
||||
1: IntrinsicColumnWidth(),
|
||||
},
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
MovieDetailsSettingsBoxResolution(
|
||||
resolution: resolution,
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
MovieDetailsSettingsBoxLocalPath(
|
||||
localPath: localPath,
|
||||
),
|
||||
],
|
||||
),
|
||||
TableRow(
|
||||
children: [
|
||||
MovieDetailsSettingsStateBox(
|
||||
state: state,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
return Table(
|
||||
columnWidths: const {
|
||||
0: IntrinsicColumnWidth(),
|
||||
1: IntrinsicColumnWidth(),
|
||||
2: IntrinsicColumnWidth(),
|
||||
},
|
||||
children: [
|
||||
TableRow(
|
||||
children: [
|
||||
MovieDetailsSettingsBoxLocalPath(
|
||||
localPath: localPath,
|
||||
),
|
||||
MovieDetailsSettingsBoxResolution(
|
||||
resolution: resolution,
|
||||
),
|
||||
MovieDetailsSettingsStateBox(
|
||||
state: state,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.backgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
color: BoxColor.titleBackgroundColor,
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(10.0),
|
||||
),
|
||||
),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Settings',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: generateInputs(context),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MovieDetailsSettingsBoxLocalPath extends StatelessWidget {
|
||||
const MovieDetailsSettingsBoxLocalPath({
|
||||
super.key,
|
||||
required this.localPath,
|
||||
});
|
||||
|
||||
final String localPath;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'Local Path',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
TextFormField(
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Local Path',
|
||||
),
|
||||
initialValue: localPath,
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MovieDetailsSettingsBoxResolution extends StatefulWidget {
|
||||
MovieDetailsSettingsBoxResolution({
|
||||
super.key,
|
||||
required this.resolution,
|
||||
});
|
||||
|
||||
String resolution;
|
||||
|
||||
@override
|
||||
State<MovieDetailsSettingsBoxResolution> createState() =>
|
||||
_MovieDetailsSettingsBoxResolutionState();
|
||||
}
|
||||
|
||||
class _MovieDetailsSettingsBoxResolutionState
|
||||
extends State<MovieDetailsSettingsBoxResolution> {
|
||||
var resolutions = [
|
||||
'',
|
||||
'360p',
|
||||
'480i',
|
||||
'480p',
|
||||
'576i',
|
||||
'576p',
|
||||
'720i',
|
||||
'720p',
|
||||
'1080i',
|
||||
'1080p',
|
||||
'1440i',
|
||||
'1440p',
|
||||
'2160p',
|
||||
];
|
||||
|
||||
var _curResolution = '';
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_curResolution = widget.resolution;
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'Resolution',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
DropdownButtonFormField(
|
||||
decoration: const InputDecoration(
|
||||
border: OutlineInputBorder(),
|
||||
labelText: 'Resolution',
|
||||
),
|
||||
dropdownColor: const Color.fromARGB(255, 127, 127, 127),
|
||||
value: _curResolution,
|
||||
items: resolutions.map((String res) {
|
||||
return DropdownMenuItem(value: res, child: Text(res));
|
||||
}).toList(),
|
||||
onChanged: (String? newValue) {
|
||||
setState(() {
|
||||
_curResolution = newValue!;
|
||||
});
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MovieDetailsSettingsStateBox extends StatefulWidget {
|
||||
MovieDetailsSettingsStateBox({super.key, required this.state});
|
||||
|
||||
int state;
|
||||
|
||||
@override
|
||||
State<MovieDetailsSettingsStateBox> createState() =>
|
||||
_MovieDetailsSettingsStateBoxState();
|
||||
}
|
||||
|
||||
class _MovieDetailsSettingsStateBoxState
|
||||
extends State<MovieDetailsSettingsStateBox> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 5.0,
|
||||
right: 5.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Column(
|
||||
children: [
|
||||
const Text(
|
||||
'State',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
// color: BoxColor.backgroundColor,
|
||||
border: Border.all(color: Colors.grey),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(5.0),
|
||||
),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: 55,
|
||||
child: Row(
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 180,
|
||||
child: CheckboxListTile(
|
||||
side: MaterialStateBorderSide.resolveWith(
|
||||
(states) =>
|
||||
const BorderSide(width: 1.0, color: Colors.grey),
|
||||
),
|
||||
title: const Text(
|
||||
'initialized',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
value: widget.state == 1,
|
||||
onChanged: (bool? value) {
|
||||
if (value == true) {
|
||||
setState(() {
|
||||
widget.state = 1;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 180,
|
||||
child: CheckboxListTile(
|
||||
side: MaterialStateBorderSide.resolveWith(
|
||||
(states) =>
|
||||
const BorderSide(width: 1.0, color: Colors.grey),
|
||||
),
|
||||
title: const Text(
|
||||
'in progress',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
value: widget.state == 2,
|
||||
onChanged: (bool? value) {
|
||||
if (value == true) {
|
||||
setState(() {
|
||||
widget.state = 2;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
width: 130,
|
||||
child: CheckboxListTile(
|
||||
side: MaterialStateBorderSide.resolveWith(
|
||||
(states) =>
|
||||
const BorderSide(width: 1.0, color: Colors.grey),
|
||||
),
|
||||
title: const Text(
|
||||
'done',
|
||||
textAlign: TextAlign.end,
|
||||
style: TextStyle(color: Colors.black),
|
||||
),
|
||||
value: widget.state == 3,
|
||||
onChanged: (bool? value) {
|
||||
if (value == true) {
|
||||
setState(() {
|
||||
widget.state = 3;
|
||||
});
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
||||
// return Row(
|
||||
// children: [
|
||||
// SizedBox(
|
||||
// width: 200,
|
||||
// child: CheckboxListTile(
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => const BorderSide(width: 1.0, color: Colors.grey),
|
||||
// ),
|
||||
// title: const Text(
|
||||
// 'initialized',
|
||||
// textAlign: TextAlign.end,
|
||||
// style: TextStyle(color: Colors.black),
|
||||
// ),
|
||||
// value: widget.state == 1,
|
||||
// onChanged: (bool? value) {
|
||||
// if (value == true) {
|
||||
// setState(() {
|
||||
// widget.state = 1;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 200,
|
||||
// child: CheckboxListTile(
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => const BorderSide(width: 1.0, color: Colors.grey),
|
||||
// ),
|
||||
// title: const Text(
|
||||
// 'in progress',
|
||||
// textAlign: TextAlign.end,
|
||||
// style: TextStyle(color: Colors.black),
|
||||
// ),
|
||||
// value: widget.state == 2,
|
||||
// onChanged: (bool? value) {
|
||||
// if (value == true) {
|
||||
// setState(() {
|
||||
// widget.state = 2;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// SizedBox(
|
||||
// width: 200,
|
||||
// child: CheckboxListTile(
|
||||
// side: MaterialStateBorderSide.resolveWith(
|
||||
// (states) => const BorderSide(width: 1.0, color: Colors.grey),
|
||||
// ),
|
||||
// title: const Text(
|
||||
// 'done',
|
||||
// textAlign: TextAlign.end,
|
||||
// style: TextStyle(color: Colors.black),
|
||||
// ),
|
||||
// value: widget.state == 3,
|
||||
// onChanged: (bool? value) {
|
||||
// if (value == true) {
|
||||
// setState(() {
|
||||
// widget.state = 3;
|
||||
// });
|
||||
// }
|
||||
// },
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// );
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'dart:convert';
|
||||
import 'package:multimedia/widgets/movies/details/detailsScreen.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
@@ -25,6 +26,7 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
final DataGridController _dataGridController = DataGridController();
|
||||
late MovieDataSource movieDataSource;
|
||||
List<GridColumn> _columns = [];
|
||||
late List<Movie> _moviesList;
|
||||
|
||||
Future<List<Movie>> generateMovieList() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
@@ -53,8 +55,11 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
var list = movies['data'];
|
||||
|
||||
List<Movie> _movies =
|
||||
await list.map<Movie>((json) => Movie.fromJson(json)).toList();
|
||||
await list.map<Movie>((json) => Movie.fromJson(json)).toList();
|
||||
movieDataSource = MovieDataSource(_movies);
|
||||
|
||||
_moviesList = _movies;
|
||||
|
||||
return _movies;
|
||||
}
|
||||
|
||||
@@ -76,6 +81,14 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('state'))),
|
||||
GridColumn(
|
||||
columnName: 'backdropPath',
|
||||
visible: false,
|
||||
width: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('backdropPath'))),
|
||||
GridColumn(
|
||||
columnName: 'movieTitle',
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
@@ -113,6 +126,30 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
_columns = getColumns();
|
||||
}
|
||||
|
||||
void showMovieDetails(int index) {
|
||||
List<DataGridCell<dynamic>> cells =
|
||||
movieDataSource.effectiveRows.elementAt(index).getCells();
|
||||
|
||||
String movieID = cells[MovieColumn.movieID].value.toString();
|
||||
bool found = false;
|
||||
int movieIndex;
|
||||
|
||||
for (movieIndex = 0; movieIndex < _moviesList.length; movieIndex++) {
|
||||
if (_moviesList[movieIndex].movieID == int.parse(movieID)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (ctx) =>
|
||||
MovieDetailsScreen(movie: _moviesList[movieIndex])));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -121,24 +158,42 @@ class _MoviesScreenState extends State<MoviesScreen> {
|
||||
builder: (context, data) {
|
||||
return data.hasData
|
||||
? SfDataGridTheme(
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: movieDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.fill,
|
||||
),
|
||||
)
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: movieDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellTap: (DataGridCellTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showMovieDetails(index);
|
||||
},
|
||||
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellLongPress: (DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -154,17 +209,19 @@ class MovieDataSource extends DataGridSource {
|
||||
void buildDataGridRow() {
|
||||
_movieDataGridRows = movies
|
||||
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
||||
DataGridCell<int>(columnName: 'state', value: e.state),
|
||||
DataGridCell<String>(
|
||||
columnName: 'movieTitle', value: e.movieTitle),
|
||||
DataGridCell<String>(
|
||||
columnName: 'releaseDate',
|
||||
value: DateFormat('yyyy-MM-dd').format(e.releaseDate)),
|
||||
DataGridCell<String>(
|
||||
columnName: 'resolution', value: e.resolution),
|
||||
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||
]))
|
||||
DataGridCell<int>(columnName: 'movieID', value: e.movieID),
|
||||
DataGridCell<int>(columnName: 'state', value: e.state),
|
||||
DataGridCell<String>(
|
||||
columnName: 'backdropPath', value: e.backdropPath),
|
||||
DataGridCell<String>(
|
||||
columnName: 'movieTitle', value: e.movieTitle),
|
||||
DataGridCell<String>(
|
||||
columnName: 'releaseDate',
|
||||
value: DateFormat('yyyy-MM-dd').format(e.releaseDate)),
|
||||
DataGridCell<String>(
|
||||
columnName: 'resolution', value: e.resolution),
|
||||
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||
]))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@@ -179,32 +236,32 @@ class MovieDataSource extends DataGridSource {
|
||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>((e) {
|
||||
Color colorBG = Colors.white;
|
||||
Color colorFG = Colors.black;
|
||||
Color colorBG = Colors.white;
|
||||
Color colorFG = Colors.black;
|
||||
|
||||
if (e.columnName == 'movieTitle') {
|
||||
int state = row.getCells().toList()[1].value;
|
||||
if (e.columnName == 'movieTitle') {
|
||||
int state = row.getCells().toList()[MovieColumn.movieState].value;
|
||||
|
||||
if (state == 1) {
|
||||
colorBG = StateColor.init;
|
||||
} else if (state == 2) {
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
}
|
||||
if (state == 1) {
|
||||
colorBG = StateColor.init;
|
||||
} else if (state == 2) {
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
}
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
color: colorBG,
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(color: colorFG),
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
color: colorBG,
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(color: colorFG),
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
}
|
||||
|
||||
void updateDataGrid() {
|
||||
|
||||
@@ -241,6 +241,10 @@ class TVShowDetailsScreen extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
bool save() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String url = 'http://image.tmdb.org/t/p/original${tvShow.backdropPath}';
|
||||
@@ -249,7 +253,24 @@ class TVShowDetailsScreen extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("${tvShow.seriesName} ($firstAiredYear)"),
|
||||
),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.check_circle_outline),
|
||||
tooltip: 'Save changes',
|
||||
onPressed: () {
|
||||
if (save()) {
|
||||
Navigator.pop(context);
|
||||
}
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(Icons.highlight_off),
|
||||
tooltip: 'Revert changes',
|
||||
onPressed: () {
|
||||
Navigator.pop(context);
|
||||
},
|
||||
),
|
||||
], ),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
|
||||
+122
-122
@@ -70,7 +70,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
}
|
||||
|
||||
List<TVShow> _tvshows =
|
||||
await tvshowList.map<TVShow>((json) => TVShow.fromJson(json)).toList();
|
||||
await tvshowList.map<TVShow>((json) => TVShow.fromJson(json)).toList();
|
||||
tvshowDataSource = TVShowDataSource(_tvshows, maxSeason);
|
||||
|
||||
List<EpisodeCount> _episodecount = await episodeList
|
||||
@@ -186,7 +186,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
|
||||
void showTVShowDetails(int index) {
|
||||
List<DataGridCell<dynamic>> cells =
|
||||
tvshowDataSource.effectiveRows.elementAt(index).getCells();
|
||||
tvshowDataSource.effectiveRows.elementAt(index).getCells();
|
||||
|
||||
String seriesID = cells[TVShowColumn.seriesID].value.toString();
|
||||
bool found = false;
|
||||
@@ -216,42 +216,42 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
builder: (context, data) {
|
||||
return data.hasData
|
||||
? SfDataGridTheme(
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: tvshowDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellTap: (DataGridCellTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showTVShowDetails(index);
|
||||
},
|
||||
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellLongPress: (DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
data: const SfDataGridThemeData(
|
||||
headerColor: Color(0xff009889),
|
||||
),
|
||||
child: SfDataGrid(
|
||||
source: tvshowDataSource,
|
||||
selectionMode: SelectionMode.single,
|
||||
navigationMode: GridNavigationMode.row,
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellTap: (DataGridCellTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showTVShowDetails(index);
|
||||
},
|
||||
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellLongPress: (DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
child: CircularProgressIndicator(
|
||||
strokeWidth: 2,
|
||||
value: 0.8,
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
);
|
||||
@@ -314,24 +314,24 @@ class TVShowDataSource extends DataGridSource {
|
||||
void buildDataGridRow() {
|
||||
_tvshowDataGridRows = tvshows
|
||||
.map<DataGridRow>((e) => DataGridRow(cells: [
|
||||
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
|
||||
DataGridCell<int>(
|
||||
columnName: 'seriesState', value: e.seriesState),
|
||||
DataGridCell<String>(columnName: 'status', value: e.status),
|
||||
DataGridCell<int>(
|
||||
columnName: 'cliffhanger', value: e.cliffhanger),
|
||||
DataGridCell<String>(
|
||||
columnName: 'backdropPath', value: e.backdropPath),
|
||||
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||
DataGridCell<String>(
|
||||
columnName: 'seriesName', value: e.seriesName),
|
||||
DataGridCell<String>(
|
||||
columnName: 'firstAired',
|
||||
value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
|
||||
DataGridCell<String>(
|
||||
columnName: 'resolution', value: e.resolution),
|
||||
...setSeasonData(maxSeason, e.seasonStatus),
|
||||
]))
|
||||
DataGridCell<int>(columnName: 'seriesID', value: e.seriesID),
|
||||
DataGridCell<int>(
|
||||
columnName: 'seriesState', value: e.seriesState),
|
||||
DataGridCell<String>(columnName: 'status', value: e.status),
|
||||
DataGridCell<int>(
|
||||
columnName: 'cliffhanger', value: e.cliffhanger),
|
||||
DataGridCell<String>(
|
||||
columnName: 'backdropPath', value: e.backdropPath),
|
||||
DataGridCell<String>(columnName: 'overview', value: e.overview),
|
||||
DataGridCell<String>(
|
||||
columnName: 'seriesName', value: e.seriesName),
|
||||
DataGridCell<String>(
|
||||
columnName: 'firstAired',
|
||||
value: DateFormat('yyyy-MM-dd').format(e.firstAired)),
|
||||
DataGridCell<String>(
|
||||
columnName: 'resolution', value: e.resolution),
|
||||
...setSeasonData(maxSeason, e.seasonStatus),
|
||||
]))
|
||||
.toList();
|
||||
}
|
||||
|
||||
@@ -368,13 +368,13 @@ class TVShowDataSource extends DataGridSource {
|
||||
|
||||
return Row(children: <Widget>[
|
||||
...stateColor.map((col) => Text(
|
||||
'1',
|
||||
style: TextStyle(
|
||||
fontFamily: 'geometric',
|
||||
fontSize: 30,
|
||||
color: col,
|
||||
),
|
||||
)),
|
||||
'1',
|
||||
style: TextStyle(
|
||||
fontFamily: 'geometric',
|
||||
fontSize: 30,
|
||||
color: col,
|
||||
),
|
||||
)),
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -382,74 +382,74 @@ class TVShowDataSource extends DataGridSource {
|
||||
DataGridRowAdapter buildRow(DataGridRow row) {
|
||||
return DataGridRowAdapter(
|
||||
cells: row.getCells().map<Widget>((e) {
|
||||
Color colorBG = Colors.white;
|
||||
Color colorFG = Colors.black;
|
||||
FontWeight fontWeight = FontWeight.normal;
|
||||
FontStyle fontStyle = FontStyle.normal;
|
||||
Color colorBG = Colors.white;
|
||||
Color colorFG = Colors.black;
|
||||
FontWeight fontWeight = FontWeight.normal;
|
||||
FontStyle fontStyle = FontStyle.normal;
|
||||
|
||||
if (e.columnName == 'seriesName') {
|
||||
int seriesState =
|
||||
row.getCells().toList()[TVShowColumn.seriesState].value;
|
||||
String status = row.getCells().toList()[TVShowColumn.state].value;
|
||||
int cliffhanger =
|
||||
row.getCells().toList()[TVShowColumn.cliffhanger].value;
|
||||
if (e.columnName == 'seriesName') {
|
||||
int seriesState =
|
||||
row.getCells().toList()[TVShowColumn.seriesState].value;
|
||||
String status = row.getCells().toList()[TVShowColumn.state].value;
|
||||
int cliffhanger =
|
||||
row.getCells().toList()[TVShowColumn.cliffhanger].value;
|
||||
|
||||
if (seriesState == 1) {
|
||||
colorBG = StateColor.init;
|
||||
} else if (seriesState == 2) {
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
if (seriesState == 1) {
|
||||
colorBG = StateColor.init;
|
||||
} else if (seriesState == 2) {
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
|
||||
if (cliffhanger == 1) {
|
||||
fontStyle = FontStyle.italic;
|
||||
}
|
||||
if (cliffhanger == 1) {
|
||||
fontStyle = FontStyle.italic;
|
||||
}
|
||||
|
||||
if (status == 'In Production' || status == 'Returning Series') {
|
||||
fontWeight = FontWeight.bold;
|
||||
}
|
||||
}
|
||||
if (status == 'In Production' || status == 'Returning Series') {
|
||||
fontWeight = FontWeight.bold;
|
||||
}
|
||||
}
|
||||
|
||||
if (e.columnName.startsWith('season')) {
|
||||
Row row = generateSeasonState(e.value.toString());
|
||||
if (e.columnName.startsWith('season')) {
|
||||
Row row = generateSeasonState(e.value.toString());
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: row,
|
||||
);
|
||||
}
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: row,
|
||||
);
|
||||
}
|
||||
|
||||
if (e.columnName.startsWith('seriesName')) {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
color: colorBG,
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(
|
||||
color: colorFG,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
if (e.columnName.startsWith('seriesName')) {
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
color: colorBG,
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(
|
||||
color: colorFG,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.centerLeft,
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
),
|
||||
);
|
||||
}).toList());
|
||||
}
|
||||
|
||||
void updateDataGrid() {
|
||||
|
||||
Reference in New Issue
Block a user