diff --git a/lib/widgets/tvshowDetailsScreen.dart b/lib/widgets/tvshowDetailsScreen.dart index 978c1b1..6bab4fd 100644 --- a/lib/widgets/tvshowDetailsScreen.dart +++ b/lib/widgets/tvshowDetailsScreen.dart @@ -5,6 +5,7 @@ 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:multimedia/widgets/tvshowDetailsSettingsBox.dart'; import 'package:transparent_image/transparent_image.dart'; import '../data/tvshows.dart'; @@ -98,6 +99,20 @@ class TVShowDetailsScreen extends StatelessWidget { ], ), ), + Padding( + padding: const EdgeInsets.only( + left: 10.0, + right: 10.0, + top: 5.0, + bottom: 5.0, + ), + child: TVShowDetailsSettingsBox( + downloadLink: tvShow.download, + localPath: tvShow.localPath, + resolution: tvShow.resolution, + cliffhanger: tvShow.cliffhanger, + ), + ), ], ), ]), diff --git a/lib/widgets/tvshowDetailsSettingsBox.dart b/lib/widgets/tvshowDetailsSettingsBox.dart new file mode 100644 index 0000000..3d5af50 --- /dev/null +++ b/lib/widgets/tvshowDetailsSettingsBox.dart @@ -0,0 +1,210 @@ +import 'package:flutter/material.dart'; + +import 'package:multimedia/constants.dart'; + +class TVShowDetailsSettingsBox extends StatefulWidget { + TVShowDetailsSettingsBox({ + super.key, + required this.downloadLink, + required this.localPath, + required this.resolution, + required this.cliffhanger, + }); + + String downloadLink; + String localPath; + String resolution; + int cliffhanger; + + @override + State createState() => + _TVShowDetailsSettingsBoxState(); +} + +class _TVShowDetailsSettingsBoxState extends State { + var resolutions = [ + '360p', + '480i', + '480p', + '576i', + '576p', + '720i', + '720p', + '1080i', + '1080p', + '1440i', + '1440p', + '2160p', + ]; + + var _curResolution = ''; + var _curCliffhanger = 0; + + @override + void initState() { + _curResolution = widget.resolution; + _curCliffhanger = widget.cliffhanger; + super.initState(); + } + + @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( + 'Settings', + style: TextStyle( + fontWeight: FontWeight.bold, + color: BoxColor.titleColor), + textAlign: TextAlign.center, + ), + ], + ), + ), + ), + ), + Row( + children: [ + Expanded( + flex: 10, + child: Padding( + padding: const EdgeInsets.only( + left: 5.0, + right: 5.0, + top: 5.0, + bottom: 5.0, + ), + child: Column( + children: [ + const Text( + 'Download Link', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextFormField( + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Download Link', + ), + initialValue: widget.downloadLink, + ), + ], + ), + ), + ), + Expanded( + flex: 10, + child: Column( + children: [ + const Text( + 'Local Path', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + TextFormField( + decoration: const InputDecoration( + border: OutlineInputBorder(), + labelText: 'Local Path', + ), + initialValue: widget.localPath, + ), + ], + ), + ), + const SizedBox( + width: 5, + ), + Expanded( + flex: 2, + 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!; + }); + }, + ), + ], + ), + ), + Expanded( + flex: 1, + child: Column( + children: [ + const Text( + 'Cliffhanger', + style: TextStyle( + fontWeight: FontWeight.bold, + ), + ), + const SizedBox( + height: 10, + ), + Checkbox( + side: MaterialStateBorderSide.resolveWith( + (states) => BorderSide(width: 1.0, color: Colors.grey), + ), + value: (_curCliffhanger == 1), + onChanged: (bool? value) { + setState(() { + _curCliffhanger = value == true ? 1 : 0; + }); + }, + ), + const SizedBox( + height: 10, + ), + ], + ), + ), + ], + ), + ], + ), + ); + } +}