diff --git a/lib/widgets/tvshows/details/detailsScreen.dart b/lib/widgets/tvshows/details/detailsScreen.dart index d4e6c8c..ac58c80 100644 --- a/lib/widgets/tvshows/details/detailsScreen.dart +++ b/lib/widgets/tvshows/details/detailsScreen.dart @@ -20,6 +20,227 @@ class TVShowDetailsScreen extends StatelessWidget { final TVShow tvShow; String firstAiredYear = '?'; + 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: TVShowDetailsCastBox( + cast: tvShow.cast, + ), + ), + ], + ), + TableRow( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCrewBox( + crew: tvShow.crew, + ), + ), + ], + ), + TableRow( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsGenreBox( + genre: tvShow.genre, + ), + ), + ], + ), + TableRow( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCompaniesBox( + companies: tvShow.productionCompanies, + ), + ), + ], + ), + TableRow( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 10.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCountriesBox( + countries: tvShow.originCountries, + ), + ), + ], + ), + ], + ); + } + + 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: TVShowDetailsCastBox( + cast: tvShow.cast, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCrewBox( + crew: tvShow.crew, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsGenreBox( + genre: tvShow.genre, + ), + ), + ], + ), + TableRow( + children: [ + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCompaniesBox( + companies: tvShow.productionCompanies, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 10.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCountriesBox( + countries: tvShow.originCountries, + ), + ), + 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: TVShowDetailsCastBox( + cast: tvShow.cast, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCrewBox( + crew: tvShow.crew, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsGenreBox( + genre: tvShow.genre, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCompaniesBox( + companies: tvShow.productionCompanies, + ), + ), + Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 10.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsCountriesBox( + countries: tvShow.originCountries, + ), + ), + ], + ), + ], + ); + } + @override Widget build(BuildContext context) { String url = 'http://image.tmdb.org/t/p/original${tvShow.backdropPath}'; @@ -52,55 +273,7 @@ class TVShowDetailsScreen extends StatelessWidget { 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, - ), - ), - ], - ), - ), + generateLists(context), Padding( padding: const EdgeInsets.only( left: 10.0, diff --git a/lib/widgets/tvshows/details/seasonBox.dart b/lib/widgets/tvshows/details/seasonBox.dart index 7fba89d..4200642 100644 --- a/lib/widgets/tvshows/details/seasonBox.dart +++ b/lib/widgets/tvshows/details/seasonBox.dart @@ -166,6 +166,9 @@ class _TVShowDetailsSeasonBoxState extends State { color: BoxColor.titleBackgroundColor, borderRadius: BorderRadius.circular(17)), child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: + BoxColor.titleBackgroundColor), onPressed: initClicked, child: Text( 'init', @@ -179,7 +182,7 @@ class _TVShowDetailsSeasonBoxState extends State { TableCell( child: Checkbox( side: MaterialStateBorderSide.resolveWith( - (states) => const BorderSide( + (states) => const BorderSide( width: 1.0, color: Colors.grey), ), value: s.split('|')[1] == '1', @@ -208,6 +211,9 @@ class _TVShowDetailsSeasonBoxState extends State { color: BoxColor.titleBackgroundColor, borderRadius: BorderRadius.circular(17)), child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: + BoxColor.titleBackgroundColor), onPressed: progClicked, child: Text( 'prog', @@ -221,7 +227,7 @@ class _TVShowDetailsSeasonBoxState extends State { TableCell( child: Checkbox( side: MaterialStateBorderSide.resolveWith( - (states) => const BorderSide( + (states) => const BorderSide( width: 1.0, color: Colors.grey), ), value: s.split('|')[1] == '2', @@ -250,6 +256,9 @@ class _TVShowDetailsSeasonBoxState extends State { color: BoxColor.titleBackgroundColor, borderRadius: BorderRadius.circular(17)), child: ElevatedButton( + style: ElevatedButton.styleFrom( + backgroundColor: + BoxColor.titleBackgroundColor), onPressed: doneClicked, child: Text( 'done', @@ -263,7 +272,7 @@ class _TVShowDetailsSeasonBoxState extends State { TableCell( child: Checkbox( side: MaterialStateBorderSide.resolveWith( - (states) => const BorderSide( + (states) => const BorderSide( width: 1.0, color: Colors.grey), ), value: s.split('|')[1] == '3', diff --git a/lib/widgets/tvshows/details/settingsBox.dart b/lib/widgets/tvshows/details/settingsBox.dart index 5ed5702..591c8be 100644 --- a/lib/widgets/tvshows/details/settingsBox.dart +++ b/lib/widgets/tvshows/details/settingsBox.dart @@ -20,32 +20,66 @@ class TVShowDetailsSettingsBox extends StatelessWidget { final String resolution; final int cliffhanger; - List generateInputs(BuildContext context) { -// double width = MediaQuery.of(context).size.width; + Widget generateInputs(BuildContext context) { + double width = MediaQuery.of(context).size.width; - return [ - TVShowDetailsSettingsBoxDownloadLink( - downloadLink: downloadLink, - ), - const SizedBox( - width: 5, - ), - TVShowDetailsSettingsBoxLocalPath( - localPath: localPath, - ), - const SizedBox( - width: 5, - ), - TVShowDetailsSettingsBoxResolution( - resolution: resolution, - ), - const SizedBox( - width: 5, - ), - TVShowDetailsSettingsBoxCliffhanger( - cliffhanger: cliffhanger, - ), - ]; + if (width < 1000) { + return Table( + columnWidths: const { + 0: IntrinsicColumnWidth(), + 1: IntrinsicColumnWidth(), + }, + children: [ + TableRow( + children: [ + TVShowDetailsSettingsBoxDownloadLink( + downloadLink: downloadLink, + ), + TVShowDetailsSettingsBoxResolution( + resolution: resolution, + ), + ], + ), + TableRow( + children: [ + TVShowDetailsSettingsBoxLocalPath( + localPath: localPath, + ), + TVShowDetailsSettingsBoxCliffhanger( + cliffhanger: cliffhanger, + ), + ], + ), + ], + ); + } + + return Table( + columnWidths: const { + 0: IntrinsicColumnWidth(), + 1: IntrinsicColumnWidth(), + 2: IntrinsicColumnWidth(), + 3: IntrinsicColumnWidth(), + }, + children: [ + TableRow( + children: [ + TVShowDetailsSettingsBoxDownloadLink( + downloadLink: downloadLink, + ), + TVShowDetailsSettingsBoxLocalPath( + localPath: localPath, + ), + TVShowDetailsSettingsBoxResolution( + resolution: resolution, + ), + TVShowDetailsSettingsBoxCliffhanger( + cliffhanger: cliffhanger, + ), + ], + ), + ], + ); } @override @@ -88,8 +122,12 @@ class TVShowDetailsSettingsBox extends StatelessWidget { ), ), ), - Row( - children: generateInputs(context), + Container( + alignment: Alignment.centerLeft, + child: SingleChildScrollView( + scrollDirection: Axis.horizontal, + child: generateInputs(context), + ), ), ], ), diff --git a/lib/widgets/tvshows/details/settingsBoxCliffhanger.dart b/lib/widgets/tvshows/details/settingsBoxCliffhanger.dart index a44acaa..e102591 100644 --- a/lib/widgets/tvshows/details/settingsBoxCliffhanger.dart +++ b/lib/widgets/tvshows/details/settingsBoxCliffhanger.dart @@ -25,8 +25,13 @@ class _TVShowDetailsSettingsBoxCliffhangerState @override Widget build(BuildContext context) { - return Expanded( - flex: 1, + return Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), child: Column( children: [ const Text( @@ -40,7 +45,7 @@ class _TVShowDetailsSettingsBoxCliffhangerState ), Checkbox( side: MaterialStateBorderSide.resolveWith( - (states) => BorderSide(width: 1.0, color: Colors.grey), + (states) => BorderSide(width: 1.0, color: Colors.grey), ), value: (_curCliffhanger == 1), onChanged: (bool? value) { diff --git a/lib/widgets/tvshows/details/settingsBoxDownloadLink.dart b/lib/widgets/tvshows/details/settingsBoxDownloadLink.dart index 421877c..a4d5764 100644 --- a/lib/widgets/tvshows/details/settingsBoxDownloadLink.dart +++ b/lib/widgets/tvshows/details/settingsBoxDownloadLink.dart @@ -10,9 +10,7 @@ class TVShowDetailsSettingsBoxDownloadLink extends StatelessWidget { @override Widget build(BuildContext context) { - return Expanded( - flex: 10, - child: Padding( + return Padding( padding: const EdgeInsets.only( left: 5.0, right: 5.0, @@ -36,7 +34,6 @@ class TVShowDetailsSettingsBoxDownloadLink extends StatelessWidget { ), ], ), - ), ); } } diff --git a/lib/widgets/tvshows/details/settingsBoxLocalPath.dart b/lib/widgets/tvshows/details/settingsBoxLocalPath.dart index 99b86a2..edd6466 100644 --- a/lib/widgets/tvshows/details/settingsBoxLocalPath.dart +++ b/lib/widgets/tvshows/details/settingsBoxLocalPath.dart @@ -10,25 +10,30 @@ class TVShowDetailsSettingsBoxLocalPath extends StatelessWidget { @override Widget build(BuildContext context) { - return Expanded( - flex: 10, - child: Column( - children: [ - const Text( - 'Local Path', - style: TextStyle( - fontWeight: FontWeight.bold, + 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', + TextFormField( + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Local Path', + ), + initialValue: localPath, ), - initialValue: localPath, - ), - ], - ), + ], + ), ); } } diff --git a/lib/widgets/tvshows/details/settingsBoxResolution.dart b/lib/widgets/tvshows/details/settingsBoxResolution.dart index 9bc3364..20f1a1a 100644 --- a/lib/widgets/tvshows/details/settingsBoxResolution.dart +++ b/lib/widgets/tvshows/details/settingsBoxResolution.dart @@ -41,34 +41,39 @@ class _TVShowDetailsSettingsBoxResolutionState @override Widget build(BuildContext context) { - return Expanded( - flex: 2, - child: Column( - children: [ - const Text( - 'Resolution', - style: TextStyle( - fontWeight: FontWeight.bold, + 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', + 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!; + }); + }, ), - 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!; - }); - }, - ), - ], - ), + ], + ), ); } }