movie and tvshow list
This commit is contained in:
@@ -10,9 +10,7 @@ import 'package:syncfusion_flutter_core/theme.dart';
|
||||
|
||||
import 'package:multimedia/data/movies.dart';
|
||||
|
||||
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
|
||||
Color _kColorProg = const Color.fromARGB(255, 0, 0, 192);
|
||||
Color _kColorDone = const Color.fromARGB(255, 0, 192, 0);
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class MoviesScreen extends StatefulWidget {
|
||||
const MoviesScreen({
|
||||
@@ -188,12 +186,12 @@ class MovieDataSource extends DataGridSource {
|
||||
int state = row.getCells().toList()[1].value;
|
||||
|
||||
if (state == 1) {
|
||||
colorBG = _kColorInit;
|
||||
colorBG = StateColor.init;
|
||||
} else if (state == 2) {
|
||||
colorBG = _kColorProg;
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = _kColorDone;
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsCastBox extends StatelessWidget {
|
||||
const TVShowDetailsCastBox({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: Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Cast',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Table(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,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsCompaniesBox extends StatelessWidget {
|
||||
const TVShowDetailsCompaniesBox({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: Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Production Companies',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Table(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,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsCountriesBox extends StatelessWidget {
|
||||
const TVShowDetailsCountriesBox({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: Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Production Countries',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Table(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,132 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsCrewBox extends StatelessWidget {
|
||||
const TVShowDetailsCrewBox({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: Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Crew',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Table(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,109 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsGenreBox extends StatelessWidget {
|
||||
const TVShowDetailsGenreBox({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: Expanded(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
children: [
|
||||
Text(
|
||||
'Genre',
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: BoxColor.titleColor),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
Table(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,70 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowDetailsOverviewBox extends StatelessWidget {
|
||||
const TVShowDetailsOverviewBox({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: Expanded(
|
||||
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,106 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsCompaniesBox.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsCountriesBox.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsCrewBox.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsCastBox.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsGenreBox.dart';
|
||||
import 'package:multimedia/widgets/tvshowDetailsOverviewBox.dart';
|
||||
import 'package:transparent_image/transparent_image.dart';
|
||||
|
||||
import '../data/tvshows.dart';
|
||||
|
||||
class TVShowDetailsScreen extends StatelessWidget {
|
||||
TVShowDetailsScreen({
|
||||
super.key,
|
||||
required this.tvShow,
|
||||
});
|
||||
|
||||
final TVShow tvShow;
|
||||
String firstAiredYear = '?';
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
String url = 'http://image.tmdb.org/t/p/original${tvShow.backdropPath}';
|
||||
|
||||
firstAiredYear = tvShow.firstAired.toString().substring(0, 4);
|
||||
return Scaffold(
|
||||
appBar: AppBar(
|
||||
title: Text("${tvShow.seriesName} ($firstAiredYear)"),
|
||||
),
|
||||
body: Stack(children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
image: NetworkImage(url),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
),
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 10.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: TVShowDetailsOverviewBox(
|
||||
overview: tvShow.overview,
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 10.0,
|
||||
right: 10.0,
|
||||
top: 5.0,
|
||||
bottom: 5.0,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: TVShowDetailsCastBox(
|
||||
cast: tvShow.cast,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TVShowDetailsCrewBox(
|
||||
crew: tvShow.crew,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TVShowDetailsGenreBox(
|
||||
genre: tvShow.genre,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TVShowDetailsCompaniesBox(
|
||||
companies: tvShow.productionCompanies,
|
||||
),
|
||||
),
|
||||
const SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
Expanded(
|
||||
child: TVShowDetailsCountriesBox(
|
||||
countries: tvShow.originCountries,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
]),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import 'dart:ui' as ui;
|
||||
|
||||
import 'dart:convert';
|
||||
import 'package:multimedia/widgets/tvshowDetailsScreen.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
@@ -12,13 +13,7 @@ import 'package:syncfusion_flutter_core/theme.dart';
|
||||
|
||||
import 'package:multimedia/data/tvshows.dart';
|
||||
|
||||
Color _kColorNone = Colors.black;
|
||||
Color _kColorInit = const Color.fromARGB(255, 192, 192, 192);
|
||||
Color _kColorProg = const Color.fromARGB(255, 0, 0, 192);
|
||||
Color _kColorDone = const Color.fromARGB(255, 0, 192, 0);
|
||||
|
||||
double _kStateWidth = 6;
|
||||
double _kStateHeight = 30;
|
||||
import 'package:multimedia/constants.dart';
|
||||
|
||||
class TVShowsScreen extends StatefulWidget {
|
||||
const TVShowsScreen({
|
||||
@@ -36,6 +31,7 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
late TVShowDataSource tvshowDataSource;
|
||||
List<GridColumn> _columns = [];
|
||||
late bool initDone = false;
|
||||
late List<TVShow> _tvshowsList;
|
||||
|
||||
Future<List<TVShow>> generateTVShowList() async {
|
||||
SharedPreferences prefs = await SharedPreferences.getInstance();
|
||||
@@ -89,6 +85,8 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
|
||||
initDone = true;
|
||||
|
||||
_tvshowsList = _tvshows;
|
||||
|
||||
return _tvshows;
|
||||
}
|
||||
|
||||
@@ -107,13 +105,15 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
List<GridColumn> getColumns() {
|
||||
return <GridColumn>[
|
||||
GridColumn(
|
||||
columnName: 'seriesID',
|
||||
visible: false,
|
||||
width: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('seriesID'))),
|
||||
columnName: 'seriesID',
|
||||
visible: false,
|
||||
width: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('seriesID'),
|
||||
),
|
||||
),
|
||||
GridColumn(
|
||||
columnName: 'seriesState',
|
||||
visible: false,
|
||||
@@ -138,6 +138,22 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('cliffhanger'))),
|
||||
GridColumn(
|
||||
columnName: 'backdropPath',
|
||||
visible: false,
|
||||
width: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('backdropPath'))),
|
||||
GridColumn(
|
||||
columnName: 'overview',
|
||||
visible: false,
|
||||
width: 70,
|
||||
label: Container(
|
||||
padding: const EdgeInsets.all(16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
child: const Text('overview'))),
|
||||
GridColumn(
|
||||
columnName: 'seriesName',
|
||||
// columnWidthMode: ColumnWidthMode.auto,
|
||||
@@ -168,6 +184,29 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
_columns = getColumns();
|
||||
}
|
||||
|
||||
void showTVShowDetails(int index) {
|
||||
List<DataGridCell<dynamic>> cells =
|
||||
tvshowDataSource.effectiveRows.elementAt(index).getCells();
|
||||
|
||||
String seriesID = cells[TVShowColumn.seriesID].value.toString();
|
||||
bool found = false;
|
||||
int tvShowIndex;
|
||||
|
||||
for (tvShowIndex = 0; tvShowIndex < _tvshowsList.length; tvShowIndex++) {
|
||||
if (_tvshowsList[tvShowIndex].seriesID == int.parse(seriesID)) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (found) {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (ctx) => TVShowDetailsScreen(tvShow: _tvshowsList[tvShowIndex])));
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
@@ -186,7 +225,21 @@ class _TVShowsScreenState extends State<TVShowsScreen> {
|
||||
columns: _columns,
|
||||
controller: _dataGridController,
|
||||
columnWidthMode: ColumnWidthMode.auto,
|
||||
columnWidthCalculationRange: ColumnWidthCalculationRange.allRows,
|
||||
columnWidthCalculationRange:
|
||||
ColumnWidthCalculationRange.allRows,
|
||||
onCellDoubleTap: (DataGridCellDoubleTapDetails details) {
|
||||
int index = details.rowColumnIndex.rowIndex - 1;
|
||||
if (index < 0) {
|
||||
return;
|
||||
}
|
||||
showTVShowDetails(index);
|
||||
},
|
||||
onCellLongPress: (DataGridCellLongPressDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
onCellSecondaryTap: (DataGridCellTapDetails details) {
|
||||
print(details.rowColumnIndex);
|
||||
},
|
||||
),
|
||||
)
|
||||
: const Center(
|
||||
@@ -263,6 +316,9 @@ class TVShowDataSource extends DataGridSource {
|
||||
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>(
|
||||
@@ -283,19 +339,8 @@ class TVShowDataSource extends DataGridSource {
|
||||
@override
|
||||
List<DataGridRow> get rows => _tvshowDataGridRows;
|
||||
|
||||
void _drawEpisodeState(Canvas c, Paint p, double x, Color color) {
|
||||
Offset p1 = Offset(x + _kStateWidth, 1);
|
||||
Offset p2 = Offset(x + _kStateWidth, _kStateHeight - 1);
|
||||
Rect rect = Rect.fromLTRB(x, 0, x + _kStateWidth, _kStateHeight);
|
||||
p.style = PaintingStyle.fill;
|
||||
p.color = color;
|
||||
c.drawRect(rect, p);
|
||||
p.color = Colors.black;
|
||||
c.drawLine(p1, p2, p);
|
||||
}
|
||||
|
||||
Row generateSeasonState(String state) {
|
||||
if (state.length == 0) {
|
||||
if (state.isEmpty) {
|
||||
return const Row(
|
||||
children: [Text('')],
|
||||
);
|
||||
@@ -304,14 +349,14 @@ class TVShowDataSource extends DataGridSource {
|
||||
List<Color> stateColor = [];
|
||||
|
||||
for (int x = 0; x < state.length; x++) {
|
||||
Color c = _kColorNone;
|
||||
Color c = StateColor.none;
|
||||
|
||||
if (state[x] == '1') {
|
||||
c = _kColorInit;
|
||||
c = StateColor.init;
|
||||
} else if (state[x] == '2') {
|
||||
c = _kColorProg;
|
||||
c = StateColor.prog;
|
||||
} else if (state[x] == '3') {
|
||||
c = _kColorDone;
|
||||
c = StateColor.done;
|
||||
}
|
||||
|
||||
stateColor.add(c);
|
||||
@@ -339,17 +384,17 @@ class TVShowDataSource extends DataGridSource {
|
||||
FontStyle fontStyle = FontStyle.normal;
|
||||
|
||||
if (e.columnName == 'seriesName') {
|
||||
int seriesState = row.getCells().toList()[1].value;
|
||||
String status = row.getCells().toList()[2].value;
|
||||
int cliffhanger = row.getCells().toList()[3].value;
|
||||
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 = _kColorInit;
|
||||
colorBG = StateColor.init;
|
||||
} else if (seriesState == 2) {
|
||||
colorBG = _kColorProg;
|
||||
colorBG = StateColor.prog;
|
||||
colorFG = Colors.white;
|
||||
} else {
|
||||
colorBG = _kColorDone;
|
||||
colorBG = StateColor.done;
|
||||
}
|
||||
|
||||
if (cliffhanger == 1) {
|
||||
@@ -366,19 +411,33 @@ class TVShowDataSource extends DataGridSource {
|
||||
|
||||
return Container(
|
||||
alignment: Alignment.center,
|
||||
padding: EdgeInsets.symmetric(horizontal: 16),
|
||||
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),
|
||||
color: colorBG,
|
||||
child: Text(
|
||||
e.value.toString(),
|
||||
style: TextStyle(
|
||||
color: colorFG,
|
||||
fontWeight: fontWeight,
|
||||
fontStyle: fontStyle,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user